[Rt-commit] rt branch, 4.0/delete-user-attributes-on-reset, updated. rt-4.0.4-116-g8e1c3c8

Jason May jasonmay at bestpractical.com
Mon Dec 12 18:09:00 EST 2011


The branch, 4.0/delete-user-attributes-on-reset has been updated
       via  8e1c3c8ec035fde37b41c91e840e9d8dee509db1 (commit)
       via  f441126f6c9f43e875923fda7ab603ecf96121b0 (commit)
      from  54149fba710aebc3cbbb9f3ca90d3598ddfe0849 (commit)

Summary of changes:
 share/html/Prefs/MyRT.html |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit f441126f6c9f43e875923fda7ab603ecf96121b0
Author: Jason May <jasonmay at bestpractical.com>
Date:   Mon Dec 12 15:47:05 2011 -0500

    Delete the Pref-SummaryRows attribute to reset everything on MyRT.html

diff --git a/share/html/Prefs/MyRT.html b/share/html/Prefs/MyRT.html
index d0f9786..dd3e049 100644
--- a/share/html/Prefs/MyRT.html
+++ b/share/html/Prefs/MyRT.html
@@ -99,8 +99,15 @@ $ARGS{'SummaryRows'} ||= $user->Preferences('SummaryRows', RT->Config->Get('Defa
 if ($ARGS{Reset}) {
     my $attr = RT::Attribute->new($session{CurrentUser});
     $attr->LoadByNameAndObject( Object => $user, Name => 'Pref-HomepageSettings' );
-    my ($ok, $msg) = $attr->Delete;
-    push @results, $ok ? loc('Preferences saved.') : $msg;
+    my ($hp_ok, $msg) = $attr->Delete;
+    push @results, $msg unless $hp_ok;
+
+    $attr->LoadByNameAndObject( Object => $user, Name => 'Pref-SummaryRows' );
+    (my $sr_ok, $msg) = $attr->Delete;
+    push @results, $msg unless $sr_ok;
+
+    push @results, loc('Preferences saved.') if $hp_ok and $sr_ok;
+
     delete $session{'my_rt_portlets'};
 }
 

commit 8e1c3c8ec035fde37b41c91e840e9d8dee509db1
Author: Jason May <jasonmay at bestpractical.com>
Date:   Mon Dec 12 17:58:25 2011 -0500

    Add a button to reset adjustments on system saved searches

diff --git a/share/html/Prefs/MyRT.html b/share/html/Prefs/MyRT.html
index dd3e049..9089dd4 100644
--- a/share/html/Prefs/MyRT.html
+++ b/share/html/Prefs/MyRT.html
@@ -77,6 +77,12 @@
 <input type="submit" class="button" value="<% loc('Reset to default') %>">
 </form>
 </&>
+<&|/Widgets/TitleBox, title => loc("Reset System Saved Search Adjustments") &>
+<form method="post" action="MyRT.html">
+<input type="hidden" name="ResetSavedSearches" value="1" />
+<input type="submit" class="button" value="<% loc('Reset to default') %>">
+</form>
+</&>
 
 
 <%INIT>
@@ -111,6 +117,18 @@ if ($ARGS{Reset}) {
     delete $session{'my_rt_portlets'};
 }
 
+if ($ARGS{ResetSavedSearches}) {
+    my $attrs = $user->Attributes;
+    while (my $attr = $attrs->Next) {
+        if ($attr->Name =~ /^Pref-RT::Attribute-\d+$/) {
+            my ($ok, $msg) = $attr->Delete;
+            push @results, $msg unless $ok;
+        }
+    }
+
+    push @results, loc('Preferences saved.');
+}
+
 my $portlets;
 if (exists $session{'my_rt_portlets'}) {
     $portlets = $session{'my_rt_portlets'};

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


More information about the Rt-commit mailing list