From 6c4771d0ca8dc38ac0d1c2a9b16a91d722f8d477 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 3 Mar 2003 02:16:15 +0000 Subject: [PATCH] Switching wobjects over to new API. --- docs/upgrades/upgrade_5.1.2-5.2.0.sql | 40 ++++++ lib/WebGUI/Wobject.pm | 16 +-- lib/WebGUI/Wobject/Article.pm | 36 +++-- lib/WebGUI/Wobject/EventsCalendar.pm | 103 +++++++------- lib/WebGUI/Wobject/ExtraColumn.pm | 31 +++-- lib/WebGUI/Wobject/FAQ.pm | 49 ++++--- lib/WebGUI/Wobject/FileManager.pm | 84 ++++++------ lib/WebGUI/Wobject/HttpProxy.pm | 45 +++--- lib/WebGUI/Wobject/Item.pm | 25 ++-- lib/WebGUI/Wobject/LinkList.pm | 46 ++++--- lib/WebGUI/Wobject/MailForm.pm | 107 ++++++++------- lib/WebGUI/Wobject/MessageBoard.pm | 42 ++++-- lib/WebGUI/Wobject/Poll.pm | 51 ++++--- lib/WebGUI/Wobject/Product.pm | 106 ++++++++------- lib/WebGUI/Wobject/SQLReport.pm | 54 +++++--- lib/WebGUI/Wobject/SiteMap.pm | 34 +++-- lib/WebGUI/Wobject/Survey.pm | 174 +++++++++++++----------- lib/WebGUI/Wobject/SyndicatedContent.pm | 30 ++-- lib/WebGUI/Wobject/USS.pm | 116 ++++++++-------- lib/WebGUI/Wobject/WobjectProxy.pm | 30 ++-- 20 files changed, 708 insertions(+), 511 deletions(-) diff --git a/docs/upgrades/upgrade_5.1.2-5.2.0.sql b/docs/upgrades/upgrade_5.1.2-5.2.0.sql index e5635c280..219c36583 100644 --- a/docs/upgrades/upgrade_5.1.2-5.2.0.sql +++ b/docs/upgrades/upgrade_5.1.2-5.2.0.sql @@ -62,6 +62,46 @@ alter table wobject add column filterPost varchar(30) not null default 'javascri delete from settings where name='filterContributedHTML'; update international set namespace='Discussion' where internationalId=524 and namespace='WebGUI'; alter table wobject add column addEditStampToPosts int not null default 1; +alter table wobject drop column processMacros; +delete from international where languageId=1 and namespace='WebGUI' and internationalId=624; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (624,1,'WebGUI','WebGUI macros are used to create dynamic content within otherwise static content. For instance, you may wish to show which user is logged in on every page, or you may wish to have a dynamically built menu or crumb trail. \r\n

\r\n\r\nMacros always begin with a carat (^) and follow with at least one other character and ended with a semicolon (;). Some macros can be extended/configured by taking the format of ^x("config text");. \r\n

\r\n\r\nNOTE: The following macros are reserved for system/wobject-specific functions as in the SQL Report wobject and the Body in the Style Manager: \r\n^-;,^0;,^1;,^2;,^3;, etc.
\r\n

\r\n', 1046656837); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=669; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (669,1,'WebGUI','Macros, Using', 1046656837); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=843; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (843,1,'WebGUI','User Macros', 1046656765); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=844; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (844,1,'WebGUI','These macros have to do with users and logins.\r\n

\r\n\r\n^a; or ^a(); - My Account Link
\r\nA link to your account information. In addition you can change the link text by creating a macro like this ^a("Account Info");. \r\n

\r\n\r\nNOTES: You can also use the special case ^a(linkonly); to return only the URL to the account page and nothing more. Also, the .myAccountLink style sheet class is tied to this macro.\r\n

\r\n\r\n\r\n^AdminText();
\r\nDisplays a small text message to a user who is in admin mode. Example: ^AdminText("You are in admin mode!");\r\n

\r\n\r\n^AdminToggle; or ^AdminToggle();
\r\nPlaces a link on the page which is only visible to content managers and adminstrators. The link toggles on/off admin mode. You can optionally specify other messages to display like this: ^AdminToggle("Edit On","Edit Off");\r\n

\r\n\r\n\r\n\r\n^GroupText();
\r\nDisplays a small text message to the user if they belong to the specified group. Example: ^GroupText("Visitors","You need an account to do anything cool on this site!");\r\n

\r\n\r\n^L; or ^L(); - Login Box
\r\nA small login form. You can also configure this macro. You can set the width of the login box like this ^L(20);. You can also set the message displayed after the user is logged in like this ^L(20,Hi ^a(^@;);. Click %here% if you wanna log out!)\r\n

\r\n\r\nNOTE: The .loginBox style sheet class is tied to this macro.\r\n

\r\n\r\n^LoginToggle; or ^LoginToggle();
\r\nDisplays a "Login" or "Logout" message depending upon whether the user is logged in or not. You can optionally specify other messages like this: ^LoginToggle("Click here to log in.","Click here to log out.");\r\n

\r\n\r\n\r\n^@; - Username
\r\nThe username of the currently logged in user.\r\n

\r\n\r\n\r\n^#; - User ID
\r\nThe user id of the currently logged in user.\r\n

\r\n\r\n', 1046656765); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=839; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (839,1,'WebGUI','Programmer Macros', 1046656621); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=840; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (840,1,'WebGUI','These macros are designed to provide programming like functionality.\r\n

\r\n\r\n^D; or ^D(); - Date
\r\nThe current date and time.\r\n

\r\n\r\nYou can configure the date by using date formatting symbols. For instance, if you created a macro like this ^D("%c %D, %y"); it would output September 26, 2001. The following are the available date formatting symbols:\r\n

\r\n\r\n
%%%
%y4 digit year
%Y2 digit year
%m2 digit month
%Mvariable digit month
%cmonth name
%d2 digit day of month
%Dvariable digit day of month
%wday of week name
%h2 digit base 12 hour
%Hvariable digit base 12 hour
%j2 digit base 24 hour
%Jvariable digit base 24 hour
%plower case am/pm
%Pupper case AM/PM
%zuser preference date format
%Zuser preference time format
\r\n

\r\n\r\n^Env()
\r\nCan be used to display a web server environment variable on a page. The environment variables available on each server are different, but you can find out which ones your web server has by going to: http://www.yourwebguisite.com/env.pl\r\n

\r\n\r\nThe macro should be specified like this ^Env("REMOTE_ADDR");\r\n

\r\n\r\n^Execute();
\r\nAllows a content manager or administrator to execute an external program. Takes the format of ^Execute("/this/file.sh");.\r\n

\r\n\r\n\r\n^FormParam();
\r\nThis macro is mainly used in generating dynamic queries in SQL Reports. Using this macro you can pull the value of any form field simply by specifing the name of the form field, like this: ^FormParam("phoneNumber");\r\n

\r\n\r\n^Include();
\r\nAllows a content manager or administrator to include a file from the local filesystem. \r\n

\r\nExample: ^Include("/this/file.html");\r\n

\r\n\r\n^International();
\r\nPull a translated message from the internationalization system.\r\n

\r\nExample: ^International(45,"Article");\r\n

\r\n\r\n\r\n^Page();
\r\nThis can be used to retrieve information about the current page. For instance it could be used to get the page URL like this ^Page("urlizedTitle"); or to get the menu title like this ^Page("menuTitle");.\r\n

\r\n^SQL();
\r\nA one line SQL report. Sometimes you just need to pull something back from the database quickly. This macro is also useful in extending the SQL Report wobject. It uses the numeric macros (^0; ^1; ^2; etc) to position data and can also use the ^rownum; macro just like the SQL Report wobject. Examples:

\r\n ^SQL("select count(*) from users","There are ^0; users on this system.");\r\n

\r\n^SQL("select userId,username from users order by username","<a href=\'^/;?op=viewProfile&uid=^0;\'>^1;</a><br>");\r\n

\r\n^URLEncode();
\r\nThis macro is mainly useful in SQL reports, but it could be useful elsewhere as well. It takes the input of a string and URL Encodes it so that the string can be passed through a URL. It\'s syntax looks like this: ^URLEncode("Is this my string?");\r\n

\r\n\r\n\r\n^User();
\r\nThis macro will allow you to display any information from a user\'s account or profile. For instance, if you wanted to display a user\'s email address you\'d create this macro: ^User("email");\r\n

\r\n\r\n^*; or ^*(); - Random Number
\r\nA randomly generated number. This is often used on images (such as banner ads) that you want to ensure do not cache. In addition, you may configure this macro like this ^*(100); to create a random number between 0 and 100.\r\n

\r\n\r\n^-;,^0;,^1;,^2;,^3;, etc.
\r\nThese macros are reserved for system/wobject-specific functions as in the SQL Report wobject and the Body in the Style Manager.\r\n

\r\n', 1046656621); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=831; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (831,1,'WebGUI','Collateral Macros', 1046656420); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=832; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (832,1,'WebGUI','The collateral management system has several macros for its specific purpose.\r\n

\r\n\r\n^File();
\r\nThis macro builds a quick file link. It creates an icon for the file and outputs the files name. Then it links them both to the file for downloading.\r\n

\r\n\r\n^I();
\r\nThis macro retrieves an image from the collateral management system along with an HTML image tag so that you can quickly display an image from the repository in your content.\r\n

\r\nExample: ^I("logo");\r\n

\r\n\r\n^i();
\r\nThis macro retrieves the URL for any file in the collateral management system.\r\n

\r\nExample: ^i("status report");\r\n

\r\n\r\n^Snippet();
\r\nThis macro retrieves the contents of a snippet in the collateral management system and inserts it into the page.\r\n

\r\nExample: ^Snippet("flash code");\r\n

\r\n\r\n^Thumbnail();
\r\nThis macro retrieves the URL for the thumbnail of any image in the collateral management system.\r\n

\r\nExample: ^Thumbnail("logo");\r\n

\r\n\r\n^ThumbnailLinker();
\r\nThis macro builds a quick image viewer using nothing more than the collateral management system. It creates a thumbnail image with the name of the image under it and then links them both to the full sized image.\r\n

\r\nExample: ^ThumbnailLinker("logo");\r\n

\r\n\r\n', 1046656420); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=841; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (841,1,'WebGUI','Navigation Macros', 1046656370); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=842; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (842,1,'WebGUI','These macros are used to create navigation on the site.\r\n

\r\n\r\n^C; or ^C(); - Crumb Trail
\r\nA dynamically generated crumb trail to the current page. You can optionally specify a delimeter to be used between page names by using ^C(::);. The default delimeter is >.\r\n

\r\n\r\nNOTE: The .crumbTrail style sheet class is tied to this macro.\r\n

\r\n\r\n^FlexMenu;
\r\nThis menu macro creates a top-level menu that expands as the user selects each menu item.\r\n

\r\n\r\n^H; or ^H(); - Home Link
\r\nA link to the home page of this site. In addition you can change the link text by creating a macro like this ^H("Go Home");.\r\n

\r\n\r\nNOTES: You can also use the special case ^H(linkonly); to return only the URL to the home page and nothing more. Also, the .homeLink style sheet class is tied to this macro.\r\n

\r\n\r\n^M; or ^M(); - Current Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the current level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^M(3);. If you set the macro to "0" it will track the entire site tree.\r\n

\r\n\r\n^m; - Current Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the current level. You can optionally specify a delimeter to be used between page names by using ^m(:--:);. The default delimeter is ·.\r\n

\r\n\r\n^P; or ^P(); - Previous Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the previous level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^P(3);. If you set the macro to "0" it will track the entire site tree.\r\n

\r\n\r\n^p; - Previous Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the previous level. You can optionally specify a delimeter to be used between page names by using ^p(:--:);. The default delimeter is ·.\r\n

\r\n\r\n^rootmenu; or ^rootmenu(); (Horizontal)
\r\nCreates a horizontal menu of the various roots on your system (except for the WebGUI system roots). You can optionally specify a menu delimiter like this: ^rootmenu(|);\r\n

\r\n\r\n\r\n^S(); - Specific SubMenu (Vertical)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^S("home",0);. The first value is the urlized title of the page and the second value is the depth you\'d like the menu to go. By default it will show only the first level. To go three levels deep create a macro like this ^S("home",3);.\r\n

\r\n\r\n\r\n^s(); - Specific SubMenu (Horizontal)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^s("home");. The value is the urlized title of the page. You can optionally specify a delimeter to be used between page names by using ^s("home",":--:");. The default delimeter is ·.\r\n

\r\n\r\n^Synopsis; or ^Synopsis(); Menu
\r\nThis macro allows you to get the submenu of a page along with the synopsis of each link. You may specify an integer to specify how many levels deep to traverse the page tree.\r\n

\r\n\r\nNOTES: The .synopsis_sub, .synopsis_summary, and .synopsis_title style sheet classes are tied to this macro.\r\n

\r\n\r\n^T; or ^T(); - Top Level Menu (Vertical)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^T(3);. If you set the macro to "0" it will track the entire site tree.\r\n

\r\n\r\n^t; - Top Level Menu (Horizontal)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). You can optionally specify a delimeter to be used between page names by using ^t(:--:);. The default delimeter is ·.\r\n

\r\n\r\n^/; - System URL
\r\nThe URL to the gateway script (example: /index.pl/).\r\n

\r\n\r\n^\\; - Page URL
\r\nThe URL to the current page (example: /index.pl/pagename).\r\n

\r\n\r\n', 1046656370); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=845; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (845,1,'WebGUI','Style Macros', 1046656109); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=846; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (846,1,'WebGUI','These macros are mainly useful in maintaining styles in WebGUI.\r\n

\r\n\r\n^AdminBar;
\r\nPlaces the administrative tool bar on the page. This is a required element in the "body" segment of the Style Manager.\r\n

\r\n\r\n\r\n^c; - Company Name
\r\nThe name of your company specified in the settings by your Administrator.\r\n

\r\n\r\n\r\n^e; - Company Email Address
\r\nThe email address for your company specified in the settings by your Administrator.\r\n

\r\n\r\n^Extras;
\r\nReturns the path to the WebGUI "extras" folder, which contains things like WebGUI icons.\r\n

\r\n\r\n^PageTitle;
\r\nDisplays the title of the current page.\r\n

\r\n\r\nNOTE: If you begin using admin functions or the indepth functions of any wobject, the page title will become a link that will quickly bring you back to the page.\r\n

\r\n\r\n^r; or ^r(); - Make Page Printable
\r\nCreates a link to remove the style from a page to make it printable. In addition, you can change the link text by creating a macro like this ^r("Print Me!");.\r\n

\r\n\r\nBy default, when this link is clicked, the current page\'s style is replaced with the "Make Page Printable" style in the Style Manager. However, that can be overridden by specifying the name of another style as the second parameter, like this: ^r("Print!","WebGUI");\r\n

\r\n\r\nNOTES: You can also use the special case ^r(linkonly); to return only the URL to the make printable page and nothing more. Also, the .makePrintableLink style sheet class is tied to this macro.\r\n

\r\n\r\n^RootTitle;
\r\nReturns the title of the root of the current page. For instance, the main root in WebGUI is the "Home" page. Many advanced sites have many roots and thus need a way to display to the user which root they are in.\r\n

\r\n\r\n^u; - Company URL
\r\nThe URL for your company specified in the settings by your Administrator.\r\n

\r\n\r\n^?; - Search
\r\nAdd a search box to the page. The search box is tied to WebGUI\'s built-in search engine.\r\n

\r\n\r\nNOTE: The .searchBox style sheet class is tied to this macro.\r\n

\r\n\r\n^-;
\r\nThis is known as the separator macro. It must appear exactly once in every style. Wherever it appears is where the content for any given page will be put.\r\n

