[Bps-public-commit] rt-extension-formtools branch dynamic-forms-from-config updated. 0.53-22-gc8a2ec6

BPS Git Server git at git.bestpractical.com
Fri Sep 22 22:10:18 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-formtools".

The branch, dynamic-forms-from-config has been updated
       via  c8a2ec6d9c733d1270db113ea053d796d65d81fa (commit)
       via  1de8428b9598a7cc49b0d2d8b01ccabc8a6e6aa7 (commit)
       via  85900317dca80df473fbafa8b76418eef036e1fb (commit)
       via  b1e90fe5c3ad0b633fd0580779758ddc67832111 (commit)
      from  8f29becf851b0008f2f5c098468f461b24dd8389 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c8a2ec6d9c733d1270db113ea053d796d65d81fa
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 22 18:07:51 2023 -0400

    Set Describe form action to avoid duplicating submitted args like id
    
    Duplicated ids can cause page menu to behave incorrectly at least.

diff --git a/html/Admin/FormTools/Describe.html b/html/Admin/FormTools/Describe.html
index bfd2077..a29ae35 100644
--- a/html/Admin/FormTools/Describe.html
+++ b/html/Admin/FormTools/Describe.html
@@ -4,7 +4,7 @@
 
 <&| /Widgets/TitleBox, title => '' &>
   <p>Forms are shown to users on a page in the RT Self Service interface. Below you can manage how the form details will appear to end users.</p>
-  <form name="EditFormDescription" action="" method="post" enctype="multipart/form-data">
+  <form name="EditFormDescription" action="<%RT->Config->Get('WebPath')%>/Admin/FormTools/Describe.html" method="post" enctype="multipart/form-data">
   <input type="hidden" class="hidden" name="id" value="<% $id %>" />
   <&| /Widgets/TitleBox, title => loc('Icon') &>
     <p>Form to upload an icon</p>

commit 1de8428b9598a7cc49b0d2d8b01ccabc8a6e6aa7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 22 18:05:00 2023 -0400

    Only super users can update forms

diff --git a/html/Admin/FormTools/Describe.html b/html/Admin/FormTools/Describe.html
index b2c1384..bfd2077 100644
--- a/html/Admin/FormTools/Describe.html
+++ b/html/Admin/FormTools/Describe.html
@@ -46,6 +46,8 @@ my ($title, @results);
 $title = loc("Description for form [_1]", $form_attribute->Description);
 
 if ( $ARGS{'SubmitDescription'} ) {
+    Abort( loc('Permission Denied') )
+        unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'SuperUser' );
 
     if ( $form->{'form-description'} ne $ARGS{'FormDescription'} ) {
         $form->{'form-description'} = $ARGS{'FormDescription'};

commit 85900317dca80df473fbafa8b76418eef036e1fb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 22 17:56:25 2023 -0400

    Tweak FormDescription form processing mainly to show end user messages
    
    It also keeps user input(so user can re-submit if needed) in case the
    change fails somehow.

diff --git a/html/Admin/FormTools/Describe.html b/html/Admin/FormTools/Describe.html
index 96aeb4a..b2c1384 100644
--- a/html/Admin/FormTools/Describe.html
+++ b/html/Admin/FormTools/Describe.html
@@ -15,7 +15,7 @@
       <div class="form-row">
         <div class="col-12">
           <input type="hidden" class="hidden" name="FormDescriptionType" value="text/html" />
-          <textarea autocomplete="off" class="form-control messagebox richtext" cols="80" rows="15" name="FormDescription"><%$form->{'form-description'}%></textarea>
+          <textarea autocomplete="off" class="form-control messagebox richtext" cols="80" rows="15" name="FormDescription"><% $ARGS{'FormDescription'} || $form->{'form-description'} %></textarea>
         </div>
       </div>
   </&>
@@ -45,16 +45,23 @@ my $form = $form_attribute->Content;
 my ($title, @results);
 $title = loc("Description for form [_1]", $form_attribute->Description);
 
-if ( $ARGS{'SubmitDescription'} && $ARGS{'SubmitDescription'} eq 'Save' ) {
-    $form->{'form-description'} = $ARGS{'FormDescription'};
+if ( $ARGS{'SubmitDescription'} ) {
 
-
-    $form_attribute->SetContent($form);
+    if ( $form->{'form-description'} ne $ARGS{'FormDescription'} ) {
+        $form->{'form-description'} = $ARGS{'FormDescription'};
+        my ( $ret, $msg ) = $form_attribute->SetContent($form);
+        if ($ret) {
+            push @results, loc('Updated description');
+        }
+        else {
+            push @results, loc( "Could not update description: [_1]", $msg );
+        }
+    }
 }
 
 MaybeRedirectForResults(
     Actions   => \@results,
-    Arguments => { id => $id },
+    Arguments => { id => $id, FormDescription => $ARGS{'FormDescription'} },
 );
 
 </%init>

commit b1e90fe5c3ad0b633fd0580779758ddc67832111
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 22 17:54:53 2023 -0400

    Add FormDescriptionType input so editor knows the input is html

diff --git a/html/Admin/FormTools/Describe.html b/html/Admin/FormTools/Describe.html
index 4267f0c..96aeb4a 100644
--- a/html/Admin/FormTools/Describe.html
+++ b/html/Admin/FormTools/Describe.html
@@ -14,6 +14,7 @@
     <p>An HTML edit box for instructions</p>
       <div class="form-row">
         <div class="col-12">
+          <input type="hidden" class="hidden" name="FormDescriptionType" value="text/html" />
           <textarea autocomplete="off" class="form-control messagebox richtext" cols="80" rows="15" name="FormDescription"><%$form->{'form-description'}%></textarea>
         </div>
       </div>

-----------------------------------------------------------------------

Summary of changes:
 html/Admin/FormTools/Describe.html | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
rt-extension-formtools


More information about the Bps-public-commit mailing list