Bugzilla – Attachment 145648 Details for
Bug 8628
Add digital signs to the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8628: Digital signs - staff interface
Bug-8628-Digital-signs---staff-interface.patch (text/plain), 39.17 KB, created by
Aleisha Amohia
on 2023-01-25 02:52:45 UTC
(
hide
)
Description:
Bug 8628: Digital signs - staff interface
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-01-25 02:52:45 UTC
Size:
39.17 KB
patch
obsolete
>From 6fcd1375d806de674cf8ec61b384a33dc6a81543 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Fri, 26 Apr 2019 01:09:18 +0000 >Subject: [PATCH] Bug 8628: Digital signs - staff interface > >This patch adds the interface for creating and managing digital signs >and streams. > >Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> >--- > Koha/SignStream.pm | 14 + > Koha/SignsToStream.pm | 14 + > .../intranet-tmpl/prog/en/includes/tools-menu.inc | 5 +- > .../intranet-tmpl/prog/en/modules/tools/signs.tt | 490 +++++++++++++++++++++ > .../prog/en/modules/tools/tools-home.tt | 7 +- > koha-tmpl/intranet-tmpl/prog/js/tools-menu.js | 2 + > tools/signs.pl | 327 ++++++++++++++ > 7 files changed, 857 insertions(+), 2 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt > create mode 100755 tools/signs.pl > >diff --git a/Koha/SignStream.pm b/Koha/SignStream.pm >index daabddc7673..185e21422a9 100644 >--- a/Koha/SignStream.pm >+++ b/Koha/SignStream.pm >@@ -33,6 +33,20 @@ Koha::SignStream - Koha SignStream object class > > =cut > >+=head3 saved_sql >+ >+my $saved_sql = $stream->saved_sql; >+ >+Return the report attached to a stream >+ >+=cut >+ >+sub saved_sql { >+ my ( $self ) = @_; >+ my $sql_rs = $self->_result->saved_sql; >+ return Koha::Report->_new_from_dbic( $sql_rs ); >+} >+ > sub _type { > return 'SignStream'; > } >diff --git a/Koha/SignsToStream.pm b/Koha/SignsToStream.pm >index b76f160ea6b..cc73371eb96 100644 >--- a/Koha/SignsToStream.pm >+++ b/Koha/SignsToStream.pm >@@ -33,6 +33,20 @@ Koha::SignsToStream - SignsToStream object class > > =cut > >+=head3 sign_stream >+ >+my $sign_stream = $sts->sign_stream >+ >+Return the stream >+ >+=cut >+ >+sub sign_stream { >+ my ( $self ) = @_; >+ my $stream_rs = $self->_result->sign_stream; >+ return Koha::SignStream->_new_from_dbic( $stream_rs ); >+} >+ > sub _type { > return 'SignsToStream'; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >index b106cffbea8..ac91707b5a6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc >@@ -52,7 +52,7 @@ > </ul> > [% END # /IF ( CAN_user_tools_items_batchdel... %] > >- [% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_additional_contents || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) || CAN_user_tools_upload_general_files || CAN_user_tools_access_files ) %] >+ [% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_additional_contents || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) || CAN_user_tools_upload_general_files || CAN_user_tools_access_files || CAN_user_tools_edit_digital_signs ) %] > <h5>Additional tools</h5> > <ul> > [% IF ( CAN_user_tools_edit_calendar ) %] >@@ -75,6 +75,9 @@ > [% IF ( CAN_user_tools_edit_quotes ) %] > <li><a href="/cgi-bin/koha/tools/quotes.pl">Quote editor</a></li> > [% END %] >+ [% IF ( CAN_user_tools_edit_digital_signs ) %] >+ <li><a href="/cgi-bin/koha/tools/signs.pl">Digital signs</a></dt> >+ [% END %] > [% IF ( plugins_enabled && CAN_user_plugins_tool ) %] > <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">Tool plugins</a></li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt >new file mode 100644 >index 00000000000..80b74d9caae >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt >@@ -0,0 +1,490 @@ >+[% USE Koha %] >+[% USE Asset %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Tools › Digital signs</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% Asset.css("css/datatables.css") %] >+</head> >+<body id="tools_signs" class="tools"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'cat-search.inc' %] >+ >+[% BLOCK dslink %]<a href="/cgi-bin/koha/tools/signs.pl">Digital signs</a> ›[% END %] >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › >+ <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › >+ [% IF op == 'stream_form' %] >+ [% IF ( stream.sign_stream_id ) %] >+ [% INCLUDE dslink %] Edit "[% stream.name %]" >+ [% ELSE %] >+ [% INCLUDE dslink %] Add a new stream >+ [% END %] >+ [% ELSIF op == 'sign_form' %] >+ [% IF ( sign.sign_id ) %] >+ [% INCLUDE dslink %] Edit "[% sign.name %]" >+ [% ELSE %] >+ [% INCLUDE dslink %] Add a new sign >+ [% END %] >+ [% ELSIF op == 'edit_streams' %] >+ [% INCLUDE dslink %] Edit streams attached to "[% sign.name %]" >+ [% ELSIF op == 'get_params' %] >+ [% INCLUDE dslink %] >+ <a href="/cgi-bin/koha/tools/signs.pl?op=edit_streams&sign_id=[% sign.sign_id %]">Edit streams attached to "[% sign.name %]"</a> › >+ Get parameters >+ [% ELSIF op == 'del_stream' %] >+ [% INCLUDE dslink %] Delete stream "[% stream.name %]" >+ [% ELSIF op == 'del_stream_ok' %] >+ [% INCLUDE dslink %] Stream deleted >+ [% ELSIF op == 'del_sign' %] >+ [% INCLUDE dslink %] Delete sign "[% sign.name %]" >+ [% ELSIF op == 'del_sign_ok' %] >+ [% INCLUDE dslink %] Sign deleted >+ [% ELSIF op == 'view_sign' %] >+ [% INCLUDE dslink %] View sign >+ [% ELSIF op == 'view_stream' %] >+ [% INCLUDE dslink %] View stream >+ [% ELSE %] >+ Digital signs >+ [% END %] >+</div> >+ >+<div id="doc3" class="yui-t2"> >+<div id="bd"> >+<div id="yui-main"> >+<div class="yui-b"> >+ >+[% UNLESS Koha.Preference( 'OPACDigitalSigns' ) %] >+ <div class="dialog alert"> >+ Digital signs are not enabled. Please enable <a href="/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=OPACDigitalSigns">OPACDigitalSigns</a> for OPAC digital signs to work. >+ </div> >+[% END %] >+ >+[% IF ( else ) %] >+ <div id="toolbar" class="btn-toolbar"> >+ <a id="newsign" href="/cgi-bin/koha/tools/signs.pl?op=add_sign" class="btn btn-default"><i class="fa fa-plus"></i> New sign</a> >+ <a id="newstream" href="/cgi-bin/koha/tools/signs.pl?op=add_stream" class="btn btn-default"><i class="fa fa-plus"></i> New stream</a> >+ </div> >+[% END %] >+ >+[% IF op == 'stream_form' %] >+ [% UNLESS ( reports ) %] >+ <div class="dialog alert"> >+ <h3>No reports found</h3> >+ No reports with group code "SIGN" were found. Please <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create+report+from+SQL&submit=Create+report+from+SQL">create a new report</a> with group code "SIGN" and try again. >+ </div> >+ [% END %] >+ >+ [% IF ( stream.sign_stream_id ) %] >+ <h1>Edit stream</h1> >+ [% ELSE %] >+ <h1>Add stream</h1> >+ [% END %] >+ <form action="[% script_name %]" name="streamform" id="streamform" method="post"> >+ <input type="hidden" name="op" value="save_stream" /> >+ [% IF ( stream.sign_stream_id ) %] >+ <input type="hidden" name="sign_stream_id" value="[% stream.sign_stream_id %]" /> >+ [% END %] >+ <fieldset class="rows"> >+ <ol> >+ <li> >+ <label for="name" class="required">Name</label> >+ <input type="text" name="name" value="[% stream.name %]" required="required"> >+ <span class="required">Required</span> >+ </li> >+ <li><label for="report" class="required">Report</label> >+ <select name="report" id="report" class="required" required="required"> >+ [% UNLESS ( stream.sign_stream_id ) %] >+ <option value="">Choose report</option> >+ [% END %] >+ [% FOREACH report IN reports %] >+ [% IF ( report.id == stream.saved_sql_id ) %] >+ <option value="[% report.id %]" selected="selected">[% report.report_name %]</option> >+ [% ELSE %] >+ <option value="[% report.id %]">[% report.report_name %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ <span class="required">Required</span> >+ </li> >+ <li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> <input type="submit" value="Submit" class="submit" /></fieldset> >+ </form> >+ >+[% ELSIF op == 'sign_form' %] >+ [% IF ( sign.sign_id ) %] >+ <h1>Edit sign</h1> >+ [% ELSE %] >+ <h1>Add sign</h1> >+ [% END %] >+ <form action="[% script_name %]" name="signform" id="signform" method="post"> >+ <input type="hidden" name="op" value="save_sign" /> >+ [% IF ( sign.sign_id ) %] >+ <input type="hidden" name="sign_id" value="[% sign.sign_id %]" /> >+ [% END %] >+ <fieldset id="sign_general_info" class="rows"> >+ <legend id="general_info_lgd">General settings</legend> >+ <ol> >+ <li><label for="name">Name</label><input type="text" name="name" value="[% sign.name %]" /></li> >+ </ol> >+ </fieldset> >+ <fieldset id="sign_appearance" class="rows"> >+ <legend id="appearance_lgd">Appearance</legend> >+ <ol> >+ <li><label for="webapp">Web-app</label> >+ <select name="webapp" id="webapp"> >+ <option value="0">Display as a normal page</option> >+ [% IF ( sign.webapp ) %] >+ <option value="1" selected="selected">Display as a Web-app</option> >+ [% ELSE %] >+ <option value="1">Display as a Web-app</option> >+ [% END %] >+ </select> >+ </li> >+ <li><label for="swatch">Theme (swatch)</label> >+ <select name="swatch" id="swatch"> >+ <option value="">Default</option> >+ [% FOREACH swatch IN Koha.Preference('OPACDigitalSignsSwatches').split('') %] >+ [% IF swatch == sign.swatch %] >+ <option value="[% swatch %]" selected="selected">[% swatch %]</option> >+ [% ELSE %] >+ <option value="[% swatch %]">[% swatch %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li><label for="transition">Transition</label> >+ <select name="transition" id="transition"> >+ [% FOREACH transition IN [ 'none' 'fade' 'pop' 'flip' 'turn' 'flow' 'slidefade' 'slide' 'slideup' 'slidedown' ] %] >+ [% IF transition == sign.transition %] >+ <option value="[% transition %]" selected="selected">[% transition %]</option> >+ [% ELSE %] >+ <option value="[% transition %]">[% transition %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset id="sign_autopage" class="rows"> >+ <legend id="autopage_lgd">Automatic page turning</legend> >+ <ol> >+ <li><label for="idleafter">Idle after</label> >+ <input type="text" name="idleafter" id="idleafter" value="[% sign.idleafter %]" size="4" /> seconds. (Set to 0 to disable automatic page turning.) >+ </li> >+ <li><label for="pagedelay">Page delay</label> >+ <input type="text" name="pagedelay" id="pagedelay" value="[% sign.pagedelay %]" size="4" /> seconds. >+ </li> >+ <li><label for="reloadafter">Reload after</label> >+ <input type="text" name="reloadafter" id="reloadafter" value="[% sign.reloadafter %]" size="4" /> seconds. >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> <input type="submit" value="Submit" class="submit" /></fieldset> >+ </form> >+ >+[% ELSIF op == 'edit_streams' %] >+ <h1>Edit streams attached to [% sign.name %]</h1> >+ <h2>Streams already attached to this sign</h2> >+ [% IF ( sts.count ) %] >+ <table id="streams_attached"> >+ <thead> >+ <tr> >+ <th>Name</th> >+ <th colspan="2">Parameters</th> >+ <th> </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH s IN sts %] >+ <tr> >+ <td>[% s.sign_stream.name %]</td> >+ <td>[% IF s.params %][% s.params %][% ELSE %]None[% END %]</td> >+ <td class="actions"> >+ [% IF s.params %] >+ <a href="/cgi-bin/koha/tools/signs.pl?op=get_params&sign_to_stream_id=[% s.sign_to_stream_id %]&sign_stream_id=[% s.sign_stream_id %]&sign_id=[% s.sign_id %]" class="btn btn-default btn-xs" title="Edit parameters"><i class="fa fa-pencil"></i></a> >+ [% ELSE %] >+ <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% s.sign_stream.saved_sql_id %]&phase=Edit SQL" class="btn btn-default btn-xs" title="Edit SQL"><i class="fa fa-pencil"></i></a> >+ [% END %] >+ </td> >+ <td class="actions"><a href="/cgi-bin/koha/tools/signs.pl?op=detach_stream_from_sign&sign_id=[% s.sign_id %]&sign_to_stream_id=[% s.sign_to_stream_id %]" class="btn btn-default btn-xs detach"><i class="fa fa-times"></i> Detach</a></td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ There are no streams attached to this sign. >+ [% END %] >+ >+ <h2>Attach a new stream to this sign</h2> >+ <form action="[% script_name %]" name="attach_stream_to_sign_form" id="attach_stream_to_sign_form" method="post"> >+ <input type="hidden" name="op" value="attach_stream_to_sign" /> >+ <input type="hidden" name="sign_id" value="[% sign_id %]" /> >+ <fieldset class="rows"> >+ <ol> >+ <li><label for="stream">Choose a stream to attach</label> >+ <select name="sign_stream_id" id="stream"> >+ [% FOREACH s IN streams %] >+ <option value="[% s.sign_stream_id %]">[% s.name %]</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> <input type="submit" value="Submit" class="submit" /></fieldset> >+ </form> >+ >+[% ELSIF op == 'get_params' %] >+ <h1>Parameters for [% stream.name %]</h1> >+ Based on report: [% sql.report_name %] | <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% stream.saved_sql_id %]&phase=Edit SQL">Edit this report</a> >+ >+ <form action="[% script_name %]" name="get_params_form" id="get_params_form" method="post"> >+ <input type="hidden" name="op" value="save_params" /> >+ <input type="hidden" name="sign_to_stream_id" value="[% sign_to_stream_id %]" /> >+ <input type="hidden" name="sign_stream_id" value="[% sign_stream_id %]" /> >+ <input type="hidden" name="sign_id" value="[% sign_id %]" /> >+ <fieldset class="rows"> >+ [% IF ( sts.params ) %] >+ <legend id="save_params_lgd">Edit parameters</legend> >+ [% ELSE %] >+ <legend id="save_params_lgd">Add parameters</legend> >+ [% END %] >+ <ol> >+ <li><label for="stream">Parameters</label> >+ <input type="text" size="60" name="parameters" id="parameters" value="[% sts.params %]" /> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> <input type="submit" value="Submit" class="submit" /></fieldset> >+ </form> >+ >+ <h2>Raw SQL</h2> >+ <pre id="sql_output">[% sql.savedsql | html %]</pre> >+ >+ <h2>SQL with current parameters replaced</h2> >+ <pre id="sql_output">[% newsql | html %]</pre> >+ >+ [% IF ( has_params ) %] >+ Sorry, your SQL still contains placeholders. You need to add more parameters. >+ [% ELSE %] >+ <h2>Records</h2> >+ [% INCLUDE display_records %] >+ [% END %] >+ >+[% ELSIF op == 'del_stream' %] >+ <div class="dialog alert"> >+ <h3>Confirm deletion of stream <span class="ex">'[% stream.name %]'</span>?</h3> >+ <form action="[% script_name %]" id ="confirm_stream_delete_form" method="post"> >+ <input type="hidden" name="op" value="del_stream_ok" /> >+ <input type="hidden" name="sign_stream_id" value="[% stream.sign_stream_id %]" /> >+ <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this stream</button> >+ </form> >+ >+ <form action="[% script_name %]" id="cancel_stream_delete_form" method="get"> >+ <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button> >+ </form> >+ </div> >+ >+[% ELSIF op == 'del_stream_ok' %] >+ <div class="dialog message"> >+ <h3>Stream deleted</h3> >+ <form action="[% script_name %]" method="get"> >+ <input type="submit" value="OK" class="approve" /> >+ </form> >+ </div> >+ >+[% ELSIF op == 'del_sign' %] >+ <div class="dialog alert"> >+ <h3>Confirm deletion of sign <span class="ex">'[% sign.name %]'</span>?</h3> >+ <form action="[% script_name %]" id ="confirm_sign_delete_form" method="post"> >+ <input type="hidden" name="op" value="del_sign_ok" /> >+ <input type="hidden" name="sign_id" value="[% sign.sign_id %]" /> >+ <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this sign</button> >+ </form> >+ >+ <form action="[% script_name %]" id="cancel_sign_delete_form" method="get"> >+ <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button> >+ </form> >+ </div> >+ >+[% ELSIF op == 'del_sign_ok' %] >+ <div class="dialog message"> >+ <h3>Sign deleted</h3> >+ <form action="[% script_name %]" method="get"> >+ <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button> >+ </form> >+ </div> >+ >+[% ELSIF op == 'view_sign' %] >+ <h1>[% sign.name %]</h1> >+ <h2>Streams</h2> >+ >+ [% IF ( streams ) %] >+ [% FOREACH stream IN streams %] >+ <h3>[% stream.sign_stream.name %]</h3> >+ <ul> >+ [% FOREACH record IN stream.records %] >+ <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% record.biblionumber %]">[% record.title %]</a></li> >+ [% END %] >+ </ul> >+ [% END %] >+ [% ELSE %] >+ No streams attached. >+ [% END %] >+ >+[% ELSIF op == 'view_stream' %] >+ <h1>[% stream.name %]</h1> >+ Based on report: [% stream.saved_sql_id.report_name %] | <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% stream.saved_sql_id %]&phase=Edit SQL">Edit this report</a> >+ >+ <h2>SQL</h2> >+ <pre id="sql_output">[% stream.saved_sql_id.savedsql | html %]</pre> >+ >+ <h2>Records</h2> >+ [% IF ( has_params ) %] >+ Unable to display records. Check that this stream has been attached to a sign and any parameters have been filled appropriately. >+ [% ELSE %] >+ [% INCLUDE display_records %] >+ [% END %] >+ >+[% ELSE %] >+ <h1>Digital signs</h1> >+ >+ [% IF ( error_on_insert_stream ) %] >+ <div class="dialog error">Failed to create a new stream.</div> >+ [% ELSIF ( success_on_insert_stream ) %] >+ <div class="dialog message">New stream added.</div> >+ [% END %] >+ >+ <h2>Signs</h2> >+ [% IF signs %] >+ <table id="table_signs"> >+ <thead> >+ <tr> >+ <th>Name</th> >+ <th>Web-app</th> >+ <th>Theme (swatch)</th> >+ <th>Transition</th> >+ <th>Idle after</th> >+ <th>Page delay</th> >+ <th>Reload after</th> >+ <th> </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH s IN signs %] >+ <tr> >+ <td><a href="/cgi-bin/koha/tools/signs.pl?op=view_sign&sign_id=[% s.sign_id %]">[% s.name %]</a></td> >+ <td>[% IF ( s.webapp ) %]Yes[% ELSE %]No[% END %]</td> >+ <td>[% s.swatch %]</td> >+ <td>[% s.transition %]</td> >+ <td>[% s.idleafter %]</td> >+ <td>[% s.pagedelay %]</td> >+ <td>[% s.reloadafter %]</td> >+ <td> >+ <div class="dropdown"> >+ <a class="btn btn-default btn-xs dropdown-toggle" id="opensignsactions[% s.sign_id %]" role="button" data-toggle="dropdown" href="#"> Actions <b class="caret"></b></a> >+ <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="opensignsactions[% s.sign_id %]"> >+ <li><a href="/cgi-bin/koha/tools/signs.pl?op=edit_sign&sign_id=[% s.sign_id %]"><i class="fa fa-pencil"></i> Edit</a></li> >+ <li><a href="/cgi-bin/koha/tools/signs.pl?op=edit_streams&sign_id=[% s.sign_id %]"><i class="fa fa-pencil"></i> Edit streams</a></li> >+ <li><a href="/cgi-bin/koha/tools/signs.pl?op=del_sign&sign_id=[% s.sign_id %]"><i class="fa fa-trash"></i> Delete</a></li> >+ [% IF ( OPACBaseURL ) %]<li><a href="[% OPACBaseURL %]/cgi-bin/koha/opac-signs.pl?sign=[% s.sign_id %]" title="View this sign in the OPAC"><i class="fa fa-eye"></i> View sign</a></li>[% END %] >+ </ul> >+ </div> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% UNLESS ( OPACBaseURL ) %]Please note: Links to view signs in the OPAC will only be displayed if you fill in the OPACBaseURL system preference.[% END %] >+ [% ELSE %] >+ <div class="dialog message">No signs defined. <a href="/cgi-bin/koha/tools/signs.pl?op=add_sign">Create a new sign.</a></div> >+ [% END %] >+ >+ <h2>Streams</h2> >+ [% IF streams %] >+ <table id="table_streams"> >+ <thead> >+ <tr> >+ <th>Name</th> >+ <th>Report</th> >+ <th>Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH s IN streams %] >+ <tr> >+ <td><a href="/cgi-bin/koha/tools/signs.pl?op=view_stream&sign_stream_id=[% s.sign_stream_id %]">[% s.name %]</a></td> >+ <td title="ID: [% s.saved_sql_id %]">[% s.saved_sql.report_name %]</td> >+ <td class="actions"> >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/signs.pl?op=edit_stream&sign_stream_id=[% s.sign_stream_id %]"><i class="fa fa-pencil"></i> Edit</a> >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/signs.pl?op=del_stream&sign_stream_id=[% s.sign_stream_id %]"><i class="fa fa-trash"></i> Delete</a> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <div class="dialog message">No streams defined. <a href="/cgi-bin/koha/tools/signs.pl?op=add_stream">Create a new stream.</a></div> >+ [% END %] >+ >+[% END %] >+ >+</div> >+</div> >+ >+<div class="yui-b"> >+[% INCLUDE 'tools-menu.inc' %] >+</div> >+ >+</div> >+ >+[% MACRO jsinclude BLOCK %] >+[% INCLUDE 'datatables.inc' %] >+[% Asset.js("js/tools-menu.js") | $raw %] >+<script> >+//<![CDATA[ >+ $(document).ready(function() { >+ $("#table_signs").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSearchable": false, "bSortable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ $("#table_streams").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSearchable": false, "bSortable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ >+ $(".detach").on("click", function(){ >+ return confirmDelete(_("Are you sure you want to detach this stream from this sign?")); >+ }); >+ }); >+//]]> >+</script> >+[% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >+ >+[% BLOCK display_records %] >+ [% IF ( records.0 ) %] >+ <table> >+ <thead> >+ <tr> >+ <th>biblionumber</th> >+ <th>title</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH r IN records %] >+ <tr><td>[% r.biblionumber %]</td><td>[% r.title %]</td></tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ No records found. >+ [% END %] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 73508b2c649..369ad203ef8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -114,7 +114,7 @@ > </div> <!-- /.col-sm-6 --> > > <div class="col-sm-6"> >- [% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_additional_contents || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( plugins_enabled && CAN_user_plugins_tool ) || CAN_user_tools_upload_general_files || CAN_user_tools_access_files ) %] >+ [% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_additional_contents || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( plugins_enabled && CAN_user_plugins_tool ) || CAN_user_tools_upload_general_files || CAN_user_tools_access_files || CAN_user_tools_edit_digital_signs ) %] > <h3>Additional tools</h3> > [% END %] > <dl> >@@ -154,6 +154,11 @@ > <dd>Manage 'Quote of the day' quotes</dd> > [% END %] > >+ [% IF ( CAN_user_tools_edit_digital_signs ) %] >+ <dt><a href="/cgi-bin/koha/tools/signs.pl">Digital signs</a></dt> >+ <dd>Create and edit digital signs for the OPAC</dd> >+ [% END %] >+ > [% IF ( plugins_enabled && CAN_user_plugins_tool && tool_plugins ) %] > <dt><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">Tool plugins</a></dt> > <dd> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >index fa8c1a6e2d2..73e29f8b052 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/tools-menu.js >@@ -20,5 +20,7 @@ > $('#navmenulist a[href$="/cgi-bin/koha/plugins/plugins-home.pl?method=tool"]').addClass("current"); > } else if (path.indexOf("page.pl") >= 0 ) { > $('#navmenulist a[href$="/cgi-bin/koha/tools/additional-contents.pl?category=pages"]').addClass("current"); >+ } else if (path.indexOf("signs") >= 0 ) { >+ $('#navmenulist a[href$="/cgi-bin/koha/tools/signs.pl"]').addClass("current"); > } > }); >diff --git a/tools/signs.pl b/tools/signs.pl >new file mode 100755 >index 00000000000..01c70bc4dec >--- /dev/null >+++ b/tools/signs.pl >@@ -0,0 +1,327 @@ >+#!/usr/bin/perl >+ >+# Copyright 2012 Magnus Enger Libriotech >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 NAME >+ >+signs.pl - Script for managing digital signs for the OPAC. >+ >+=head1 SYNOPSIS >+ >+signs.pl >+ >+=head1 DESCRIPTION >+ >+Allows authorized users to create and manage digital signs for the OPAC. >+ >+=cut >+ >+use Koha::Sign; >+use Koha::Signs; >+use Koha::SignStream; >+use Koha::SignStreams; >+use Koha::SignsToStreams; >+use Koha::Reports; >+use CGI; >+use C4::Auth; >+use C4::Context; >+use C4::Log; >+use C4::Output; >+use C4::Reports::Guided; >+use Modern::Perl; >+ >+my $cgi = new CGI; >+my $dbh = C4::Context->dbh; >+my $script_name = 'signs.pl'; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => "tools/signs.tt", >+ query => $cgi, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { tools => 'edit_digital_signs' }, >+ debug => 0, >+}); >+ >+my $op = $cgi->param('op') || ''; >+my $sign_id = $cgi->param('sign_id') || ''; >+my $sign_stream_id = $cgi->param('sign_stream_id') || ''; >+my $sign_to_stream_id = $cgi->param('sign_to_stream_id') || ''; >+my $parameters = $cgi->param('parameters') || ''; >+ >+# Streams >+ >+if ( $op eq 'add_stream' ) { >+ >+ $template->param( >+ op => 'stream_form', >+ reports => get_saved_reports({ group => 'SIGN' }), >+ ); >+ >+} elsif ( $op eq 'edit_stream' && $sign_stream_id ne '') { >+ >+ my $stream = Koha::SignStreams->find( $sign_stream_id ); >+ >+ $template->param( >+ op => 'stream_form', >+ stream => $stream, >+ reports => get_saved_reports({ group => 'SIGN' }), >+ script_name => $script_name >+ ); >+ >+} elsif ( $op eq 'save_stream' ) { >+ >+ my $name = $cgi->param('name'); >+ my $report = $cgi->param('report'); >+ if ( $sign_stream_id ne '' ) { >+ Koha::SignStreams->find( $sign_stream_id )->set({ name => $name, saved_sql_id => $report })->store; # modify >+ } else { >+ Koha::SignStream->new({ name => $name, saved_sql_id => $report })->store; # add new >+ } >+ print $cgi->redirect($script_name); >+ >+} elsif ( $op eq 'view_stream' && $sign_stream_id ne '' ) { >+ >+ my $stream = Koha::SignStreams->find( $sign_stream_id ); >+ my $report = Koha::Reports->find($stream->saved_sql_id); >+ my $sql = $report->savedsql; >+ my ( $records, $error ) = execute_query( $sql, 0, 999999 ); >+ if ( $records && not $error ) { >+ $records = $records->fetchall_arrayref({}); >+ $template->param( records => $records ); >+ } else { >+ $template->param( has_params => 1 ); >+ } >+ >+ $template->param( >+ op => 'view_stream', >+ stream => $stream, >+ script_name => $script_name >+ ); >+ >+} elsif ( $op eq 'del_stream' ) { >+ >+ my $stream = Koha::SignStreams->find( $sign_stream_id ); >+ >+ $template->param( >+ op => 'del_stream', >+ stream => $stream, >+ script_name => $script_name, >+ ); >+ >+} elsif ( $op eq 'del_stream_ok' ) { >+ >+ Koha::SignStreams->find( $sign_stream_id )->delete; >+ >+ $template->param( >+ op => 'del_stream_ok', >+ script_name => $script_name, >+ ); >+ >+# Signs >+ >+} elsif ( $op eq 'add_sign' ) { >+ >+ $template->param( op => 'sign_form' ); >+ >+} elsif ( $op eq 'edit_sign' && $sign_id ne '' ) { >+ >+ my $sign = Koha::Signs->find( $sign_id ); >+ >+ $template->param( >+ op => 'sign_form', >+ sign => $sign, >+ script_name => $script_name, >+ ); >+ >+} elsif ( $op eq 'save_sign' ) { >+ >+ if ($cgi->param('sign_id')) { >+ Koha::Signs->find( scalar $cgi->param('sign_id') )->set({ >+ name => scalar $cgi->param('name'), >+ webapp => scalar $cgi->param('webapp'), >+ swatch => scalar $cgi->param('swatch'), >+ transition => scalar $cgi->param('transition'), >+ idleafter => scalar $cgi->param('idleafter'), >+ pagedelay => scalar $cgi->param('pagedelay'), >+ reloadafter => scalar $cgi->param('reloadafter') >+ })->store; # modify >+ } else { >+ Koha::Sign->new({ >+ name => scalar $cgi->param('name'), >+ webapp => scalar $cgi->param('webapp'), >+ swatch => scalar $cgi->param('swatch'), >+ transition => scalar $cgi->param('transition'), >+ idleafter => scalar $cgi->param('idleafter'), >+ pagedelay => scalar $cgi->param('pagedelay'), >+ reloadafter => scalar $cgi->param('reloadafter') >+ })->store; # add new >+ } >+ print $cgi->redirect($script_name); >+ >+} elsif ( $op eq 'view_sign' && $sign_id ne '' ) { >+ >+ # Getting sign streams attached to sign with records >+ my $schema = Koha::Database->new()->schema(); >+ my @signstostreams = $schema->resultset('SignsToStream')->search({ 'me.sign_id' => $sign_id }, { prefetch => 'sign_stream' }); >+ my @changedstreams; >+ >+ foreach my $s ( @signstostreams ) { >+ my $stream = Koha::SignStreams->find( $s->sign_stream_id ); >+ my $sql = Koha::Reports->find($stream->saved_sql_id); >+ my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id }); >+ # Generate SQL with added params >+ my $newsql = $sql->savedsql; >+ foreach my $param ( split /&/, $params->params ) { >+ my ( $key, $value ) = split /=|<|>/, $param; # The < and > in the split are just to prevent software errors, the sign in the query must be changed in the report itself >+ $newsql =~ s/$key/$value/g; >+ } >+ # Run query with new sql >+ my ( $records, $error ) = execute_query( $newsql, 0, 999999 ); >+ if ( $records && not $error ) { >+ $s->{'records'} = $records->fetchall_arrayref({}); >+ push @changedstreams, $s; >+ } >+ } >+ >+ $template->param( >+ op => 'view_sign', >+ sign => Koha::Signs->find( $sign_id ), >+ streams => \@changedstreams, >+ script_name => $script_name, >+ ); >+ >+} elsif ( $op eq 'del_sign' && $sign_id ne '' ) { >+ >+ my $sign = Koha::Signs->find( $sign_id ); >+ >+ $template->param( >+ op => 'del_sign', >+ sign => $sign, >+ script_name => $script_name, >+ ); >+ >+} elsif ( $op eq 'del_sign_ok' ) { >+ >+ Koha::Signs->find( $sign_id )->delete; >+ >+ $template->param( >+ op => 'del_sign_ok', >+ script_name => $script_name, >+ ); >+ >+# Signs and streams >+ >+} elsif ( $op eq 'edit_streams' && $sign_id ne '') { >+ >+ my $sign = Koha::Signs->find( $sign_id ); >+ my $streams = Koha::SignStreams->search({}); >+ my $signstostreams = Koha::SignsToStreams->search({ 'sign_id' => $sign_id }); >+ >+ $template->param( >+ op => 'edit_streams', >+ sign => $sign, >+ sign_id => $sign_id, >+ streams => $streams, >+ sts => $signstostreams, >+ script_name => $script_name >+ ); >+ >+} elsif ( $op eq 'attach_stream_to_sign' && $sign_stream_id ne '' && $sign_id ne '' ) { >+ >+ my $sign_to_stream = Koha::SignsToStream->new({ sign_stream_id => $sign_stream_id, sign_id => $sign_id })->store; >+ >+ # Check if the SQL associated with the stream needs parameters >+ my $stream = Koha::SignStreams->find( $sign_stream_id ); >+ my $sql = Koha::Reports->find($stream->saved_sql_id); >+ if ( $sql->savedsql =~ m/WHERE/ ) { >+ print $cgi->redirect( $script_name . '?op=get_params&sign_to_stream_id=' . $sign_to_stream->sign_to_stream_id . '&sign_stream_id=' . $sign_stream_id . '&sign_id=' . $sign_id ); >+ } else { >+ print $cgi->redirect( $script_name . '?op=edit_streams&sign_id=' . $sign_id ); >+ } >+ >+} elsif ( $op eq 'get_params' && $sign_to_stream_id ne '' && $sign_stream_id ne '' && $sign_id ne '' ) { >+ >+ my $stream = Koha::SignStreams->find( $sign_stream_id ); >+ my $sql = Koha::Reports->find($stream->saved_sql_id); >+ my $sts = Koha::SignsToStreams->find({ sign_to_stream_id => $sign_to_stream_id }); >+ # Generate SQL with added params >+ my $newsql = $sql->savedsql; >+ foreach my $param ( split /&/, $sts->params ) { >+ $param =~ tr/ //ds; # replace any whitespace with nothing, strip the spaces out so the query works >+ my ( $key, $value ) = split /=|<|>/, $param; # The < and > in the split are just to prevent software errors, the sign in the query must be changed in the report itself >+ $newsql =~ s/$key/$value/g; >+ } >+ # Run query with new sql >+ my ( $records, $error ) = execute_query( $newsql, 0, 999999 ); >+ if ( $records && not $error) { >+ $template->param( records => $records->fetchall_arrayref({}) ); >+ } else { >+ $template->param( has_params => 1 ); >+ } >+ >+ my $sign = Koha::Signs->find( $sign_id ); >+ >+ $template->param( >+ op => 'get_params', >+ stream => $stream, >+ sign_id => $sign_id, >+ sign_stream_id => $sign_stream_id, >+ sign_to_stream_id => $sign_to_stream_id, >+ sts => $sts, >+ sql => $sql, >+ newsql => $newsql, >+ script_name => $script_name, >+ sign => $sign >+ ); >+ >+} elsif ( $op eq 'save_params' && $sign_to_stream_id ne '' && $sign_id ne '' ) { >+ >+ Koha::SignsToStreams->find( $sign_to_stream_id )->set({ params => $parameters })->store; >+ print $cgi->redirect( $script_name . '?op=get_params&sign_to_stream_id=' . $sign_to_stream_id . '&sign_stream_id=' . $sign_stream_id . '&sign_id=' . $sign_id ); >+ >+} elsif ( $op eq 'detach_stream_from_sign' && $sign_to_stream_id ne '' ) { >+ >+ Koha::SignsToStreams->find( $sign_to_stream_id )->delete; >+ print $cgi->redirect($script_name . '?op=edit_streams&sign_id=' . $sign_id); >+ >+} else { >+ >+ my @streams = Koha::SignStreams->search(); >+ my @signs = Koha::Signs->search(); >+ >+ $template->param( >+ streams => \@streams, >+ signs => \@signs, >+ reports => get_saved_reports({ group => 'SIGN' }), >+ OPACBaseURL => C4::Context->preference( 'OPACBaseURL' ) || '', >+ else => 1 >+ ); >+ >+} >+ >+output_html_with_http_headers $cgi, $cookie, $template->output; >+ >+exit 0; >+ >+=head1 AUTHORS >+ >+Written by Magnus Enger of Libriotech. >+Aleisha Amohia <aleisha@catalyst.net.nz> >+ >+=cut >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8628
:
42703
|
42704
|
45968
|
45969
|
58602
|
58603
|
58604
|
58605
|
62338
|
64249
|
66246
|
66247
|
66248
|
66249
|
66250
|
77025
|
77026
|
77027
|
77028
|
77141
|
77142
|
77143
|
77144
|
77145
|
78709
|
80248
|
80249
|
80250
|
80252
|
82896
|
82897
|
82898
|
82899
|
82900
|
82901
|
83312
|
88821
|
88822
|
88823
|
88824
|
88825
|
88826
|
93054
|
93055
|
93056
|
93057
|
93058
|
93059
|
93066
|
93067
|
93068
|
93069
|
93070
|
93071
|
99608
|
99609
|
99610
|
99611
|
99612
|
99613
|
99614
|
99615
|
99616
|
99617
|
99618
|
99619
|
99620
|
99621
|
99622
|
99623
|
99624
|
99717
|
99718
|
99801
|
118472
|
118473
|
118474
|
118475
|
118476
|
118477
|
118478
|
118479
|
118480
|
119455
|
131223
|
131224
|
145645
|
145646
|
145647
|
145648
|
145649
|
145650
|
145651
|
145652
|
145653
|
145654
|
147000
|
147001
|
147002
|
147003
|
147004
|
147005
|
147006
|
147007
|
147008
|
147009
|
147010