[freeside-commits] branch FREESIDE_4_BRANCH updated. 287b33b072a38c08535bc0c300ea48e0a587190c

Ivan ivan at 420.am
Fri Nov 11 11:42:59 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  287b33b072a38c08535bc0c300ea48e0a587190c (commit)
      from  70c70dbaa188bd8c8c9850657c1cd8d5a61cc8c5 (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 287b33b072a38c08535bc0c300ea48e0a587190c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Nov 11 11:42:54 2016 -0800

    UX: add status to package actions, redirect back to package tab

diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index cbb73f4..414e1fa 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -468,15 +468,19 @@ if ( -e $addl_handler_use_file ) {
   no warnings 'redefine';
   *CGI::redirect = sub {
     my $self = shift;
-    my $cookie = '';
-    if ( $_[0] eq '-cookie' ) { #this isn't actually used at the moment
-      (my $x, $cookie) = (shift, shift);
-      $HTML::Mason::r->err_headers_out->add( 'Set-cookie' => $cookie );
-    }
-    my $location = shift;
 
     use vars qw($m);
 
+    my $location = '';
+    if ( $_[0] =~ /^-/ ) {
+      my %opt = @_;
+      $location = $opt{'-uri'};
+      my $cookie = $opt{'-cookie'};
+      $m->apache_req->err_headers_out->{'Set-cookie'} = $cookie if $cookie;
+    } else {
+      $location = shift;
+    }
+
     # false laziness w/below
     if ( @DBIx::Profile::ISA ) {
 
diff --git a/httemplate/elements/header-cust_main.html b/httemplate/elements/header-cust_main.html
index a481881..d0dc1db 100644
--- a/httemplate/elements/header-cust_main.html
+++ b/httemplate/elements/header-cust_main.html
@@ -13,7 +13,7 @@ Examples:
              'title'          => $title,
              'title_noescape' => $title_noescape,
              'head'           => $head,
-             'nobr'           => 1,
+             #'nobr'           => 1,
              'etc'            => $opt{'etc'},
           }
 &>
diff --git a/httemplate/elements/header-full.html b/httemplate/elements/header-full.html
index fe02650..59e2785 100644
--- a/httemplate/elements/header-full.html
+++ b/httemplate/elements/header-full.html
@@ -193,6 +193,20 @@ Example:
             <% $title_noescape || encode_entities($title) %>
           </H1>
 
+% my %cookies = CGI::Cookie->fetch($r);
+% if ( $cookies{freeside_status} ) {
+    <BR>
+%   foreach my $status_msg ( $cookies{freeside_status}->value ) {
+      <TABLE CLASS="fsinnerbox" STYLE="background-color:#eeffee"><TR>
+        <TD><IMG SRC="<% $fsurl %>images/tick.png"> <% $status_msg |h %></TD>
+      </TR></TABLE>
+%   }
+    <script src="<% $fsurl %>elements/js.cookie.js"></script>
+    <SCRIPT TYPE="text/javascript">
+      Cookies.remove('freeside_status', { path: '/' });
+    </SCRIPT>
+% }
+
 % unless ( $nobr ) {
           <BR>
 % }
diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html
index b8be271..0649261 100755
--- a/httemplate/misc/process/cancel_pkg.html
+++ b/httemplate/misc/process/cancel_pkg.html
@@ -1,5 +1,9 @@
 <& /elements/header-popup.html, emt("Package $past_method") &>
+  <script src="<% $fsurl %>elements/js.cookie.js"></script>
   <SCRIPT TYPE="text/javascript">
+    Cookies.set('freeside_status', <% mt("Package $past_method") |js_string %>,{
+                  expires: 0.0035
+    });
     topreload();
   </SCRIPT>
   </BODY>
diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi
index b350693..ad7effc 100755
--- a/httemplate/misc/unsusp_pkg.cgi
+++ b/httemplate/misc/unsusp_pkg.cgi
@@ -1,7 +1,16 @@
 %if ( $error ) {
 %  errorpage($error);
 %} else {
-<% $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')) %>
+%  my $cookie = CGI::Cookie->new( -name    => 'freeside_status',
+%                                 -value   => mt('Package unsuspended'),
+%                                 -expires => '+5m',
+%                               );
+% #$r->headers_out->add( 'Set-Cookie' => $cookie->as_string );
+<% $cgi->redirect(
+     -uri => popurl(2). "view/cust_main.cgi?show=packages;custnum=".$cust_pkg->getfield('custnum'),
+     -cookie => $cookie
+  )
+%>
 %}
 <%init>
 

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

Summary of changes:
 FS/FS/Mason.pm                            |   16 ++++++++++------
 httemplate/elements/header-cust_main.html |    2 +-
 httemplate/elements/header-full.html      |   14 ++++++++++++++
 httemplate/misc/process/cancel_pkg.html   |    4 ++++
 httemplate/misc/unsusp_pkg.cgi            |   11 ++++++++++-
 5 files changed, 39 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list