Bug 26703: reports folder
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / guided_reports_start.tt
index 401384c..a002e40 100644 (file)
 [% INCLUDE 'doc-head-open.inc' %]
 
 <title>
-    Koha &rsaquo; Reports &rsaquo; Guided reports wizard
     [%- IF ( saved1 ) -%]
-        &rsaquo; Saved reports
-    [%- ELSIF ( create ) -%]
-        &rsaquo; Create from SQL
-    [%- ELSIF ( showsql ) -%]
-        &rsaquo; Saved reports &rsaquo; SQL view
-    [%- ELSIF ( execute ) -%]
-        &rsaquo; Saved reports &rsaquo; Report [% name | html %] ([% id | html %])
-    [%- ELSIF ( editsql ) -%]
-        &rsaquo; Saved reports &rsaquo; Edit report [% reportname | html %] ([% id | html %])
-    [%- END -%]
+        Saved reports &rsaquo; [%- ELSIF ( create ) -%]
+        Create from SQL &rsaquo; [%- ELSIF ( showsql ) -%]
+        SQL view &rsaquo; Saved reports &rsaquo; [%- ELSIF ( execute ) -%]
+        Report [% name | html %] ([% id | html %]) &rsaquo; Saved reports &rsaquo; [%- ELSIF ( editsql ) -%]
+        Edit report [% reportname | html %] ([% id | html %]) &rsaquo; Saved reports &rsaquo; [%- END -%]
+
     [%- IF ( build1 ) -%]
-        &rsaquo; Build a report, step 1 of 6: Choose a module
-    [%- ELSIF ( build2 ) -%]
-        &rsaquo; Build a report, step 2 of 6: Pick a report type
-    [%- ELSIF ( build3 ) -%]
-        &rsaquo; Build a report, step 3 of 6: Select columns for display
-    [%- ELSIF ( build4 ) -%]
-        &rsaquo; Build a report, step 4 of 6: Select criteria to limit on
-    [%- ELSIF ( build5 ) -%]
-        &rsaquo; Build a report, step 5 of 6: Pick which columns to total
-    [%- ELSIF ( build6 ) -%]
-        &rsaquo; Build a report, step 6 of 6: Select how you want the report ordered
-    [%- END -%]
+        Build a report, step 1 of 6: Choose a module &rsaquo; [%- ELSIF ( build2 ) -%]
+        Build a report, step 2 of 6: Pick a report type &rsaquo; [%- ELSIF ( build3 ) -%]
+        Build a report, step 3 of 6: Select columns for display &rsaquo; [%- ELSIF ( build4 ) -%]
+        Build a report, step 4 of 6: Select criteria to limit on &rsaquo; [%- ELSIF ( build5 ) -%]
+        Build a report, step 5 of 6: Pick which columns to total &rsaquo; [%- ELSIF ( build6 ) -%]
+        Build a report, step 6 of 6: Select how you want the report ordered &rsaquo; [%- END -%]
+    Guided reports wizard &rsaquo; Reports &rsaquo; Koha
 </title>
 
 [% INCLUDE 'doc-head-close.inc' %]
@@ -53,6 +43,9 @@
     .CodeMirror {
         resize:  vertical;
     }
+    .cm-sqlParams {
+        color: #11917B;
+    }
     #mana_search_errortext { font-family: monospace; font-weight: bold; }
 </style>
 [% Asset.css("css/reports.css") | $raw %]
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'circ-search.inc' %]
 
