diff --git a/docs/upgrades/upgrade_6.6.3-6.7.0.pl b/docs/upgrades/upgrade_6.6.3-6.7.0.pl index 859ca561b..6ac5621dc 100644 --- a/docs/upgrades/upgrade_6.6.3-6.7.0.pl +++ b/docs/upgrades/upgrade_6.6.3-6.7.0.pl @@ -8,6 +8,7 @@ use WebGUI::Asset; use WebGUI::Asset::Wobject::Folder; use WebGUI::Asset::Snippet; use WebGUI::Session; +use WebGUI::SQL; my $configFile; my $quiet; @@ -20,12 +21,26 @@ GetOptions( WebGUI::Session::open("../..",$configFile); insertHelpTemplate(); - insertXSLTSheets(); insertSyndicatedContentTemplate(); +addAssetVersioning(); WebGUI::Session::close(); +sub addAssetVersioning { + print "\tMaking changes for asset versioning\n" unless ($quiet); + WebGUI::SQL->write("create table assetVersionTag ( + tagId varchar(22) not null primary key, + name varchar(255) not null, + isCommitted int not null default 0, + creationDate bigint not null default 0, + createdBy varchar(22), + commitDate bigint not null default 0, + committedBy varchar(22) + )"); +} + + sub insertHelpTemplate{ print "\tInserting new Help template\n" unless ($quiet); my $helpTemplate = <"manageAssets", group=>"12" }, + "versions"=>{ + title=>{ + id=>"content versioning", + namespace=>"Asset" + }, + icon=>"versionTags.gif", + func=>"manageVersions", + group=>"12" + }, "users"=>{ title=>{ id=>"149", diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 374056c42..80956d32e 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -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 = ' + '; + 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 .= ''; + } + $sth->finish; + $output .= '
Tag NameCommitted OnCommitted By
'.$name.''.WebGUI::DateTime::epochToHuman($date).''.$u->username.'[rollback]
'; + 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 = '

You are currently working under a tag called: '.$tag.'.

+ '; + 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 .= ''; + } + $sth->finish; + $output .= '
Tag NameCreated OnCreated By
'.$name.''.WebGUI::DateTime::epochToHuman($date).''.$u->username.'[cancel] [commit]
'; + 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(). diff --git a/lib/WebGUI/Operation/Auth.pm b/lib/WebGUI/Operation/Auth.pm index 601c7b883..6a0de06a1 100644 --- a/lib/WebGUI/Operation/Auth.pm +++ b/lib/WebGUI/Operation/Auth.pm @@ -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; diff --git a/lib/WebGUI/Operation/FormHelpers.pm b/lib/WebGUI/Operation/FormHelpers.pm index 606e46222..4bde4b31f 100644 --- a/lib/WebGUI/Operation/FormHelpers.pm +++ b/lib/WebGUI/Operation/FormHelpers.pm @@ -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( diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm index 5470cbb82..ac7127f6a 100644 --- a/lib/WebGUI/i18n/English/Asset.pm +++ b/lib/WebGUI/i18n/English/Asset.pm @@ -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, diff --git a/www/extras/adminConsole/small/versionTags.gif b/www/extras/adminConsole/small/versionTags.gif new file mode 100644 index 000000000..af59b9b28 Binary files /dev/null and b/www/extras/adminConsole/small/versionTags.gif differ diff --git a/www/extras/adminConsole/versionTags.gif b/www/extras/adminConsole/versionTags.gif new file mode 100644 index 000000000..35ee293e3 Binary files /dev/null and b/www/extras/adminConsole/versionTags.gif differ