plainblack.com
Username Password
search
Bookmark and Share
Link "Leave version tag"  (#543)
Issue

To compare or just to watch the site as it is, it might be practical to have a Leave version tag (or "Go back to the Live page" or whatever) function. Now it can only be done by or changing to another version tag or to log out and refresh a couple of times (for end-users this is confusing).

Also, you don't want to set your cache timeout to a very small interval, then your server gets a unnecesary high load. (of course you can set it back again, but forgetting is human)

While making some more rigorous changes I often want to do this, but it takes a while. Also, not everybody has two computers so they can have the two next to each other.

This probably should include an automated "Clear Cache" function and a reload of the page. 

Bart

Solution Summary
Added in 7.6.2
Comments
bartjol
0
8/29/2008 12:55 pm

I am actually working on this:

API method in VersionTag.pm:

#-------------------------------------------------------------------

=head2 quitWorking ( )

Quits the current working tag and returns the user to the page as it is

=cut

sub quitWorking {
    my $self = shift;
    $self->session->scratch->delete("versionTag");

}

 

extra link in the adminbar:

 my $working = WebGUI::VersionTag->getWorking($session, 1);
     my $workingId = "";
     my @tags = ();
     if ($working) {
      $workingId = $working->getId;
      my $commitUrl = "";
     if ($session->setting->get("skipCommitComments")) {
          $session->url->page("op=commitVersionTagConfirm;tagId=".$workingId);
   }
     else {
         $session->url->page("op=commitVersionTag;tagId=".$workingId);
     }
     push(@tags, {
        url=>$session->url->page("op=commitVersionTag;tagId=".$workingId),
        title=>$i18n->get("commit my changes"),
        icon=>$session->url->extras('adminConsole/small/versionTags.gif')
     });
     push(@tags, {
        url=>$session->url->page("op=leaveVersionTag"),
        title=>$i18n->get("leave version tag"),
        icon=>$session->url->extras('adminConsole/small/picture.gif')   #some icon should be existing here
     });

 }

Now I'm going to look how to couple the operation to the API call. Hey, it's all new to me, but if anyone got comment, feel free :)

bartjol
0
8/30/2008 1:58 pm

for the operation (/data/WebGUI/lib/WebGUI/Operation/VersionTag.pm it's something like:

#-------------------------------------------------------------------

=head2 www_leaveVersionTag ( session )

this will take the user out of the version tag

=head3 session

A reference to the current session.

=cut

sub www_eaveWorkingVersionTag {
    my $session = shift;
    my $tag = WebGUI::Session->get(versionTag );
    if ($tag) {
      $tag->quitWorking();
    }
    if ($session->form->param("backToSite")) {
      return undef;
    }
    return www_manageVersions($session);
}

bartjol
0
8/30/2008 2:14 pm

ok, except testing, debugging and stuff, I should add it in getOperations:

'leaveVersionTag' => 'VersionTag',

Gonna find out whther we need more, probably some adding in the adminconsole, but that's only applying the script...

By the way this starts to be mainly a kinda blog for me what the status is, my excuses for that.

patspam
0
9/17/2008 6:48 pm

 Hi Bart,

My visual debugger threw up a couple of compilation errors:

  • www_eaveWorkingVersionTag should be www_leaveWorkingVersionTag
  • my $tag = WebGUI::Session->get(versionTag ); should be my $tag = WebGUI::Session->get( "versionTag" );

A general comment, you've used two different words for API methods that more or less mean the same thing: "quit" and "leave". I'd suggesting sticking to one to be consistent.

The VersionTag API already has a function called clearWorking that makes it so that the version tag is not the version tag for any user. I'd suggest that rather than implementing your new API method quitWorking, you enhance clearWorking so that it accepts an optional argument, a single userId (or a list of userIds) and only clears the working tag for those users. Keeping the API surface area as small as possible is a good design principle, and this seems like a natural extension for an existing method.

Hope that helps :)

Patrick

JT
5
10/21/2008 3:56 pm
Bart, Looks good other than the couple of things patspam pointed out. Very good for your first attempt. In the future actually make the change in your code and submit a DIFF for your changes. That will help them get included more quickly.
JT
0
10/21/2008 3:57 pm
Added in 7.6.2
bartjol
0
10/22/2008 5:11 am
thanks!
Details
Ticket Status Closed  
Rating5.0 
Submitted By bartjol  
Date Submitted2007-12-20 
Assigned To unassigned  
Date Assigned 2012-05-22  
Assigned By  
What to improve?  
URLrfe/request-for-enhancement/link-leave-version-tag
Karma
Difficulty 1  
Karma So Far723
Karma Rank723.00
Keywords
Ticket History
10/22/2008
6:11 AM
Closed bartjol
10/21/2008
4:57 PM
Resolved JT
© 2012 Plain Black Corporation | All Rights Reserved