diff --git a/docs/upgrades/upgrade_4.6.9-4.7.0.sql b/docs/upgrades/upgrade_4.6.9-4.7.0.sql index 2272953b6..0275aacb2 100644 --- a/docs/upgrades/upgrade_4.6.9-4.7.0.sql +++ b/docs/upgrades/upgrade_4.6.9-4.7.0.sql @@ -1,7 +1,18 @@ insert into webguiVersion values ('4.7.0','upgrade',unix_timestamp()); update international set internationalId=728, namespace='WebGUI' where internationalId=12 and namespace='Product'; - - +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (728,1,'WebGUI','UI Level', 1033832377); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (738,1,'WebGUI','9 Guru', 1033836704); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (737,1,'WebGUI','8 Master', 1033836698); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (736,1,'WebGUI','7 Expert', 1033836692); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (735,1,'WebGUI','6 Professional', 1033836686); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (734,1,'WebGUI','5 Adept', 1033836678); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (733,1,'WebGUI','4 Skilled', 1033836668); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (732,1,'WebGUI','3 Rookie', 1033836660); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (731,1,'WebGUI','2 Trained', 1033836651); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (730,1,'WebGUI','1 Novice', 1033836642); +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (729,1,'WebGUI','0 Beginner', 1033836631); +INSERT INTO userProfileField VALUES ('uiLevel','WebGUI::International::get(728,\"WebGUI\");',0,0,'select','{\r\n0=>WebGUI::International::get(729,\"WebGUI\"),\r\n1=>WebGUI::International::get(730,\"WebGUI\"),\r\n2=>WebGUI::International::get(731,\"WebGUI\"),\r\n3=>WebGUI::International::get(732,\"WebGUI\"),\r\n4=>WebGUI::International::get(733,\"WebGUI\"),\r\n5=>WebGUI::International::get(734,\"WebGUI\"),\r\n6=>WebGUI::International::get(735,\"WebGUI\"),\r\n7=>WebGUI::International::get(736,\"WebGUI\"),\r\n8=>WebGUI::International::get(737,\"WebGUI\"),\r\n9=>WebGUI::International::get(738,\"WebGUI\")\r\n}','[5]',8,4,1); +INSERT INTO userProfileData VALUES (3,'uiLevel','9'); diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index 257af11a9..ca60b010c 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -144,13 +144,14 @@ sub _loadWobjects { unless ($@) { $exclude = $session{config}{excludeWobject}; $exclude =~ s/ //g; - unless (isIn($namespace, split(/,/,$exclude))) { - $cmd = "\$WebGUI::Wobject::".$namespace."::name"; - $session{wobject}{$namespace} = eval($cmd); - if ($@) { - WebGUI::ErrorHandler::warn("No name method in wobject: $namespace. ".$@); - $session{wobject}{$namespace} = "ERROR: ".$namespace; - } + next if (isIn($namespace, split(/,/,$exclude))); + $cmd = "\WebGUI::Wobject::".$namespace."::uiLevel"; + next if (eval($cmd) > $session{user}{uiLevel}); + $cmd = "\$WebGUI::Wobject::".$namespace."::name"; + $session{wobject}{$namespace} = eval($cmd); + if ($@) { + WebGUI::ErrorHandler::warn("No name method in wobject: $namespace. ".$@); + $session{wobject}{$namespace} = "ERROR: ".$namespace; } } else { WebGUI::ErrorHandler::warn("Wobject failed to compile: $namespace. ".$@); diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index c88580907..df24fb3f8 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -672,6 +672,19 @@ sub setCollateral { } +#------------------------------------------------------------------- + +=head2 uiLevel + + Returns the UI Level of a wobject. Defaults to "0" for all wobjects. + Override to set the UI Level higher for a given wobject. + +=cut + +sub uiLevel { + return 0; +} + #------------------------------------------------------------------- =head2 www_approvePost ( ) diff --git a/lib/WebGUI/Wobject/DownloadManager.pm b/lib/WebGUI/Wobject/DownloadManager.pm index 765ed212f..9e512a5c7 100644 --- a/lib/WebGUI/Wobject/DownloadManager.pm +++ b/lib/WebGUI/Wobject/DownloadManager.pm @@ -89,6 +89,11 @@ sub set { $_[0]->SUPER::set($_[1],[qw(paginateAfter displayThumbnails)]); } +#------------------------------------------------------------------- +sub uiLevel { + return 4; +} + #------------------------------------------------------------------- sub www_deleteFile { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); diff --git a/lib/WebGUI/Wobject/ExtraColumn.pm b/lib/WebGUI/Wobject/ExtraColumn.pm index 251f97314..ef065fca8 100644 --- a/lib/WebGUI/Wobject/ExtraColumn.pm +++ b/lib/WebGUI/Wobject/ExtraColumn.pm @@ -43,6 +43,11 @@ sub set { $_[0]->SUPER::set($_[1],[qw(spacer width class)]); } +#------------------------------------------------------------------- +sub uiLevel { + return 1; +} + #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); diff --git a/lib/WebGUI/Wobject/MailForm.pm b/lib/WebGUI/Wobject/MailForm.pm index 7bca0c2b1..6cfd5a0a0 100755 --- a/lib/WebGUI/Wobject/MailForm.pm +++ b/lib/WebGUI/Wobject/MailForm.pm @@ -77,6 +77,11 @@ sub set { $_[0]->SUPER::set($_[1],[@fields]); } +#------------------------------------------------------------------- +sub uiLevel { + return 5; +} + #------------------------------------------------------------------- sub www_deleteField { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); diff --git a/lib/WebGUI/Wobject/SQLReport.pm b/lib/WebGUI/Wobject/SQLReport.pm index 4f87413ff..e24219140 100644 --- a/lib/WebGUI/Wobject/SQLReport.pm +++ b/lib/WebGUI/Wobject/SQLReport.pm @@ -51,6 +51,11 @@ sub set { $_[0]->SUPER::set($_[1],[qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)]); } +#------------------------------------------------------------------- +sub uiLevel { + return 9; +} + #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); diff --git a/lib/WebGUI/Wobject/SyndicatedContent.pm b/lib/WebGUI/Wobject/SyndicatedContent.pm index d614c2090..4032ab123 100644 --- a/lib/WebGUI/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Wobject/SyndicatedContent.pm @@ -43,6 +43,11 @@ sub set { $_[0]->SUPER::set($_[1], [qw(rssUrl content lastFetched)]); } +#------------------------------------------------------------------- +sub uiLevel { + return 6; +} + #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); diff --git a/lib/WebGUI/Wobject/WobjectProxy.pm b/lib/WebGUI/Wobject/WobjectProxy.pm index a7cd5c68c..bc7c93150 100644 --- a/lib/WebGUI/Wobject/WobjectProxy.pm +++ b/lib/WebGUI/Wobject/WobjectProxy.pm @@ -41,6 +41,11 @@ sub set { $_[0]->SUPER::set($_[1],[qw(proxiedWobjectId)]); } +#------------------------------------------------------------------- +sub uiLevel { + return 8; +} + #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());