diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 5e872cf7e..5e337ab7a 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -29,3 +29,5 @@ matching collateral is found. - Added style personalization. - Added admin style option. + - Added per page printable styles. + - Wobject privileges are available per page rather than site-wide. diff --git a/docs/upgrades/upgrade_5.5.3-6.0.0.pl b/docs/upgrades/upgrade_5.5.3-6.0.0.pl deleted file mode 100644 index 9e360d981..000000000 --- a/docs/upgrades/upgrade_5.5.3-6.0.0.pl +++ /dev/null @@ -1,489 +0,0 @@ -#!/usr/bin/perl - -use lib "../../lib"; -use Getopt::Long; -use Parse::PlainConfig; -use strict; -use WebGUI::Session; -use WebGUI::SQL; -use WebGUI::Forum; - -my $configFile; -my $quiet; -GetOptions( - 'configFile=s'=>\$configFile, - 'quiet'=>\$quiet -); -WebGUI::Session::open("../..",$configFile); - - -#-------------------------------------------- -print "\tMigrating styles.\n" unless ($quiet); -my $sth = WebGUI::SQL->read("select * from style"); -while (my $style = $sth->hashRef) { - my ($header,$footer) = split(/\^\-\;/,$style->{body}); - my ($newStyleId) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='style'"); - if ($style->{styleId} > 0 && $style->{styleId} < 25) { - $newStyleId = $style->{styleId}; - } elsif ($newStyleId > 999) { - $newStyleId++; - } else { - $newStyleId = 1000; - } - my $newStyle = $session{setting}{docTypeDec}.' - - - <tmpl_var session.page.title> - <tmpl_var session.setting.companyName> - - '.$style->{styleSheet}.' - - '.$header.' - - '.$footer.' - - '; - WebGUI::SQL->write("insert into template (templateId, name, template, namespace) values (".$newStyleId.", - ".quote($style->{name}).", ".quote($newStyle).", 'style')"); - WebGUI::SQL->write("update page set styleId=".$newStyleId." where styleId=".$style->{styleId}); - WebGUI::SQL->write("update themeComponent set id=".$newStyleId.", type='template' where id=".$style->{styleId}." and type='style'"); -} -$sth->finish; -WebGUI::SQL->write("delete from incrementer where incrementerId='styleId'"); -WebGUI::SQL->write("delete from settings where name='docTypeDec'"); -WebGUI::SQL->write("drop table style"); -my @templateManagers = WebGUI::SQL->buildArray("select userId from groupings where groupId=8"); -my $clause; -if ($#templateManagers > 0) { - $clause = "and userId not in (".join(",",@templateManagers).")"; -} -$sth = WebGUI::SQL->read("select userId,expireDate,groupAdmin from groupings where groupId=5 ".$clause); -while (my $user = $sth->hashRef) { - WebGUI::SQL->write("insert into groupings (groupId,userId,expireDate,groupAdmin) values (8, ".$user->{userId}.", - ".$user->{expireDate}.", ".$user->{groupAdmin}.")"); -} -$sth->finish; -WebGUI::SQL->write("delete from groups where groupId=5"); -WebGUI::SQL->write("delete from groupings where groupId=5"); - - -#-------------------------------------------- -print "\tMigrating extra columns to page templates.\n" unless ($quiet); -my $a = WebGUI::SQL->read("select a.wobjectId, a.templatePosition, a.sequenceNumber, a.pageId, b.templateId, c.width, c.class, c.spacer from wobject a - left join page b on a.pageId=b.pageId left join ExtraColumn c on a.wobjectId=c.wobjectId where a.namespace='ExtraColumn'"); -while (my $data = $a->hashRef) { - my ($template, $name) = WebGUI::SQL->quickArray("select template,name from template where namespace='Page' and templateId=".$data->{templateId}); - $name .= " w/ Extra Column"; - #eliminate the need for compatibility with old-style page templates - $template =~ s/\^(\d+)\;/_positionFormat5x($1)/eg; - my $i = 1; - while ($template =~ m/page\.position$i/) { - $i++; - } - my $position = $i; - my $replacement = '{templatePosition}.'>'; - my $spliton = "{templatePosition}.">"; - my @parts = split(/$spliton/, $template); - $template = $parts[0].$replacement.$parts[1]; - my ($id) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='Page'"); - $id++; - WebGUI::SQL->write("insert into template (templateId, name, template, namespace) values ($id, ".quote($name).", ".quote($template).", 'Page')"); - WebGUI::SQL->write("update page set templateId=$id where pageId=".$data->{pageId}); - WebGUI::SQL->write("update wobject set templatePosition=".$position." where pageId=".$data->{pageId}." and templatePosition=". - $data->{templatePosition}." and sequenceNumber>".$data->{sequenceNumber}); - WebGUI::SQL->write("delete from wobject where wobjectId=".$data->{wobjectId}); - my $b = WebGUI::SQL->read("select wobjectId from wobject where pageId=".$data->{pageId}." order by templatePosition,sequenceNumber"); - my $i = 0; - while (my ($wid) = $b->array) { - $i++; - WebGUI::SQL->write("update wobject set sequenceNumber='$i' where wobjectId=$wid"); - } - $b->finish; -} -$a->finish; -WebGUI::SQL->write("drop table ExtraColumn"); - - -#-------------------------------------------- -print "\tMigrating page templates.\n" unless ($quiet); -my $sth = WebGUI::SQL->read("select * from template where namespace='Page'"); -while (my $template = $sth->hashRef) { - #eliminate the need for compatibility with old-style page templates - $template->{template} =~ s/\^(\d+)\;/_positionFormat5x($1)/eg; - $template->{template} = ' - - - - - - - '.$template->{template}; - $template->{template} =~ s/\/_positionFormat6x($1)/eg; - WebGUI::SQL->write("update template set namespace='page', template=".quote($template->{template}) - ." where templateId=".$template->{templateId}." and namespace='Page'"); -} -$sth->finish; - -#-------------------------------------------- -print "\tConverting items into articles.\n" unless ($quiet); -my $sth = WebGUI::SQL->read("select * from template where namespace='Item'"); -while (my $template = $sth->hashRef) { - $template->{name} =~ s/Default (.*?)/$1/i; - if ($template->{templateId} < 1000) { - ($template->{templateId}) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='Article' and templateId<1000"); - $template->{templateId}++; - } else { - ($template->{templateId}) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='Article'"); - if ($template->{templateId} > 999) { - $template->{templateId}++; - } else { - $template->{templateId} = 1000; - } - } - WebGUI::SQL->write("insert into template (templateId,name,template,namespace) values (".$template->{templateId}.", - ".quote($template->{name}).", ".quote($template->{template}).", 'Article')"); -} -$sth->finish; -WebGUI::SQL->write("delete from template where namespace='Item'"); -WebGUI::SQL->write("update wobject set namespace='Article' where namespace='Item'"); -my $sth = WebGUI::SQL->read("select * from Item"); -while (my $data = $sth->hashRef) { - WebGUI::SQL->write("insert into Article (wobjectId,linkURL,attachment) values (".$data->{wobjectId}.", - ".quote($data->{linkURL}).", ".quote($data->{attachment}).")"); -} -$sth->finish; -WebGUI::SQL->write("drop table Item"); - - -#-------------------------------------------- -print "\tSequencing user submissions.\n" unless ($quiet); -WebGUI::SQL->write("alter table USS_submission add column sequenceNumber int not null"); -WebGUI::SQL->write("alter table USS add column USS_id int not null"); -WebGUI::SQL->write("alter table USS_submission add column USS_id int not null"); -my $ussId = 1000; -my $a = WebGUI::SQL->read("select wobjectId from USS"); -while (my ($wobjectId) = $a->array) { - WebGUI::SQL->write("update USS set USS_id=$ussId where wobjectId=$wobjectId"); - my $b = WebGUI::SQL->read("select USS_submissionId from USS_submission where wobjectId=$wobjectId order by dateSubmitted"); - my $seq = 1; - while (my ($subId) = $b->array) { - WebGUI::SQL->write("update USS_submission set sequenceNumber=$seq, USS_id=$ussId where USS_submissionId=$subId"); - $seq++; - } - $b->finsih; - $ussId++; -} -$a->finish; -WebGUI::SQL->write("alter table USS_submission drop column wobjectId"); -WebGUI::SQL->write("alter table USS add column submissionFormTemplateId int not null default 1"); -WebGUI::SQL->write("alter table USS_submission add column contentType varchar(35) not null default 'mixed'"); -WebGUI::SQL->write("update USS_submission set contentType='html' where convertCarriageReturns=0"); -WebGUI::SQL->write("alter table USS_submission drop column convertCarriageReturns"); -WebGUI::SQL->write("insert into incrementer (incrementerId,nextValue) values ('USS_id',$ussId)"); -WebGUI::SQL->write("alter table USS_submission add column userDefined1 text"); -WebGUI::SQL->write("alter table USS_submission add column userDefined2 text"); -WebGUI::SQL->write("alter table USS_submission add column userDefined3 text"); -WebGUI::SQL->write("alter table USS_submission add column userDefined4 text"); -WebGUI::SQL->write("alter table USS_submission add column userDefined5 text"); - - -#-------------------------------------------- -print "\tConverting FAQs into USS Submissions.\n" unless ($quiet); -my $sth = WebGUI::SQL->read("select * from template where namespace='FAQ'"); -while (my $template = $sth->hashRef) { - $template->{name} =~ s/Default (.*?)/$1/i; - if ($template->{templateId} < 1000) { - ($template->{templateId}) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='USS' and templateId<1000"); - $template->{templateId}++; - } else { - ($template->{templateId}) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='USS'"); - if ($template->{templateId} > 999) { - $template->{templateId}++; - } else { - $template->{templateId} = 1000; - } - } - $template->{template} =~ s/\/\/igs; - my $replacement = ' - - [] - - - - - '; - $template->{template} =~ s/\\s*\\s*\<\/tmpl_if\>/$replacement/igs; - $replacement = ' - '; - $template->{template} =~ s/\\s*\"\>/$replacement/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - WebGUI::SQL->write("insert into template (templateId,name,template,namespace) values (".$template->{templateId}.", - ".quote($template->{name}).", ".quote($template->{template}).", 'USS')"); -} -$sth->finish; -WebGUI::SQL->write("delete from template where namespace='FAQ'"); -my $a = WebGUI::SQL->read("select a.wobjectId,a.groupIdEdit,a.ownerId,a.lastEdited,b.username,a.dateAdded from wobject a left join users b on - a.ownerId=b.userId where a.namespace='FAQ'"); -while (my $data = $a->hashRef) { - $ussId = getNextId("USS_id"); - WebGUI::SQL->write("insert into USS (wobjectId, USS_id, groupToContribute, submissionsPerPage, filterContent, sortBy, sortOrder, - submissionFormTemplateId) values ( - ".$data->{wobjectId}.", $ussId, ".$data->{groupIdEdit}.", 1000, 'none', 'sequenceNumber', 'asc', 2)"); - my $b = WebGUI::SQL->read("select * from FAQ_question"); - while (my $sub = $b->hashRef) { - my $subId = getNextId("USS_submissionId"); - my $forum = WebGUI::Forum->create({}); - WebGUI::SQL->write("insert into USS_submission (USS_submissionId, USS_id, title, username, userId, content, - dateUpdated, dateSubmited, forumId,contentType) values ( $subId, $ussId, ".quote($sub->{question}).", - ".quote($data->{username}).", ".$data->{ownerId}.", ".quote($sub->{answer}).", ".$data->{lastEdited}.", - ".$data->{dateAdded}.", ".$forum->get("forumId").", 'html')"); - } - $b->finish; -} -$a->finish; -WebGUI::SQL->write("update wobject set namespace='USS' where namespace='FAQ'"); -WebGUI::SQL->write("drop table FAQ"); -WebGUI::SQL->write("drop table FAQ_question"); -WebGUI::SQL->write("delete from incrementer where incrementerId='FAQ_questionId'"); - - -#-------------------------------------------- -print "\tMigrating Link Lists to USS Submissions.\n" unless ($quiet); -my $sth = WebGUI::SQL->read("select * from template where namespace='LinkList'"); -while (my $template = $sth->hashRef) { - $template->{name} =~ s/Default (.*?)/$1/i; - if ($template->{templateId} < 1000) { - ($template->{templateId}) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='USS' and templateId<1000"); - $template->{templateId}++; - } else { - ($template->{templateId}) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='USS'"); - if ($template->{templateId} > 999) { - $template->{templateId}++; - } else { - $template->{templateId} = 1000; - } - } - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\//igs; - $template->{template} =~ s/\<\/tmpl\_if\>\s*\<\/tmpl\_if\>/\<\/tmpl_if>/igs; - my $replacement = ' - - [] - - - - '; - $template->{template} =~ s/\\s*\\s*/$replacement/igs; - $replacement = ' - '; - $template->{template} =~ s/\\s*\"\>/$replacement/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - $template->{template} =~ s/\/\/igs; - WebGUI::SQL->write("insert into template (templateId,name,template,namespace) values (".$template->{templateId}.", - ".quote($template->{name}).", ".quote($template->{template}).", 'USS')"); -} -$sth->finish; -WebGUI::SQL->write("delete from template where namespace='LinkList'"); -my $a = WebGUI::SQL->read("select a.wobjectId,a.groupIdEdit,a.ownerId,a.lastEdited,b.username,a.dateAdded from wobject a left join users b on - a.ownerId=b.userId where a.namespace='LinkList'"); -while (my $data = $a->hashRef) { - $ussId = getNextId("USS_id"); - WebGUI::SQL->write("insert into USS (wobjectId, USS_id, groupToContribute, submissionsPerPage, filterContent, sortBy, sortOrder, - submissionFormTemplateId) values ( - ".$data->{wobjectId}.", $ussId, ".$data->{groupIdEdit}.", 1000, 'none', 'sequenceNumber', 'asc', 3)"); - my $b = WebGUI::SQL->read("select * from LinkList_link"); - while (my $sub = $b->hashRef) { - my $subId = getNextId("USS_submissionId"); - my $forum = WebGUI::Forum->create({}); - WebGUI::SQL->write("insert into USS_submission (USS_submissionId, USS_id, title, username, userId, content, - dateUpdated, dateSubmited, forumId,contentType,userDefined1, userDefined2) values ( $subId, $ussId, ".quote($sub->{name}).", - ".quote($data->{username}).", ".$data->{ownerId}.", ".quote($sub->{description}).", ".$data->{lastEdited}.", - ".$data->{dateAdded}.", ".$forum->get("forumId").", 'html', ".quote($sub->{url}).", ".quote($sub->{newWindow}).")"); - } - $b->finish; -} -$a->finish; -WebGUI::SQL->write("update wobject set namespace='USS' where namespace='LinkList'"); -WebGUI::SQL->write("drop table LinkList"); -WebGUI::SQL->write("drop table LinkList_link"); -WebGUI::SQL->write("delete from incrementer where incrementerId='LinkList_linkId'"); - - - -#-------------------------------------------- -print "\tUpdating SQL Reports.\n" unless ($quiet); -my %dblink; -$dblink{$session{config}{dsn}} = ( - id=>0, - user=>$session{config}{dbuser} - ); -my $sth = WebGUI::SQL->read("select DSN, databaseLinkId, username, identifier, wobjectId from SQLReport"); -while (my $data = $sth->hashRef) { - my $id = undef; - next if ($data->{databaseLinkId} > 0); - foreach my $dsn (keys %dblink) { - if ($dsn eq $data->{dsn} && $dblink{$dsn}{user} eq $data->{username}) { - $id = $dblink{$dsn}{id}; - last; - } - } - unless (defined $id) { - $id = getNextId("databaseLinkId"); - my $title = $data->{username}.'@'.$data->{DSN}; - WebGUI::SQL->write("insert into databaseLink (databaseLinkId, title, DSN, username, identifier) values ($id, ".quote($title).", - ".quote($data->{DSN}).", ".quote($data->{username}).", ".quote($data->{identifier}).")"); - $dblink{$data->{DSN}} = ( - id=>$id, - user=>$data->{username} - ); - } - WebGUI::SQL->write("update SQLReport set databaseLinkId=".$id." where wobjectId=".$data->{wobjectId}); -} -$sth->finish; -WebGUI::SQL->write("alter table SQLReport drop column DSN"); -WebGUI::SQL->write("alter table SQLReport drop column username"); -WebGUI::SQL->write("alter table SQLReport drop column identifier"); -use WebGUI::DatabaseLink; -my $templateId; -my $a = WebGUI::SQL->read("select a.databaseLinkId, a.dbQuery, a.template, a.wobjectId, b.title from SQLReport a - left join wobject b on a.wobjectId=b.wobjectId"); -while (my $data = $a->hashRef) { - my $db = WebGUI::DatabaseLink->new($data->{databaseLinkId}); - if ($data->{template} ne "") { - ($templateId) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='SQLReport'"); - if ($templateId > 999) { - $templateId++; - } else { - $templateId = 1000; - } - my $b = WebGUI::SQL->unconditionalRead($data->{dbQuery},$db->dbh); - my @template = split(/\^\-\;/,$data->{template}); - my $final = ' -