', 1046656109); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=421; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (421,1,'WebGUI','Remove everything except basic formating.', 1046611728); +delete from international where languageId=1 and namespace='Discussion' and internationalId=1; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (1,1,'Discussion','Filter Post', 1046607477); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=418; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (418,1,'WebGUI','Filter Content', 1046604931); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=419; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (419,1,'WebGUI','Leave only the text.', 1046604699); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=526; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (526,1,'WebGUI','Remove JavaScript and macros.', 1046604649); +delete from international where languageId=1 and namespace='WebGUI' and internationalId=891; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (891,1,'WebGUI','Remove only macros.', 1046604579); + + + diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index 887c6dae2..9f1fa5588 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -519,7 +519,7 @@ sub name { #------------------------------------------------------------------- -=head2 new ( properties [, extendedProperties, allowDiscussion] ) +=head2 new ( properties [, extendedProperties, useDiscussion] ) Constructor. @@ -548,7 +548,7 @@ Then the extended property list would be "[something, foo, bar]". NOTE: This is used to define the wobject and should only be passed in by a wobject subclass. -=item allowDiscussion +=item useDiscussion Defaults to "0". If set to "1" this will add a discussion properties tab to this wobject to enable content managers to set the properties of a discussion attached to this wobject. @@ -562,14 +562,14 @@ sub new { my $self = shift; my $properties = shift; my $extendedProperties = shift; - my $allowDiscussion = shift || 0; + my $useDiscussion = shift || 0; my $wobjectProperties = [qw(userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 moderationType groupToModerate groupToPost karmaPerPost editTimeout filterPost addEditStampToPosts title displayTitle description pageId templatePosition startDate endDate sequenceNumber)]; bless({ _property=>$properties, _extendedProperties=>$extendedProperties, - _allowDiscussion=>$allowDiscussion, + _useDiscussion=>$useDiscussion, _wobjectProperties=>$wobjectProperties }, $self); @@ -593,11 +593,7 @@ sub new { =cut sub processMacros { - if ($_[0]->get("processMacros")) { - return WebGUI::Macro::process($_[1]); - } else { - return $_[1]; - } + return WebGUI::Macro::process($_[1]); } #------------------------------------------------------------------- @@ -1109,7 +1105,7 @@ sub www_edit { -value=>$_[0]->get("description") ); $f->raw($_[1]); - if ($_[0]->{_allowDiscussion}) { + if ($_[0]->{_useDiscussion}) { $f->raw($_[0]->discussionProperties); } $f->submit; diff --git a/lib/WebGUI/Wobject/Article.pm b/lib/WebGUI/Wobject/Article.pm index 26b0bbb47..0aece7455 100644 --- a/lib/WebGUI/Wobject/Article.pm +++ b/lib/WebGUI/Wobject/Article.pm @@ -25,14 +25,13 @@ use WebGUI::URL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "Article"; #------------------------------------------------------------------- sub duplicate { my ($file, $w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::Article->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::Article->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $file = WebGUI::Attachment->new($_[0]->get("image"),$_[0]->get("wobjectId")); $file->copy($w->get("wobjectId")); $file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId")); @@ -50,12 +49,19 @@ sub duplicate { #------------------------------------------------------------------- sub name { - return WebGUI::International::get(1,$namespace); + return WebGUI::International::get(1,$_[0]->get("namespace")); } #------------------------------------------------------------------- sub new { - $_[0]->SUPER::new($_[1],[qw(image templateId linkTitle linkURL attachment convertCarriageReturns allowDiscussion)],1); + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(image templateId linkTitle linkURL attachment convertCarriageReturns allowDiscussion)], + 1 + ); + bless $self, $class; } #------------------------------------------------------------------- @@ -69,13 +75,13 @@ sub www_edit { } $template = $_[0]->get("templateId") || 1; $groupToModerate = $_[0]->get("groupToModerate") || 4; - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(12,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(12,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$template, - -namespace=>$namespace, + -namespace=>$_[0]->get("namespace"), -label=>WebGUI::International::get(356), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); @@ -89,26 +95,26 @@ sub www_edit { ); $f->text( -name=>"linkTitle", - -label=>WebGUI::International::get(7,$namespace), + -label=>WebGUI::International::get(7,$_[0]->get("namespace")), -value=>$_[0]->get("linkTitle"), -uiLevel=>3 ); $f->url( -name=>"linkURL", - -label=>WebGUI::International::get(8,$namespace), + -label=>WebGUI::International::get(8,$_[0]->get("namespace")), -value=>$_[0]->get("linkURL"), -uiLevel=>3 ); $f->yesNo( -name=>"convertCarriageReturns", - -label=>WebGUI::International::get(10,$namespace), + -label=>WebGUI::International::get(10,$_[0]->get("namespace")), -value=>$_[0]->get("convertCarriageReturns"), - -subtext=>'   '.WebGUI::International::get(11,$namespace).'', + -subtext=>'   '.WebGUI::International::get(11,$_[0]->get("namespace")).'', -uiLevel=>5 ); $f->yesNo( -name=>"allowDiscussion", - -label=>WebGUI::International::get(18,$namespace), + -label=>WebGUI::International::get(18,$_[0]->get("namespace")), -value=>$_[0]->get("allowDiscussion"), -uiLevel=>5 ); @@ -139,7 +145,7 @@ sub www_editSave { #------------------------------------------------------------------- sub www_showMessage { - return $_[0]->SUPER::www_showMessage(''.WebGUI::International::get(27,$namespace).'
'); + return $_[0]->SUPER::www_showMessage(''.WebGUI::International::get(27,$_[0]->get("namespace")).'
'); } #------------------------------------------------------------------- @@ -165,9 +171,9 @@ sub www_view { ($var{"replies.count"}) = WebGUI::SQL->quickArray("select count(*) from discussion where wobjectId=".$_[0]->get("wobjectId")); $var{"replies.URL"} = WebGUI::URL::page('func=showMessage&wid='.$_[0]->get("wobjectId")); - $var{"replies.label"} = WebGUI::International::get(28,$namespace); + $var{"replies.label"} = WebGUI::International::get(28,$_[0]->get("namespace")); $var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); - $var{"post.label"} = WebGUI::International::get(24,$namespace); + $var{"post.label"} = WebGUI::International::get(24,$_[0]->get("namespace")); } return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/EventsCalendar.pm b/lib/WebGUI/Wobject/EventsCalendar.pm index d2d031586..409a8f24d 100644 --- a/lib/WebGUI/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Wobject/EventsCalendar.pm @@ -27,8 +27,6 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "EventsCalendar"; -our $name = WebGUI::International::get(2,$namespace); #------------------------------------------------------------------- sub _drawBigCalendar { @@ -141,7 +139,7 @@ sub _drawSmallCalendar { sub duplicate { my ($sth, $w, @row, $newEventId, $previousRecurringEventId); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::EventsCalendar->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::EventsCalendar->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ templateId=>$_[0]->get("templateId"), eventTemplateId=>$_[0]->get("eventTemplateId"), @@ -165,14 +163,25 @@ sub duplicate { } #------------------------------------------------------------------- -sub purge { - WebGUI::SQL->write("delete from EventsCalendar_event where wobjectId=".$_[0]->get("wobjectId")); - $_[0]->SUPER::purge(); +sub name { + return WebGUI::International::get(2,$_[0]->get("namespace")); } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(templateId eventTemplateId startMonth endMonth defaultMonth paginateAfter)]); +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(templateId eventTemplateId startMonth endMonth defaultMonth paginateAfter)] + ); + bless $self, $class; +} + +#------------------------------------------------------------------- +sub purge { + WebGUI::SQL->write("delete from EventsCalendar_event where wobjectId=".$_[0]->get("wobjectId")); + $_[0]->SUPER::purge(); } #------------------------------------------------------------------- @@ -180,14 +189,14 @@ sub www_deleteEvent { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output); $output = '

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

'; - $output .= WebGUI::International::get(75,$namespace).'

'; + $output .= WebGUI::International::get(75,$_[0]->get("namespace")).'

'; $output .= ''.WebGUI::International::get(76,$namespace).'

'; + .$session{form}{eid}).'">'.WebGUI::International::get(76,$_[0]->get("namespace")).'

'; $output .= '' - .WebGUI::International::get(77,$namespace).'

'; + .WebGUI::International::get(77,$_[0]->get("namespace")).'

'; $output .= '' - .WebGUI::International::get(78,$namespace).''; + .WebGUI::International::get(78,$_[0]->get("namespace")).''; $output .= '

'; return $output; } @@ -212,60 +221,60 @@ sub www_edit { $endMonth = $_[0]->get("endMonth") || "after12"; $defaultMonth = $_[0]->get("defaultMonth") || "current"; $afterEdit = 'func=edit&wid='.$_[0]->get("wobjectId") if ($_[0]->get("wobjectId") ne "new"); - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(12,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(12,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, - -label=>WebGUI::International::get(79,$namespace), + -namespace=>$_[0]->get("namespace"), + -label=>WebGUI::International::get(79,$_[0]->get("namespace")), -afterEdit=>$afterEdit ); $f->template( -name=>"eventTemplateId", -value=>$_[0]->get("eventTemplateId"), - -namespace=>$namespace."/Event", - -label=>WebGUI::International::get(80,$namespace), + -namespace=>$_[0]->get("namespace")."/Event", + -label=>WebGUI::International::get(80,$_[0]->get("namespace")), -afterEdit=>$afterEdit ); $f->select( -name=>"startMonth", -options=>{ - "current"=>WebGUI::International::get(82,$namespace), - "first"=>WebGUI::International::get(83,$namespace) + "current"=>WebGUI::International::get(82,$_[0]->get("namespace")), + "first"=>WebGUI::International::get(83,$_[0]->get("namespace")) }, - -label=>WebGUI::International::get(81,$namespace), + -label=>WebGUI::International::get(81,$_[0]->get("namespace")), -value=>[$startMonth] ); $f->select( -name=>"endMonth", -options=>{ - "last"=>WebGUI::International::get(85,$namespace), - "after12"=>WebGUI::International::get(86,$namespace), - "after9"=>WebGUI::International::get(87,$namespace), - "after6"=>WebGUI::International::get(88,$namespace), - "after3"=>WebGUI::International::get(89,$namespace), - "current"=>WebGUI::International::get(82,$namespace), + "last"=>WebGUI::International::get(85,$_[0]->get("namespace")), + "after12"=>WebGUI::International::get(86,$_[0]->get("namespace")), + "after9"=>WebGUI::International::get(87,$_[0]->get("namespace")), + "after6"=>WebGUI::International::get(88,$_[0]->get("namespace")), + "after3"=>WebGUI::International::get(89,$_[0]->get("namespace")), + "current"=>WebGUI::International::get(82,$_[0]->get("namespace")), }, - -label=>WebGUI::International::get(84,$namespace), + -label=>WebGUI::International::get(84,$_[0]->get("namespace")), -value=>[$endMonth] ); $f->select( -name=>"defaultMonth", -options=>{ - "current"=>WebGUI::International::get(82,$namespace), - "last"=>WebGUI::International::get(85,$namespace), - "first"=>WebGUI::International::get(83,$namespace) + "current"=>WebGUI::International::get(82,$_[0]->get("namespace")), + "last"=>WebGUI::International::get(85,$_[0]->get("namespace")), + "first"=>WebGUI::International::get(83,$_[0]->get("namespace")) }, - -label=>WebGUI::International::get(90,$namespace), + -label=>WebGUI::International::get(90,$_[0]->get("namespace")), -value=>[$defaultMonth] ); - $f->integer("paginateAfter",WebGUI::International::get(19,$namespace),$paginateAfter); + $f->integer("paginateAfter",WebGUI::International::get(19,$_[0]->get("namespace")),$paginateAfter); if ($_[0]->get("wobjectId") eq "new") { $f->whatNext( -options=>{ - addEvent=>WebGUI::International::get(91,$namespace), + addEvent=>WebGUI::International::get(91,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"backToPage" @@ -301,7 +310,7 @@ sub www_editEvent { tie %event, 'Tie::CPHash'; tie %recursEvery, 'Tie::IxHash'; if ($session{form}{eid} eq "new") { - %recursEvery = ('never'=>WebGUI::International::get(4,$namespace), + %recursEvery = ('never'=>WebGUI::International::get(4,$_[0]->get("namespace")), 'day'=>WebGUI::International::get(700), 'week'=>WebGUI::International::get(701), 'month'=>WebGUI::International::get(702), @@ -309,10 +318,10 @@ sub www_editEvent { ); $event{endDate} = $event{endDate}; $f = WebGUI::HTMLForm->new(1); - $f->raw(''.WebGUI::International::get(8,$namespace).''); + $f->raw(''.WebGUI::International::get(8,$_[0]->get("namespace")).''); $f->integer("interval","",1,"","","",3); $f->select("recursEvery",\%recursEvery); - $f->raw(' '.WebGUI::International::get(9,$namespace).' '); + $f->raw(' '.WebGUI::International::get(9,$_[0]->get("namespace")).' '); $f->date("until"); $f->raw(""); $special = $f->printRowsOnly; @@ -322,19 +331,19 @@ sub www_editEvent { $f->hidden("until"); $special = $f->printRowsOnly; } - $output = helpIcon(2,$namespace); - $output .= '

'.WebGUI::International::get(13,$namespace).'

