Bugzilla – Attachment 62918 Details for
Bug 18516
Add possibility to import text from file based help system as news based help system item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18516 - Add possibility to import text from file based help system as news based help system item
Bug-18516---Add-possibility-to-import-text-from-fi.patch (text/plain), 5.48 KB, created by
Marc Véron
on 2017-05-01 13:20:38 UTC
(
hide
)
Description:
Bug 18516 - Add possibility to import text from file based help system as news based help system item
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2017-05-01 13:20:38 UTC
Size:
5.48 KB
patch
obsolete
>From f88a76525f0da08a957ae7db689ae80b088c6b63 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Mon, 1 May 2017 15:16:00 +0200 >Subject: [PATCH] Bug 18516 - Add possibility to import text from file based > help system as news based help system item > >Adds additional button to help page to import text from file based help to a new >news based help item. > >First draft - proof of concept. >Not yet ready to sign-off. >--- > help.pl | 23 +++++++++++++++++++--- > .../intranet-tmpl/prog/en/includes/help-top.inc | 3 +++ > .../prog/en/modules/tools/koha-news.tt | 8 ++++++-- > tools/koha-news.pl | 4 +++- > 4 files changed, 32 insertions(+), 6 deletions(-) > >diff --git a/help.pl b/help.pl >index 4d13684..29d6b76 100755 >--- a/help.pl >+++ b/help.pl >@@ -38,7 +38,21 @@ sub _help_template_file_of_url { > return "help/$file.tt"; > } > >-my $query = new CGI; >+our $query = new CGI; >+ >+# CP code for proof of concept Bug 18516, will need rework >+sub _get_filepath ($;$) { >+ my $referer = shift; >+ $referer =~ /koha\/(.*)\.pl/; >+ my $file = $1; >+ $file =~ s/[^0-9a-zA-Z_\-\/]*//g; >+ my $from = "help/$file.tt"; >+ my $htdocs = C4::Context->config('intrahtdocs'); >+ my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); >+ return "$htdocs/$theme/$lang/modules/$from"; >+} >+ >+ > > # Init the interface to get the correct language. > # This is usually set by get_template_and_user >@@ -61,6 +75,10 @@ my $htdocs = C4::Context->config('intrahtdocs'); > # checking that the help file exist, otherwise, display nohelp.tt page > my ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); > >+#my $createfrom = $from; >+my $createfrom = _get_filepath($refer, 1); # 2nd argument triggers themelanguage call >+ >+ > unless ( -e "$htdocs/$theme/$lang/modules/$from" ) { > $from = "help/nohelp.tt"; > ( $theme, $lang ) = C4::Templates::themelanguage( $htdocs, $from, "intranet", $query ); >@@ -85,14 +103,13 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > >- >- > $template->param( > referer => $refer, > helpkey => $helpkey, > intranetstylesheet => C4::Context->preference("intranetstylesheet"), > intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), > helpsystem => $helpsys, >+ createfrom => $createfrom, > ); > > if ( index($helpsys,'newsbased') != -1 || index ($helpsys,'filebased') != -1 ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >index b914d0e..96757a8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc >@@ -34,6 +34,9 @@ > <p><a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&helpkey=all&lang=staffhelp&popup_window=1&popupreferer=[% referer %]"> > <i class="fa fa-plus"></i> Add help for all pages</a> > <span class="hint">Key is: all</span></p> >+ <p><a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&helpkey=[% helpkey %]&lang=staffhelp&createfrom=[% createfrom %]&popup_window=1&popupreferer=[% referer %]"> >+ <i class="fa fa-plus"></i> Add help for this page using built in text</a> >+ <span class="hint">Uses installed Koha help text as a base for new entry</span></p> > </div> > <p class="hint">Note: You can manage and / or delete help entries in More › Tools</p> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index 9d73c22..4b0e5f3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -193,8 +193,12 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% END %] > > </li> >- <li><label for="content">News: </label> >- <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content %]</textarea> >+ <li><label for="content">Text: </label> >+ [% IF createfrom %] >+ <textarea name="content" id="content" cols="75" rows="10">[% INSERT "$createfrom" %]</textarea> >+ [% ELSE %] >+ <textarea name="content" id="content" cols="75" rows="10">[% new_detail.content %]</textarea> >+ [% END %] > </li> > </ol> > </fieldset> >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index 5bf0859..9993b2a 100755 >--- a/tools/koha-news.pl >+++ b/tools/koha-news.pl >@@ -46,6 +46,7 @@ if ( $cgi->param('expirationdate') ) { > my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); > my $number = $cgi->param('number'); > my $helpkey = $cgi->param('helpkey'); >+my $createfrom = $cgi->param('createfrom'); > my $lang = $cgi->param('lang'); > my $branchcode = $cgi->param('branch'); > my $error_message = $cgi->param('error_message'); >@@ -119,7 +120,8 @@ if ( $op eq 'add_form' ) { > else { > $template->param( > op => 'add', >- helpkey => $helpkey >+ helpkey => $helpkey, >+ createfrom => $createfrom > ); > > } >-- >2.1.4
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 18516
:
62918
|
62924