-
- - -

- - - -

    - -
  • -
    -
-
- '.$template[0].' - '; - my $i; - foreach my $col ($b->getColumnNames) { - my $replacement = ''; - $template[1] =~ s/\^$i\;/$replacement/g; - $i++; - } - $template[1] =~ s/\^rownum\;/\/g; - $final .= $template[1].' - - '.$template[2].' - - - '; - WebGUI::SQL->write("insert into template (templateId, name, template, namespace) values ($templateId, - ".quote($data->{title}).",".quote($final).",'SQLReport')"); - } else { - $templateId = 1; - } - WebGUI::SQL->write("insert into wobject set templateId=$templateId where wobjectId=".$data->{wobjectId}); -} -$a->finish; -WebGUI::SQL->write("alter table SQLReport drop column template"); - - - -#-------------------------------------------- -print "\tUpdating config file.\n" unless ($quiet); -my $pathToConfig = '../../etc/'.$configFile; -my $conf = Parse::PlainConfig->new('DELIM' => '=', 'FILE' => $pathToConfig); -my $macros = $conf->get("macros"); -delete $macros->{"\\"}; -$macros->{"\\\\"} = "Backslash_pageUrl"; -$conf->set("macros"=>$macros); -my $wobjects = $conf->get("wobjects"); -my @newWobjects; -foreach my $wobject (@{$wobjects}) { - unless ($wobject eq "Item" || $wobject eq "FAQ" || $wobject eq "ExtraColumn" || $wobject eq "LinkList") { - push(@newWobjects,$wobject); - } -} -$conf->set("wobjects"=>\@newWobjects); -$conf->write; - - -#-------------------------------------------- -print "\tUpdating Authentication.\n" unless ($quiet); -WebGUI::SQL->write("delete from authentication where authMethod='WebGUI' and fieldName='passwordLastUpdated'"); -WebGUI::SQL->write("delete from authentication where authMethod='WebGUI' and fieldName='passwordTimeout'"); -my $authSth = WebGUI::SQL->read("select userId from users where authMethod='WebGUI'"); -while (my $authHash = $authSth->hashRef){ - WebGUI::SQL->write("insert into authentication (userId,authMethod,fieldName,fieldData) values ('".$authHash->{userId}."','WebGUI','passwordLastUpdated','".time()."')"); - WebGUI::SQL->write("insert into authentication (userId,authMethod,fieldName,fieldData) values ('".$authHash->{userId}."','WebGUI','passwordTimeout','3122064000')"); -} - - -#-------------------------------------------- -print "\tRemoving unneeded files and directories.\n" unless ($quiet); -unlink("../../lib/WebGUI/Operation/Style.pm"); -unlink("../../lib/WebGUI/Wobject/Item.pm"); -unlink("../../lib/WebGUI/Wobject/LinkList.pm"); -unlink("../../lib/WebGUI/Wobject/FAQ.pm"); -unlink("../../lib/WebGUI/Wobject/ExtraColumn.pm"); -unlink("../../lib/WebGUI/Authentication.pm"); -unlink("../../lib/WebGUI/Operation/Account.pm"); -unlink("../../lib/WebGUI/Authentication/WebGUI.pm"); -unlink("../../lib/WebGUI/Authentication/LDAP.pm"); -unlink("../../lib/WebGUI/Authentication/SMB.pm"); -rmdir("../../lib/WebGUI/Authentication"); -WebGUI::Session::close(); - - -#------------------------------------------------------------------- -sub _positionFormat5x { - return ""; -} - -#------------------------------------------------------------------- -sub _positionFormat6x { - my $newPositionCode = ' - - -
-
- - '; - return $newPositionCode; -} - - diff --git a/docs/upgrades/upgrade_5.9.9-6.0.0.pl b/docs/upgrades/upgrade_5.9.9-6.0.0.pl index cce4b5029..6cbdc9547 100644 --- a/docs/upgrades/upgrade_5.9.9-6.0.0.pl +++ b/docs/upgrades/upgrade_5.9.9-6.0.0.pl @@ -457,6 +457,15 @@ unlink("../../lib/WebGUI/Authentication/WebGUI.pm"); unlink("../../lib/WebGUI/Authentication/LDAP.pm"); unlink("../../lib/WebGUI/Authentication/SMB.pm"); rmdir("../../lib/WebGUI/Authentication"); + + +#-------------------------------------------- +print "\tMigrating wobject privileges.\n" unless ($quiet); +WebGUI::SQL->write("alter table page add column wobjectPrivileges int not null default 0"); +WebGUI::SQL->write("update page set wobjectPrivileges=$session{setting}{wobjectPrivileges}"); +WebGUI::SQL->write("delete from settings where name='wobjectPrivileges'"); + + WebGUI::Session::close(); diff --git a/lib/WebGUI/Operation/Package.pm b/lib/WebGUI/Operation/Package.pm index 642db4839..1aa5c703f 100644 --- a/lib/WebGUI/Operation/Package.pm +++ b/lib/WebGUI/Operation/Package.pm @@ -75,7 +75,8 @@ sub _recursePageTree { newWindow, cacheTimeout, cacheTimeoutVisitor, - printableStyleId + printableStyleId, + wobjectPrivileges ) values ( $newPageId, $_[1], @@ -103,7 +104,8 @@ sub _recursePageTree { $package{newWindow}, $package{cacheTimeout}, $package{cacheTimeoutVisitor}, - $package{printableStyleId} + $package{printableStyleId}, + $package{wobjectPrivileges} )"); _recursePageTree($package{pageId},$newPageId); } diff --git a/lib/WebGUI/Operation/Page.pm b/lib/WebGUI/Operation/Page.pm index ffc26d1de..05b4368dc 100644 --- a/lib/WebGUI/Operation/Page.pm +++ b/lib/WebGUI/Operation/Page.pm @@ -56,7 +56,7 @@ sub _recursivelyChangePrivileges { WebGUI::SQL->write("update page set startDate=".WebGUI::FormProcessor::dateTime("startDate").", endDate=".WebGUI::FormProcessor::dateTime("endDate").", ownerId=$session{form}{ownerId}, groupIdView=$session{form}{groupIdView}, - groupIdEdit=$session{form}{groupIdEdit} where pageId=$pageId"); + groupIdEdit=$session{form}{groupIdEdit}, wobjectPrivileges=$session{form}{wobjectPrivileges} where pageId=$pageId"); _recursivelyChangePrivileges($pageId); } } @@ -294,7 +294,11 @@ sub www_editPage { -label=>WebGUI::International::get(500), -uiLevel=>3 ); - $f->getTab("properties")->text("title",WebGUI::International::get(99),$page{title}); + $f->getTab("properties")->text( + -name=>"title", + -label=>WebGUI::International::get(99), + -value=>$page{title} + ); $f->getTab("properties")->text( -name=>"menuTitle", -label=>WebGUI::International::get(411), @@ -448,6 +452,12 @@ sub www_editPage { -excludeGroups=>[1,7], -uiLevel=>6 ); + $f->getTab("privileges")->yesNo( + -name=>"wobjectPrivileges", + -label=>WebGUI::International::get(1003), + -value=>$page{wobjectPrivileges}, + -uiLevel=>9 + ); if ($childCount) { $f->getTab("privileges")->yesNo( -name=>"recursePrivs", @@ -500,6 +510,7 @@ sub www_editPageSave { groupIdView=$session{form}{groupIdView}, groupIdEdit=$session{form}{groupIdEdit}, newWindow=$session{form}{newWindow}, + wobjectPrivileges=$session{form}{wobjectPrivileges}, hideFromNavigation=$session{form}{hideFromNavigation}, startDate=".WebGUI::FormProcessor::dateTime("startDate").", endDate=".WebGUI::FormProcessor::dateTime("endDate").", diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index 9d058c342..d5719230d 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -82,7 +82,6 @@ sub www_editContentSettings { $f->integer("textAreaRows",WebGUI::International::get(463),$session{setting}{textAreaRows}); $f->integer("textAreaCols",WebGUI::International::get(464),$session{setting}{textAreaCols}); $f->integer("textBoxSize",WebGUI::International::get(465),$session{setting}{textBoxSize}); - $f->yesNo("wobjectPrivileges",WebGUI::International::get(1003),$session{setting}{wobjectPrivileges}); $f->submit; $output .= $f->print; return _submenu($output); diff --git a/lib/WebGUI/Operation/Style.pm b/lib/WebGUI/Operation/Style.pm new file mode 100644 index 000000000..d04438aaf --- /dev/null +++ b/lib/WebGUI/Operation/Style.pm @@ -0,0 +1,69 @@ +package WebGUI::Operation::Style; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2003 Plain Black LLC. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Session; +use WebGUI::URL; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_makePrintable &www_setPersonalStyle &www_unsetPersonalStyle); + +#------------------------------------------------------------------- +sub www_makePrintable { + if ($session{form}{styleId} ne "") { + $session{page}{printableStyleId} = $session{form}{styleId}; + } + $session{page}{makePrintable} = 1; + return ""; +} + +#------------------------------------------------------------------- +sub www_setPersonalStyle { + WebGUI::Session::setScratch("personalStyleId",$session{form}{styleId}); + return ""; +} + +#------------------------------------------------------------------- +sub www_unsetPersonalStyle { + WebGUI::Session::deleteScratch("personalStyleId"); + return ""; +} + +#------------------------------------------------------------------- +sub www_listRoots { + return WebGUI::Privilege::adminOnly() unless(WebGUI::Privilege::isInGroup(3)); + my ($output, $p, $sth, %data, @row, $i); + $output = helpIcon(28); + $output .= '

