version tags are roughed in

This commit is contained in:
JT Smith 2005-06-24 21:20:56 +00:00
parent 4de26f6410
commit 3d12d52a8e
8 changed files with 189 additions and 9 deletions

View file

@ -28,15 +28,11 @@ Package WebGUI::Asset
=head1 DESCRIPTION
Package to manipulate items in WebGUI's asset system. Replaces Collateral.
The admin console is a menuing system to manage webgui's administrative functions.
=head1 SYNOPSIS
An asset is the basic class of content in WebGUI. This handles security, urls, and other basic information common to all content items.
A lineage is a concatenated series of sequence numbers, each six digits long, that explain an asset's position in its familiy tree. Lineage describes who the asset's ancestors are, how many ancestors the asset has in its family tree (lineage length), and the asset's position (rank) amongst its siblings. In addition, lineage provides enough information about an asset to generate a list of its siblings and descendants.
use WebGUI::Asset;
use WebGUI::AdminConsole;
_formatFunction
addSubmenuItem
@ -156,6 +152,15 @@ sub getAdminFunction {
func=>"manageAssets",
group=>"12"
},
"versions"=>{
title=>{
id=>"content versioning",
namespace=>"Asset"
},
icon=>"versionTags.gif",
func=>"manageVersions",
group=>"12"
},
"users"=>{
title=>{
id=>"149",

View file

@ -2427,6 +2427,58 @@ sub www_add {
return $newAsset->www_edit();
}
#-------------------------------------------------------------------
=head2 www_addVersionTag ()
Displays the add version tag form.
=cut
sub www_addVersionTag {
my $self = shift;
my $ac = WebGUI::AdminConsole->new("versions");
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(12));
my $i18n = WebGUI::International->new("Asset");
$ac->addSubmenuItem($self->getUrl('func=manageVersions'), $i18n->get("manage versions"));
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
my $tag = WebGUI::SQL->getRow("assetVersionTag","tagId",$session{form}{tagId});
$f->hidden(
-name=>"func",
-value=>"addVersionTagSave"
);
$f->text(
-name=>"name",
-label=>"Version Tag Name",
-value=>$tag->{name}
);
$f->submit;
return $ac->render($f->print,$i18n->get("add version tag"));
}
#-------------------------------------------------------------------
=head2 www_addVersionTagSave ()
Adds a version tag and sets the user's default version tag to that.
=cut
sub www_addVersionTagSave {
my $self = shift;
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(12));
my $tagId = WebGUI::SQL->setRow("assetVersionTag","tagId",{
tagId=>"new",
name=>$session{form}{name},
creationDate=>time(),
createdBy=>$session{user}{userId}
});
WebGUI::Session::setScratch("versionTag",$tagId);
return $self->www_manageVersions();
}
#-------------------------------------------------------------------
=head2 www_copy ( )
@ -3381,6 +3433,33 @@ WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.c
#-------------------------------------------------------------------
=head2 www_manageVersionTags ()
Shows a list of the currently available asset version tags.
=cut
sub www_manageCommittedVersions {
my $self = shift;
my $ac = WebGUI::AdminConsole->new("versions");
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
my $i18n = WebGUI::International->new("Asset");
$ac->addSubmenuItem($self->getUrl('func=addVersionTag'), $i18n->get("add a version tag"));
$ac->addSubmenuItem($self->getUrl('func=manageVersions'), $i18n->get("manage versions"));
my $output = '<table width=100% class="content">
<tr><th>Tag Name</th><th>Committed On</th><th>Committed By</th><th></th></tr> ';
my $sth = WebGUI::SQL->read("select tagId,name,commitDate,committedBy from assetVersionTag where isCommitted=1");
while (my ($id,$name,$date,$by) = $sth->array) {
my $u = WebGUI::User->new($by);
$output .= '<tr><td>'.$name.'</td><td>'.WebGUI::DateTime::epochToHuman($date).'</td><td>'.$u->username.'</td><td>[rollback]</td></tr>';
}
$sth->finish;
$output .= '</table>';
return $ac->render($output,$i18n->get("committed versions"));
}
#-------------------------------------------------------------------
=head2 www_manageMetaData ( )
Returns an AdminConsole to deal with MetaDataFields. If isInGroup(4) is False, renders an insufficient privilege page.
@ -3468,6 +3547,36 @@ sub www_manageTrash {
}
#-------------------------------------------------------------------
=head2 www_manageVersionTags ()
Shows a list of the currently available asset version tags.
=cut
sub www_manageVersions {
my $self = shift;
my $ac = WebGUI::AdminConsole->new("versions");
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(12));
$ac->setHelp("versions manage");
my $i18n = WebGUI::International->new("Asset");
$ac->addSubmenuItem($self->getUrl('func=addVersionTag'), $i18n->get("add a version tag"));
$ac->addSubmenuItem($self->getUrl('func=manageCommittedVersions'), $i18n->get("manage committed versions"));
my ($tag) = WebGUI::SQL->quickArray("select name from assetVersionTag where tagId=".quote($session{scratch}{versionTag}));
$tag ||= "None";
my $output = '<p>You are currently working under a tag called: <b>'.$tag.'</b>.</p><table width=100% class="content">
<tr><th>Tag Name</th><th>Created On</th><th>Created By</th><th></th></tr> ';
my $sth = WebGUI::SQL->read("select tagId,name,creationDate,createdBy from assetVersionTag where isCommitted=0");
while (my ($id,$name,$date,$by) = $sth->array) {
my $u = WebGUI::User->new($by);
$output .= '<tr><td><a href="'.$self->getUrl("func=setVersionTag&tagId=".$id).'">'.$name.'</a></td><td>'.WebGUI::DateTime::epochToHuman($date).'</td><td>'.$u->username.'</td><td>[cancel] [commit]</td></tr>';
}
$sth->finish;
$output .= '</table>';
return $ac->render($output);
}
#-------------------------------------------------------------------
=head2 www_paste ( )
@ -3575,6 +3684,21 @@ sub www_setRank {
#-------------------------------------------------------------------
=head2 www_setVersionTag ()
Sets the current user's working version tag.
=cut
sub www_setVersionTag () {
my $self = shift;
return WebGUI::Privilege::insufficient() unless WebGUI::Grouping::isInGroup(12);
WebGUI::Session::setScratch("versionTag",$session{form}{tagId});
return $self->www_manageVersions();
}
#-------------------------------------------------------------------
=head2 www_view ( )
Returns "". If canView is False, returns WebGUI::Privilege::noAccess().

View file

@ -41,8 +41,8 @@ sub getInstance {
#Create Auth Object
my $cmd = "WebGUI::Auth::".$authMethod;
my $load = "use ".$cmd;
WebGUI::ErrorHandler::fatal("Authentication module failed to compile: $cmd.".$@) if($@);
eval($load);
WebGUI::ErrorHandler::fatal("Authentication module failed to compile: $cmd.".$@) if($@);
my $auth = eval{$cmd->new($authMethod,$userId)};
WebGUI::ErrorHandler::fatal("Couldn't instanciate authentication module: $authMethod. Root cause: ".$@) if($@);
return $auth;

View file

@ -57,7 +57,7 @@ sub www_richEditPageTree {
-name=>"target",
-label=>WebGUI::International::get('target'),
-options=>{"_self"=>WebGUI::International::get('link in same window'),
"_blank"=>WebGUI::International::get('link in new window'),
"_blank"=>WebGUI::International::get('link in new window')},
-extras=>'id="target"'
);
$f->button(

View file

@ -1,6 +1,42 @@
package WebGUI::i18n::English::Asset;
our $I18N = {
'manage versions' => {
message => q|Manage versions.|,
lastUpdated => 0,
context => q|Menu item in version tag manager.|
},
'manage committed versions' => {
message => q|Manage committed versions.|,
lastUpdated => 0,
context => q|Menu item in version tag manager.|
},
'add version tag' => {
message => q|Add Version Tag|,
lastUpdated => 0,
context => q|Admin console label.|
},
'content versioning' => {
message => q|Content Versioning|,
lastUpdated => 0,
context => q|Admin console label.|
},
'committed versions' => {
message => q|Committed Versions|,
lastUpdated => 0,
context => q|Admin console label.|
},
'add a version tag' => {
message => q|Add a version tag.|,
lastUpdated => 0,
context => q|Menu item in version tag manager.|
},
'rank' => {
message => q|Rank|,
lastUpdated => 0,