View | Details | Raw Unified | Return to bug 18483
Collapse All | Expand All

(-)a/edithelp.pl (-11 / +2 lines)
Lines 18-23 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use C4::Koha;
21
use C4::Output;
22
use C4::Output;
22
use C4::Templates;
23
use C4::Templates;
23
use C4::Auth;
24
use C4::Auth;
Lines 45-61 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
45
        query           => $input,
46
        query           => $input,
46
        type            => "intranet",
47
        type            => "intranet",
47
        authnotrequired => 0,
48
        authnotrequired => 0,
48
        flagsrequired   => {
49
        flagsrequired   => { tools => 'edit_help' },
49
            catalogue        => 1,
50
            circulate        => 1,
51
            parameters       => 1,
52
            borrowers        => 1,
53
            permissions      => 1,
54
            reserveforothers => 1,
55
            reserveforself   => 1,
56
            editcatalogue    => 1,
57
            updatecharges    => 1,
58
        },
59
        debug => 1,
50
        debug => 1,
60
    }
51
    }
61
);
52
);
(-)a/help.pl (-4 / +49 lines)
Lines 21-27 use strict; Link Here
21
use warnings;
21
use warnings;
22
use C4::Templates;
22
use C4::Templates;
23
use C4::Output;
23
use C4::Output;
24
# use C4::Auth;
24
use C4::NewsChannels; # GetNewsToDisplay
25
use C4::Auth;
25
use C4::Context;
26
use C4::Context;
26
use CGI qw ( -utf8 );
27
use CGI qw ( -utf8 );
27
28
Lines 43-70 my $query = new CGI; Link Here
43
# This is usually set by get_template_and_user
44
# This is usually set by get_template_and_user
44
C4::Context->interface('intranet');
45
C4::Context->interface('intranet');
45
46
47
my $helpsys = C4::Context->preference('HelpSystem');
48
46
# find the script that called the online help using the CGI referer()
49
# find the script that called the online help using the CGI referer()
47
our $refer = $query->param('url');
50
our $refer = $query->param('url');
48
$refer = $query->referer()  if !$refer || $refer eq 'undefined';
51
$refer = $query->referer()  if !$refer || $refer eq 'undefined';
52
# replace referer if we come back from news edit popup
53
$refer = $query->param('popupreferer') if defined $query->param('popupreferer') ;
54
49
my $from = _help_template_file_of_url($refer);
55
my $from = _help_template_file_of_url($refer);
56
my $helpkey = substr( $from, 0, rindex( $from, q{.} ) );
50
my $htdocs = C4::Context->config('intrahtdocs');
57
my $htdocs = C4::Context->config('intrahtdocs');
51
58
52
#
59
#Template for 'classic' Koha help text (filebased) if needed, otherwise no text
60
53
# checking that the help file exist, otherwise, display nohelp.tt page
61
# checking that the help file exist, otherwise, display nohelp.tt page
54
#
55
my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
62
my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
63
56
unless ( -e "$htdocs/$theme/$lang/modules/$from" ) {
64
unless ( -e "$htdocs/$theme/$lang/modules/$from" ) {
57
    $from = "help/nohelp.tt";
65
    $from = "help/nohelp.tt";
58
    ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
66
    ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
59
}
67
}
60
68
61
my $template = C4::Templates::gettemplate($from, 'intranet', $query);
69
# Classic Koha help text not used
70
if ( $helpsys eq 'newsbased' ) {
71
    #Template without classic Koha help text
72
    $from = "help/nohelptext.tt";
73
    ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
74
}
75
76
#my $template = C4::Templates::gettemplate($from, 'intranet', $query);
77
78
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
79
    {
80
        template_name   => $from,
81
        query           => $query,
82
        type            => "intranet",
83
        authnotrequired => 0,
84
    }
