background-repeat : no-repeat;
}
-#editpatron a, #editmenuc .first-child, #editshelf a, #edit a, #editsupplier a, #managelabel a, #managetemplate a, #managelabelbatch a, #manageprofile a {
+#editpatron a,
+#editreport a,
+#editmenuc .first-child,
+#editshelf a,
+#edit a,
+#editsupplier a,
+#managelabel a,
+#managetemplate a,
+#managelabelbatch a,
+#manageprofile a {
padding-left : 34px;
background-image: url("../../img/toolbar-edit.gif");
background-position : center left;
-<h5>Build and Run Reports</h5>
+<h5>Run Reports</h5>
<ul>
- [% IF ( CAN_user_reports_create_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build New</a></li>[% END %]
- [% IF ( CAN_user_reports_execute_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Use Saved</a></li>[% END %]
- [% IF ( CAN_user_reports_create_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">Create from SQL</a></li>[% END %]
+ [% IF ( CAN_user_reports_execute_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a></li>[% END %]
</ul>
<h5>Reports Dictionary</h5>
<ul>
--- /dev/null
+[% UNLESS ( no_add ) %]
+<div id="toolbar">
+ <script type="text/javascript">
+ //<![CDATA[
+ $(document).ready(function() {
+ $("#newmenuc").empty();
+ $("#newsql").remove();
+ yuiToolbar();
+ });
+
+ // YUI Toolbar Functions
+ function yuiToolbar() {
+ [% IF ( CAN_user_reports_create_reports ) %]
+ var newmenu = [
+ { text: _("Guided report"), url: "/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new" },
+ { text: _("SQL report"), url: "/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL" }
+ ]
+ new YAHOO.widget.Button({
+ type: "menu",
+ label: _("New"),
+ name: "newmenubutton",
+ menu: newmenu,
+ container: "newmenuc"
+ });
+ new YAHOO.widget.Button("editreport");[% END %]
+ new YAHOO.widget.Button("runreport");
+ }
+ //]]>
+ </script>
+
+ <ul class="toolbar">
+ [% IF ( CAN_user_reports_create_reports ) %]<li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>[% END %]
+ <li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
+ [% IF ( showsql || execute || editsql || save_successful ) %]
+ [% UNLESS ( errors ) %][%# Unless there are errors saving a report %]
+ [% UNLESS ( editsql ) %][%# Do not show edit button on edit page %]
+ [% IF ( CAN_user_reports_create_reports ) %]<li><a id="editreport" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Edit%20SQL">Edit</a></li>[% END %]
+ [% END %]
+ <li><a id="runreport" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Run%20this%20report">Run report</a></li>
+ [% END %]
+ [% END %]
+ </ul>
+</div>
+[% END %]
\ No newline at end of file
<div id="bd">
<div id="yui-main">
<div class="yui-b">
+ [% INCLUDE "reports-toolbar.inc" %]
[% IF ( start ) %]
<h2>Guided Reports</h2>
</fieldset>
<fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
-<input type="submit" name="submit" value="Save Report" /></fieldset>
+<input type="submit" name="submit" value="Save Report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
+</fieldset>
</form>
[% END %]
[% END %]
[% IF ( showsql ) %]
-<textarea id="sql">[% sql %]</textarea>
+<fieldset class="rows">
+ <legend>[% reportname %]</legend>
+ <ol>
+ [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes %]</li>[% ELSE %][% END %]
+ <li><textarea id="sql">[% sql %]</textarea></li>
+ </ol>
+</fieldset>
[% END %]
[% IF ( editsql ) %]
<input type="hidden" name="phase" value="Update SQL" />
<input type="hidden" name="id" value="[% id %]"/>
<fieldset class="rows">
-<legend>Edit SQL</legend>
+<legend>Edit SQL report</legend>
<ol>
-<li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="[% reportname %]" /></li>
+<li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="[% reportname %]" size="50" /></li>
<li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
<li><textarea id="sql" name="sql" rows="10" cols="60">[% sql %]</textarea></li>
</ol>
</fieldset>
<fieldset class="action">
-<input type="submit" name="submit" value="Update SQL" /></fieldset>
+<input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
+</fieldset>
</form>
[% IF ( save_successful ) %]
[% UNLESS ( errors ) %]
<h2>Your report has been saved</h2>
-<p>The report you have created has now been saved. You can now</p>
+<h4>[% reportname %]</h4>
<ul>
[% IF ( id ) %]
<li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&phase=Run%20this%20report">Run this report</a></li>
elsif ( $phase eq 'Show SQL'){
my $id = $input->param('reports');
- my $sql = get_sql($id);
+ my ($sql,$type,$reportname,$notes) = get_saved_report($id);
$template->param(
- 'sql' => $sql,
+ 'id' => $id,
+ 'reportname' => $reportname,
+ 'notes' => $notes,
+ 'sql' => $sql,
'showsql' => 1,
);
}
update_sql( $id, $sql, $reportname, $notes );
$template->param(
'save_successful' => 1,
+ 'reportname' => $reportname,
'id' => $id,
);
}
my $id = save_report( $borrowernumber, $sql, $name, $type, $notes );
$template->param(
'save_successful' => 1,
+ 'reportname' => $name,
'id' => $id,
);
}
$template->param(
'results' => \@rows,
'sql' => $sql,
+ 'id' => $report,
'execute' => 1,
'name' => $name,
'notes' => $notes,