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

(-)a/help.pl (-3 / +22 lines)
Lines 38-44 sub _help_template_file_of_url { Link Here
38
    return "help/$file.tt";
38
    return "help/$file.tt";
39
}
39
}
40
40
41
my $query = new CGI;
41
our $query = new CGI;
42
43
# CP code for proof of concept Bug 18516, will need rework
44
sub _get_filepath ($;$) {
45
    my $referer = shift;
46
    $referer =~ /koha\/(.*)\.pl/;
47
    my $file = $1;
48
    $file =~ s/[^0-9a-zA-Z_\-\/]*//g;
49
    my $from = "help/$file.tt";
50
    my $htdocs = C4::Context->config('intrahtdocs');
51
    my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
52
    return "$htdocs/$theme/$lang/modules/$from";
53
}
54
55
42
56
43
# Init the interface to get the correct language.
57
# Init the interface to get the correct language.
44
# This is usually set by get_template_and_user
58
# This is usually set by get_template_and_user
Lines 61-66 my $htdocs = C4::Context->config('intrahtdocs'); Link Here
61
# checking that the help file exist, otherwise, display nohelp.tt page
75
# checking that the help file exist, otherwise, display nohelp.tt page
62
my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
76
my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
63
77
78
my $createfrom = _get_filepath($refer, 1);  # 2nd argument triggers themelanguage call
79
$createfrom = '' if (! -r $createfrom);
80
81
64
unless ( -e "$htdocs/$theme/$lang/modules/$from" ) {
82
unless ( -e "$htdocs/$theme/$lang/modules/$from" ) {
65
    $from = "help/nohelp.tt";
83
    $from = "help/nohelp.tt";
66
    ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
84
    ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query );
Lines 85-100 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
85
);
103
);
86
104
87
105
88
89
90
$template->param(
106
$template->param(
91
    referer => $refer,
107
    referer => $refer,
92
    helpkey => $helpkey,
108
    helpkey => $helpkey,
93
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
109
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
94
    intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
110
    intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
95
    helpsystem => $helpsys,
111
    helpsystem => $helpsys,
112
    createfrom => $createfrom,
96
);
113
);
97
114
115
116
98
if ( index($helpsys,'newsbased') != -1 || index ($helpsys,'filebased') != -1 ) {
117
if ( index($helpsys,'newsbased') != -1 || index ($helpsys,'filebased') != -1 ) {
99
118
100
    my $homebranch;
119
    my $homebranch;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc (+5 lines)
Lines 34-39 Link Here
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 %]">
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> Add help for all pages</a>
35
                <i class="fa fa-plus"></i> Add help for all pages</a>
36
                <span class="hint">Key is: all</span></p>
36
                <span class="hint">Key is: all</span></p>
37
                [% IF createfrom %]
38
                    <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;createfrom=[% createfrom %]&amp;helpversion=[% helpVersion %]&amp;popup_window=1&amp;popupreferer=[% referer %]">
39
                    <i class="fa fa-plus"></i> Add help for this page using built in text</a>
40
                    <span class="hint">Uses installed help text for Koha version [% helpVersion %] as a base for new help entry</span></p>
41
                [% END %]
37
            </div>
42
            </div>
38
            <p class="hint">Note: You can manage and / or delete help entries in More &rsaquo; Tools</p>
43
            <p class="hint">Note: You can manage and / or delete help entries in More &rsaquo; Tools</p>
39
        [% END %]
44
        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-2 / +6 lines)
Lines 193-200 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
193
                [% END %]
193
                [% END %]
194
194
195
            </li>
195
            </li>
196
            <li><label for="content">News: </label>
196
            <li><label for="content">Text: [% helpversion %] </label>
197
            <textarea name="content" id="content"  cols="75" rows="10">[% new_detail.content %]</textarea>
197
            [% IF createfrom %]
198
                <textarea name="content" id="content"  cols="75" rows="10">[% INSERT "$createfrom" FILTER remove('\[%(.|\n)*?%\]') FILTER replace('manual.koha-community.org//', "manual.koha-community.org/$helpversion/" )  %]</textarea>
199
            [% ELSE %]
200
                <textarea name="content" id="content"  cols="75" rows="10">[% new_detail.content %]</textarea>
201
            [% END %]
198
            </li>
202
            </li>
199
            </ol>
203
            </ol>
200
			</fieldset>
204
			</fieldset>
(-)a/tools/koha-news.pl (-2 / +5 lines)
Lines 46-51 if ( $cgi->param('expirationdate') ) { Link Here
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 $helpkey        = $cgi->param('helpkey');
49
my $createfrom     = $cgi->param('createfrom');
50
my $helpversion    = $cgi->param('helpversion');
49
my $lang           = $cgi->param('lang');
51
my $lang           = $cgi->param('lang');
50
my $branchcode     = $cgi->param('branch');
52
my $branchcode     = $cgi->param('branch');
51
my $error_message  = $cgi->param('error_message');
53
my $error_message  = $cgi->param('error_message');
Lines 119-125 if ( $op eq 'add_form' ) { Link Here
119
    else {
121
    else {
120
        $template->param(
122
        $template->param(
121
            op => 'add',
123
            op => 'add',
122
            helpkey => $helpkey
124
            helpkey => $helpkey,
125
            createfrom => $createfrom,
126
            helpversion => $helpversion,
123
        );
127
        );
124
128
125
    }
129
    }
126
- 

Return to bug 18516