85
);
86
87
88
89
62
$template->param(
90
$template->param(
63
    referer => $refer,
91
    referer => $refer,
92
    helpkey => $helpkey,
64
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
93
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
65
    intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
94
    intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
95
    helpsystem => $helpsys,
66
);
96
);
67
97
98
if ( index($helpsys,'newsbased') != -1 || index ($helpsys,'filebased') != -1 ) {
99
100
    my $homebranch;
101
    if (C4::Context->userenv) {
102
        $homebranch = C4::Context->userenv->{'branch'};
103
    }
104
    my $help_from_news   = &GetNewsToDisplay('staffhelp', $homebranch);
105
    my $help_from_news_count = scalar @$help_from_news;
106
    $template->param(
107
        help_from_news       => $help_from_news,
108
        help_from_news_count => $help_from_news_count,
109
        homebranch           => $homebranch
110
    );
111
}
112
68
my $help_version = C4::Context->preference("Version");
113
my $help_version = C4::Context->preference("Version");
69
if ( $help_version =~ m|^(\d+)\.(\d{2}).*$| ) {
114
if ( $help_version =~ m|^(\d+)\.(\d{2}).*$| ) {
70
    my $version = $1;
115
    my $version = $1;
(-)a/installer/data/mysql/atomicupdate/bug_18472-Add_system_preference_CustomOnlineHelpStaff.perl (-1 / +1 lines)
Lines 1-7 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
3
    # you can use $dbh here like:
4
    $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES  ('HelpSystem', 'filebased', 'filebased', 'Select online help system.', 'multiple')" );
4
    $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES  ('HelpSystem', 'filebased', 'filebased|newsbased', 'Select online help system.', 'multiple')" );
5
    $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES  ('EnableEditingFilebasedHelp', '1', '', 'Enable editing of file based Koha help.', 'yesno')" );
5
    $dbh->do("INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES  ('EnableEditingFilebasedHelp', '1', '', 'Enable editing of file based Koha help.', 'yesno')" );
6
6
7
    # or perform some test and warn
7
    # or perform some test and warn
(-)a/installer/data/mysql/atomicupdate/bug_18483_news-driven-help-system.perl (+17 lines)
Line 0 Link Here
1
$DBversion = 'XXXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    $dbh->do( "UPDATE systempreferences SET VALUE = 'filebased', OPTIONS = 'filebased|newsbased' where variable = 'HelpSystem'" );
5
6
    $dbh->do( "ALTER TABLE opac_news ADD COLUMN helpkey varchar(250) AFTER lang ");
7
    $dbh->do( "INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (13, 'edit_help', 'Edit custom help');" );
8
9
    # or perform some test and warn
10
    # if( !column_exists( 'biblio', 'biblionumber' ) ) {
11
    #    warn "There is something wrong";
12
    # }
13
14
    # Always end with this (adjust the bug info)
15
    SetVersion( $DBversion );
16
    print "Upgrade to $DBversion done (Bug 18483 - Customised help: Enhance staff client with news based, easily editable help system)\n";
17
}
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 115-121 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
115
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
115
('CronjobLog','0',NULL,'If ON, log information from cron jobs.','YesNo'),
116
('CumulativeRestrictionPeriods',0,NULL,'Cumulate the restriction periods instead of keeping the highest','YesNo'),
116
('CumulativeRestrictionPeriods',0,NULL,'Cumulate the restriction periods instead of keeping the highest','YesNo'),
117
('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\'  in \'FR\' or \'360,000.00\'  in \'US\'.','Choice'),
117
('CurrencyFormat','US','US|FR|CH','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\'  in \'FR\' or \'360,000.00\'  in \'US\'.','Choice'),
118
('HelpSystem', 'filebased', 'filebased', 'Select online help system.', 'multiple'),
118
('HelpSystem', 'filebased', 'filebased|newsbased', 'Select online help system.', 'multiple'),
119
('EnableEditingFilebasedHelp', '1', '', 'Enable editing of file based Koha help.', 'yesno'),
119
('EnableEditingFilebasedHelp', '1', '', 'Enable editing of file based Koha help.', 'yesno'),
120
('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'),
120
('dateformat','us','metric|us|iso|dmydot','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd, dmydot dd.mm.yyyy)','Choice'),
121
('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'),
121
('DebugLevel','2','0|1|2','Define the level of debugging information sent to the browser when errors are encountered (set to 0 in production). 0=none, 1=some, 2=most','Choice'),
(-)a/installer/data/mysql/userpermissions.sql (+1 lines)
Lines 30-35 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
30
   (11, 'budget_manage_all', 'Manage all budgets'),
30
   (11, 'budget_manage_all', 'Manage all budgets'),
31
   (11, 'edi_manage', 'Manage EDIFACT transmissions'),
31
   (11, 'edi_manage', 'Manage EDIFACT transmissions'),
32
   (13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
32
   (13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
33
   (13, 'edit_help', 'Edit custom help'),
33
   (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
34
   (13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
34
   (13, 'edit_calendar', 'Define days when the library is closed'),
35
   (13, 'edit_calendar', 'Define days when the library is closed'),
35
   (13, 'moderate_comments', 'Moderate patron comments'),
36
   (13, 'moderate_comments', 'Moderate patron comments'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (-1 / +1 lines)
Lines 98-104 Link Here
98
                    </li>
98
                    </li>
99
                </ul>
99
                </ul>
100
            </li>
100
            </li>
101
                [% IF Koha.Preference('HelpSystem') == 'filebased' %]
101
                [% IF Koha.Preference('HelpSystem').match('filebased|newsbased')  %]
102
                    <li>
102
                    <li>
103
                        <a class="toplinks" href="/cgi-bin/koha/help.pl" id="helper">Help</a>
103
                        <a class="toplinks" href="/cgi-bin/koha/help.pl" id="helper">Help</a>
104
                    </li>
104
                    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc (-5 / +10 lines)
Lines 1-10 Link Here
1
[% USE Koha %]
2
1
<form action="/cgi-bin/koha/edithelp.pl" method="post">
3
<form action="/cgi-bin/koha/edithelp.pl" method="post">
2
    <fieldset class="action"><input type="button" class="close" value="Close help window" />
4
    <fieldset class="action">
3
    [% IF (Koha.Preference('HelpSystem') == 'filebased') && (Koha.Preference('EnableEditingFilebasedHelp') ) %]
5
        <input type="button" class="close" value="Close help window" />
4
        <input type="hidden" name="type" value="modify" />
5
        <input type="hidden" name="referer" value="[% referer %]" />
6
        <input type="hidden" name="referer" value="[% referer %]" />
6
        <input type="submit" class="submit" value="Edit help" /></fieldset>
7
        [% IF ( Koha.Preference('HelpSystem').match('filebased') && Koha.Preference('EnableEditingFilebasedHelp') && CAN_user_tools_edit_help ) %]
7
    [% END %]
8
            <input type="hidden" name="type" value="modify" />
9
            <input type="submit" class="submit" value="Edit help" />
10
        [% END %]
11
    </fieldset>
8
</form>
12
</form>
13
</div> <!-- /koha-help -->
9
</body>
14
</body>
10
</html>
15
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc (-16 / +38 lines)
Lines 1-21 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Online help</title>
4
<title>Online help</title>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
6
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.css" />
7
<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" />
8
[% INCLUDE intranetstylesheet.inc %]
9
[% IF ( bidi ) %]
10
   <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/right-to-left.css" />
11
[% END %]
12
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-2.2.3.min.js"></script>
13
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-migrate-1.3.0.min.js"></script>
14
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.js"></script>
15
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
16
<!-- koha core js -->
17
<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script>
18
19
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/help.css" />
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/help.css" />
20
</head>
6
[% USE Koha %]
7
[% INCLUDE 'doc-head-close.inc' %]
8
21
<body id="help" class="help">
9
<body id="help" class="help">
10
11
[% IF Koha.Preference('HelpSystem').match('newsbased') %]
12
    <div id="help_from_news">
13
        <h1><span class="help_title">Help for [% Branches.GetName( homebranch ) %]</span></h1>
14
            [% FOREACH helpitem IN help_from_news %]
15
            [% IF (helpitem.helpkey == helpkey) || (helpitem.helpkey == 'all') %]
16
                <div class="help-item-title" id="helpnews[% helpitem.idnew %]">
17
                    <h4>[% helpitem.title %]</h4>
18
                    <div class="help-item-body">[% helpitem.content %]</div>
19
                    <div class="help-item-date">[% helpitem.newdate %]</div>
20
                    <div class="help-item-footer">
21
                        [% IF CAN_user_tools_edit_help %]
22
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% helpitem.idnew %]&amp;popup_window=1&amp;popupreferer=[% referer %]">
23
                            <i class="fa fa-pencil"></i>Edit</a>
24
                        [% END %]
25
                    </div>
26
                </div>
27
            [% END %]
28
        [% END %]
29
        [% IF CAN_user_tools_edit_help %]
30
            <div class="help-item-buttons">
31
                <p><a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;helpkey=[% helpkey %]&amp;lang=staffhelp&amp;popup_window=1&amp;popupreferer=[% referer %]">
32
                <i class="fa fa-plus"></i>New custom help for this page</a>
33
                <span class="hint">Key is: [% helpkey %]</span></p>
34
                <p><a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;helpkey=all&amp;lang=staffhelp&amp;popup_window=1&amp;popupreferer=[% referer %]">
35
                <i class="fa fa-plus"></i>New custom help for all pages</a>
36
                <span class="hint">Key is: all</span></p>
37
            </div>
38
            <p class="hint">Note: You can manage and / or delete help entries in More &rsaquo; Tools</p>
39
        [% END %]
40
    </div><!-- /help-from-news -->
41
[% END %]
42
43
<div id="koha-help">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (+1 lines)
Lines 57-62 Link Here
57
    [%- CASE 'batch_upload_patron_images' -%]<span>Upload patron images in a batch or one at a time</span>
57
    [%- CASE 'batch_upload_patron_images' -%]<span>Upload patron images in a batch or one at a time</span>
58
    [%- CASE 'delete_anonymize_patrons' -%]<span>Delete old borrowers and anonymize circulation history (deletes borrower reading history)</span>
58
    [%- CASE 'delete_anonymize_patrons' -%]<span>Delete old borrowers and anonymize circulation history (deletes borrower reading history)</span>
59
    [%- CASE 'edit_calendar' -%]<span>Define days when the library is closed</span>
59
    [%- CASE 'edit_calendar' -%]<span>Define days when the library is closed</span>
60
    [%- CASE 'edit_help' -%]<span>Edit custom help</span>
60
    [%- CASE 'edit_news' -%]<span>Write news for the OPAC and staff interfaces</span>
61
    [%- CASE 'edit_news' -%]<span>Write news for the OPAC and staff interfaces</span>
61
    [%- CASE 'edit_notice_status_triggers' -%]<span>Set notice/status triggers for overdue items</span>
62
    [%- CASE 'edit_notice_status_triggers' -%]<span>Set notice/status triggers for overdue items</span>
62
    [%- CASE 'edit_notices' -%]<span>Define notices</span>
63
    [%- CASE 'edit_notices' -%]<span>Define notices</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+1 lines)
Lines 420-425 Administration: Link Here
420
              default: filebased
420
              default: filebased
421
              multiple:
421
              multiple:
422
                  filebased: "File based (staff client)"
422
                  filebased: "File based (staff client)"
423
                  newsbased: "News based"
423
        -
424
        -
424
            - "Enable editing of file based Koha help: "
425
            - "Enable editing of file based Koha help: "
425
            - pref: EnableEditingFilebasedHelp
426
            - pref: EnableEditingFilebasedHelp
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/mainpage.tt (-2 / +3 lines)
Lines 2-8 Link Here
2
[% INCLUDE 'help-top.inc' %]
2
[% INCLUDE 'help-top.inc' %]
3
3
4
<h2>Welcome to Koha</h2>
4
<h2>Welcome to Koha</h2>
5
6
<p>If this is your first time logging into Koha, you should now go to Koha Administration and set up all system preferences, patron categories, item types and libraries. You should also review the other settings found in Administration.</p>
5
<p>If this is your first time logging into Koha, you should now go to Koha Administration and set up all system preferences, patron categories, item types and libraries. You should also review the other settings found in Administration.</p>
7
6
8
<p>Once you have set up patron categories, you should create a new user in the Patrons module with superlibrarian permissions. Once that user is created, you should log in as that user rather than the root user which is set up as part of installation.</p>
7
<p>Once you have set up patron categories, you should create a new user in the Patrons module with superlibrarian permissions. Once that user is created, you should log in as that user rather than the root user which is set up as part of installation.</p>
Lines 18-24 Link Here
18
<li><a href="http://koha-community.org/get-involved/irc/">Chat with Koha users and developers</a></li>
17
<li><a href="http://koha-community.org/get-involved/irc/">Chat with Koha users and developers</a></li>
19
</ul>
18
</ul>
20
19
21
[% IF ( Koha.Preference('HelpSystem') == 'filebased' ) %]
20
 [% IF Koha.Preference('HelpSystem').match('filebased') && (Koha.Preference('EnableEditingFilebasedHelp') && CAN_user_tools_edit_help ) %]
21
22
    <h2>Can I edit the online help?</h2>
22
    <h2>Can I edit the online help?</h2>
23
23
24
    <p>You can edit the online help through the Koha Staff Client by clicking the &quot;Edit Help&quot; button. This feature has been designed so that library workflow and policies can be documented within Koha.</p>
24
    <p>You can edit the online help through the Koha Staff Client by clicking the &quot;Edit Help&quot; button. This feature has been designed so that library workflow and policies can be documented within Koha.</p>
Lines 26-31 Link Here
26
    <p><strong>IMPORTANT:</strong> Your online help will be overwritten by the new Help when there is an upgrade. If you want to keep a copy of your online help, you should instruct your System Administrator to upgrade the Online Help directory in the Koha file tree.</p>
26
    <p><strong>IMPORTANT:</strong> Your online help will be overwritten by the new Help when there is an upgrade. If you want to keep a copy of your online help, you should instruct your System Administrator to upgrade the Online Help directory in the Koha file tree.</p>
27
27
28
    <p>The online help directory is: <pre>[% themelang %]/modules/help</pre></p>
28
    <p>The online help directory is: <pre>[% themelang %]/modules/help</pre></p>
29
29
    <p><strong>Note:</strong> Files in help directory must be writeable to make this feature work. Additionally, system preference 'EnableEditingFilebasedHelp' must be set to 'Yes'.</p>
30
    <p><strong>Note:</strong> Files in help directory must be writeable to make this feature work. Additionally, system preference 'EnableEditingFilebasedHelp' must be set to 'Yes'.</p>
30
[% END %]
31
[% END %]
31
32
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/nohelptext.tt (+2 lines)
Line 0 Link Here
1
[% INCLUDE 'help-top.inc' %]
2
[% INCLUDE 'help-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-56 / +88 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
2
[% USE Branches %]
3
[% USE Branches %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
Lines 72-82 tinyMCE.init({ Link Here
72
</script>
73
</script>
73
</head>
74
</head>
74
<body id="tools_koha-news" class="tools">
75
<body id="tools_koha-news" class="tools">
75
[% INCLUDE 'header.inc' %]
76
[% INCLUDE 'cat-search.inc' %]
77
76
78
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> &rsaquo; [% IF ( id ) %]
77
[% IF not popup_window  %]
78
    [% INCLUDE 'header.inc' %]
79
    [% INCLUDE 'cat-search.inc' %]
80
81
    <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> &rsaquo; [% IF ( id ) %]
79
Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
82
Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
83
[% END %]
80
84
81
[% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
85
[% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
82
   <div id="bd">
86
   <div id="bd">
Lines 92-97 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
92
</div>
96
</div>
93
[% END %]
97
[% END %]
94
98
99
[% BLOCK langoptions %]
100
    <label for="lang">Display location:</label>
101
    <select id="lang" name="lang">
102
        [% IF CAN_user_tools_edit_news  %]
103
            [% IF ( default_lang == "" ) %]
104
                <option value="" selected="selected">All</option>
105
            [% ELSE %]
106
               <option value="">All</option>
107
            [% END %]
108
            [% IF ( default_lang == "koha" ) %]
109
                <option value="koha" selected="selected">Librarian interface</option>
110
            [% ELSE %]
111
                <option value="koha">Librarian interface</option>
112
            [% END %]
113
            [% IF ( default_lang == "slip" ) %]
114
                <option value="slip" selected="selected">Slip</option>
115
            [% ELSE %]
116
                <option value="slip">Slip</option>
117
            [% END %]
118
            [% FOREACH lang_lis IN lang_list %]
119
                [% IF ( lang_lis.language == default_lang ) %]
120
                    <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option>
121
                [% ELSE %]
122
                    <option value="[% lang_lis.language %]">OPAC ([% lang_lis.language %])</option>
123
                [% END %]
124
            [% END %]
125
        [% END %]
126
        [% IF ( Koha.Preference('HelpSystem').match('newsbased') && CAN_user_tools_edit_help ) %]
127
            [% IF ( default_lang == "staffhelp" ) %]
128
                <option value="staffhelp" selected="selected">Staff help</option>
129
            [% ELSE %]
130
                <option value="staffhelp">Help for staff client</option>
131
            [% END %]
132
        [% END %]
133
    </select>
134
[% END %]
135
95
[% IF ( add_form ) %]
136
[% IF ( add_form ) %]
96
    [% IF ( op == 'add' ) %][% default_lang = lang %]
137
    [% IF ( op == 'add' ) %][% default_lang = lang %]
97
    [% ELSE %][% default_lang = new_detail.lang %]
138
    [% ELSE %][% default_lang = new_detail.lang %]
Lines 99-132 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
99
        <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
140
        <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
100
            <input type="hidden" name="op" value="[% op %]" />
141
            <input type="hidden" name="op" value="[% op %]" />
101
            <input type="hidden" name="id" value="[% id %]" />
142
            <input type="hidden" name="id" value="[% id %]" />
143
            <input type="hidden" name="popupreferer" value="[% popupreferer %]" >
102
			<fieldset class="rows">
144
			<fieldset class="rows">
103
            <legend>OPAC and Koha news</legend>
145
            <legend>OPAC and Koha news</legend>
104
           <ol> <li>
146
            <ol> <li>
105
            <label for="lang">Display location:</label>
147
                [% INCLUDE langoptions %]
106
            <select id="lang" name="lang">
107
                [% IF ( default_lang == "" ) %]
108
                <option value="" selected="selected">All</option>
109
                [% ELSE %]
110
                <option value=""                    >All</option>
111
                [% END %]
112
                [% IF ( default_lang == "koha" ) %]
113
                <option value="koha" selected="selected">Librarian interface</option>
114
                [% ELSE %]
115
                <option value="koha"                    >Librarian interface</option>
116
                [% END %]
117
                [% IF ( default_lang == "slip" ) %]
118
                <option value="slip" selected="selected">Slip</option>
119
                [% ELSE %]
120
                <option value="slip"                    >Slip</option>
121
                [% END %]
122
                [% FOREACH lang_lis IN lang_list %]
123
                [% IF ( lang_lis.language == default_lang ) %]
124
                    <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option>
125
                [% ELSE %]
126
                    <option value="[% lang_lis.language %]"                    >OPAC ([% lang_lis.language %])</option>
127
                [% END %]
128
                [% END %]
129
            </select>
130
            </li>
148
            </li>
131
            <li>
149
            <li>
132
                <label for="branch">Library: </label>
150
                <label for="branch">Library: </label>
Lines 161-202 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
161
                    <input id="number" size="3" name="number" type="text" />
179
                    <input id="number" size="3" name="number" type="text" />
162
                [% END %]
180
                [% END %]
163
            </li>
181
            </li>
182
            <li>
183
                [% IF ( Koha.Preference('HelpSystem').match('newsbased') && CAN_user_tools_edit_help ) %]
184
                    <label for="helpkey">Help key: </label>
185
                    [% IF ( new_detail.helpkey ) %]
186
                        <input id="number" size="60" name="helpkey" type="text" value="[% new_detail.helpkey %]" />
187
                    [% ELSIF ( helpkey ) %]
188
                        <input id="number" size="60" name="helpkey" type="text" value="[% helpkey %]" />
189
                    [% ELSE %]
190
                        <input id="helpkey" size="60" name="helpkey" type="text" />
191
                    [% END %]
192
                    <span class="hint">Used for staff help. Will be populated for individual page when creating a new entry from 'Help'. Example: 'help/circ/circulation'. Use 'all' for all pages.</span>
193
                [% END %]
194
195
            </li>
164
            <li><label for="content">News: </label>
196
            <li><label for="content">News: </label>
165
            <textarea name="content" id="content"  cols="75" rows="10">[% new_detail.content %]</textarea>
197
            <textarea name="content" id="content"  cols="75" rows="10">[% new_detail.content %]</textarea>
166
            </li>
198
            </li>
167
            </ol>
199
            </ol>
168
			</fieldset>
200
			</fieldset>
169
  
201
170
                <fieldset class="action"><input class="button" type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a></fieldset>
202
            <fieldset class="action">
203
                [% IF popup_window %]
204
                    <input class="button" type="submit" value="Submit" />
205
                    <a class="cancel" href="#" onclick="history.back(); return false;">Cancel</a>
206
                [% ELSE %]
207
                    <input class="button" type="submit" value="Submit" />
208
                    <a class="cancel" href="/cgi-bin/koha/tools/koha-news.pl">Cancel</a>
209
                [% END %]
210
            </fieldset>
171
        </form>
211
        </form>
172
    [% ELSE %]
212
    [% ELSE %]
173
        <div style="margin-bottom:5px;">
213
        <div style="margin-bottom:5px;">
174
        <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
214
        <form name="add_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" >
175
            <label for="lang">Display location:</label>
215
176
            <select name="lang" id="lang">
216
            [% INCLUDE langoptions %]
177
            [% IF ( lang == "" ) %]
217
178
            <option value=""     selected="selected">All</option>
179
            [% ELSE %]
180
            <option value=""             >All</option>
181
            [% END %]
182
            [% IF ( lang == "koha" ) %]
183
            <option value="koha" selected="selected">Librarian interface</option>
184
            [% ELSE %]
185
            <option value="koha"         >Librarian interface</option>
186
            [% END %]
187
            [% IF ( lang == "slip" ) %]
188
            <option value="slip" selected="selected">Slip</option>
189
            [% ELSE %]
190
            <option value="slip"         >Slip</option>
191
            [% END %]
192
                [% FOREACH lang_lis IN lang_list %]
193
                [% IF ( lang_lis.language == lang ) %]
194
                    <option value="[% lang_lis.language %]" selected="selected">OPAC ([% lang_lis.language %])</option>
195
                [% ELSE %]
196
                    <option value="[% lang_lis.language %]"         >OPAC ([% lang_lis.language %])</option>
197
                [% END %]
198
                [% END %]
199
            </select>
200
            <label for="branch">Library: </label>
218
            <label for="branch">Library: </label>
201
            <select id="branch" name="branch">
219
            <select id="branch" name="branch">
202
                [% IF ( branchcode == "" ) %]
220
                [% IF ( branchcode == "" ) %]
Lines 225-230 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
225
                        <th>Actions</th>
243
                        <th>Actions</th>
226
                    </tr></thead>
244
                    </tr></thead>
227
                    <tbody>[% FOREACH opac_new IN opac_news %]
245
                    <tbody>[% FOREACH opac_new IN opac_news %]
246
                        [% IF opac_new.lang == 'staffhelp' %]
247
                            [% NEXT IF not ( CAN_user_tools_edit_help && Koha.Preference('HelpSystem').match('newsbased') ) %]
248
                        [% ELSE %]
249
                            [% NEXT IF not CAN_user_tools_edit_news %]
250
                        [% END %]
251
228
                         [% IF ( opac_new.expired ) %]
252
                         [% IF ( opac_new.expired ) %]
229
                            <tr class="expired">
253
                            <tr class="expired">
230
                            [% ELSE %]
254
                            [% ELSE %]
Lines 240-245 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
240
                                    Slip
264
                                    Slip
241
                                [%   CASE "" %]
265
                                [%   CASE "" %]
242
                                    All
266
                                    All
267
                                [% CASE "staffhelp" %]
268
                                    Staff help
269
                                    [% IF opac_new.helpkey %]
270
                                        <span class="hint">[% opac_new.helpkey %]</span>
271
                                    [% ELSE %]
272
                                        <span class="hint">No page key!</span>
273
                                    [% END %]
274
243
                                [%   CASE %]
275
                                [%   CASE %]
244
                                    OPAC ([% opac_new.lang %])
276
                                    OPAC ([% opac_new.lang %])
245
                                [% END %]
277
                                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-3 / +11 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools</title>
3
<title>Koha &rsaquo; Tools</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 89-97 Link Here
89
    <dd>Browse the system logs</dd>
90
    <dd>Browse the system logs</dd>
90
    [% END %]
91
    [% END %]
91
92
92
    [% IF ( CAN_user_tools_edit_news ) %]
93
    [% IF CAN_user_tools_edit_news && CAN_user_tools_edit_help && Koha.Preference('HelpSystem').match('newsbased') %]
93
    <dt><a href="/cgi-bin/koha/tools/koha-news.pl">News</a></dt>
94
        <dt><a href="/cgi-bin/koha/tools/koha-news.pl">Manage news and news based help</a></dt>
94
    <dd>Write news for the OPAC and staff interfaces</dd>
95
        <dd>Write news for the OPAC and staff interfaces and manage news based online help for staff interface</dd>
96
    [% ELSIF CAN_user_tools_edit_help && Koha.Preference('HelpSystem').match('newsbased')  %]
97
        <dt><a href="/cgi-bin/koha/tools/koha-news.pl">Manage news based help</a></dt>
98
        <dd>Manage news based online help for staff interface</dd>
99
    [% ELSE %]
100
        <dt><a href="/cgi-bin/koha/tools/koha-news.pl">Manage news</a></dt>
101
        <dd>Write news for the OPAC and staff interfaces</dd>
102
95
    [% END %]
103
    [% END %]
96
104
97
    [% IF ( CAN_user_tools_schedule_tasks ) %]
105
    [% IF ( CAN_user_tools_schedule_tasks ) %]
(-)a/tools/koha-news.pl (-8 / +41 lines)
Lines 45-50 if ( $cgi->param('expirationdate') ) { Link Here
45
}
45
}
46
my $timestamp      = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 });
46
my $timestamp      = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 });
47
my $number         = $cgi->param('number');
47
my $number         = $cgi->param('number');
48
my $helpkey        = $cgi->param('helpkey');
48
my $lang           = $cgi->param('lang');
49
my $lang           = $cgi->param('lang');
49
my $branchcode     = $cgi->param('branch');
50
my $branchcode     = $cgi->param('branch');
50
my $error_message  = $cgi->param('error_message');
51
my $error_message  = $cgi->param('error_message');
Lines 55-71 $branchcode = undef if (defined($branchcode) && $branchcode eq ''); Link Here
55
56
56
my $new_detail = get_opac_new($id);
57
my $new_detail = get_opac_new($id);
57
58
59
# flagsrequired checks for all flags listed, we need an 'or'
60
# to work with edit_news or edit_help.
58
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
61
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
59
    {
62
    {
60
        template_name   => "tools/koha-news.tt",
63
        template_name   => "tools/koha-news.tt",
61
        query           => $cgi,
64
        query           => $cgi,
62
        type            => "intranet",
65
        type            => "intranet",
63
        authnotrequired => 0,
66
        authnotrequired => 1,
64
        flagsrequired   => { tools => 'edit_news' },
65
        debug           => 1,
67
        debug           => 1,
66
    }
68
    }
67
);
69
);
68
70
71
#news based help system can call this script as a popup window
72
$template->param( popup_window => 1 ) if( $cgi->param('popup_window')== 1 );
73
74
my $popupreferer = $cgi->param('popupreferer') // '';
75
if ($ popupreferer ) {
76
    $template->param( popupreferer => $popupreferer );
77
}
78
79
#Check now the flags, user must have news or help edit permission
80
if ( not (defined $template->{VARS}->{'CAN_user_tools_edit_news'} ||
81
    defined $template->{VARS}->{'CAN_user_tools_edit_help'} ) ) {
82
warn "EXIT FROM koha-news.pl ";
83
    print $cgi->redirect("/cgi-bin/koha/errors/403.pl");
84
} else {
85
#TODO: Indent as followup to bug 18483
86
69
# Pass error message if there is one.
87
# Pass error message if there is one.
70
$template->param( error_message => $error_message ) if $error_message;
88
$template->param( error_message => $error_message ) if $error_message;
71
89
Lines 99-105 if ( $op eq 'add_form' ) { Link Here
99
        $template->{VARS}->{'new_detail'} = $new_detail;
117
        $template->{VARS}->{'new_detail'} = $new_detail;
100
    }
118
    }
101
    else {
119
    else {
102
        $template->param( op => 'add' );
120
        $template->param(
121
            op => 'add',
122
            helpkey => $helpkey
123
        );
124
103
    }
125
    }
104
}
126
}
105
elsif ( $op eq 'add' ) {
127
elsif ( $op eq 'add' ) {
Lines 112-125 elsif ( $op eq 'add' ) { Link Here
112
                expirationdate => $expirationdate,
134
                expirationdate => $expirationdate,
113
                timestamp      => $timestamp,
135
                timestamp      => $timestamp,
114
                number         => $number,
136
                number         => $number,
137
                helpkey        => $helpkey,
115
                branchcode     => $branchcode,
138
                branchcode     => $branchcode,
116
                borrowernumber => $borrowernumber,
139
                borrowernumber => $borrowernumber,
117
            }
140
            }
118
        );
141
        );