-<div id="breadcrumbs">
-    <a href="/cgi-bin/koha/mainpage.pl">Home</a>
-    &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
-    &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
-
-    [% IF ( saved1 ) %]
-        &rsaquo; Saved reports
-    [% ELSIF ( create ) %]
-        &rsaquo; Create from SQL
-    [% ELSIF ( showsql ) %]
-        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; [% reportname | html %] ([% id | html %])
-    [% ELSIF ( editsql ) %]
-        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&amp;phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a> &rsaquo; Edit
-    [% ELSIF ( execute ) %]
-        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&amp;phase=Show%20SQL">[% name | html %] ([% id | html %])</a> &rsaquo; Run
-    [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
-        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
-        [% IF ( build1 ) %]
-            &rsaquo; Step 1 of 6: Choose a module
-        [% ELSIF ( build2 ) %]
-            &rsaquo; Step 2 of 6: Pick a report type
-        [% ELSIF ( build3 ) %]
-            &rsaquo; Step 3 of 6: Select columns for display
-        [% ELSIF ( build4 ) %]
-            &rsaquo; Step 4 of 6: Select criteria to limit on
-        [% ELSIF ( build5 ) %]
-            &rsaquo; Step 5 of 6: Pick which columns to total
-        [% ELSIF ( build6 ) %]
-            &rsaquo; Step 6 of 6: Select how you want the report ordered
+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
+    <ol>
+        <li>
+            <a href="/cgi-bin/koha/mainpage.pl">Home</a>
+        </li>
+        <li>
+            <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
+        </li>
+        <li>
+            <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
+        </li>
+
+        [% IF ( saved1 ) %]
+            <li>
+                <a href="#" aria-current="page">
+                    Saved reports
+                </a>
+            </li>
+        [% ELSIF ( create ) %]
+            <li>
+                <a href="#" aria-current="page">
+                    Create from SQL
+                </a>
+            </li>
+        [% ELSIF ( showsql ) %]
+            <li>
+                <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
+            </li>
+            <li>
+                <a href="#" aria-current="page">
+                    [% reportname | html %] ([% id | html %])
+                </a>
+            </li>
+        [% ELSIF ( editsql ) %]
+            <li>
+                <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
+            </li>
+            <li>
+                <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&amp;phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
+            </li>
+            <li>
+                <a href="#" aria-current="page">
+                    Edit
+                </a>
+            </li>
+        [% ELSIF ( execute ) %]
+            <li>
+                <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
+            </li>
+            <li>
+                <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&amp;phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
+            </li>
+            <li>
+                <a href="#" aria-current="page">
+                    Run
+                </a>
+            </li>
+        [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
+            <li>
+                <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
+            </li>
+            <li>
+                <a href="#" aria-current="page">
+                    [% IF ( build1 ) %]
+                        Step 1 of 6: Choose a module
+                    [% ELSIF ( build2 ) %]
+                        Step 2 of 6: Pick a report type
+                    [% ELSIF ( build3 ) %]
+                        Step 3 of 6: Select columns for display
+                    [% ELSIF ( build4 ) %]
+                        Step 4 of 6: Select criteria to limit on
+                    [% ELSIF ( build5 ) %]
+                        Step 5 of 6: Pick which columns to total
+                    [% ELSIF ( build6 ) %]
+                        Step 6 of 6: Select how you want the report ordered
+                    [% END %]
+                </a>
         [% END %]
-    [% END %]
-</div> <!-- /#breadcrumbs -->
+    </ol>
+</nav> <!-- /#breadcrumbs -->
 
 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
     <div class="modal-dialog">
                                                 <th>Subgroup</th>
                                                 <th>Notes</th>
                                                 <th>Author</th>
-                                                <th class="title-string">Creation date</th>
-                                                <th class="title-string">Last edit</th>
-                                                <th class="title-string">Last run</th>
+                                                <th>Creation date</th>
+                                                <th>Last edit</th>
+                                                <th>Last run</th>
                                                 <th class="report_public">Public</th>
                                                 <th class="report_json_url">JSON URL</th>
                                                 [% IF (usecache) %]
                                                         [% END %]
                                                         ([% savedreport.borrowernumber | html %])
                                                     </td>
-                                                    <td>
-                                                        <span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span>
+                                                    <td data-order="[% savedreport.date_created | html %]">
+                                                        [% savedreport.date_created | $KohaDates %]
                                                     </td>
-                                                    <td>
-                                                        <span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates  with_hours => 1 %]</span>
+                                                    <td data-order="[% savedreport.last_modified | html %]">
+                                                        [% savedreport.last_modified | $KohaDates  with_hours => 1 %]
                                                     </td>
-                                                    <td>
-                                                        <span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates  with_hours => 1 %]</span>
+                                                    <td data-order="[% savedreport.last_run | html %]">
+                                                        [% savedreport.last_run | $KohaDates  with_hours => 1 %]
                                                     </td>
                                                     <td class="report_public">
                                                         [% IF (savedreport.public) %]
                                                 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
                                                 <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
                                             </li>
+                                        [% ELSIF ( sql_param.input == 'textarea' ) %]
+                                            <li>
+                                                <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
+                                                <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
+                                            </li>
                                         [% ELSE %]
                                             <li>
                                                 <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
-                                                <select name="[%- sql_param.input.name | html -%]" tabindex="1"  size="1" id="[%- sql_param.input.id | html -%]">
+                                                <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
                                                     [% IF (sql_param.include_all) %]
                                                         <option value="%">All</option>
                                                     [% END %]
                 [% INCLUDE 'guided-reports-view.inc' %]
             </aside>
         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
-     </div> <!-- /.row -->
+    </div> <!-- /.row -->
 
 [% MACRO jsinclude BLOCK %]
     [% Asset.js("js/charts.js") | $raw %]
         [% INCLUDE 'columns_settings.inc' %]
     [% END %]
     [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
+    [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
     [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
     [% Asset.js( "js/mana.js" ) | $raw %]
     <script>
             }
         }
 
+        /* overlay a syntax-highlighting definition on top of the existing sql one */
+        CodeMirror.defineMode("sqlParams", function(config, parserConfig) {
+            var sqlParamsOverlay = {
+                token: function(stream, state) {
+                var ch;
+                if (stream.match("<<")) {
+                    while ((ch = stream.next()) != null)
+                    if (ch == ">" && stream.next() == ">") {
+                        stream.eat(">");
+                        return "sqlParams";
+                    }
+                }
+                while (stream.next() != null && !stream.match("<<", false)) {}
+                return null;
+                }
+            };
+            return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay);
+        });
+
         var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
         var group_subgroups = {};
         [% FOREACH group IN groups_with_subgroups %]
         [% END %]
 
         [% IF ( create || editsql || save ) %]
+
             var editor = CodeMirror.fromTextArea(sql, {
                 lineNumbers: true,
-                mode: "text/x-sql",
+                mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
                 lineWrapping: true,
                 smartIndent: false
             });
         [% IF ( showsql ) %]
             var editor = CodeMirror.fromTextArea(sql, {
                 lineNumbers: false,
-                mode: "text/x-sql",
+                mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
                 lineWrapping: true,
                 readOnly: true
             });
                     'sPaginationType': 'full',
                     'aaSorting': [[ 1, "asc" ]],
                     'aoColumnDefs': [
-                        { 'bSearchable': false, 'aTargets': [3] },
-                        { "aTargets": [ 1, 2 ], "sType": "natural"  },
                         { "visible": false, "aTargets" : [ "hidden" ] }
                     ],
                     'oLanguage': {
                             ],
                             "aoColumnDefs": [
                                 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
-                                { "sType": "title-string", "aTargets" : [ "title-string" ] },
                                 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
                             ]
                         }));