'; + $output = helpIcon(2,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(13,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("eid",$session{form}{eid}); $f->hidden("func","editEventSave"); $f->text("name",WebGUI::International::get(99),$event{name}); $f->HTMLArea("description",WebGUI::International::get(85),$event{description}); - $f->date("startDate",WebGUI::International::get(14,$namespace),$event{startDate}, + $f->date("startDate",WebGUI::International::get(14,$_[0]->get("namespace")),$event{startDate}, 'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"'); $f->date( -name=>"endDate", - -label=>WebGUI::International::get(15,$namespace), + -label=>WebGUI::International::get(15,$_[0]->get("namespace")), -value=>$event{endDate}, -extras=>'onBlur="this.form.until.value=this.form.endDate.value;"' ); @@ -342,7 +351,7 @@ sub www_editEvent { if ($session{form}{eid} eq "new") { $f->whatNext( -options=>{ - addEvent=>WebGUI::International::get(91,$namespace), + addEvent=>WebGUI::International::get(91,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"backToPage" @@ -417,7 +426,7 @@ sub www_view { my (%var, $junk, $sameDate, $p, @list, $date, $flag, %previous, @row, $i, $maxDate, $minDate); tie %previous, 'Tie::CPHash'; $var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId")); - $var{"addevent.label"} = WebGUI::International::get(20,$namespace); + $var{"addevent.label"} = WebGUI::International::get(20,$_[0]->get("namespace")); if ($_[0]->get("startMonth") eq "first") { ($minDate) = WebGUI::SQL->quickArray("select min(startDate) from EventsCalendar_event where wobjectId=".$_[0]->get("wobjectId")); @@ -519,9 +528,9 @@ sub www_viewEvent { tie %event, 'Tie::CPHash'; %event = WebGUI::SQL->quickHash("select * from EventsCalendar_event where EventsCalendar_eventId=$session{form}{eid}"); $var{title} = $event{name}; - $var{"start.label"} = WebGUI::International::get(14,$namespace); + $var{"start.label"} = WebGUI::International::get(14,$_[0]->get("namespace")); $var{"start.date"} = epochToHuman($event{startDate},"%z"); - $var{"end.label"} = WebGUI::International::get(15,$namespace); + $var{"end.label"} = WebGUI::International::get(15,$_[0]->get("namespace")); $var{"end.date"} = epochToHuman($event{endDate},"%z"); $var{canEdit} = WebGUI::Privilege::canEditPage(); $var{"edit.url"} = WebGUI::URL::page('func=editEvent&eid='.$session{form}{eid}.'&wid='.$session{form}{wid}); @@ -532,12 +541,12 @@ sub www_viewEvent { ($id) = WebGUI::SQL->quickArray("select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>$event{EventsCalendar_eventId} and startDate<=$event{startDate} order by startDate desc, endDate desc"); - $var{"previous.label"} = '«'.WebGUI::International::get(92,$namespace); + $var{"previous.label"} = '«'.WebGUI::International::get(92,$_[0]->get("namespace")); $var{"previous.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id); ($id) = WebGUI::SQL->quickArray("select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>$event{EventsCalendar_eventId} and startDate>=$event{startDate} order by startDate, endDate"); - $var{"next.label"} = WebGUI::International::get(93,$namespace).'»'; + $var{"next.label"} = WebGUI::International::get(93,$_[0]->get("namespace")).'»'; $var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id); $var{description} = $event{description}; return WebGUI::Template::process( WebGUI::Template::get( $_[0]->get("eventTemplateId"), "EventsCalendar/Event"), \%var); diff --git a/lib/WebGUI/Wobject/ExtraColumn.pm b/lib/WebGUI/Wobject/ExtraColumn.pm index 144d9268c..e498b593a 100644 --- a/lib/WebGUI/Wobject/ExtraColumn.pm +++ b/lib/WebGUI/Wobject/ExtraColumn.pm @@ -24,15 +24,13 @@ use WebGUI::Template; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "ExtraColumn"; -our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::ExtraColumn->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::ExtraColumn->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ spacer=>$_[0]->get("spacer"), width=>$_[0]->get("width"), @@ -41,8 +39,19 @@ sub duplicate { } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(spacer width class)]); +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(spacer width class)] + ); + bless $self, $class; } #------------------------------------------------------------------- @@ -54,8 +63,8 @@ sub uiLevel { sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $f, $endDate, $width, $class, $spacer,$startDate, $templatePosition); - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(6,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(6,$_[0]->get("namespace")).'

'; $width = $_[0]->get("width") || 200; $spacer = $_[0]->get("spacer") || 10; $templatePosition = $_[0]->get("templatePosition") || 1; @@ -67,7 +76,7 @@ sub www_edit { $f->hidden("namespace",$_[0]->get("namespace")) if ($_[0]->get("wobjectId") eq "new"); $f->hidden("func","editSave"); $f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499)); - $f->hidden("title",$namespace); + $f->hidden("title",$_[0]->get("namespace")); $f->hidden("displayTitle",0); $f->select( -name=>"templatePosition", @@ -79,9 +88,9 @@ sub www_edit { ); $f->date("startDate",WebGUI::International::get(497),$startDate); $f->date("endDate",WebGUI::International::get(498),$endDate); - $f->integer("spacer",WebGUI::International::get(3,$namespace),$spacer); - $f->integer("width",WebGUI::International::get(4,$namespace),$width); - $f->text("class",WebGUI::International::get(5,$namespace),$class); + $f->integer("spacer",WebGUI::International::get(3,$_[0]->get("namespace")),$spacer); + $f->integer("width",WebGUI::International::get(4,$_[0]->get("namespace")),$width); + $f->text("class",WebGUI::International::get(5,$_[0]->get("namespace")),$class); $f->submit; $output .= $f->print; return $output; diff --git a/lib/WebGUI/Wobject/FAQ.pm b/lib/WebGUI/Wobject/FAQ.pm index ce2ae8377..2ad7855f6 100644 --- a/lib/WebGUI/Wobject/FAQ.pm +++ b/lib/WebGUI/Wobject/FAQ.pm @@ -22,8 +22,6 @@ use WebGUI::URL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "FAQ"; -our $name = WebGUI::International::get(2,$namespace); #------------------------------------------------------------------- @@ -31,7 +29,7 @@ sub duplicate { my ($w, %data, $newQuestionId, $sth); tie %data, 'Tie::CPHash'; $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::FAQ->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::FAQ->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ templateId=>$_[0]->get("templateId") }); @@ -44,21 +42,32 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub name { + return WebGUI::International::get(2,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(templateId)] + ); + bless $self, $class; +} + #------------------------------------------------------------------- sub purge { WebGUI::SQL->write("delete from FAQ_question where wobjectId=".$_[0]->get("wobjectId")); $_[0]->SUPER::purge(); } -#------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(templateId)]); -} - #------------------------------------------------------------------- sub www_deleteQuestion { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - return $_[0]->confirm(WebGUI::International::get(7,$namespace), + return $_[0]->confirm(WebGUI::International::get(7,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteQuestionConfirm&wid='.$_[0]->get("wobjectId").'&qid='.$session{form}{qid})); } @@ -74,20 +83,20 @@ sub www_deleteQuestionConfirm { sub www_edit { my ($f, $output); return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(8,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(8,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, - -label=>WebGUI::International::get(74,$namespace), + -namespace=>$_[0]->get("namespace"), + -label=>WebGUI::International::get(74,$_[0]->get("namespace")), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); if ($_[0]->get("wobjectId") eq "new") { $f->whatNext( -options=>{ - addQuestion=>WebGUI::International::get(75,$namespace), + addQuestion=>WebGUI::International::get(75,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"addQuestion" @@ -115,26 +124,26 @@ sub www_editQuestion { my ($output, $question, $f); return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); $question = $_[0]->getCollateral("FAQ_question","FAQ_questionId",$session{form}{qid}); - $output = helpIcon(2,$namespace); - $output .= '

'.WebGUI::International::get(10,$namespace).'

'; + $output = helpIcon(2,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(10,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("qid",$question->{FAQ_questionId}); $f->hidden("func","editQuestionSave"); $f->textarea( -name=>"question", - -label=>WebGUI::International::get(5,$namespace), + -label=>WebGUI::International::get(5,$_[0]->get("namespace")), -value=>$question->{question} ); $f->HTMLArea( -name=>"answer", - -label=>WebGUI::International::get(6,$namespace), + -label=>WebGUI::International::get(6,$_[0]->get("namespace")), -value=>$question->{answer} ); if ($question->{FAQ_questionId} eq "new") { $f->whatNext( -options=>{ - addQuestion=>WebGUI::International::get(75,$namespace), + addQuestion=>WebGUI::International::get(75,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"backToPage" @@ -179,7 +188,7 @@ sub www_view { my (%question, $controls, $sth, %var, @qa); tie %question,'Tie::CPHash'; $var{"addquestion.url"} = WebGUI::URL::page('func=editQuestion&wid='.$_[0]->get("wobjectId")); - $var{"addquestion.label"} = WebGUI::International::get(9,$namespace); + $var{"addquestion.label"} = WebGUI::International::get(9,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select * from FAQ_question where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); while (%question = $sth->hash) { $controls = deleteIcon('func=deleteQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId}) diff --git a/lib/WebGUI/Wobject/FileManager.pm b/lib/WebGUI/Wobject/FileManager.pm index 46ea836e5..fa9c94f21 100644 --- a/lib/WebGUI/Wobject/FileManager.pm +++ b/lib/WebGUI/Wobject/FileManager.pm @@ -26,12 +26,10 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "FileManager"; -our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- sub _sortByColumn { - if ($session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sortDirection"} eq "asc") { + if ($session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection"} eq "asc") { return WebGUI::URL::append($_[2],'sort='.$_[1]."&sortDirection=desc"); } else { return WebGUI::URL::append($_[2],'sort='.$_[1]."&sortDirection=asc"); @@ -44,7 +42,7 @@ sub duplicate { my ($file, $w, %row, $sth, $newDownloadId); tie %row, 'Tie::CPHash'; $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::FileManager->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::FileManager->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ paginateAfter=>$_[0]->get("paginateAfter"), templateId=>$_[0]->get("templateId") @@ -67,9 +65,19 @@ sub duplicate { } #------------------------------------------------------------------- -sub purge { - WebGUI::SQL->write("delete from FileManager_file where wobjectId=".$_[0]->get("wobjectId")); - $_[0]->SUPER::purge(); +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(paginateAfter templateId)] + ); + bless $self, $class; } #------------------------------------------------------------------- @@ -93,7 +101,7 @@ sub www_deleteFile { #------------------------------------------------------------------- sub www_deleteDownload { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - return $_[0]->confirm(WebGUI::International::get(12,$namespace), + return $_[0]->confirm(WebGUI::International::get(12,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteDownloadConfirm&wid='.$session{form}{wid}.'&did='.$session{form}{did})); } @@ -141,21 +149,21 @@ sub www_edit { if ($_[0]->get("wobjectId") eq "new") { $proceed = 1; } - $output .= helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(9,$namespace).'

'; + $output .= helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(9,$_[0]->get("namespace")).'

'; $paginateAfter = $_[0]->get("paginateAfter") || 50; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, + -namespace=>$_[0]->get("namespace"), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); - $f->integer("paginateAfter",WebGUI::International::get(20,$namespace),$paginateAfter); + $f->integer("paginateAfter",WebGUI::International::get(20,$_[0]->get("namespace")),$paginateAfter); if ($_[0]->get("wobjectId") eq "new") { $f->whatNext( -options=>{ - addFile=>WebGUI::International::get(74,$namespace), + addFile=>WebGUI::International::get(74,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"addFile" @@ -185,40 +193,40 @@ sub www_editDownload { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $file, $f); $file = $_[0]->getCollateral("FileManager_file","FileManager_fileId",$session{form}{did}); - $output .= helpIcon(2,$namespace); - $output .= '

'.WebGUI::International::get(10,$namespace).'

'; + $output .= helpIcon(2,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(10,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("did",$file->{FileManager_fileId}); $f->hidden("func","editDownloadSave"); - $f->text("fileTitle",WebGUI::International::get(5,$namespace),$file->{fileTitle}); + $f->text("fileTitle",WebGUI::International::get(5,$_[0]->get("namespace")),$file->{fileTitle}); if ($file->{downloadFile} ne "") { $f->readOnly(''.WebGUI::International::get(391). - '',WebGUI::International::get(6,$namespace)); + '',WebGUI::International::get(6,$_[0]->get("namespace"))); } else { - $f->file("downloadFile",WebGUI::International::get(6,$namespace)); + $f->file("downloadFile",WebGUI::International::get(6,$_[0]->get("namespace"))); } if ($file->{alternateVersion1} ne "") { $f->readOnly(''. - WebGUI::International::get(391).'',WebGUI::International::get(17,$namespace)); + WebGUI::International::get(391).'',WebGUI::International::get(17,$_[0]->get("namespace"))); } else { - $f->file("alternateVersion1",WebGUI::International::get(17,$namespace)); + $f->file("alternateVersion1",WebGUI::International::get(17,$_[0]->get("namespace"))); } if ($file->{alternateVersion2} ne "") { $f->readOnly(''. - WebGUI::International::get(391).'',WebGUI::International::get(18,$namespace)); + WebGUI::International::get(391).'',WebGUI::International::get(18,$_[0]->get("namespace"))); } else { - $f->file("alternateVersion2",WebGUI::International::get(18,$namespace)); + $f->file("alternateVersion2",WebGUI::International::get(18,$_[0]->get("namespace"))); } - $f->text("briefSynopsis",WebGUI::International::get(8,$namespace),$file->{briefSynopsis}); - $f->group("groupToView",WebGUI::International::get(7,$namespace),[$file->{groupToView}]); + $f->text("briefSynopsis",WebGUI::International::get(8,$_[0]->get("namespace")),$file->{briefSynopsis}); + $f->group("groupToView",WebGUI::International::get(7,$_[0]->get("namespace")),[$file->{groupToView}]); if ($file->{FileManager_fileId} eq "new") { $f->whatNext( -options=>{ - addFile=>WebGUI::International::get(74,$namespace), + addFile=>WebGUI::International::get(74,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"backToPage" @@ -269,8 +277,8 @@ sub www_editDownloadSave { #------------------------------------------------------------------- sub www_moveDownloadDown { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection","-delete-"); - WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort","-delete-"); + WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection","-delete-"); + WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort","-delete-"); $_[0]->moveCollateralUp("FileManager_file","FileManager_fileId",$session{form}{did}); return ""; } @@ -278,8 +286,8 @@ sub www_moveDownloadDown { #------------------------------------------------------------------- sub www_moveDownloadUp { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection","-delete-"); - WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort","-delete-"); + WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection","-delete-"); + WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort","-delete-"); $_[0]->moveCollateralDown("FileManager_file","FileManager_fileId",$session{form}{did}); return ""; } @@ -289,21 +297,21 @@ sub www_view { my ($sortDirection, %var, @fileloop, $files, $sort, $file, $p, $file1, $file2, $file3, $constraints, $url, $numResults, $sql, $flag); $url = WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")); - WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sortDirection",$session{form}{sortDirection}); - WebGUI::Session::setScratch($namespace.".".$_[0]->get("wobjectId").".sort",$session{form}{sort}); + WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection",$session{form}{sortDirection}); + WebGUI::Session::setScratch($_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort",$session{form}{sort}); $numResults = $_[0]->get("paginateAfter") || 25; - $var{"titleColumn.label"} = WebGUI::International::get(14,$namespace); + $var{"titleColumn.label"} = WebGUI::International::get(14,$_[0]->get("namespace")); $var{"titleColumn.url"} = $_[0]->_sortByColumn("fileTitle",$url); - $var{"descriptionColumn.label"} = WebGUI::International::get(15,$namespace); + $var{"descriptionColumn.label"} = WebGUI::International::get(15,$_[0]->get("namespace")); $var{"descriptionColumn.url"} = $_[0]->_sortByColumn("briefSynopsis",$url); - $var{"dateColumn.label"} = WebGUI::International::get(16,$namespace); + $var{"dateColumn.label"} = WebGUI::International::get(16,$_[0]->get("namespace")); $var{"dateColumn.url"} = $_[0]->_sortByColumn("dateUploaded",$url); $session{form}{sort} = "sequenceNumber" if ($session{form}{sort} eq ""); $var{"search.form"} = WebGUI::Search::form({wid=>$_[0]->get("wobjectId"),func=>"view"}); $var{"search.url"} = WebGUI::Search::toggleURL(); $var{"search.label"} = WebGUI::International::get(364); $var{"addfile.url"} = WebGUI::URL::page('func=editDownload&did=new&wid='.$_[0]->get("wobjectId")); - $var{"addfile.label"} = WebGUI::International::get(11,$namespace); + $var{"addfile.label"} = WebGUI::International::get(11,$_[0]->get("namespace")); $sql = "select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId")." "; if ($session{scratch}{search}) { $numResults = $session{scratch}{numResults}; @@ -311,8 +319,8 @@ sub www_view { [qw(fileTitle downloadFile alternateVersion1 alternateVersion2 briefSynopsis)]); $sql .= " and ".$constraints if ($constraints ne ""); } - $sort = $session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sort"} || "sequenceNumber"; - $sortDirection = $session{scratch}{$namespace.".".$_[0]->get("wobjectId").".sortDirection"} || "desc"; + $sort = $session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sort"} || "sequenceNumber"; + $sortDirection = $session{scratch}{$_[0]->get("namespace").".".$_[0]->get("wobjectId").".sortDirection"} || "desc"; $sql .= " order by $sort $sortDirection"; $p = WebGUI::Paginator->new($url,[],$numResults); $p->setDataByQuery($sql); @@ -357,7 +365,7 @@ sub www_view { }); $flag = 1; } - $var{"noresults.message"} = WebGUI::International::get(19,$namespace); + $var{"noresults.message"} = WebGUI::International::get(19,$_[0]->get("namespace")); $var{noresults} = !$flag; $var{file_loop} = \@fileloop; $var{firstPage} = $p->getFirstPageLink; diff --git a/lib/WebGUI/Wobject/HttpProxy.pm b/lib/WebGUI/Wobject/HttpProxy.pm index 89f78bf7d..428f614cb 100644 --- a/lib/WebGUI/Wobject/HttpProxy.pm +++ b/lib/WebGUI/Wobject/HttpProxy.pm @@ -1,7 +1,7 @@ package WebGUI::Wobject::HttpProxy; #------------------------------------------------------------------- -# WebGUI is Copyright 2001-2002 Plain Black LLC. +# 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 @@ -9,7 +9,6 @@ package WebGUI::Wobject::HttpProxy; #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- -# Len Kranendonk - 20021212 use strict; use URI; @@ -26,15 +25,13 @@ use WebGUI::Wobject; use WebGUI::ProxyParse; our @ISA = qw(WebGUI::Wobject); -our $namespace = "HttpProxy"; -our $name = WebGUI::International::get(3,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ proxiedUrl=>$_[0]->get("proxiedUrl"), timeout=>$_[0]->get("timeout"), @@ -47,17 +44,19 @@ sub duplicate { } #------------------------------------------------------------------- -sub new { - my ($self, $class, $property); - $class = shift; - $property = shift; - $self = WebGUI::Wobject->new($property); - bless $self, $class; +sub name { + return WebGUI::International::get(3,$_[0]->get("namespace")); } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(proxiedUrl timeout removeStyle filterHtml followExternal followRedirect cookiebox)]); +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(proxiedUrl timeout removeStyle filterHtml followExternal followRedirect cookiebox)] + ); + bless $self, $class; } #------------------------------------------------------------------- @@ -77,35 +76,35 @@ sub www_edit { %hash=(5=>5,10=>10,20=>20,30=>30,60=>60); %htmlFilter = ('none'=>WebGUI::International::get(420), 'most'=>WebGUI::International::get(421), 'javascript'=>WebGUI::International::get(526), 'all'=>WebGUI::International::get(419)); - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(2,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(2,$_[0]->get("namespace")).'

'; $templatePosition = $_[0]->get("templatePosition") || '0'; $startDate = $_[0]->get("startDate") || $session{page}{startDate}; $endDate = $_[0]->get("endDate") || $session{page}{endDate}; $f = WebGUI::HTMLForm->new; - $f->url("proxiedUrl", WebGUI::International::get(1,$namespace),$_[0]->get("proxiedUrl")||'http://'); + $f->url("proxiedUrl", WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("proxiedUrl")||'http://'); $f->yesNo( -name=>"followExternal", - -label=>WebGUI::International::get(5,$namespace), + -label=>WebGUI::International::get(5,$_[0]->get("namespace")), -value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("followExternal"), -uiLevel=>5 ); $f->yesNo( -name=>"followRedirect", - -label=>WebGUI::International::get(8,$namespace), + -label=>WebGUI::International::get(8,$_[0]->get("namespace")), -value=>$_[0]->get("followRedirect"), -uiLevel=>5 ); $f->yesNo( -name=>"removeStyle", - -label=>WebGUI::International::get(6,$namespace), + -label=>WebGUI::International::get(6,$_[0]->get("namespace")), -value=>($_[0]->get("wobjectId") eq "new") ? 1 : $_[0]->get("removeStyle"), -uiLevel=>5 ); - $f->select("filterHtml",\%htmlFilter,WebGUI::International::get(7,$namespace),[$_[0]->get("filterHtml")||"javascript"]); - $f->select("timeout", \%hash, WebGUI::International::get(4,$namespace),[$_[0]->get("timeout")||30]); - $f->text("cookiebox", WebGUI::International::get(9,$namespace),$_[0]->get("cookiebox")||'/tmp'); + $f->select("filterHtml",\%htmlFilter,WebGUI::International::get(7,$_[0]->get("namespace")),[$_[0]->get("filterHtml")||"javascript"]); + $f->select("timeout", \%hash, WebGUI::International::get(4,$_[0]->get("namespace")),[$_[0]->get("timeout")||30]); + $f->text("cookiebox", WebGUI::International::get(9,$_[0]->get("namespace")),$_[0]->get("cookiebox")||'/tmp'); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; } else { @@ -144,7 +143,7 @@ sub www_view { return "Error while opening cookie directory ".$_[0]->get("cookiebox")."

$!"; } - $cookiebox = $_[0]->get("cookiebox").'/'.$namespace.'_cookie_'.WebGUI::URL::escape($session{var}{sessionId}).'.jar'; + $cookiebox = $_[0]->get("cookiebox").'/'.$_[0]->get("namespace").'_cookie_'.WebGUI::URL::escape($session{var}{sessionId}).'.jar'; $jar = HTTP::Cookies->new(File => $cookiebox, AutoSave => 1); if($session{form}{wid} == $_[0]->get("wobjectId") && $session{form}{func}!~/editSave/i) { diff --git a/lib/WebGUI/Wobject/Item.pm b/lib/WebGUI/Wobject/Item.pm index 17c82e457..53855bf96 100644 --- a/lib/WebGUI/Wobject/Item.pm +++ b/lib/WebGUI/Wobject/Item.pm @@ -24,14 +24,12 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "Item"; -our $name = WebGUI::International::get(4,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w, $f); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::Item->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::Item->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ linkURL=>$_[0]->get("linkURL"), attachment=>$_[0]->get("attachment"), @@ -42,8 +40,19 @@ sub duplicate { } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(linkURL attachment templateId)]); +sub name { + return WebGUI::International::get(4,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(linkURL attachment templateId)] + ); + bless $self, $class; } #------------------------------------------------------------------- @@ -52,15 +61,15 @@ sub www_edit { my ($output, $f, $template); $template = $_[0]->get("templateId") || 1; $output = helpIcon(1,$_[0]->get("namespace")); - $output .= '

'.WebGUI::International::get(6,$namespace).'

'; + $output .= '

'.WebGUI::International::get(6,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->url("linkURL",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("linkURL")); $f->raw($_[0]->fileProperty("attachment",2)); $f->template( -name=>"templateId", -value=>$template, - -namespace=>$namespace, - -label=>WebGUI::International::get(72,$namespace), + -namespace=>$_[0]->get("namespace"), + -label=>WebGUI::International::get(72,$_[0]->get("namespace")), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); diff --git a/lib/WebGUI/Wobject/LinkList.pm b/lib/WebGUI/Wobject/LinkList.pm index 42309de75..a81a7e77c 100644 --- a/lib/WebGUI/Wobject/LinkList.pm +++ b/lib/WebGUI/Wobject/LinkList.pm @@ -22,15 +22,13 @@ use WebGUI::URL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "LinkList"; -our $name = WebGUI::International::get(6,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w, $sth, $row); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::LinkList->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::LinkList->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ templateId=>$_[0]->get("templateId") }); @@ -43,21 +41,33 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub name { + return WebGUI::International::get(6,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(templateId)] + ); + bless $self, $class; +} + #------------------------------------------------------------------- sub purge { WebGUI::SQL->write("delete from LinkList_link where wobjectId=".$_[0]->get("wobjectId")); $_[0]->SUPER::purge(); } -#------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(templateId)]); -} #------------------------------------------------------------------- sub www_deleteLink { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - return $_[0]->confirm(WebGUI::International::get(9,$namespace), + return $_[0]->confirm(WebGUI::International::get(9,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteLinkConfirm&wid='.$session{form}{wid}.'&lid='.$session{form}{lid})); } @@ -79,19 +89,19 @@ sub www_edit { $bullet = $_[0]->get("bullet") || '·'; $lineSpacing = $_[0]->get("lineSpacing") || 1; $indent = $_[0]->get("indent") || 5; - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(10,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(10,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, + -namespace=>$_[0]->get("namespace"), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); if ($_[0]->get("wobjectId") eq "new") { $f->whatNext( -options=>{ - addLink=>WebGUI::International::get(13,$namespace), + addLink=>WebGUI::International::get(13,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"addLink" @@ -125,21 +135,21 @@ sub www_editLink { } else { $newWindow = $link->{newWindow}; } - $output = helpIcon(2,$namespace); - $output .= '

'.WebGUI::International::get(12,$namespace).'

'; + $output = helpIcon(2,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(12,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("lid",$link->{LinkList_linkId}); $f->hidden("func","editLinkSave"); $f->text("name",WebGUI::International::get(99),$link->{name}); - $f->url("url",WebGUI::International::get(8,$namespace),$link->{url}); - $f->yesNo("newWindow",WebGUI::International::get(3,$namespace),$newWindow); + $f->url("url",WebGUI::International::get(8,$_[0]->get("namespace")),$link->{url}); + $f->yesNo("newWindow",WebGUI::International::get(3,$_[0]->get("namespace")),$newWindow); $f->textarea("description",WebGUI::International::get(85),$link->{description}); if ($link->{LinkList_linkId} eq "new") { $f->hidden("sequenceNumber",-1); $f->whatNext( -options=>{ - addLink=>WebGUI::International::get(13,$namespace), + addLink=>WebGUI::International::get(13,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"backToPage" @@ -187,7 +197,7 @@ sub www_moveLinkUp { sub www_view { my (%var, @linkloop, $controls, $link, $sth); $var{"addlink.url"} = WebGUI::URL::page('func=editLink&lid=new&wid='.$_[0]->get("wobjectId")); - $var{"addlink.label"} = WebGUI::International::get(13,$namespace); + $var{"addlink.label"} = WebGUI::International::get(13,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); while ($link = $sth->hashRef) { diff --git a/lib/WebGUI/Wobject/MailForm.pm b/lib/WebGUI/Wobject/MailForm.pm index abfe279a8..1ef585054 100755 --- a/lib/WebGUI/Wobject/MailForm.pm +++ b/lib/WebGUI/Wobject/MailForm.pm @@ -25,8 +25,6 @@ use WebGUI::URL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "MailForm"; -our $name = WebGUI::International::get(1,$namespace); our @fields = qw(width fromField fromStatus toField toStatus ccField ccStatus bccField bccStatus subjectField subjectStatus acknowledgement storeEntries); @@ -36,7 +34,7 @@ sub duplicate { my ($w, %data, $sth); tie %data, 'Tie::CPHash'; $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::MailForm->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::MailForm->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ width=>$_[0]->get("width"), fromField=>$_[0]->get("fromField"), @@ -60,6 +58,22 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + \@fields + ); + bless $self, $class; +} + #------------------------------------------------------------------- sub purge { WebGUI::SQL->write("delete from MailForm_field where wobjectId=".$_[0]->get("wobjectId")); @@ -68,11 +82,6 @@ sub purge { $_[0]->SUPER::purge(); } -#------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[@fields]); -} - #------------------------------------------------------------------- sub uiLevel { return 5; @@ -81,7 +90,7 @@ sub uiLevel { #------------------------------------------------------------------- sub www_deleteField { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - return $_[0]->confirm(WebGUI::International::get(19,$namespace), + return $_[0]->confirm(WebGUI::International::get(19,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteFieldConfirm&wid='.$_[0]->get("wobjectId").'&fid='.$session{form}{fid})); } @@ -97,9 +106,9 @@ sub www_deleteFieldConfirm { sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $f, $proceed); - my %fieldStatus = ( 1 => WebGUI::International::get(4, $namespace), - 2 => WebGUI::International::get(5, $namespace), - 3 => WebGUI::International::get(6, $namespace) ); + my %fieldStatus = ( 1 => WebGUI::International::get(4, $_[0]->get("namespace")), + 2 => WebGUI::International::get(5, $_[0]->get("namespace")), + 3 => WebGUI::International::get(6, $_[0]->get("namespace")) ); # field defaults my %data = ( width => 45, @@ -111,9 +120,9 @@ sub www_edit { ccStatus => 1, bccField => '', bccStatus => 1, - subjectField => WebGUI::International::get(2, $namespace), + subjectField => WebGUI::International::get(2, $_[0]->get("namespace")), subjectStatus => 3, - acknowledgement => WebGUI::International::get(3, $namespace), + acknowledgement => WebGUI::International::get(3, $_[0]->get("namespace")), storeEntries => 1, ); # initialize fields from existing data, if any @@ -125,22 +134,22 @@ sub www_edit { $proceed = 1; } $output = helpIcon(1,$_[0]->get("namespace")); - $output .= '

'.WebGUI::International::get(7, $namespace).'

'; + $output .= '

'.WebGUI::International::get(7, $_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; - $f->integer("width",WebGUI::International::get(8, $namespace),$_[0]->get("width") || 45); - $f->raw( $_[0]->_textSelectRow("fromField",WebGUI::International::get(10, $namespace),$data{fromField},128, + $f->integer("width",WebGUI::International::get(8, $_[0]->get("namespace")),$_[0]->get("width") || 45); + $f->raw( $_[0]->_textSelectRow("fromField",WebGUI::International::get(10, $_[0]->get("namespace")),$data{fromField},128, "fromStatus",\%fieldStatus,$data{fromStatus}) ); - $f->raw( $_[0]->_textSelectRow("toField",WebGUI::International::get(11, $namespace),$data{toField},128, + $f->raw( $_[0]->_textSelectRow("toField",WebGUI::International::get(11, $_[0]->get("namespace")),$data{toField},128, "toStatus",\%fieldStatus,$data{toStatus}) ); - $f->raw( $_[0]->_textSelectRow("ccField",WebGUI::International::get(12, $namespace),$data{ccField},128, + $f->raw( $_[0]->_textSelectRow("ccField",WebGUI::International::get(12, $_[0]->get("namespace")),$data{ccField},128, "ccStatus",\%fieldStatus,$data{ccStatus}) ); - $f->raw( $_[0]->_textSelectRow("bccField",WebGUI::International::get(13, $namespace),$data{bccField},128, + $f->raw( $_[0]->_textSelectRow("bccField",WebGUI::International::get(13, $_[0]->get("namespace")),$data{bccField},128, "bccStatus",\%fieldStatus,$data{bccStatus}) ); - $f->raw( $_[0]->_textSelectRow("subjectField",WebGUI::International::get(14, $namespace),$data{subjectField},128, + $f->raw( $_[0]->_textSelectRow("subjectField",WebGUI::International::get(14, $_[0]->get("namespace")),$data{subjectField},128, "subjectStatus",\%fieldStatus,$data{subjectStatus}) ); - $f->HTMLArea("acknowledgement",WebGUI::International::get(16, $namespace),$_[0]->get("acknowledgement") || WebGUI::International::get(3, $namespace)); - $f->yesNo("storeEntries",WebGUI::International::get(26,$namespace),[ $data{storeEntries} ]); - $f->yesNo("proceed",WebGUI::International::get(15,$namespace),$proceed); + $f->HTMLArea("acknowledgement",WebGUI::International::get(16, $_[0]->get("namespace")),$_[0]->get("acknowledgement") || WebGUI::International::get(3, $_[0]->get("namespace"))); + $f->yesNo("storeEntries",WebGUI::International::get(26,$_[0]->get("namespace")),[ $data{storeEntries} ]); + $f->yesNo("proceed",WebGUI::International::get(15,$_[0]->get("namespace")),$proceed); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; } @@ -168,9 +177,9 @@ sub www_editField { tie %fieldTypes, 'Tie::IxHash'; tie %validation, 'Tie::IxHash'; - %fieldStatus = ( 1 => WebGUI::International::get(4, $namespace), - 2 => WebGUI::International::get(5, $namespace), - 3 => WebGUI::International::get(6, $namespace) ); + %fieldStatus = ( 1 => WebGUI::International::get(4, $_[0]->get("namespace")), + 2 => WebGUI::International::get(5, $_[0]->get("namespace")), + 3 => WebGUI::International::get(6, $_[0]->get("namespace")) ); %fieldTypes = ( text => "Textbox", checkbox => "Checkbox", @@ -193,13 +202,13 @@ sub www_editField { %field = WebGUI::SQL->quickHash("select * from MailForm_field where MailForm_fieldId='$session{form}{fid}'"); $output = helpIcon(2,$_[0]->get("namespace")); - $output .= '

'.WebGUI::International::get(20,$namespace).'

'; + $output .= '

'.WebGUI::International::get(20,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $session{form}{fid} = "new" if ($session{form}{fid} eq ""); $f->hidden("fid",$session{form}{fid}); $f->hidden("func","editFieldSave"); - $f->text("name",WebGUI::International::get(21,$namespace),$field{name}); + $f->text("name",WebGUI::International::get(21,$_[0]->get("namespace")),$field{name}); $f->text( -name=>"subtext", @@ -209,21 +218,21 @@ sub www_editField { ); my $status = [ $field{status} ||= 3 ]; # make it modifiable by default - $f->select("status",\%fieldStatus,WebGUI::International::get(22,$namespace),$status); + $f->select("status",\%fieldStatus,WebGUI::International::get(22,$_[0]->get("namespace")),$status); my $type = [ $field{type} ||= "text" ]; - $f->select("type",\%fieldTypes,WebGUI::International::get(23,$namespace),$type); + $f->select("type",\%fieldTypes,WebGUI::International::get(23,$_[0]->get("namespace")),$type); $f->select("validation",\%validation,"Input validation", [$field{validation} || "none"]); - $f->integer("width",WebGUI::International::get(8, $namespace),$field{width} || $_[0]->get("width") || 45); + $f->integer("width",WebGUI::International::get(8, $_[0]->get("namespace")),$field{width} || $_[0]->get("width") || 45); $f->integer( -name=>"rows", -value=>$field{rows} || "", - -label=>WebGUI::International::get(27, $namespace), - -subtext=>WebGUI::International::get(28, $namespace), + -label=>WebGUI::International::get(27, $_[0]->get("namespace")), + -subtext=>WebGUI::International::get(28, $_[0]->get("namespace")), ); - $f->textarea("possibleValues",WebGUI::International::get(24,$namespace),$field{possibleValues}); - $f->textarea("defaultValue",WebGUI::International::get(25,$namespace),$field{defaultValue}); - $f->yesNo("proceed",WebGUI::International::get(15,$namespace)); + $f->textarea("possibleValues",WebGUI::International::get(24,$_[0]->get("namespace")),$field{possibleValues}); + $f->textarea("defaultValue",WebGUI::International::get(25,$_[0]->get("namespace")),$field{defaultValue}); + $f->yesNo("proceed",WebGUI::International::get(15,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -280,16 +289,16 @@ sub www_view { # get all international text for each field caption my %text = ( - from => WebGUI::International::get(10, $namespace), - to => WebGUI::International::get(11, $namespace), - cc => WebGUI::International::get(12, $namespace), - bcc => WebGUI::International::get(13, $namespace), - subject => WebGUI::International::get(14, $namespace), + from => WebGUI::International::get(10, $_[0]->get("namespace")), + to => WebGUI::International::get(11, $_[0]->get("namespace")), + cc => WebGUI::International::get(12, $_[0]->get("namespace")), + bcc => WebGUI::International::get(13, $_[0]->get("namespace")), + subject => WebGUI::International::get(14, $_[0]->get("namespace")), ); if ($session{var}{adminOn}) { $output .= '' - .WebGUI::International::get(9,$namespace).''; + .WebGUI::International::get(9,$_[0]->get("namespace")).''; } $f = WebGUI::HTMLForm->new(); @@ -343,7 +352,7 @@ sub www_view { $f->raw($row); } - $f->submit(WebGUI::International::get(73, $namespace)); + $f->submit(WebGUI::International::get(73, $_[0]->get("namespace"))); $output .= $f->print; return $output; @@ -637,7 +646,7 @@ sub www_send { $output = $_[0]->displayTitle; $error = $@ if $@; - $output .= ($error || $_[0]->get("acknowledgement"))."

\n".WebGUI::International::get(18, $namespace).""; + $output .= ($error || $_[0]->get("acknowledgement"))."

\n".WebGUI::International::get(18, $_[0]->get("namespace")).""; return $output; } @@ -652,10 +661,10 @@ sub _validate { word => qr/^\w+$/, email => qr/^\s*]+@[^@.<>]+(?:\.[^@.<>]+)+>?\s*$/, ); - my %message = ( notnull => ""$fieldName" ".WebGUI::International::get(29,$namespace), - number => ""$fieldName" ".WebGUI::International::get(30,$namespace), - word => ""$fieldName" ".WebGUI::International::get(31,$namespace), - email => ""$value" " .WebGUI::International::get(32,$namespace), + my %message = ( notnull => ""$fieldName" ".WebGUI::International::get(29,$_[0]->get("namespace")), + number => ""$fieldName" ".WebGUI::International::get(30,$_[0]->get("namespace")), + word => ""$fieldName" ".WebGUI::International::get(31,$_[0]->get("namespace")), + email => ""$value" " .WebGUI::International::get(32,$_[0]->get("namespace")), ); if ($value !~ $regex{$validation}) { diff --git a/lib/WebGUI/Wobject/MessageBoard.pm b/lib/WebGUI/Wobject/MessageBoard.pm index 1b1f59e93..8a13cac7f 100644 --- a/lib/WebGUI/Wobject/MessageBoard.pm +++ b/lib/WebGUI/Wobject/MessageBoard.pm @@ -26,20 +26,34 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "MessageBoard"; -our $name = WebGUI::International::get(2,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::MessageBoard->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::MessageBoard->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ messagesPerPage=>$_[0]->get("messagesPerPage"), templateId=>$_[0]->get("templateId") }); } +#------------------------------------------------------------------- +sub name { + return WebGUI::International::get(2,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(templateId messagesPerPage)] + ); + bless $self, $class; +} + #------------------------------------------------------------------- sub set { $_[0]->SUPER::set($_[1],[qw(templateId messagesPerPage)]); @@ -61,15 +75,15 @@ sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $f, $messagesPerPage); $messagesPerPage = $_[0]->get("messagesPerPage") || 50; - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(6,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(6,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; - $f->integer("messagesPerPage",WebGUI::International::get(4,$namespace),$messagesPerPage); + $f->integer("messagesPerPage",WebGUI::International::get(4,$_[0]->get("namespace")),$messagesPerPage); $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, - -label=>WebGUI::International::get(72,$namespace), + -namespace=>$_[0]->get("namespace"), + -label=>WebGUI::International::get(72,$_[0]->get("namespace")), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); $f->raw($_[0]->SUPER::discussionProperties); @@ -89,7 +103,7 @@ sub www_editSave { #------------------------------------------------------------------- sub www_showMessage { - return $_[0]->SUPER::www_showMessage(''.WebGUI::International::get(11,$namespace).'
'); + return $_[0]->SUPER::www_showMessage(''.WebGUI::International::get(11,$_[0]->get("namespace")).'
'); } #------------------------------------------------------------------- @@ -99,15 +113,15 @@ sub www_view { $var{description} = $_[0]->get("description"); $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToPost")); $var{"post.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); - $var{"post.label"} = WebGUI::International::get(17,$namespace); + $var{"post.label"} = WebGUI::International::get(17,$_[0]->get("namespace")); $var{"search.url"} = WebGUI::URL::page('func=search&wid='.$_[0]->get("wobjectId")); $var{"search.label"} = WebGUI::International::get(364); $var{"subject.label"} = WebGUI::International::get(229); - $var{"user.label"} = WebGUI::International::get(15,$namespace); - $var{"date.label"} = WebGUI::International::get(18,$namespace); + $var{"user.label"} = WebGUI::International::get(15,$_[0]->get("namespace")); + $var{"date.label"} = WebGUI::International::get(18,$_[0]->get("namespace")); $var{"views.label"} = WebGUI::International::get(514); - $var{"replies.label"} = WebGUI::International::get(19,$namespace); - $var{"last.label"} = WebGUI::International::get(20,$namespace); + $var{"replies.label"} = WebGUI::International::get(19,$_[0]->get("namespace")); + $var{"last.label"} = WebGUI::International::get(20,$_[0]->get("namespace")); $p = WebGUI::Paginator->new(WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=view'),[],$_[0]->get("messagesPerPage")); $p->setDataByQuery("select messageId,subject,username,dateOfPost,userId,views,status from discussion where wobjectId=".$_[0]->get("wobjectId")." and pid=0 diff --git a/lib/WebGUI/Wobject/Poll.pm b/lib/WebGUI/Wobject/Poll.pm index 64db08d00..c7b971d93 100644 --- a/lib/WebGUI/Wobject/Poll.pm +++ b/lib/WebGUI/Wobject/Poll.pm @@ -25,15 +25,13 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "Poll"; -our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w, $f, $sth, @row); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::Poll->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::Poll->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ active=>$_[0]->get("active"), randomizeAnswers=>$_[0]->get("randomizeAnswers"), @@ -70,14 +68,25 @@ sub duplicate { } #------------------------------------------------------------------- -sub purge { - WebGUI::SQL->write("delete from Poll_answer where wobjectId=".$_[0]->get("wobjectId")); - $_[0]->SUPER::purge(); +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(active karmaPerVote graphWidth voteGroup question randomizeAnswers a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20)]); +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(active karmaPerVote graphWidth voteGroup question randomizeAnswers a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20)] + ); + bless $self, $class; +} + +#------------------------------------------------------------------- +sub purge { + WebGUI::SQL->write("delete from Poll_answer where wobjectId=".$_[0]->get("wobjectId")); + $_[0]->SUPER::purge(); } #------------------------------------------------------------------- @@ -98,25 +107,25 @@ sub www_edit { $answers .= $_[0]->get("a".$i)."\n"; } } - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(9,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(9,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; - $f->yesNo("active",WebGUI::International::get(3,$namespace),$active); - $f->group("voteGroup",WebGUI::International::get(4,$namespace),[$voteGroup]); + $f->yesNo("active",WebGUI::International::get(3,$_[0]->get("namespace")),$active); + $f->group("voteGroup",WebGUI::International::get(4,$_[0]->get("namespace")),[$voteGroup]); if ($session{setting}{useKarma}) { - $f->integer("karmaPerVote",WebGUI::International::get(20,$namespace),$_[0]->get("karmaPerVote")); + $f->integer("karmaPerVote",WebGUI::International::get(20,$_[0]->get("namespace")),$_[0]->get("karmaPerVote")); } else { $f->hidden("karmaPerVote",$_[0]->get("karmaPerVote")); } - $f->integer("graphWidth",WebGUI::International::get(5,$namespace),$graphWidth); - $f->text("question",WebGUI::International::get(6,$namespace),$_[0]->get("question")); - $f->textarea("answers",WebGUI::International::get(7,$namespace).'
'.WebGUI::International::get(8,$namespace).'
',$answers); - $f->yesNo("randomizeAnswers",WebGUI::International::get(72,$namespace),$randomizeAnswers); + $f->integer("graphWidth",WebGUI::International::get(5,$_[0]->get("namespace")),$graphWidth); + $f->text("question",WebGUI::International::get(6,$_[0]->get("namespace")),$_[0]->get("question")); + $f->textarea("answers",WebGUI::International::get(7,$_[0]->get("namespace")).'
'.WebGUI::International::get(8,$_[0]->get("namespace")).'
',$answers); + $f->yesNo("randomizeAnswers",WebGUI::International::get(72,$_[0]->get("namespace")),$randomizeAnswers); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); if ($_[0]->get("wobjectId") ne "new") { $output .= '

'; $output .= '' - .WebGUI::International::get(10,$namespace).''; + .WebGUI::International::get(10,$_[0]->get("namespace")).''; } return $output; } @@ -181,7 +190,7 @@ sub www_view { $f->raw($answer); } $f->raw('
'); - $f->submit(WebGUI::International::get(11,$namespace)); + $f->submit(WebGUI::International::get(11,$_[0]->get("namespace"))); $output .= $f->print; } else { ($totalResponses) = WebGUI::SQL->quickArray("select count(*) from Poll_answer where wobjectId=".$_[0]->get("wobjectId")); @@ -199,7 +208,7 @@ sub www_view { round(100*$data[0]/$totalResponses).'% ('.($data[0]+0).')'; } } - $output .= '


'.WebGUI::International::get(12,$namespace).' '.$totalResponses.''; + $output .= '
'.WebGUI::International::get(12,$_[0]->get("namespace")).' '.$totalResponses.'
'; } return $output; } @@ -213,7 +222,7 @@ sub www_vote { '$session{form}{answer}', $session{user}{userId}, '$session{env}{REMOTE_ADDR}')"); if ($session{setting}{useKarma}) { $u = WebGUI::User->new($session{user}{userId}); - $u->karma($_[0]->get("karmaPerVote"),$namespace." (".$_[0]->get("wobjectId").")","Voted on this poll."); + $u->karma($_[0]->get("karmaPerVote"),$_[0]->get("namespace")." (".$_[0]->get("wobjectId").")","Voted on this poll."); } } return ""; diff --git a/lib/WebGUI/Wobject/Product.pm b/lib/WebGUI/Wobject/Product.pm index 262c7abdb..bbbe4a073 100644 --- a/lib/WebGUI/Wobject/Product.pm +++ b/lib/WebGUI/Wobject/Product.pm @@ -23,15 +23,13 @@ use WebGUI::URL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "Product"; -our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w, $file, %data, $newId, $sth); tie %data, 'Tie::CPHash'; $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::Product->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::Product->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ image1=>$_[0]->get("image1"), image2=>$_[0]->get("image2"), @@ -90,6 +88,22 @@ sub duplicate { $sth->finish; } +#------------------------------------------------------------------- +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(price templateId productNumber image1 image2 image3 manual brochure warranty)] + ); + bless $self, $class; +} + #------------------------------------------------------------------- sub purge { WebGUI::SQL->write("delete from Product_accessory where wobjectId=".$_[0]->get("wobjectId")." @@ -102,17 +116,13 @@ sub purge { $_[0]->SUPER::purge(); } -#------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(price templateId productNumber image1 image2 image3 manual brochure warranty)]); -} #------------------------------------------------------------------- sub www_addAccessory { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $f, $accessory, @usedAccessories); - $output = helpIcon(4,$namespace); - $output .= '

'.WebGUI::International::get(16,$namespace).'

'; + $output = helpIcon(4,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(16,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("func","addAccessorySave"); @@ -121,8 +131,8 @@ sub www_addAccessory { push(@usedAccessories,$session{form}{wid}); $accessory = WebGUI::SQL->buildHashRef("select wobjectId,title from wobject where namespace='Product' and wobjectId not in (".join(",",@usedAccessories).")"); - $f->select("accessoryWobjectId",$accessory,WebGUI::International::get(17,$namespace)); - $f->yesNo("proceed",WebGUI::International::get(18,$namespace)); + $f->select("accessoryWobjectId",$accessory,WebGUI::International::get(17,$_[0]->get("namespace"))); + $f->yesNo("proceed",WebGUI::International::get(18,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -147,8 +157,8 @@ sub www_addAccessorySave { sub www_addRelated { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $f, $related, @usedRelated); - $output = helpIcon(5,$namespace); - $output .= '

'.WebGUI::International::get(19,$namespace).'

'; + $output = helpIcon(5,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(19,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("func","addRelatedSave"); @@ -157,8 +167,8 @@ sub www_addRelated { push(@usedRelated,$session{form}{wid}); $related = WebGUI::SQL->buildHashRef("select wobjectId,title from wobject where namespace='Product' and wobjectId not in (".join(",",@usedRelated).")"); - $f->select("relatedWobjectId",$related,WebGUI::International::get(20,$namespace)); - $f->yesNo("proceed",WebGUI::International::get(21,$namespace)); + $f->select("relatedWobjectId",$related,WebGUI::International::get(20,$_[0]->get("namespace"))); + $f->yesNo("proceed",WebGUI::International::get(21,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -182,7 +192,7 @@ sub www_addRelatedSave { #------------------------------------------------------------------- sub www_deleteAccessory { return $_[0]->confirm( - WebGUI::International::get(2,$namespace), + WebGUI::International::get(2,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteAccessoryConfirm&wid='.$_[0]->get("wobjectId").'&aid='.$session{form}{aid}) ); } @@ -198,7 +208,7 @@ sub www_deleteAccessoryConfirm { #------------------------------------------------------------------- sub www_deleteBenefit { return $_[0]->confirm( - WebGUI::International::get(48,$namespace), + WebGUI::International::get(48,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteBenefitConfirm&wid='.$_[0]->get("wobjectId").'&bid='.$session{form}{bid}) ); } @@ -214,7 +224,7 @@ sub www_deleteBenefitConfirm { #------------------------------------------------------------------- sub www_deleteFeature { return $_[0]->confirm( - WebGUI::International::get(3,$namespace), + WebGUI::International::get(3,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteFeatureConfirm&wid='.$_[0]->get("wobjectId").'&fid='.$session{form}{fid}) ); } @@ -230,7 +240,7 @@ sub www_deleteFeatureConfirm { #------------------------------------------------------------------- sub www_deleteRelated { return $_[0]->confirm( - WebGUI::International::get(4,$namespace), + WebGUI::International::get(4,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteRelatedConfirm&wid='.$_[0]->get("wobjectId").'&rid='.$session{form}{rid}) ); } @@ -246,7 +256,7 @@ sub www_deleteRelatedConfirm { #------------------------------------------------------------------- sub www_deleteSpecification { return $_[0]->confirm( - WebGUI::International::get(5,$namespace), + WebGUI::International::get(5,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteSpecificationConfirm&wid='.$_[0]->get("wobjectId").'&sid='.$session{form}{sid}) ); } @@ -263,8 +273,8 @@ sub www_deleteSpecificationConfirm { sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($f, $output, $template); - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(6,$namespace).'

'; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(6,$_[0]->get("namespace")).'

'; if ($_[0]->get("wobjectId") eq "new") { $template = 1; } else { @@ -274,12 +284,12 @@ sub www_edit { $f->template( -name=>"templateId", -value=>$template, - -namespace=>$namespace, - -label=>WebGUI::International::get(61,$namespace), + -namespace=>$_[0]->get("namespace"), + -label=>WebGUI::International::get(61,$_[0]->get("namespace")), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); - $f->text("price",WebGUI::International::get(10,$namespace),$_[0]->get("price")); - $f->text("productNumber",WebGUI::International::get(11,$namespace),$_[0]->get("productNumber")); + $f->text("price",WebGUI::International::get(10,$_[0]->get("namespace")),$_[0]->get("price")); + $f->text("productNumber",WebGUI::International::get(11,$_[0]->get("namespace")),$_[0]->get("productNumber")); $f->raw($_[0]->fileProperty("image1",7)); $f->raw($_[0]->fileProperty("image2",8)); $f->raw($_[0]->fileProperty("image3",9)); @@ -325,15 +335,15 @@ sub www_editBenefit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $data, $f, $benefits); $data = $_[0]->getCollateral("Product_benefit","Product_benefitId",$session{form}{bid}); - $output = helpIcon(6,$namespace); - $output .= '

'.WebGUI::International::get(53,$namespace).'

'; + $output = helpIcon(6,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(53,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("bid",$data->{Product_benefitId}); $f->hidden("func","editBenefitSave"); $benefits = WebGUI::SQL->buildHashRef("select benefit,benefit from Product_benefit order by benefit"); - $f->combo("benefit",$benefits,WebGUI::International::get(51,$namespace),[$data->{benefits}]); - $f->yesNo("proceed",WebGUI::International::get(52,$namespace)); + $f->combo("benefit",$benefits,WebGUI::International::get(51,$_[0]->get("namespace")),[$data->{benefits}]); + $f->yesNo("proceed",WebGUI::International::get(52,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -360,15 +370,15 @@ sub www_editFeature { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $data, $f, $features); $data = $_[0]->getCollateral("Product_feature","Product_featureId",$session{form}{fid}); - $output = helpIcon(2,$namespace); - $output .= '

'.WebGUI::International::get(22,$namespace).'

'; + $output = helpIcon(2,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(22,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("fid",$data->{Product_featureId}); $f->hidden("func","editFeatureSave"); $features = WebGUI::SQL->buildHashRef("select feature,feature from Product_feature order by feature"); - $f->combo("feature",$features,WebGUI::International::get(23,$namespace),[$data->{feature}]); - $f->yesNo("proceed",WebGUI::International::get(24,$namespace)); + $f->combo("feature",$features,WebGUI::International::get(23,$_[0]->get("namespace")),[$data->{feature}]); + $f->yesNo("proceed",WebGUI::International::get(24,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -395,18 +405,18 @@ sub www_editSpecification { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $data, $f, $hashRef); $data = $_[0]->getCollateral("Product_specification","Product_specificationId",$session{form}{sid}); - $output = helpIcon(3,$namespace); - $output .= '

'.WebGUI::International::get(25,$namespace).'

'; + $output = helpIcon(3,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(25,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); $f->hidden("sid",$data->{Product_specificationId}); $f->hidden("func","editSpecificationSave"); $hashRef = WebGUI::SQL->buildHashRef("select name,name from Product_specification order by name"); - $f->combo("name",$hashRef,WebGUI::International::get(26,$namespace),[$data->{name}]); - $f->text("value",WebGUI::International::get(27,$namespace),$data->{value}); + $f->combo("name",$hashRef,WebGUI::International::get(26,$_[0]->get("namespace")),[$data->{name}]); + $f->text("value",WebGUI::International::get(27,$_[0]->get("namespace")),$data->{value}); $hashRef = WebGUI::SQL->buildHashRef("select units,units from Product_specification order by units"); - $f->combo("units",$hashRef,WebGUI::International::get(29,$namespace),[$data->{units}]); - $f->yesNo("proceed",WebGUI::International::get(28,$namespace)); + $f->combo("units",$hashRef,WebGUI::International::get(29,$_[0]->get("namespace")),[$data->{units}]); + $f->yesNo("proceed",WebGUI::International::get(28,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -509,21 +519,21 @@ sub www_view { if ($_[0]->get("brochure")) { $file = WebGUI::Attachment->new($_[0]->get("brochure"),$_[0]->get("wobjectId")); $var{"brochure.icon"} = $file->getIcon; - $var{"brochure.label"} = WebGUI::International::get(13,$namespace); + $var{"brochure.label"} = WebGUI::International::get(13,$_[0]->get("namespace")); $var{"brochure.URL"} = $file->getURL; } #---manual if ($_[0]->get("manual")) { $file = WebGUI::Attachment->new($_[0]->get("manual"),$_[0]->get("wobjectId")); $var{"manual.icon"} = $file->getIcon; - $var{"manual.label"} = WebGUI::International::get(14,$namespace); + $var{"manual.label"} = WebGUI::International::get(14,$_[0]->get("namespace")); $var{"manual.URL"} = $file->getURL; } #---warranty if ($_[0]->get("warranty")) { $file = WebGUI::Attachment->new($_[0]->get("warranty"),$_[0]->get("wobjectId")); $var{"warranty.icon"} = $file->getIcon; - $var{"warranty.label"} = WebGUI::International::get(15,$namespace); + $var{"warranty.label"} = WebGUI::International::get(15,$_[0]->get("namespace")); $var{"warranty.URL"} = $file->getURL; } #---image1 @@ -547,7 +557,7 @@ sub www_view { #---features $var{"addFeature.url"} = WebGUI::URL::page('func=editFeature&fid=new&wid='.$_[0]->get("wobjectId")); - $var{"addFeature.label"} = WebGUI::International::get(34,$namespace); + $var{"addFeature.label"} = WebGUI::International::get(34,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select feature,Product_featureId from Product_feature where wobjectId=" .$_[0]->get("wobjectId")." order by sequenceNumber"); while (%data = $sth->hash) { @@ -565,7 +575,7 @@ sub www_view { #---benefits $var{"addBenefit.url"} = WebGUI::URL::page('func=editBenefit&fid=new&wid='.$_[0]->get("wobjectId")); - $var{"addBenefit.label"} = WebGUI::International::get(55,$namespace); + $var{"addBenefit.label"} = WebGUI::International::get(55,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select benefit,Product_benefitId from Product_benefit where wobjectId=" .$_[0]->get("wobjectId")." order by sequenceNumber"); while (%data = $sth->hash) { @@ -583,7 +593,7 @@ sub www_view { #---specifications $var{"addSpecification.url"} = WebGUI::URL::page('func=editSpecification&sid=new&wid='.$_[0]->get("wobjectId")); - $var{"addSpecification.label"} = WebGUI::International::get(35,$namespace); + $var{"addSpecification.label"} = WebGUI::International::get(35,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select name,value,units,Product_specificationId from Product_specification where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); while (%data = $sth->hash) { @@ -603,7 +613,7 @@ sub www_view { #---accessories $var{"addaccessory.url"} = WebGUI::URL::page('func=addAccessory&wid='.$_[0]->get("wobjectId")); - $var{"addaccessory.label"} = WebGUI::International::get(36,$namespace); + $var{"addaccessory.label"} = WebGUI::International::get(36,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_accessory.accessoryWobjectId from Product_accessory,wobject,page where Product_accessory.wobjectId=".$_[0]->get("wobjectId")." @@ -624,7 +634,7 @@ sub www_view { #---related $var{"addrelatedproduct.url"} = WebGUI::URL::page('func=addRelated&wid='.$_[0]->get("wobjectId")); - $var{"addrelatedproduct.label"} = WebGUI::International::get(37,$namespace); + $var{"addrelatedproduct.label"} = WebGUI::International::get(37,$_[0]->get("namespace")); $sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_related.relatedWobjectId from Product_related,wobject,page where Product_related.wobjectId=".$_[0]->get("wobjectId")." diff --git a/lib/WebGUI/Wobject/SQLReport.pm b/lib/WebGUI/Wobject/SQLReport.pm index 04fc73953..4e16c07f0 100644 --- a/lib/WebGUI/Wobject/SQLReport.pm +++ b/lib/WebGUI/Wobject/SQLReport.pm @@ -25,14 +25,12 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "SQLReport"; -our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::SQLReport->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::SQLReport->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ template=>$_[0]->get("template"), dbQuery=>$_[0]->get("dbQuery"), @@ -47,8 +45,20 @@ sub duplicate { } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)]); +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); +} + + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(template dbQuery DSN username identifier convertCarriageReturns paginateAfter preprocessMacros debugMode)] + ); + bless $self, $class; } #------------------------------------------------------------------- @@ -64,17 +74,17 @@ sub www_edit { $username = $_[0]->get("username") || $session{config}{dbuser}; $paginateAfter = $_[0]->get("paginateAfter") || 50; $f = WebGUI::HTMLForm->new; - $output = helpIcon(1,$namespace); - $output .= '

'.WebGUI::International::get(8,$namespace).'

'; - $f->yesNo("preprocessMacros",WebGUI::International::get(15,$namespace),$_[0]->get("preprocessMacros")); - $f->yesNo("debugMode",WebGUI::International::get(16,$namespace),$_[0]->get("debugMode")); - $f->textarea("dbQuery",WebGUI::International::get(4,$namespace),$_[0]->get("dbQuery")); - $f->textarea("template",WebGUI::International::get(3,$namespace),$_[0]->get("template")); - $f->text("DSN",WebGUI::International::get(5,$namespace),$dsn); - $f->text("username",WebGUI::International::get(6,$namespace),$username); - $f->password("identifier",WebGUI::International::get(7,$namespace),$_[0]->get("identifier")); - $f->integer("paginateAfter",WebGUI::International::get(14,$namespace),$paginateAfter); - $f->yesNo("convertCarriageReturns",WebGUI::International::get(13,$namespace),$_[0]->get("convertCarriageReturns")); + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

'.WebGUI::International::get(8,$_[0]->get("namespace")).'

'; + $f->yesNo("preprocessMacros",WebGUI::International::get(15,$_[0]->get("namespace")),$_[0]->get("preprocessMacros")); + $f->yesNo("debugMode",WebGUI::International::get(16,$_[0]->get("namespace")),$_[0]->get("debugMode")); + $f->textarea("dbQuery",WebGUI::International::get(4,$_[0]->get("namespace")),$_[0]->get("dbQuery")); + $f->textarea("template",WebGUI::International::get(3,$_[0]->get("namespace")),$_[0]->get("template")); + $f->text("DSN",WebGUI::International::get(5,$_[0]->get("namespace")),$dsn); + $f->text("username",WebGUI::International::get(6,$_[0]->get("namespace")),$username); + $f->password("identifier",WebGUI::International::get(7,$_[0]->get("namespace")),$_[0]->get("identifier")); + $f->integer("paginateAfter",WebGUI::International::get(14,$_[0]->get("namespace")),$paginateAfter); + $f->yesNo("convertCarriageReturns",WebGUI::International::get(13,$_[0]->get("namespace")),$_[0]->get("convertCarriageReturns")); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; } @@ -107,7 +117,7 @@ sub www_view { $dsn = $_[0]->get("DSN"); $output = $_[0]->displayTitle; $output .= $_[0]->description; - $output .= WebGUI::International::get(17,$namespace)." ".$query."

" if ($_[0]->get("debugMode")); + $output .= WebGUI::International::get(17,$_[0]->get("namespace"))." ".$query."

" if ($_[0]->get("debugMode")); if ($dsn eq $session{config}{dsn}) { $dbh = $session{dbh}; } elsif ($dsn =~ /\DBI\:\w+\:\w+/) { @@ -117,7 +127,7 @@ sub www_view { undef $dbh; } } else { - $output .= WebGUI::International::get(9,$namespace).'

' if ($_[0]->get("debugMode")); + $output .= WebGUI::International::get(9,$_[0]->get("namespace")).'

' if ($_[0]->get("debugMode")); WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] The DSN specified is of an improper format."); } if (defined $dbh) { @@ -125,7 +135,7 @@ sub www_view { $sth = WebGUI::SQL->unconditionalRead($query,$dbh); unless ($sth->errorCode < 1) { $errorMessage = $sth->errorMessage; - $output .= WebGUI::International::get(11,$namespace).' : '.$errorMessage.'

' if ($_[0]->get("debugMode")); + $output .= WebGUI::International::get(11,$_[0]->get("namespace")).' : '.$errorMessage.'

' if ($_[0]->get("debugMode")); WebGUI::ErrorHandler::warn("There was a problem with the query: ".$errorMessage); } else { if ($_[0]->get("template") ne "") { @@ -158,7 +168,7 @@ sub www_view { } if ($sth->rows < 1) { $output .= $template[2]; - $output .= WebGUI::International::get(18,$namespace).'

'; + $output .= WebGUI::International::get(18,$_[0]->get("namespace")).'

'; } else { $url = WebGUI::URL::page('&wid='.$_[0]->get("wobjectId").'&func=view'); foreach (keys %{$session{form}}) { @@ -175,12 +185,12 @@ sub www_view { $sth->finish; } } else { - $output .= WebGUI::International::get(10,$namespace).'

' if ($_[0]->get("debugMode")); + $output .= WebGUI::International::get(10,$_[0]->get("namespace")).'

' if ($_[0]->get("debugMode")); WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] The SQL query is improperly formatted."); } $dbh->disconnect() unless ($dsn eq $session{config}{dsn}); } else { - $output .= WebGUI::International::get(12,$namespace).'

' if ($_[0]->get("debugMode")); + $output .= WebGUI::International::get(12,$_[0]->get("namespace")).'

' if ($_[0]->get("debugMode")); WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] Could not connect to database."); } return $output; diff --git a/lib/WebGUI/Wobject/SiteMap.pm b/lib/WebGUI/Wobject/SiteMap.pm index 02b304dea..edba25913 100644 --- a/lib/WebGUI/Wobject/SiteMap.pm +++ b/lib/WebGUI/Wobject/SiteMap.pm @@ -22,8 +22,6 @@ use WebGUI::URL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "SiteMap"; -our $name = WebGUI::International::get(2,$namespace); #------------------------------------------------------------------- sub _traversePageTree { @@ -61,7 +59,7 @@ sub _traversePageTree { sub duplicate { my ($w, $f); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::SiteMap->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::SiteMap->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ startAtThisLevel=>$_[0]->get("startAtThisLevel"), templateId=>$_[0]->get("templateId"), @@ -71,10 +69,22 @@ sub duplicate { } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(startAtThisLevel indent templateId depth)]); +sub name { + return WebGUI::International::get(2,$_[0]->get("namespace")); } +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(startAtThisLevel indent templateId depth)] + ); + bless $self, $class; +} + + #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); @@ -88,26 +98,26 @@ sub www_edit { and (pageId=1 or pageId>999) order by title"); $indent = $_[0]->get("indent") || 5; $output = helpIcon(1,$_[0]->get("namespace")); - $output .= '

'.WebGUI::International::get(5,$namespace).'

'; + $output .= '

'.WebGUI::International::get(5,$_[0]->get("namespace")).'

'; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, + -namespace=>$_[0]->get("namespace"), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); $f->select( -name=>"startAtThisLevel", - -label=>WebGUI::International::get(3,$namespace), + -label=>WebGUI::International::get(3,$_[0]->get("namespace")), -value=>[$startLevel], -options=>{ - 0=>WebGUI::International::get(75,$namespace), - $session{page}{pageId}=>WebGUI::International::get(74,$namespace), + 0=>WebGUI::International::get(75,$_[0]->get("namespace")), + $session{page}{pageId}=>WebGUI::International::get(74,$_[0]->get("namespace")), %{$options} } ); - $f->integer("depth",WebGUI::International::get(4,$namespace),$_[0]->get("depth")); - $f->integer("indent",WebGUI::International::get(6,$namespace),$indent); + $f->integer("depth",WebGUI::International::get(4,$_[0]->get("namespace")),$_[0]->get("depth")); + $f->integer("indent",WebGUI::International::get(6,$_[0]->get("namespace")),$indent); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; } diff --git a/lib/WebGUI/Wobject/Survey.pm b/lib/WebGUI/Wobject/Survey.pm index 779d22edb..e4fee1098 100644 --- a/lib/WebGUI/Wobject/Survey.pm +++ b/lib/WebGUI/Wobject/Survey.pm @@ -24,8 +24,6 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "Survey"; -our $name = WebGUI::International::get(1,$namespace); #------------------------------------------------------------------- @@ -34,7 +32,7 @@ sub _addAnswer { Survey_id=>$_[0]->get("Survey_id"), Survey_questionId=>$_[2], Survey_answerId=>"new", - answer=>WebGUI::International::get($_[1],$namespace) + answer=>WebGUI::International::get($_[1],$_[0]->get("namespace")) },1,0,"Survey_id"); } @@ -55,13 +53,13 @@ sub _submenu { '; $output .= $_[1]; $output .= ''; - $output .= '
  • '.WebGUI::International::get(62,$namespace).''; - $output .= '
  • '.WebGUI::International::get(63,$namespace).''; - $output .= '
  • '.WebGUI::International::get(64,$namespace).''; - $output .= '
  • '.WebGUI::International::get(65,$namespace).''; - $output .= '
  • '.WebGUI::International::get(61,$namespace).''; - $output .= '
  • '.WebGUI::International::get(59,$namespace).''; - $output .= '
  • '.WebGUI::International::get(60,$namespace).''; + $output .= '
  • '.WebGUI::International::get(62,$_[0]->get("namespace")).''; + $output .= '
  • '.WebGUI::International::get(63,$_[0]->get("namespace")).''; + $output .= '
  • '.WebGUI::International::get(64,$_[0]->get("namespace")).''; + $output .= '
  • '.WebGUI::International::get(65,$_[0]->get("namespace")).''; + $output .= '
  • '.WebGUI::International::get(61,$_[0]->get("namespace")).''; + $output .= '
  • '.WebGUI::International::get(59,$_[0]->get("namespace")).''; + $output .= '
  • '.WebGUI::International::get(60,$_[0]->get("namespace")).''; $output .= ''; return $output; } @@ -70,7 +68,7 @@ sub _submenu { sub duplicate { my ($w, $newSurveyId, $qdata, $adata, $rdata, $a, $b, $c); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::Survey->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::Survey->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $newSurveyId = getNextId("Survey_id"); $w->set({ questionOrder=>$_[0]->get("questionOrder"), @@ -108,6 +106,22 @@ sub duplicate { $a->finish; } +#------------------------------------------------------------------- +sub name { + return WebGUI::International::get(1,$_[0]->get("namespace")); +} + +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(Survey_id questionOrder groupToTakeSurvey groupToViewReports mode)] + ); + bless $self, $class; +} + #------------------------------------------------------------------- sub purge { my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey where Survey_id=".$_[0]->get("Survey_id")); @@ -119,10 +133,6 @@ sub purge { $_[0]->SUPER::purge(); } -#------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(Survey_id questionOrder groupToTakeSurvey groupToViewReports mode)]); -} #------------------------------------------------------------------- sub uiLevel { @@ -132,7 +142,7 @@ sub uiLevel { #------------------------------------------------------------------- sub www_deleteAnswer { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - return $_[0]->confirm(WebGUI::International::get(45,$namespace), + return $_[0]->confirm(WebGUI::International::get(45,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteAnswerConfirm&wid='.$_[0]->get("wobjectId").'&aid=' .$session{form}{aid}.'&qid='.$session{form}{qid})); } @@ -149,7 +159,7 @@ sub www_deleteAnswerConfirm { #------------------------------------------------------------------- sub www_deleteQuestion { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - return $_[0]->confirm(WebGUI::International::get(44,$namespace), + return $_[0]->confirm(WebGUI::International::get(44,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteQuestionConfirm&wid='.$_[0]->get("wobjectId").'&qid='.$session{form}{qid})); } @@ -166,7 +176,7 @@ sub www_deleteQuestionConfirm { #------------------------------------------------------------------- sub www_deleteResponses { return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))); - return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(72,$namespace), + return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(72,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteResponsesConfirm&wid='.$_[0]->get("wobjectId").'&uid=' .$session{form}{uid}.'&ip='.$session{form}{ip}))); } @@ -182,7 +192,7 @@ sub www_deleteResponsesConfirm { #------------------------------------------------------------------- sub www_deleteAllResponses { return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))); - return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(74,$namespace), + return $_[0]->_submenu($_[0]->confirm(WebGUI::International::get(74,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteAllResponsesConfirm&wid='.$_[0]->get("wobjectId")))); } @@ -203,43 +213,43 @@ sub www_edit { $groupToViewReports = $_[0]->get("groupToViewReports") || 4; $groupToTakeSurvey = $_[0]->get("groupToTakeSurvey") || 2; $surveyId = $_[0]->get("Survey_id") || getNextId("Survey_id"); - $output = helpIcon(1,$namespace); - $output .= '

    '.WebGUI::International::get(2,$namespace).'

    '; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

    '.WebGUI::International::get(2,$_[0]->get("namespace")).'

    '; $f = WebGUI::HTMLForm->new; $f->hidden("Survey_id",$surveyId); $f->select( -name=>"questionOrder", -options=>{ - sequential => WebGUI::International::get(5,$namespace), - random => WebGUI::International::get(6,$namespace), - response => WebGUI::International::get(7,$namespace) + sequential => WebGUI::International::get(5,$_[0]->get("namespace")), + random => WebGUI::International::get(6,$_[0]->get("namespace")), + response => WebGUI::International::get(7,$_[0]->get("namespace")) }, - -label=>WebGUI::International::get(8,$namespace), + -label=>WebGUI::International::get(8,$_[0]->get("namespace")), -value=>[$questionOrder] ); $f->select( -name=>"mode", -options=>{ - survey => WebGUI::International::get(9,$namespace), - quiz => WebGUI::International::get(10,$namespace) + survey => WebGUI::International::get(9,$_[0]->get("namespace")), + quiz => WebGUI::International::get(10,$_[0]->get("namespace")) }, - -label=>WebGUI::International::get(11,$namespace), + -label=>WebGUI::International::get(11,$_[0]->get("namespace")), -value=>[$mode] ); $f->group( -name=>"groupToTakeSurvey", -value=>[$groupToTakeSurvey], - -label=>WebGUI::International::get(12,$namespace) + -label=>WebGUI::International::get(12,$_[0]->get("namespace")) ); $f->group( -name=>"groupToViewReports", - -label=>WebGUI::International::get(13,$namespace), + -label=>WebGUI::International::get(13,$_[0]->get("namespace")), -value=>[$groupToViewReports] ); if ($_[0]->get("wobjectId") eq "new") { $f->whatNext( -options=>{ - addQuestion=>WebGUI::International::get(28,$namespace), + addQuestion=>WebGUI::International::get(28,$_[0]->get("namespace")), backToPage=>WebGUI::International::get(745) }, -value=>"addQuestion" @@ -248,7 +258,7 @@ sub www_edit { $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); if ($_[0]->get("wobjectId") ne "new") { $output .= ''.WebGUI::International::get(30,$namespace).'

    '; + .'">'.WebGUI::International::get(30,$_[0]->get("namespace")).'

    '; $sth = WebGUI::SQL->read("select Survey_questionId,question from Survey_question where Survey_id=" .$_[0]->get("Survey_id")." order by sequenceNumber"); while (%data = $sth->hash) { @@ -285,7 +295,7 @@ sub www_editAnswer { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($question, $output, $f, $answer); $answer = $_[0]->getCollateral("Survey_answer","Survey_answerId",$session{form}{aid}); - $output = '

    '.WebGUI::International::get(18,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(18,$_[0]->get("namespace")).'

    '; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$session{form}{wid}); $f->hidden("func","editAnswerSave"); @@ -294,13 +304,13 @@ sub www_editAnswer { $f->text( -name=>"answer", -value=>$answer->{answer}, - -label=>WebGUI::International::get(19,$namespace) + -label=>WebGUI::International::get(19,$_[0]->get("namespace")) ); if ($_[0]->get("mode") eq "quiz") { $f->yesNo( -name=>"isCorrect", -value=>$answer->{isCorrect}, - -label=>WebGUI::International::get(20,$namespace) + -label=>WebGUI::International::get(20,$_[0]->get("namespace")) ); } else { $f->hidden("isCorrect",0); @@ -312,16 +322,16 @@ sub www_editAnswer { -name=>"gotoQuestion", -options=>$question, -value=>[$answer->{gotoQuestion}], - -label=>WebGUI::International::get(21,$namespace) + -label=>WebGUI::International::get(21,$_[0]->get("namespace")) ); } if ($answer->{Survey_answerId} eq "new") { my %options; tie %options, 'Tie::IxHash'; %options = ( - "addAnswer"=>WebGUI::International::get(24,$namespace), - "addQuestion"=>WebGUI::International::get(28,$namespace), - "editQuestion"=>WebGUI::International::get(75,$namespace), + "addAnswer"=>WebGUI::International::get(24,$_[0]->get("namespace")), + "addQuestion"=>WebGUI::International::get(28,$_[0]->get("namespace")), + "editQuestion"=>WebGUI::International::get(75,$_[0]->get("namespace")), "backToPage"=>WebGUI::International::get(745) ); $f->whatNext( @@ -362,7 +372,7 @@ sub www_editQuestion { my ($output, $f, $question, $answerFieldType, $sth, %data); tie %data, 'Tie::CPHash'; $question = $_[0]->getCollateral("Survey_question","Survey_questionId",$session{form}{qid}); - $output = '

    '.WebGUI::International::get(17,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(17,$_[0]->get("namespace")).'

    '; $answerFieldType = $question->{answerFieldType} || "radioList"; $f = WebGUI::HTMLForm->new; $f->hidden("wid",$_[0]->get("wobjectId")); @@ -372,28 +382,28 @@ sub www_editQuestion { $f->HTMLArea( -name=>"question", -value=>$question->{question}, - -label=>WebGUI::International::get(14,$namespace) + -label=>WebGUI::International::get(14,$_[0]->get("namespace")) ); $f->yesNo( -name=>"allowComment", -value=>$question->{allowComment}, - -label=>WebGUI::International::get(15,$namespace) + -label=>WebGUI::International::get(15,$_[0]->get("namespace")) ); $f->yesNo( -name=>"randomizeAnswers", -value=>$question->{randomizeAnswers}, - -label=>WebGUI::International::get(16,$namespace) + -label=>WebGUI::International::get(16,$_[0]->get("namespace")) ); if ($question->{Survey_questionId} eq "new") { my %options; tie %options, 'Tie::IxHash'; %options = ( - "addMultipleChoiceAnswer"=>WebGUI::International::get(24,$namespace), - "addTextAnswer"=>WebGUI::International::get(29,$namespace), - "addBooleanAnswer"=>WebGUI::International::get(25,$namespace), - "addFrequencyAnswer"=>WebGUI::International::get(26,$namespace), - "addOpinionAnswer"=>WebGUI::International::get(27,$namespace), - #"addQuestion"=>WebGUI::International::get(28,$namespace), + "addMultipleChoiceAnswer"=>WebGUI::International::get(24,$_[0]->get("namespace")), + "addTextAnswer"=>WebGUI::International::get(29,$_[0]->get("namespace")), + "addBooleanAnswer"=>WebGUI::International::get(25,$_[0]->get("namespace")), + "addFrequencyAnswer"=>WebGUI::International::get(26,$_[0]->get("namespace")), + "addOpinionAnswer"=>WebGUI::International::get(27,$_[0]->get("namespace")), + #"addQuestion"=>WebGUI::International::get(28,$_[0]->get("namespace")), "backToPage"=>WebGUI::International::get(745) ); $f->whatNext( @@ -405,7 +415,7 @@ sub www_editQuestion { $output .= $f->print; if ($question->{Survey_questionId} ne "new" && $question->{answerFieldType} ne "text") { $output .= '{Survey_questionId}).'">'.WebGUI::International::get(23,$namespace).'

    '; + .$question->{Survey_questionId}).'">'.WebGUI::International::get(23,$_[0]->get("namespace")).'

    '; $sth = WebGUI::SQL->read("select Survey_answerId,answer from Survey_answer where Survey_questionId=".$question->{Survey_questionId}." order by sequenceNumber"); while (%data = $sth->hash) { @@ -564,7 +574,7 @@ sub www_view { $output .= $_[0]->description; if (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))) { $output .= '' - .WebGUI::International::get(68,$namespace).'

    '; + .WebGUI::International::get(68,$_[0]->get("namespace")).'

    '; } if (WebGUI::Privilege::isInGroup($_[0]->get("groupToTakeSurvey"))) { $previousResponse = WebGUI::SQL->quickHashRef("select Survey_questionId, Survey_answerId from Survey_response @@ -645,16 +655,16 @@ sub www_view { if ($question->{allowComment}) { $f->textarea( -name=>"comment", - -label=>WebGUI::International::get(51,$namespace) + -label=>WebGUI::International::get(51,$_[0]->get("namespace")) ); } - $f->submit(WebGUI::International::get(50,$namespace)); + $f->submit(WebGUI::International::get(50,$_[0]->get("namespace"))); $output .= $f->print; } else { if ($_[0]->get("mode") eq "survey") { - $output .= WebGUI::International::get(46,$namespace); + $output .= WebGUI::International::get(46,$_[0]->get("namespace")); } else { - $output .= WebGUI::International::get(47,$namespace); + $output .= WebGUI::International::get(47,$_[0]->get("namespace")); my ($questionCount) = WebGUI::SQL->quickArray("select count(*) from Survey_question where Survey_id=".$_[0]->get("Survey_id")); my ($correctCount) = WebGUI::SQL->quickArray("select count(*) from Survey_response a, @@ -663,18 +673,18 @@ sub www_view { (userId=1 and ipAddress='$session{env}{REMOTE_ADDR}')) and a.Survey_answerId=b.Survey_answerId and b.isCorrect=1"); if ($questionCount > 0) { - $output .= "

    ".WebGUI::International::get(52,$namespace).": " + $output .= "

    ".WebGUI::International::get(52,$_[0]->get("namespace")).": " .$correctCount."/".$questionCount - ."
    ".WebGUI::International::get(54,$namespace).": " + ."
    ".WebGUI::International::get(54,$_[0]->get("namespace")).": " .round(($correctCount/$questionCount)*100)."%

    "; } } } } else { if ($_[0]->get("mode") eq "survey") { - $output .= WebGUI::International::get(48,$namespace); + $output .= WebGUI::International::get(48,$_[0]->get("namespace")); } else { - $output .= WebGUI::International::get(49,$namespace); + $output .= WebGUI::International::get(49,$_[0]->get("namespace")); } } return $output; @@ -684,7 +694,7 @@ sub www_view { sub www_viewComments { return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))); my ($output, $sth, $comment); - $output = '

    '.WebGUI::International::get(57,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(57,$_[0]->get("namespace")).'

    '; $sth = WebGUI::SQL->read("select comment from Survey_response where Survey_questionId=".$session{form}{qid}); while (($comment) = $sth->array) { $output .= $comment."

    \n"; @@ -697,7 +707,7 @@ sub www_viewComments { sub www_viewGradebook { return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))); my ($output, $p, $users, $user); - $output = '

    '.WebGUI::International::get(71,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(71,$_[0]->get("namespace")).'

    '; $p = WebGUI::Paginator->new('func=viewGradebook&wid='.$_[0]->get("wobjectId")); $p->setDataByQuery("select userId,username,ipAddress from Survey_response group by userId,username,ipAddress order by username,ipAddress"); @@ -705,9 +715,9 @@ sub www_viewGradebook { my ($questionCount) = WebGUI::SQL->quickArray("select count(*) from Survey_question where Survey_id=".$_[0]->get("Survey_id")); $output .= ''; - $output .= ' - - '; + $output .= ' + + '; foreach $user (@$users) { $output .= ''; $output .= '
    '.WebGUI::International::get(67,$namespace).''.WebGUI::International::get(52,$namespace).''.WebGUI::International::get(54,$namespace).'
    '.WebGUI::International::get(67,$_[0]->get("namespace")).''.WebGUI::International::get(52,$_[0]->get("namespace")).''.WebGUI::International::get(54,$_[0]->get("namespace")).'
    get("groupToViewReports"))); my ($output, $questions, $sth, $qdata, $rdata, $adata, $p); - $output = '

    '.WebGUI::International::get(70,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(70,$_[0]->get("namespace")).'

    '; $output .= '
    '.WebGUI::International::get(69,$namespace).'

    '; + .'&uid='.$session{form}{uid}.'&ip='.$session{form}{ip}).'">'.WebGUI::International::get(69,$_[0]->get("namespace")).'

    '; my ($start) = WebGUI::SQL->quickArray("select min(dateOfResponse) from Survey_response where Survey_id=".$_[0]->get("Survey_id")." and ((userId=".$session{form}{uid}." and userId<>1) or (userId=1 and ipAddress='".$session{form}{ip}."'))"); my ($end) = WebGUI::SQL->quickArray("select max(dateOfResponse) from Survey_response where Survey_id=".$_[0]->get("Survey_id")." and ((userId=".$session{form}{uid}." and userId<>1) or (userId=1 and ipAddress='".$session{form}{ip}."'))"); - $output .= ''.WebGUI::International::get(76,$namespace).': '.epochToHuman($start).'
    '; - $output .= ''.WebGUI::International::get(77,$namespace).': '.epochToHuman($end).'
    '; - $output .= ''.WebGUI::International::get(78,$namespace).': '.int(($end-$start)/60).' ' - .WebGUI::International::get(79,$namespace).', '.(($end-$start)%60).' ' - .WebGUI::International::get(80,$namespace).'

    '; + $output .= ''.WebGUI::International::get(76,$_[0]->get("namespace")).': '.epochToHuman($start).'
    '; + $output .= ''.WebGUI::International::get(77,$_[0]->get("namespace")).': '.epochToHuman($end).'
    '; + $output .= ''.WebGUI::International::get(78,$_[0]->get("namespace")).': '.int(($end-$start)/60).' ' + .WebGUI::International::get(79,$_[0]->get("namespace")).', '.(($end-$start)%60).' ' + .WebGUI::International::get(80,$_[0]->get("namespace")).'

    '; $p = WebGUI::Paginator->new(WebGUI::URL::page('func=viewIndividualSurvey&wid='.$_[0]->get("wobjectId") .'&uid='.$session{form}{uid}.'&ip='.$session{form}{ip})); $p->setDataByQuery("select Survey_questionId,question,answerFieldType from Survey_question @@ -761,7 +771,7 @@ sub www_viewIndividualSurvey { .''; if ($qdata->{answerFieldType} eq "radioList") { $output .= ''; } $output .= ''; + .WebGUI::International::get(66,$_[0]->get("namespace")).''; $rdata = WebGUI::SQL->quickHashRef("select Survey_answerId,response,comment from Survey_response where Survey_questionId=".$qdata->{Survey_questionId}." and ((userId=".$session{form}{uid}." and userId<>1) @@ -779,7 +789,7 @@ sub www_viewIndividualSurvey { $output .= ''; if ($rdata->{comment} ne "") { $output .= '' + .WebGUI::International::get(57,$_[0]->get("namespace")).'' .''; } $output .= "
    ' - .WebGUI::International::get(19,$namespace).''; + .WebGUI::International::get(19,$_[0]->get("namespace")).''; $sth = WebGUI::SQL->read("select Survey_answerId,answer from Survey_answer where Survey_questionId=".$qdata->{Survey_questionId}." and isCorrect=1 order by sequenceNumber"); while ($adata = $sth->hashRef) { @@ -771,7 +781,7 @@ sub www_viewIndividualSurvey { $output .= '
    ' - .WebGUI::International::get(66,$namespace).''.$rdata->{response}.'
    ' - .WebGUI::International::get(57,$namespace).''.$rdata->{comment}.'

    \n"; @@ -791,7 +801,7 @@ sub www_viewIndividualSurvey { sub www_viewResponses { return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))); my ($output, $sth, $response); - $output = '

    '.WebGUI::International::get(66,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(66,$_[0]->get("namespace")).'

    '; $sth = WebGUI::SQL->read("select response from Survey_response where Survey_questionId=".$session{form}{qid}); while (($response) = $sth->array) { $output .= $response."

    \n"; @@ -804,9 +814,9 @@ sub www_viewResponses { sub www_viewStatisticalOverview { return "" unless (WebGUI::Privilege::isInGroup($_[0]->get("groupToViewReports"))); my ($output, $p, $questions, $question, $sth, $answer, $totalResponses, $data); - $output = '

    '.WebGUI::International::get(58,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(58,$_[0]->get("namespace")).'

    '; $output .= ''.WebGUI::International::get(73,$namespace).'

    '; + .'">'.WebGUI::International::get(73,$_[0]->get("namespace")).'

    '; $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewStatisticalOverview')); $p->setDataByQuery("select Survey_questionId,question,answerFieldType,allowComment from Survey_question where Survey_id=".$_[0]->get("Survey_id")." order by sequenceNumber"); @@ -815,9 +825,9 @@ sub www_viewStatisticalOverview { $output .= ''.$question->{question}.''; if ($question->{answerFieldType} eq "radioList") { $output .= ''; - $output .= ' - - '; + $output .= ' + + '; ($totalResponses) = WebGUI::SQL->quickArray("select count(*) from Survey_response where Survey_questionId=".$question->{Survey_questionId}); $sth = WebGUI::SQL->read("select Survey_answerId,answer,isCorrect from Survey_answer where @@ -845,12 +855,12 @@ sub www_viewStatisticalOverview { $output .= "
    '.WebGUI::International::get(19,$namespace).''.WebGUI::International::get(53,$namespace).''.WebGUI::International::get(54,$namespace).'
    '.WebGUI::International::get(19,$_[0]->get("namespace")).''.WebGUI::International::get(53,$_[0]->get("namespace")).''.WebGUI::International::get(54,$_[0]->get("namespace")).'
    "; } else { $output .= '
    '.WebGUI::International::get(55,$namespace) + .'&qid='.$question->{Survey_questionId}).'">'.WebGUI::International::get(55,$_[0]->get("namespace")) .'
    '; } if ($question->{allowComment}) { $output .= ''.WebGUI::International::get(56,$namespace).''; + .'&qid='.$question->{Survey_questionId}).'">'.WebGUI::International::get(56,$_[0]->get("namespace")).''; } $output .= '


    '; } diff --git a/lib/WebGUI/Wobject/SyndicatedContent.pm b/lib/WebGUI/Wobject/SyndicatedContent.pm index 04e37a90c..13a4d7549 100644 --- a/lib/WebGUI/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Wobject/SyndicatedContent.pm @@ -22,14 +22,12 @@ use WebGUI::SQL; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "SyndicatedContent"; -our $name = WebGUI::International::get(2,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::SyndicatedContent->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::SyndicatedContent->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ rssUrl=>$_[0]->get("rssUrl"), content=>$_[0]->get("content"), @@ -38,10 +36,22 @@ sub duplicate { } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1], [qw(rssUrl content lastFetched)]); +sub name { + return WebGUI::International::get(2,$_[0]->get("namespace")); } +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(rssUrl content lastFetched)] + ); + bless $self, $class; +} + + #------------------------------------------------------------------- sub uiLevel { return 6; @@ -51,13 +61,13 @@ sub uiLevel { sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); my ($output, $f); - $output = helpIcon(1,$namespace); - $output .= '

    '.WebGUI::International::get(4,$namespace).'

    '; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

    '.WebGUI::International::get(4,$_[0]->get("namespace")).'

    '; $f = WebGUI::HTMLForm->new; - $f->url("rssUrl",WebGUI::International::get(1,$namespace),$_[0]->get("rssUrl")); + $f->url("rssUrl",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("rssUrl")); if ($_[0]->get("wobjectId") ne "new") { - $f->readOnly(WebGUI::DateTime::epochToHuman($_[0]->get("lastFetched"),"%z %Z"),WebGUI::International::get(5,$namespace)); - $f->readOnly($_[0]->get("content"),WebGUI::International::get(6,$namespace)); + $f->readOnly(WebGUI::DateTime::epochToHuman($_[0]->get("lastFetched"),"%z %Z"),WebGUI::International::get(5,$_[0]->get("namespace"))); + $f->readOnly($_[0]->get("content"),WebGUI::International::get(6,$_[0]->get("namespace"))); } else { $f->hidden("content","Not yet fetched!"); $f->hidden("lastFetched",time()); diff --git a/lib/WebGUI/Wobject/USS.pm b/lib/WebGUI/Wobject/USS.pm index 170b2a487..f63174537 100644 --- a/lib/WebGUI/Wobject/USS.pm +++ b/lib/WebGUI/Wobject/USS.pm @@ -31,15 +31,13 @@ use WebGUI::Utility; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "USS"; -our $name = WebGUI::International::get(29,$namespace); #------------------------------------------------------------------- sub duplicate { my ($sth, $file, %row, $newSubmissionId, $w); tie %row, 'Tie::CPHash'; $w = $_[0]->SUPER::duplicate($_[1],1); - $w = WebGUI::Wobject::USS->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::USS->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ groupToContribute=>$_[0]->get("groupToContribute"), submissionsPerPage=>$_[0]->get("submissionsPerPage"), @@ -67,15 +65,27 @@ sub duplicate { } #------------------------------------------------------------------- -sub purge { - WebGUI::SQL->write("delete from USS_submission where wobjectId=".$_[0]->get("wobjectId")); - $_[0]->SUPER::purge(); +sub name { + return WebGUI::International::get(29,$_[0]->get("namespace")); } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(submissionsPerPage groupToContribute groupToApprove defaultStatus - submissionTemplateId templateId karmaPerSubmission allowDiscussion)]); +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(submissionsPerPage groupToContribute groupToApprove defaultStatus + submissionTemplateId templateId karmaPerSubmission allowDiscussion)], + 1 + ); + bless $self, $class; +} + +#------------------------------------------------------------------- +sub purge { + WebGUI::SQL->write("delete from USS_submission where wobjectId=".$_[0]->get("wobjectId")); + $_[0]->SUPER::purge(); } #------------------------------------------------------------------- @@ -97,7 +107,7 @@ sub www_approveSubmission { %submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=$session{form}{sid}"); WebGUI::SQL->write("update USS_submission set status='Approved' where USS_submissionId=$session{form}{sid}"); WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='. - $session{form}{wid}.'&sid='.$session{form}{sid}),4,$namespace); + $session{form}{wid}.'&sid='.$session{form}{sid}),4,$_[0]->get("namespace")); WebGUI::MessageLog::completeEntry($session{form}{mlog}); return WebGUI::Operation::www_viewMessageLog(); } else { @@ -124,7 +134,7 @@ sub www_deleteSubmission { my ($owner); ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=$session{form}{sid}"); if ($owner == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) { - return $_[0]->confirm(WebGUI::International::get(17,$namespace), + return $_[0]->confirm(WebGUI::International::get(17,$_[0]->get("namespace")), WebGUI::URL::page('func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid})); } else { return WebGUI::Privilege::insufficient(); @@ -153,7 +163,7 @@ sub www_denySubmission { %submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=$session{form}{sid}"); WebGUI::SQL->write("update USS_submission set status='Denied' where USS_submissionId=$session{form}{sid}"); WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='. - $session{form}{wid}.'&sid='.$session{form}{sid}),5,$namespace); + $session{form}{wid}.'&sid='.$session{form}{sid}),5,$_[0]->get("namespace")); WebGUI::MessageLog::completeEntry($session{form}{mlog}); return WebGUI::Operation::www_viewMessageLog(); } else { @@ -168,34 +178,34 @@ sub www_edit { $groupToApprove = $_[0]->get("groupToApprove") || 4; $submissionsPerPage = $_[0]->get("submissionsPerPage") || 50; $defaultStatus = $_[0]->get("defaultStatus") || "Approved"; - $output = helpIcon(1,$namespace); - $output .= '

    '.WebGUI::International::get(18,$namespace).'

    '; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

    '.WebGUI::International::get(18,$_[0]->get("namespace")).'

    '; $f = WebGUI::HTMLForm->new; $f->template( -name=>"templateId", -value=>$_[0]->get("templateId"), - -namespace=>$namespace, - -label=>WebGUI::International::get(72,$namespace), + -namespace=>$_[0]->get("namespace"), + -label=>WebGUI::International::get(72,$_[0]->get("namespace")), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); $f->template( -name=>"submissionTemplateId", -value=>$_[0]->get("submissionTemplateId"), - -namespace=>$namespace."/Submission", - -label=>WebGUI::International::get(73,$namespace), + -namespace=>$_[0]->get("namespace")."/Submission", + -label=>WebGUI::International::get(73,$_[0]->get("namespace")), -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") ); - $f->group("groupToApprove",WebGUI::International::get(1,$namespace),[$groupToApprove]); - $f->group("groupToContribute",WebGUI::International::get(2,$namespace),[$_[0]->get("groupToContribute")]); - $f->integer("submissionsPerPage",WebGUI::International::get(6,$namespace),$submissionsPerPage); + $f->group("groupToApprove",WebGUI::International::get(1,$_[0]->get("namespace")),[$groupToApprove]); + $f->group("groupToContribute",WebGUI::International::get(2,$_[0]->get("namespace")),[$_[0]->get("groupToContribute")]); + $f->integer("submissionsPerPage",WebGUI::International::get(6,$_[0]->get("namespace")),$submissionsPerPage); $f->select("defaultStatus",{Approved=>status('Approved'),Denied=>status('Denied'),Pending=>status('Pending')} ,WebGUI::International::get(563),[$defaultStatus]); if ($session{setting}{useKarma}) { - $f->integer("karmaPerSubmission",WebGUI::International::get(30,$namespace),$_[0]->get("karmaPerSubmission")); + $f->integer("karmaPerSubmission",WebGUI::International::get(30,$_[0]->get("namespace")),$_[0]->get("karmaPerSubmission")); } else { $f->hidden("karmaPerSubmission",$_[0]->get("karmaPerSubmission")); } - $f->yesNo("allowDiscussion",WebGUI::International::get(48,$namespace),$_[0]->get("allowDiscussion")); + $f->yesNo("allowDiscussion",WebGUI::International::get(48,$_[0]->get("namespace")),$_[0]->get("allowDiscussion")); $f->raw($_[0]->SUPER::discussionProperties); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; @@ -225,7 +235,7 @@ sub www_editSubmission { $submission->{userId} = $session{user}{userId}; } if (WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")) || $submission->{userId} == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) { - $output = '

    '.WebGUI::International::get(19,$namespace).'

    '; + $output = '

    '.WebGUI::International::get(19,$_[0]->get("namespace")).'

    '; $f = WebGUI::HTMLForm->new; if ($session{user}{userId} == 1 && $submission->{USS_submissionId} eq "new") { $f->text("visitorName",WebGUI::International::get(438)); @@ -233,23 +243,23 @@ sub www_editSubmission { $f->hidden("wid",$session{form}{wid}); $f->hidden("sid",$submission->{USS_submissionId}); $f->hidden("func","editSubmissionSave"); - $f->text("title",WebGUI::International::get(35,$namespace),$submission->{title}); - $f->HTMLArea("body",WebGUI::International::get(31,$namespace),$submission->{content}); + $f->text("title",WebGUI::International::get(35,$_[0]->get("namespace")),$submission->{title}); + $f->HTMLArea("body",WebGUI::International::get(31,$_[0]->get("namespace")),$submission->{content}); if ($submission->{image} ne "") { $f->readOnly('' - .WebGUI::International::get(391).'',WebGUI::International::get(32,$namespace)); + .WebGUI::International::get(391).'',WebGUI::International::get(32,$_[0]->get("namespace"))); } else { - $f->file("image",WebGUI::International::get(32,$namespace)); + $f->file("image",WebGUI::International::get(32,$_[0]->get("namespace"))); } if ($submission->{attachment} ne "") { $f->readOnly('' - .WebGUI::International::get(391).'',WebGUI::International::get(33,$namespace)); + .WebGUI::International::get(391).'',WebGUI::International::get(33,$_[0]->get("namespace"))); } else { - $f->file("attachment",WebGUI::International::get(33,$namespace)); + $f->file("attachment",WebGUI::International::get(33,$_[0]->get("namespace"))); } - $f->yesNo("convertCarriageReturns",WebGUI::International::get(34,$namespace),$submission->{convertCarriageReturns}, - '','   '.WebGUI::International::get(38,$namespace)); + $f->yesNo("convertCarriageReturns",WebGUI::International::get(34,$_[0]->get("namespace")),$submission->{convertCarriageReturns}, + '','   '.WebGUI::International::get(38,$_[0]->get("namespace"))); $f->submit; $output .= $f->print; return $output; @@ -273,13 +283,13 @@ sub www_editSubmissionSave { $hash{USS_submissionId} = "new"; if ($session{setting}{useKarma}) { $u = WebGUI::User->new($session{user}{userId}); - $u->karma($_[0]->get("karmaPerSubmission"),$namespace." (".$_[0]->get("wobjectId") + $u->karma($_[0]->get("karmaPerSubmission"),$_[0]->get("namespace")." (".$_[0]->get("wobjectId") ."/".$session{form}{sid}.")","User submission."); } $session{form}{sid} = $_[0]->setCollateral("USS_submission","USS_submissionId",\%hash,0); %hash = (); } - $hash{title} = WebGUI::HTML::filter($session{form}{title},'all') || WebGUI::International::get(16,$namespace); + $hash{title} = WebGUI::HTML::filter($session{form}{title},'all') || WebGUI::International::get(16,$_[0]->get("namespace")); $hash{USS_submissionId} = $session{form}{sid}; $hash{dateSubmitted} = time(); $hash{content} = $session{form}{body}; @@ -295,7 +305,7 @@ sub www_editSubmissionSave { $hash{status} = $_[0]->get("defaultStatus"); WebGUI::MessageLog::addInternationalizedEntry('',$_[0]->get("groupToApprove"), WebGUI::URL::page('func=viewSubmission&wid='.$_[0]->get("wobjectId").'&sid='. - $session{form}{sid}),3,$namespace,'pending'); + $session{form}{sid}),3,$_[0]->get("namespace"),'pending'); } else { $hash{status} = "Approved"; } @@ -310,21 +320,21 @@ sub www_editSubmissionSave { #------------------------------------------------------------------- sub www_showMessage { return $_[0]->SUPER::www_showMessage(''.WebGUI::International::get(45,$namespace).'
    ' - .''.WebGUI::International::get(28,$namespace).'
    '); + .'&sid='.$session{form}{sid}).'">'.WebGUI::International::get(45,$_[0]->get("namespace")).'
    ' + .''.WebGUI::International::get(28,$_[0]->get("namespace")).'
    '); } #------------------------------------------------------------------- sub www_view { my (%var, $row, $page, $p, $constraints, @submission, @content, $image, $i, $numResults, $thumbnail, $responses); $numResults = $_[0]->get("submissionsPerPage"); - $var{"readmore.label"} = WebGUI::International::get(46,$namespace); - $var{"responses.label"} = WebGUI::International::get(57,$namespace); + $var{"readmore.label"} = WebGUI::International::get(46,$_[0]->get("namespace")); + $var{"responses.label"} = WebGUI::International::get(57,$_[0]->get("namespace")); $var{title} = $_[0]->get("title"); $var{description} = $_[0]->get("description"); $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")); $var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId")); - $var{"post.label"} = WebGUI::International::get(20,$namespace); + $var{"post.label"} = WebGUI::International::get(20,$_[0]->get("namespace")); $var{"search.label"} = WebGUI::International::get(364); $var{"search.Form"} = WebGUI::Search::form({wid=>$_[0]->get("wobjectId"),func=>'view',search=>1}); $var{"search.url"} = WebGUI::Search::toggleURL(); @@ -338,9 +348,9 @@ sub www_view { $constraints = "(status='Approved' or userId=$session{user}{userId})"; } $var{"title.label"} = WebGUI::International::get(99); - $var{"thumbnail.label"} = WebGUI::International::get(52,$namespace); - $var{"date.label"} = WebGUI::International::get(13,$namespace); - $var{"by.label"} = WebGUI::International::get(21,$namespace); + $var{"thumbnail.label"} = WebGUI::International::get(52,$_[0]->get("namespace")); + $var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace")); + $var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace")); $p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults); $p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and $constraints order by dateSubmitted desc"); @@ -399,37 +409,37 @@ sub www_viewSubmission { $var{content} = WebGUI::HTML::filter($submission->{content},$session{setting}{filterContributedHTML}); $var{content} =~ s/\^\-\;//g; $var{content} =~ s/\n/\/g if ($submission->{convertCarriageReturns}); - $var{"user.label"} = WebGUI::International::get(21,$namespace); + $var{"user.label"} = WebGUI::International::get(21,$_[0]->get("namespace")); $var{"user.Profile"} = WebGUI::URL::page('op=viewProfile&uid='.$submission->{userId}); $var{"user.Id"} = $submission->{userId}; $var{"user.username"} = $submission->{username}; - $var{"date.label"} = WebGUI::International::get(13,$namespace); + $var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace")); $var{"date.epoch"} = $submission->{dateSubmitted}; $var{"date.human"} = epochToHuman($submission->{dateSubmitted}); - $var{"status.label"} = WebGUI::International::get(14,$namespace); + $var{"status.label"} = WebGUI::International::get(14,$_[0]->get("namespace")); $var{"status.status"} = status($submission->{status}); $var{"views.label"} = WebGUI::International::get(514); $var{"views.count"} = $submission->{views}; $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")); $var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId")); - $var{"post.label"} = WebGUI::International::get(20,$namespace); + $var{"post.label"} = WebGUI::International::get(20,$_[0]->get("namespace")); @data = WebGUI::SQL->quickArray("select max(USS_submissionId) from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and USS_submissionId<$submission->{USS_submissionId} and (userId=$submission->{userId} or status='Approved')"); $var{"previous.more"} = ($data[0] ne ""); $var{"previous.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$data[0].'&wid='.$session{form}{wid}); - $var{"previous.label"} = WebGUI::International::get(58,$namespace); + $var{"previous.label"} = WebGUI::International::get(58,$_[0]->get("namespace")); @data = WebGUI::SQL->quickArray("select min(USS_submissionId) from USS_submission where wobjectId=$submission->{wobjectId} and USS_submissionId>$submission->{USS_submissionId} and (userId=$submission->{userId} or status='Approved')"); $var{"next.more"} = ($data[0] ne ""); $var{"next.url"} = WebGUI::URL::page('func=viewSubmission&sid='.$data[0].'&wid='.$session{form}{wid}); - $var{"next.label"} = WebGUI::International::get(59,$namespace); + $var{"next.label"} = WebGUI::International::get(59,$_[0]->get("namespace")); $var{canEdit} = ($submission->{userId} == $session{user}{userId} || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))); $var{"delete.url"} = WebGUI::URL::page('func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}); - $var{"delete.label"} = WebGUI::International::get(37,$namespace); + $var{"delete.label"} = WebGUI::International::get(37,$_[0]->get("namespace")); $var{"edit.url"} = WebGUI::URL::page('func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}); - $var{"edit.label"} = WebGUI::International::get(27,$namespace); + $var{"edit.label"} = WebGUI::International::get(27,$_[0]->get("namespace")); $var{canChangeStatus} = WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"),$session{user}{userId}); $var{"approve.url"} = WebGUI::URL::page('func=approveSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'&mlog='.$session{form}{mlog}); $var{"approve.label"} = WebGUI::International::get(572); @@ -439,11 +449,11 @@ sub www_viewSubmission { $var{"deny.label"} = WebGUI::International::get(574); $var{"canReply"} = ($_[0]->get("allowDiscussion")); $var{"reply.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId").'&sid='.$session{form}{sid}); - $var{"reply.label"} = WebGUI::International::get(47,$namespace); + $var{"reply.label"} = WebGUI::International::get(47,$_[0]->get("namespace")); $var{"search.url"} = WebGUI::Search::toggleURL(); $var{"search.label"} = WebGUI::International::get(364); $var{"back.url"} = WebGUI::URL::page(); - $var{"back.label"} = WebGUI::International::get(28,$namespace); + $var{"back.label"} = WebGUI::International::get(28,$_[0]->get("namespace")); if ($submission->{image} ne "") { $file = WebGUI::Attachment->new($submission->{image},$session{form}{wid},$session{form}{sid}); $var{"image.url"} = $file->getURL; diff --git a/lib/WebGUI/Wobject/WobjectProxy.pm b/lib/WebGUI/Wobject/WobjectProxy.pm index 6c9573904..1c774883c 100644 --- a/lib/WebGUI/Wobject/WobjectProxy.pm +++ b/lib/WebGUI/Wobject/WobjectProxy.pm @@ -24,25 +24,35 @@ use WebGUI::Template; use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); -our $namespace = "WobjectProxy"; -our $name = WebGUI::International::get(3,$namespace); #------------------------------------------------------------------- sub duplicate { my ($w); $w = $_[0]->SUPER::duplicate($_[1]); - $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$namespace}); + $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")}); $w->set({ proxiedWobjectId=>$_[0]->get("proxiedWobjectId") }); } #------------------------------------------------------------------- -sub set { - $_[0]->SUPER::set($_[1],[qw(proxiedWobjectId)]); +sub name { + return WebGUI::International::get(3,$_[0]->get("namespace")); } +#------------------------------------------------------------------- +sub new { + my $class = shift; + my $property = shift; + my $self = WebGUI::Wobject->new( + $property, + [qw(proxiedWobjectId)] + ); + bless $self, $class; +} + + #------------------------------------------------------------------- sub uiLevel { return 8; @@ -55,8 +65,8 @@ sub www_edit { tie %wobject, 'Tie::CPHash'; tie %page, 'Tie::CPHash'; tie %wobjects, 'Tie::IxHash'; - $output = helpIcon(1,$namespace); - $output .= '

    '.WebGUI::International::get(2,$namespace).'

    '; + $output = helpIcon(1,$_[0]->get("namespace")); + $output .= '

    '.WebGUI::International::get(2,$_[0]->get("namespace")).'

    '; $templatePosition = $_[0]->get("templatePosition") || 1; $startDate = $_[0]->get("startDate") || $session{page}{startDate}; $endDate = $_[0]->get("endDate") || $session{page}{endDate}; @@ -65,7 +75,7 @@ sub www_edit { $f->hidden("namespace",$_[0]->get("namespace")) if ($_[0]->get("wobjectId") eq "new"); $f->hidden("func","editSave"); $f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499)); - $f->hidden("title",$namespace); + $f->hidden("title",$_[0]->get("namespace")); $f->hidden("displayTitle",0); $f->select( -name=>"templatePosition", @@ -88,7 +98,7 @@ sub www_edit { $b->finish; } $a->finish; - $f->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$namespace),[$_[0]->get("proxiedWobjectId")]); + $f->select("proxiedWobjectId",\%wobjects,WebGUI::International::get(1,$_[0]->get("namespace")),[$_[0]->get("proxiedWobjectId")]); $f->submit; $output .= $f->print; return $output; @@ -105,7 +115,7 @@ sub www_editSave { #------------------------------------------------------------------- sub www_view { - return WebGUI::International::get(4,$namespace); + return WebGUI::International::get(4,$_[0]->get("namespace")); }