119
        print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
142
143
        if ( $popupreferer ) {
144
             print $cgi->redirect( "/cgi-bin/koha/help.pl?popupreferer=$popupreferer");
145
        } else {
146
            print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
147
        }
120
    }
148
    }
121
    else {
149
    else {
122
        print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl?error_message=title_missing");
150
        print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl?error_message=title_missing&popupreferer=$popupreferer");
123
    }
151
    }
124
}
152
}
125
elsif ( $op eq 'edit' ) {
153
elsif ( $op eq 'edit' ) {
Lines 131-141 elsif ( $op eq 'edit' ) { Link Here
131
            lang           => $lang,
159
            lang           => $lang,
132
            expirationdate => $expirationdate,
160
            expirationdate => $expirationdate,
133
            timestamp      => $timestamp,
161
            timestamp      => $timestamp,
162
            helpkey        => $helpkey,
134
            number         => $number,
163
            number         => $number,
135
            branchcode     => $branchcode,
164
            branchcode     => $branchcode,
136
        }
165
        }
137
    );
166
    );
138
    print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
167
168
    if ( $popupreferer ) {
169
        print $cgi->redirect("/cgi-bin/koha/help.pl?popupreferer=$popupreferer");
170
    } else {
171
        print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
172
    }
139
}
173
}
140
elsif ( $op eq 'del' ) {
174
elsif ( $op eq 'del' ) {
141
    my @ids = $cgi->multi_param('ids');
175
    my @ids = $cgi->multi_param('ids');
Lines 144-150 elsif ( $op eq 'del' ) { Link Here
144
}
178
}
145
179
146
else {
180
else {
147
148
    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode );
181
    my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang, $branchcode );
149
    
182
    
150
    foreach my $new ( @$opac_news ) {
183
    foreach my $new ( @$opac_news ) {
Lines 161-164 else { Link Here
161
		);
194
		);
162
}
195
}
163
$template->param( lang => $lang );
196
$template->param( lang => $lang );
197
}
164
output_html_with_http_headers $cgi, $cookie, $template->output;
198
output_html_with_http_headers $cgi, $cookie, $template->output;
165
- 

Return to bug 18483