Bugzilla – Attachment 127133 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.19 KB, created by
Katrin Fischer
on 2021-10-31 12:19:39 UTC
(
hide
)
Description:
Bug 22659: Add save and continue button to additional-contents.tt
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-10-31 12:19:39 UTC
Size:
5.19 KB
patch
obsolete
>From 4fb6d583db00bac5baf7d722d81e2017d067c37c Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 20 Oct 2021 17:27:23 +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 open a News item >3. Notice a Save and continue button >4. Make some changes and use the Save and continue button, making sure it works. >5. Make sure it works using both the text (CodeMirror) editor and wysiwyg (TinyMCE) editor >6. Flip the 'AdditionalContentsEditor' system preference and repeat steps 4 & 5. >7. Turn on the NewsLog system preference >8. Make some changes and make sure those changes get logged when you use the Save and continue button > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/tools/additional-contents.tt | 18 +++++++++++++++++- > tools/additional-contents.pl | 13 +++++++++++-- > 2 files changed, 28 insertions(+), 3 deletions(-) > >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 8f43afc707..f94878c1ee 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 >@@ -165,18 +165,26 @@ > <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> > [% ELSE %] > <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations"><i class="fa fa-remove"></i> Cancel</a> > [% END %] >- </div> >+ </div> <!-- /#toolbar --> > > <form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate"> > <input type="hidden" name="op" value="add_validate" /> > <input type="hidden" name="id" value="[% additional_content.idnew | html %]" /> > <input type="hidden" name="category" value="[% category | html %]" /> >+ <input type="hidden" id="redirect" name="redirect" value="" /> >+ <input type="hidden" id="editmode" name="editmode" value="[% editmode | html %]" /> > <fieldset class="rows"> > <ol> > <li> >@@ -439,9 +447,17 @@ > [% 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> >+ > $('.preview_news').click( function() { > modalNumber = $(this).attr('data-number'); > $('.modal[data-number="'+modalNumber+'"]').modal('show'); >diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl >index 2e87f23d68..1a8933b2ed 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -40,11 +40,15 @@ 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 == 1 ? "wysiwyg" : "text"; > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { >@@ -82,7 +86,6 @@ elsif ( $op eq 'add_validate' ) { > my $location = $cgi->param('location'); > my $code = $cgi->param('code'); > my $branchcode = $cgi->param('branchcode') || undef; >- > my @title = $cgi->multi_param('title'); > my @content = $cgi->multi_param('content'); > my @lang = $cgi->multi_param('lang'); >@@ -185,7 +188,12 @@ 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'); >@@ -254,6 +262,7 @@ $template->param( > op => $op, > category => $category, > wysiwyg => $wysiwyg, >+ editmode => $editmode, > languages => \@languages, > ); > >-- >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 22659
:
126593
|
126929
|
127133
|
130155
|
130238
|
132365
|
134802
|
134803
|
134804
|
134805
|
135471
|
135472
|
135473
|
136523
|
136524