Bugzilla – Attachment 134804 Details for
Bug 22659
Add 'save and continue' functionality to news and HTML customizations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22659: Add save and continue button to additional-contents.tt
Bug-22659-Add-save-and-continue-button-to-addition.patch (text/plain), 5.27 KB, created by
Biblibre Sandboxes
on 2022-05-10 09:02:12 UTC
(
hide
)
Description:
Bug 22659: Add save and continue button to additional-contents.tt
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2022-05-10 09:02:12 UTC
Size:
5.27 KB
patch
obsolete
>From b5f36b0eaa34475b30a86b3b8748ecfccc6a608d Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 3 Feb 2022 22:31:19 +0000 >Subject: [PATCH] Bug 22659: Add save and continue button to > additional-contents.tt > >To test: >1. Apply patch and restart everything >2. Go to Tools > News and create some new additional content. >3. Notice a Save and continue button >4. Try saving and contining. >5. Make sure if you are using the CodeMirror editor that you are still in the CodeMirror editor >6. Try 2 - 5 again but with the wysiwyg editor, make sure when you save and continue you remain in the wysiwyg editor. >7. If you are saving and contining from News make sure you remain in News, when you are saving and contining from HTML customizations make sure you remain there. >8. Turn on the NewsLog system preference >9. With the NewsLog on make sure your content is being logged correctly when you sabe and continue. > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > .../prog/en/modules/tools/additional-contents.tt | 15 +++++++++++++++ > tools/additional-contents.pl | 16 +++++++++++++++- > 2 files changed, 30 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 62f8c5febb..36b5f93447 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -171,6 +171,12 @@ > <div id="toolbar" class="btn-toolbar"> > <div class="btn-group"> > <button class="btn btn-default" id="submit_form"><i class="fa fa-save"></i> Save</button> >+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"> >+ <span class="caret"></span> >+ </button> >+ <ul class="dropdown-menu"> >+ <li><a id="saveandcontinue" href="#">Save and continue editing</a></li> >+ </ul> > </div> > [% IF category == 'news' %] > <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a> >@@ -183,6 +189,8 @@ > <input type="hidden" name="op" value="add_validate" /> > <input type="hidden" name="category" value="[% category | html %]" /> > <input type="hidden" name="code" value="[% additional_content.code | html %]" /> >+ <input type="hidden" id="redirect" name="redirect" value="" /> >+ <input type="hidden" id="editmode" name="editmode" value="[% editmode | html %]" /> > <fieldset class="rows"> > <ol> > <li> >@@ -452,6 +460,13 @@ > [% INCLUDE 'calendar.inc' %] > [% Asset.js("js/tools-menu.js") | $raw %] > [% Asset.js("lib/hc-sticky.js") | $raw %] >+ <script> >+ $("#saveandcontinue").on("click",function(e){ >+ e.preventDefault(); >+ $("#redirect").val("just_save"); >+ $("#submit_form").click(); >+ }); >+ </script> > [% IF additional_contents.count %] > [% INCLUDE 'datatables.inc' %] > <script> >diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl >index cead55e9a1..1bd27a2051 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -40,12 +40,17 @@ my $op = $cgi->param('op') || 'list'; > my $id = $cgi->param('id'); > my $category = $cgi->param('category') || 'news'; > my $wysiwyg; >+my $redirect = $cgi->param('redirect'); >+my $editmode; >+ > if( $cgi->param('editmode') ){ > $wysiwyg = $cgi->param('editmode') eq "wysiwyg" ? 1 : 0; > } else { > $wysiwyg = C4::Context->preference("AdditionalContentsEditor") eq "tinymce" ? 1 : 0; > } > >+$editmode = $wysiwyg eq 1 ? "wysiwyg" : "text"; >+ > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "tools/additional-contents.tt", >@@ -133,6 +138,7 @@ elsif ( $op eq 'add_validate' ) { > ); > $updated = $additional_content->_result->get_dirty_columns; > $additional_content->store; >+ $id = $additional_content->idnew; > }; > if ($@) { > $success = 0; >@@ -167,6 +173,7 @@ elsif ( $op eq 'add_validate' ) { > ? 'News_' . $additional_content->idnew > : $location . '_' . $additional_content->idnew; > $additional_content->code($code)->store; >+ $id = $additional_content->idnew; > } > }; > if ($@) { >@@ -180,7 +187,13 @@ elsif ( $op eq 'add_validate' ) { > } > > } >- $op = 'list'; >+ >+ if( $redirect eq "just_save" ){ >+ print $cgi->redirect("/cgi-bin/koha/tools/additional-contents.pl?op=add_form&id=$id&editmode=$editmode&redirect=done"); >+ exit; >+ } else { >+ $op = 'list'; >+ } > } > elsif ( $op eq 'delete_confirmed' ) { > my @ids = $cgi->multi_param('ids'); >@@ -249,6 +262,7 @@ $template->param( > op => $op, > category => $category, > wysiwyg => $wysiwyg, >+ editmode => $editmode, > languages => \@languages, > ); > >-- >2.30.2
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 22659
:
126593
|
126929
|
127133
|
130155
|
130238
|
132365
|
134802
|
134803
|
134804
|
134805
|
135471
|
135472
|
135473
|
136523
|
136524