We are already using CodeMirror (http://codemirror.net) somewhere. I would guess in Rancor, the advanced cataloguing editor. How about also using it for syntax highlighting when editing the SQL of an SQL report?
CodeMirror in SQL mode: http://codemirror.net/mode/sql/index.html
+1 !
Created attachment 75180 [details] [review] Bug 20260: Use CodeMirror for the SQL reports editor This patch adds CodeMirror syntax highlighting to the SQL reports editor. Newly added is a file containing the sql-specific syntax highlighting code, in both compressed and uncompressed versions. Unrelated change: Some JavaScript has been moved from inside the body of the page to the footer. To test, apply the patch and go to Reports -> Saved SQL reports - Edit an existing report and confirm that the SQL is correctly highlighted and that there are no display problems when editing. - Confirm that changes are saved successfully. - Perform the same test when creating a new SQL report. - View an existing report and confirm that the SQL is syntax-highlighted but is read-only.
I've tried to also address Bug 19399 in these changes. If testers agree, please mark that bug as a duplicate.
Comment on attachment 75180 [details] [review] Bug 20260: Use CodeMirror for the SQL reports editor Review of attachment 75180 [details] [review]: ----------------------------------------------------------------- ::: koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ +31,4 @@ > [%- END -%]</title> > > [% INCLUDE 'doc-head-close.inc' %] > +[% Asset.css("lib/codemirror/codemirror.css") %] Where is this? @@ +953,4 @@ > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] > [% END %] > + [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) %] Where is this?
(In reply to M. Tompsett from comment #5) > Where is this? DOH! find . | grep codemirror and comment #0.
It was beautiful (edit and create), but the show is empty. Inspecting the source, I see a display: none with the correct SQL outside the CodeMirror divs. I think Failed QA is appropriate, because of that.
Created attachment 80367 [details] [review] Bug 20260: Use CodeMirror for the SQL reports editor This patch adds CodeMirror syntax highlighting to the SQL reports editor. Newly added is a file containing the sql-specific syntax highlighting code, in both compressed and uncompressed versions. Unrelated changes: - Some JavaScript has been moved from inside the body of the page to the footer. - Paths to some assets have been corrected to no use relative paths. To test, apply the patch and go to Reports -> Saved SQL reports - Edit an existing report and confirm that the SQL is correctly highlighted and that there are no display problems when editing. - Confirm that changes are saved successfully. - Perform the same test when creating a new SQL report. - View an existing report and confirm that the SQL is syntax-highlighted but is read-only.
Created attachment 80419 [details] [review] Bug 20260: Use CodeMirror for the SQL reports editor This patch adds CodeMirror syntax highlighting to the SQL reports editor. Newly added is a file containing the sql-specific syntax highlighting code, in both compressed and uncompressed versions. Unrelated changes: - Some JavaScript has been moved from inside the body of the page to the footer. - Paths to some assets have been corrected to no use relative paths. To test, apply the patch and go to Reports -> Saved SQL reports - Edit an existing report and confirm that the SQL is correctly highlighted and that there are no display problems when editing. - Confirm that changes are saved successfully. - Perform the same test when creating a new SQL report. - View an existing report and confirm that the SQL is syntax-highlighted but is read-only. Signed-off-by: Michal Denar <black23@gmail.com>
I really like that now when you make a mistake and it gives you a line number to look at, there are actually line numbers now!
Created attachment 80431 [details] [review] Bug 21541: Use raw filter for report results To test: 1 - Create new report SELECT CONCAT('<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=',borrowernumber,'">',"",firstname,"",surname,'</a>') AS people FROM borrowers 2 - Run this report 3 - Note the results contain raw text, they are not hyperlinks 4 - Apply patch 5 - Reload the results 6 - They should now be links Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 80432 [details] [review] Bug 20260: Use CodeMirror for the SQL reports editor This patch adds CodeMirror syntax highlighting to the SQL reports editor. Newly added is a file containing the sql-specific syntax highlighting code, in both compressed and uncompressed versions. Unrelated changes: - Some JavaScript has been moved from inside the body of the page to the footer. - Paths to some assets have been corrected to no use relative paths. To test, apply the patch and go to Reports -> Saved SQL reports - Edit an existing report and confirm that the SQL is correctly highlighted and that there are no display problems when editing. - Confirm that changes are saved successfully. - Perform the same test when creating a new SQL report. - View an existing report and confirm that the SQL is syntax-highlighted but is read-only. Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed for 18.11. Thanks all!
Just come across this, lovely enhancement! :) Won't be backported however.. too large a change.
Any reason why this couldn't also be used for intranet/opacuserjs & intranet/opacusercss?
(In reply to Andrew Isherwood from comment #15) > Any reason why this couldn't also be used for intranet/opacuserjs & > intranet/opacusercss? Sounds like an excellent idea to me. Create a new bug report for it?
Done :) https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21582