'.WebGUI::International::get(408).'

'; + $sth = WebGUI::SQL->read("select * from page where title<>'Reserved' and parentId=0 order by title"); + while (%data = $sth->hash) { + $row[$i] = '' + .deleteIcon('op=deletePage',$data{urlizedTitle}) + .editIcon('op=editPage',$data{urlizedTitle}) + .cutIcon('op=cutPage',$data{urlizedTitle}) + .''; + $row[$i] .= ''.$data{title}.''; + $row[$i] .= ''.$data{urlizedTitle}.''; + $i++; + } + $sth->finish; + $p = WebGUI::Paginator->new(WebGUI::URL::page('op=listRoots'),\@row); + $output .= ''; + $output .= $p->getPage; + $output .= '
'; + $output .= $p->getBarTraditional; + return _submenu($output); +} + + +1; diff --git a/lib/WebGUI/Privilege.pm b/lib/WebGUI/Privilege.pm index 61067eef1..21aa935cd 100644 --- a/lib/WebGUI/Privilege.pm +++ b/lib/WebGUI/Privilege.pm @@ -128,7 +128,7 @@ The unique identifier for the wobject that you wish to check the privileges on. sub canEditWobject { my (%wobject); tie %wobject, 'Tie::CPHash'; - return canEditPage() if ($session{setting}{wobjectPrivileges} != 1 || $_[0] eq "new"); + return canEditPage() if ($session{page}{wobjectPrivileges} != 1 || $_[0] eq "new"); %wobject = WebGUI::SQL->quickHash("select ownerId,groupIdEdit from wobject where wobjectId=".quote($_[0])); if ($session{user}{userId} == $wobject{ownerId}) { return 1; @@ -196,7 +196,7 @@ The unique identifier for the wobject that you wish to check the privileges on. sub canViewWobject { my (%wobject); tie %wobject, 'Tie::CPHash'; - return canViewPage() unless ($session{setting}{wobjectPrivileges} == 1); + return canViewPage() unless ($session{page}{wobjectPrivileges} == 1); %wobject = WebGUI::SQL->quickHash("select ownerId,groupIdView,startDate,endDate from wobject where wobjectId=".quote($_[0])); if ($wobject{startDate} < time() && $wobject{endDate} > time()) { if ($session{user}{userId} == $wobject{ownerId}) { diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index b014a8044..adc623cb3 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -1249,7 +1249,7 @@ sub www_edit { } else { $subtext = ""; } - if ($session{setting}{wobjectPrivileges}) { + if ($session{page}{wobjectPrivileges}) { my $clause; if (WebGUI::Privilege::isInGroup(3)) { my $contentManagers = WebGUI::Grouping::getUsersInGroup(4,1);