Converting wobjects to use new global template mechanism.

This commit is contained in:
JT Smith 2003-05-18 00:22:31 +00:00
parent 50f9aa9171
commit 5ec7c67b66
20 changed files with 253 additions and 250 deletions

View file

@ -61,10 +61,10 @@ unlink("../../lib/WebGUI/Wobject/MailForm.pm");
unlink("../../www/extras/floatCheck.js");
unlink("../../www/extras/numberCheck.js");
WebGUI::Session::open("../..",$configFile);
print "\tMigrating Mail Form to Data Form.\n" unless ($quiet);
WebGUI::Session::open("../..",$configFile);
#renaming namespace
my @sql = (
@ -146,6 +146,25 @@ foreach my $query (@sql) {
WebGUI::SQL->write($query);
}
print "\tSetting up new global template structure.\n" unless ($quiet);
WebGUI::SQL->write("alter table wobject add column templateId int not null default 1");
foreach (qw(Article DataForm EventsCalendar FAQ FileManager Item LinkList MessageBoard Product SiteMap SyndicatedContent USS)) {
my $sth = WebGUI::SQL->read("select templateId,wobjectId from $_ where templateId<>1");
while (my @data = $sth->array) {
WebGUI::SQL->write("update wobject set templateId=$data[0] where wobjectId=$data[1]");
}
$sth->finish;
WebGUI::SQL->write("alter table $_ drop column templateId");
}
WebGUI::SQL->write("alter table WobjectProxy add column proxiedNamespace varchar(35)");
my $sth = WebGUI::SQL->read("select wobject.namespace,wobject.wobjectId from WobjectProxy left join wobject
on WobjectProxy.proxiedWobjectId=wobject.wobjectId");
while (my @data = $sth->array) {
WebGUI::SQL->write("update WobjectProxy set proxiedNamespace=".quote($data[0])." where proxiedWobjectId=$data[1]");
}
$sth->finish;
WebGUI::Session::close();

View file

@ -523,14 +523,40 @@ delete from settings where name='sharedTrash';
insert into settings (name,value) values ('sharedTrash','0');
delete from international where languageId=1 and namespace='WebGUI' and internationalId=629;
INSERT INTO international (internationalId,languageId,namespace,message,lastUpdated) VALUES (629,1,'WebGUI','<b>Use shared clipboard?</b><br>\r\nEnables a single, system-wide clipboard shared by all users. Default is user separated clipboards.\r\n<p>\r\n\r\n<b>Use shared trash?</b><br>\r\nEnables a single, system-wide trash shared by all users. Default is user separated trash.\r\n<p>\r\n\r\n<b>Prevent Proxy Caching</b><br>\r\nSome companies have proxy servers that cause problems with WebGUI. If you\'re experiencing problems with WebGUI, and you have a proxy server, you may want to set this setting to <i>Yes</i>. Beware that WebGUI\'s URLs will not be as user-friendly after this feature is turned on.\r\n<p>\r\n\r\n<b>Show debugging?</b><br>\r\nShow debugging information in WebGUI\'s output. This is primarily useful for WebGUI developers, but can also be interesting for Administrators trying to troubleshoot a problem.\r\n<p>\r\n\r\n<b>Track page statistics?</b><br/>\r\nWebGUI can track some statistical information for your site. However, this will add a little extra strain on your processor and will make your database grow much more quickly. Enable this only if you do not have an external web statistics program.\r\n<p/>\r\n',1052850265);
alter table HttpProxy change ProxiedUrl proxiedUrl text;
alter table HttpProxy change ProxiedUrl proxiedUrl varchar(255);
delete from international where namespace='DataForm' and internationalId=78;
delete from international where namespace='EventsCalendar' and internationalId=79;
delete from international where namespace='FAQ' and internationalId=74;
delete from international where namespace='Item' and internationalId=72;
delete from international where namespace='MessageBoard' and internationalId=72;
delete from international where namespace='Product' and internationalId=61;
delete from international where namespace='USS' and internationalId=72;
alter table WobjectProxy add column overrideTitle int not null default 0;
alter table WobjectProxy add column overrideDescription int not null default 0;
alter table WobjectProxy add column overrideTemplate int not null default 0;
alter table WobjectProxy add column overrideDisplayTitle int not null default 0;
delete from international where languageId=1 and namespace='WobjectProxy' and internationalId=10;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (10,1,'WobjectProxy','Override template?', 1053183837,'Asking the user if s/he would like to use the template specified in the wobject proxy or the original template of the original wobject.');
delete from international where languageId=1 and namespace='WobjectProxy' and internationalId=9;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (9,1,'WobjectProxy','Override description?', 1053183804,'Asking the user if s/he would like to use the description specified in the wobject proxy or the original description of the original wobject.');
delete from international where languageId=1 and namespace='WobjectProxy' and internationalId=8;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (8,1,'WobjectProxy','Override display title?', 1053183719,'Asking the user if s/he would like to use the "display title" setting specified in the wobject proxy or the original display title setting of the original wobject.');
delete from international where languageId=1 and namespace='WobjectProxy' and internationalId=7;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (7,1,'WobjectProxy','Override title?', 1053183682,'Asking the user if s/he would like to use the title specified in the wobject proxy or the original title of the original wobject.');
INSERT INTO style VALUES (-10,'htmlArea Image Manager','<style type=\"text/css\">\r\nTD { font: 8pt \'MS Shell Dlg\', Helvetica, sans-serif; }\r\nTD.delete { font: italic 7pt \'MS Shell Dlg\', Helvetica, sans-serif; }\r\nTD.label { font: 8pt \'MS Shell Dlg\', Helvetica, sans-serif; background-color: #c0c0c0; }\r\nTD.none { font: italic 12pt \'MS Shell Dlg\', Helvetica, sans-serif; }\r\n\r\n</style>\r\n','<script language=\"javascript\">\r\nfunction findAncestor(element, name, type) {\r\n while(element != null && (element.name != name || element.tagName != type))\r\n element = element.parentElement;\r\n return element;\r\n}\r\n</script>\r\n<script language=\"javascript\">\r\n\r\nfunction actionComplete(action, path, error, info) {\r\n var manager = findAncestor(window.frameElement, \'manager\', \'TABLE\');\r\n var wrapper = findAncestor(window.frameElement, \'wrapper\', \'TABLE\');\r\n\r\n if(manager) {\r\n if(error.length < 1) {\r\n manager.all.actions.reset();\r\n if(action == \'upload\') {\r\n manager.all.actions.image.value = \'\';\r\n manager.all.actions.name.value = \'\';\r\n manager.all.actions.thumbnailSize.value = \'\';\r\n\r\n }\r\n if(action == \'create\')\r\n manager.all.actions.folder.value = \'\';\r\n if(action == \'delete\')\r\n manager.all.txtFileName.value = \'\';\r\n }\r\n manager.all.actions.DPI.value = 96;\r\n manager.all.actions.path.value = path;\r\n }\r\n if(wrapper)\r\n wrapper.all.viewer.contentWindow.navigate(\'/?op=htmlAreaviewCollateral\');\r\n if(error.length > 0)\r\n alert(error);\r\n else if(info.length > 0)\r\n alert(info);\r\n}\r\n</script>\r\n\r\n<script language=\"javascript\">\r\nfunction deleteCollateral(options) {\r\n var lister = findAncestor(window.frameElement, \'lister\', \'IFRAME\');\r\n\r\n if(lister && confirm(\"Are you sure you want to delete this item ?\"))\r\n lister.contentWindow.navigate(\'^/;?op=htmlAreaDelete&\' + options);\r\n}\r\n</script>\r\n</head>\r\n<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n^-;\r\n</body>');
delete from international where languageId=1 and namespace='WebGUI' and internationalId=844;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (844,1,'WebGUI','These macros have to do with users and logins.\r\n<p/>\r\n\r\n<b>&#94;a; or &#94;a(); - My Account Link</b><br>\r\nA link to your account information. In addition you can change the link text by creating a macro like this <b>&#94;a("Account Info");</b>. \r\n<p>\r\n\r\n<b>NOTES:</b> You can also use the special case &#94;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<p>\r\n\r\n\r\n<b>&#94;AdminText();</b><br>\r\nDisplays a small text message to a user who is in admin mode. Example: &#94;AdminText("You are in admin mode!");\r\n<p>\r\n\r\n<b>&#94;AdminToggle; or &#94;AdminToggle();</b><br>\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: &#94;AdminToggle("Edit On","Edit Off");\r\n<p>\r\n\r\n<b>&#94;CanEditText();</b><br>\r\nDisplay a message to a user that can edit the current page.\r\n<p>\r\n<i>Example:</i> &#94;CanEditText(^AdminToggle;);\r\n<p>\r\n\r\n<b>&#94;EditableToggle; or &#94;EditableToggle();</b><br>\r\nExactly the same as AdminToggle, except that the toggle is only displayed if the user has the rights to edit the current page.\r\n<p>\r\n\r\n<b>&#94;GroupText();</b><br>\r\nDisplays a small text message to the user if they belong to the specified group. And you can specify an alternate message to those who are not in the group.\r\n<p>\r\n<i>Example:</i> &#94;GroupText("Visitors","You need an account to do anything cool on this site!","We value our registered users!");\r\n<p>\r\n\r\n<b>&#94;L; or &#94;L(); - Login Box</b><br>\r\nA small login form. You can also configure this macro. You can set the width of the login box like this &#94;L(20);. You can also set the message displayed after the user is logged in like this &#94;L(20,Hi &#94;a(&#94;@;);. Click %here% if you wanna log out!)\r\n<p>\r\n\r\n<b>NOTE:</b> The .loginBox style sheet class is tied to this macro.\r\n<p>\r\n\r\n<b>&#94;LoginToggle; or &#94;LoginToggle();</b><br>\r\nDisplays a "Login" or "Logout" message depending upon whether the user is logged in or not. You can optionally specify other labels like this: &#94;LoginToggle("Click here to log in.","Click here to log out.");. You can also use the special case &#94;LoginToggle(linkonly); to return only the URL with no label.\r\n<p>\r\n\r\n<b>&#94;@; - Username</b><br>\r\nThe username of the currently logged in user.\r\n<p>\r\n\r\n\r\n<b>&#94;#; - User ID</b><br>\r\nThe user id of the currently logged in user.\r\n<p>\r\n\r\n', 1053114197,NULL);
INSERT INTO style VALUES (-10,'htmlArea Image Manager','<style type=\"text/css\">\r\nTD { font: 8pt \'MS Shell Dlg\', Helvetica, sans-serif; }\r\nTD.delete { font: italic 7pt \'MS Shell Dlg\', Helvetica, sans-serif; }\r\nTD.label { font: 8pt \'MS Shell Dlg\', Helvetica, sans-serif; background-color: #c0c0c0; }\r\nTD.none { font: italic 12pt \'MS Shell Dlg\', Helvetica, sans-serif; }\r\n\r\n</style>\r\n','<script language=\"javascript\">\r\nfunction findAncestor(element, name, type) {\r\n while(element != null && (element.name != name || element.tagName != type))\r\n element = element.parentElement;\r\n return element;\r\n}\r\n</script>\r\n<script language=\"javascript\">\r\n\r\nfunction actionComplete(action, path, error, info) {\r\n var manager = findAncestor(window.frameElement, \'manager\', \'TABLE\');\r\n var wrapper = findAncestor(window.frameElement, \'wrapper\', \'TABLE\');\r\n\r\n if(manager) {\r\n if(error.length < 1) {\r\n manager.all.actions.reset();\r\n if(action == \'upload\') {\r\n manager.all.actions.image.value = \'\';\r\n manager.all.actions.name.value = \'\';\r\n manager.all.actions.thumbnailSize.value = \'\';\r\n\r\n }\r\n if(action == \'create\')\r\n manager.all.actions.folder.value = \'\';\r\n if(action == \'delete\')\r\n manager.all.txtFileName.value = \'\';\r\n }\r\n manager.all.actions.DPI.value = 96;\r\n manager.all.actions.path.value = path;\r\n }\r\n if(wrapper)\r\n wrapper.all.viewer.contentWindow.navigate(\'/?op=htmlAreaviewCollateral\');\r\n if(error.length > 0)\r\n alert(error);\r\n else if(info.length > 0)\r\n alert(info);\r\n}\r\n</script>\r\n\r\n<script language=\"javascript\">\r\nfunction deleteCollateral(options) {\r\n var lister = findAncestor(window.frameElement, \'lister\', \'IFRAME\');\r\n\r\n if(lister && confirm(\"Are you sure you want to delete this item ?\"))\r\n lister.contentWindow.navigate(\'^/;?op=htmlAreaDelete&\' + options);\r\n}\r\n</script>\r\n</head>\r\n<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n^-;\r\n</body>');

View file

@ -68,6 +68,7 @@ sub _generatePage {
.moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId})
.cutIcon('func=cut&wid='.${$wobject}{wobjectId})
.copyIcon('func=copy&wid='.${$wobject}{wobjectId})
.shortcutIcon('func=createShortcut&wid='.${$wobject}{wobjectId})
.'<br>';
}
if (${$wobject}{namespace} eq "WobjectProxy") {

View file

@ -1243,7 +1243,7 @@ Returns a select list of templates.
=item name
The name field for this form element.
The name field for this form element. Defaults to "templateId".
=item value
@ -1258,10 +1258,10 @@ The namespace for the list of templates to return. If this is omitted, all templ
=cut
sub template {
my ($templateId, $where);
$templateId = $_[0]->{value} || 1;
my $templateId = $_[0]->{value} || 1;
my $name = $_[0]->{name} || "templateId";
return selectList({
name=>$_[0]->{name},
name=>$name,
options=>WebGUI::Template::getList($_[0]->{namespace}),
value=>[$templateId]
});

View file

@ -22,7 +22,7 @@ use WebGUI::URL;
our @ISA = qw(Exporter);
our @EXPORT = qw(&helpIcon &becomeIcon &cutIcon &copyIcon &deleteIcon &editIcon
&moveBottomIcon &moveDownIcon &moveLeftIcon &moveRightIcon &moveTopIcon &moveUpIcon
&pageIcon &pasteIcon &wobjectIcon &viewIcon);
&pageIcon &shortcutIcon &pasteIcon &wobjectIcon &viewIcon);
=head1 NAME
@ -48,6 +48,7 @@ A package for generating user interface buttons. The subroutines found herein do
$html = moveUpIcon('op=something');
$html = pageIcon();
$html = pasteIcon('op=something');
$html = shortcutIcon('op=something');
$html = viewIcon('op=something');
$html = wobjectIcon();
@ -405,6 +406,39 @@ sub pasteIcon {
return $output;
}
#-------------------------------------------------------------------
=head2 shortcutIcon ( urlParameters [, pageURL ] )
Generates a button with a shortcut symbol printed on it, similar to the shortcut icon in Microsoft Windows or the link Icon in Gnome.
=over
=item urlParameters
Any URL parameters that need to be tacked on to the current URL to accomplish whatever function this button represents.
=item pageURL
The URL to any page. Defaults to the current page.
=back
=cut
sub shortcutIcon {
my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'.$session{config}{extrasURL}.'/toolbar/'.$session{language}{toolbar}.'/shortcut.gif" align="middle" border="0" alt="Shortcut" title="Shortcut" /></a>';
return $output;
}
#-------------------------------------------------------------------
=head2 pasteIcon ( urlParameters [, pageURL ] )
#-------------------------------------------------------------------
=head2 viewIcon ( urlParameters [, pageURL ] )

View file

@ -622,7 +622,13 @@ NOTE: This is used to define the wobject and should only be passed in by a wobje
=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.
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.
NOTE: This is used to define the wobject and should only be passed in by a wobject subclass.
=item -useTemplate
Defaults to "0". If set to "1" this will add a template field to the wobject to enable content managers to select a template to layout this wobject.
NOTE: This is used to define the wobject and should only be passed in by a wobject subclass.
@ -632,14 +638,15 @@ NOTE: This is used to define the wobject and should only be passed in by a wobje
sub new {
my ($self, @p) = @_;
my ($properties, $extendedProperties, $useDiscussion);
my ($properties, $extendedProperties, $useTemplate, $useDiscussion);
if (ref $_[1] eq "HASH") {
$properties = $_[1]; # reverse compatibility prior to 5.2
} else {
($properties, $extendedProperties, $useDiscussion) =
rearrange([qw(properties extendedProperties useDiscussion)], @p);
($properties, $extendedProperties, $useDiscussion, $useTemplate) =
rearrange([qw(properties extendedProperties useDiscussion useTemplate)], @p);
}
$useDiscussion = 0 unless ($useDiscussion);
$useTemplate = 0 unless ($useDiscussion);
my $wobjectProperties = {
userDefined1=>{
fieldType=>"text"
@ -657,13 +664,13 @@ sub new {
fieldType=>"text"
},
bufferUserId=>{
fieldType=>"integer"
fieldType=>"hidden"
},
bufferDate=>{
fieldType=>"integer"
fieldType=>"hidden"
},
bufferPrevId=>{
fieldType=>"integer"
fieldType=>"hidden"
},
allowDiscussion=>{
fieldType=>"yesNo",
@ -698,8 +705,13 @@ sub new {
defaultValue=>1,
},
title=>{
fieldType=>"text"
fieldType=>"text",
defaultValue=>$_[0]->get("namespace")
},
templateId=>{
fieldType=>"template",
defaultValue=>1
},
displayTitle=>{
fieldType=>"yesNo",
defaultValue=>1
@ -709,7 +721,7 @@ sub new {
fieldType=>"HTMLArea"
},
pageId=>{
fieldType=>"integer",
fieldType=>"hidden",
defaultValue=>$session{page}{pageId}
},
templatePosition=>{
@ -725,7 +737,7 @@ sub new {
fieldType=>"date"
},
sequenceNumber=>{
fieldType=>"integer"
fieldType=>"hidden"
}
};
bless({
@ -1065,12 +1077,35 @@ NOTE: Should never need to be overridden or extended.
=cut
sub www_copy {
if (WebGUI::Privilege::canEditPage()) {
$_[0]->duplicate;
return "";
} else {
return WebGUI::Privilege::insufficient();
}
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->duplicate;
return "";
}
#-------------------------------------------------------------------
=head2 www_createShortcut ( )
Creates a shortcut (using the wobject proxy) of this wobject on the clipboard.
NOTE: Should never need to be overridden or extended.
=cut
sub www_createShortcut {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>"new",namespace=>"WobjectProxy"});
$w->set({
pageId=>2,
templatePosition=>1,
title=>$_[0]->getValue("title"),
proxiedNamespace=>$_[0]->get("namespace"),
proxiedWobjectId=>$_[0]->get("wobjectId"),
bufferUserId=>$session{user}{userId},
bufferDate=>time(),
bufferPrevId=>$session{page}{pageId}
});
return "";
}
#-------------------------------------------------------------------
@ -1082,16 +1117,16 @@ Moves this instance to the clipboard.
=cut
sub www_cut {
if (WebGUI::Privilege::canEditPage()) {
$_[0]->set({pageId=>2, templatePosition=>1,
bufferUserId=>$session{user}{userId},
bufferDate=>time(),
bufferPrevId=>$session{page}{pageId}});
_reorderWobjects($session{page}{pageId});
return "";
} else {
return WebGUI::Privilege::insufficient();
}
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->set({
pageId=>2,
templatePosition=>1,
bufferUserId=>$session{user}{userId},
bufferDate=>time(),
bufferPrevId=>$session{page}{pageId}
});
_reorderWobjects($session{page}{pageId});
return "";
}
#-------------------------------------------------------------------
@ -1302,6 +1337,13 @@ sub www_edit {
-value=>$displayTitle,
-uiLevel=>5
);
if ($_[0]->{_useTemplate}) {
$f->getTab("layout")->template(
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
}
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),

View file

@ -51,9 +51,6 @@ sub new {
-properties=>$property,
-extendedProperties=>{
image=>{ },
templateId=>{
defaultValue=>1
},
linkTitle=>{ },
linkURL=>{ },
attachment=>{ },
@ -61,7 +58,8 @@ sub new {
defaultValue=>0
}
},
-useDiscussion=>1
-useDiscussion=>1,
-useTemplate=>1
);
bless $self, $class;
}
@ -70,13 +68,6 @@ sub new {
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(356),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$properties->raw(
-value=>$_[0]->fileProperty("image",6),
-uiLevel=>3

View file

@ -179,9 +179,6 @@ sub new {
-properties=>$property,
-extendedProperties=>{
acknowledgement=>{},
templateId=>{
defaultValue=>1
},
emailTemplateId=>{
defaultValue=>2
},
@ -190,8 +187,9 @@ sub new {
},
mailData=>{
defaultValue=>0
},
}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -269,13 +267,6 @@ sub www_deleteFieldConfirm {
#-------------------------------------------------------------------
sub www_edit {
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(78,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$layout->template(
-name=>"emailTemplateId",
-value=>$_[0]->getValue("emailTemplateId"),

View file

@ -165,9 +165,6 @@ sub new {
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
},
eventTemplateId=>{
defaultValue=>1
},
@ -183,7 +180,8 @@ sub new {
paginateAfter=>{
defaultValue=>50
}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -227,13 +225,6 @@ sub www_edit {
my $afterEdit = 'func=edit&wid='.$_[0]->get("wobjectId") if ($_[0]->get("wobjectId") ne "new");
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(79,$_[0]->get("namespace")),
-afterEdit=>$afterEdit
);
$layout->template(
-name=>"eventTemplateId",
-value=>$_[0]->getValue("eventTemplateId"),

View file

@ -49,11 +49,8 @@ sub new {
my $property = shift;
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
}
}
-extendedProperties=>{},
-useTemplate=>1
);
bless $self, $class;
}
@ -82,14 +79,6 @@ sub www_deleteQuestionConfirm {
#-------------------------------------------------------------------
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-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") {
$properties->whatNext(
-options=>{
@ -101,7 +90,6 @@ sub www_edit {
}
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-headingId=>8,
-helpId=>1
);

View file

@ -73,11 +73,9 @@ sub new {
-extendedProperties=>{
paginateAfter=>{
defaultValue=>50,
},
templateId=>{
defaultValue=>1
}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -149,12 +147,6 @@ sub www_download {
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$layout->integer(
-name=>"paginateAfter",
-label=>WebGUI::International::get(20,$_[0]->get("namespace")),

View file

@ -46,11 +46,9 @@ sub new {
-properties=>$property,
-extendedProperties=>{
linkURL=>{},
attachment=>{},
templateId=>{
defaultValue=>1
}
}
attachment=>{}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -58,22 +56,13 @@ sub new {
#-------------------------------------------------------------------
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$properties->url(
-name=>"linkURL",
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>$_[0]->getValue("linkURL"));
$properties->raw($_[0]->fileProperty("attachment",2));
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-headingId=>6,
-helpId=>1
);

View file

@ -49,11 +49,8 @@ sub new {
my $property = shift;
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
}
}
-extendedProperties=>{},
-useTemplate=>1,
);
bless $self, $class;
}
@ -82,14 +79,7 @@ sub www_deleteLinkConfirm {
#-------------------------------------------------------------------
sub www_edit {
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
if ($_[0]->get("wobjectId") eq "new") {
$properties->whatNext(
-options=>{
@ -101,7 +91,6 @@ sub www_edit {
}
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-headingId=>10,
-helpId=>1
);

View file

@ -40,13 +40,11 @@ sub new {
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
templateId=>{
defaultValue=>1
},
messagesPerPage=>{
defaultValue=>50
}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -71,13 +69,6 @@ sub www_edit {
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("messagesPerPage")
);
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$properties->raw($_[0]->SUPER::discussionProperties);
return $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,

View file

@ -95,7 +95,8 @@ sub new {
a18=>{},
a19=>{},
a20=>{}
}
},
-useTemplate=>1
);
bless $self, $class;
}

View file

@ -87,9 +87,6 @@ sub new {
-properties=>$property,
-extendedProperties=>{
price=>{},
templateId=>{
defaultValue=>1
},
productNumber=>{},
image1=>{},
image2=>{},
@ -97,7 +94,8 @@ sub new {
manual=>{},
brochure=>{},
warranty=>{}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -274,15 +272,7 @@ sub www_deleteSpecificationConfirm {
#-------------------------------------------------------------------
sub www_edit {
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("template"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(61,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$properties->text(
-name=>"price",
-label=>WebGUI::International::get(10,$_[0]->get("namespace")),
@ -301,7 +291,6 @@ sub www_edit {
$properties->raw($_[0]->fileProperty("warranty",15));
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-helpId=>1,
-headingId=>6
);

View file

@ -75,13 +75,11 @@ sub new {
indent=>{
defaultValue=>5
},
templateId=>{
defaultValue=>1
},
depth=>{
defaultValue=>0
}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -93,12 +91,6 @@ sub www_edit {
and (pageId=1 or pageId>999) order by title");
my $layout = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$properties->select(
-name=>"startAtThisLevel",
-label=>WebGUI::International::get(3,$_[0]->get("namespace")),

View file

@ -39,11 +39,9 @@ sub new {
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
rssUrl=>{},
templateId=>{
defaultValue=>1
}
}
rssUrl=>{}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -57,21 +55,13 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_edit {
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$properties->url(
-name=>"rssUrl",
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>$_[0]->getValue("rssUrl")
);
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-headingId=>4,
-helpId=>1
);

View file

@ -81,16 +81,14 @@ sub new {
submissionTemplateId=>{
defaultValue=>1
},
templateId=>{
defaultValue=>1
},
karmaPerSubmission=>{
defaultValue=>0
},
filterContent=>{
defaultValue=>"javascript"
}
}
},
-useTemplate=>1
);
bless $self, $class;
}
@ -187,13 +185,6 @@ sub www_edit {
my $layout = WebGUI::HTMLForm->new;
my $privileges = WebGUI::HTMLForm->new;
my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId",
-value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"),
-label=>WebGUI::International::get(72,$_[0]->get("namespace")),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
);
$layout->template(
-name=>"submissionTemplateId",
-value=>$_[0]->getValue("submissionTemplateId"),

View file

@ -38,7 +38,32 @@ sub new {
my $self = WebGUI::Wobject->new(
-properties=>$property,
-extendedProperties=>{
proxiedWobjectId=>{ }
proxiedWobjectId=>{
fieldType=>"hidden"
},
proxiedNamespace=>{
fieldType=>"hidden"
},
overrideTitle=>{
fieldType=>"yesNo",
defaultValue=>0
},
overrideTemplate=>{
fieldType=>"yesNo",
defaultValue=>0
},
overrideDisplayTitle=>{
fieldType=>"yesNo",
defaultValue=>0
},
overrideDescription=>{
fieldType=>"yesNo",
defaultValue=>0
},
proxiedTemplateId=>{
fieldType=>"template",
defaultValue=>1
}
}
);
bless $self, $class;
@ -47,80 +72,51 @@ sub new {
#-------------------------------------------------------------------
sub uiLevel {
return 8;
return 999;
}
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $f, %wobjects, %page, %wobject, $a, $b);
tie %wobject, 'Tie::CPHash';
tie %page, 'Tie::CPHash';
tie %wobjects, 'Tie::IxHash';
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(2,$_[0]->get("namespace")).'</h1>';
my %tabs;
tie %tabs, 'Tie::IxHash';
%tabs = (
properties=>{
label=>WebGUI::International::get(893)
},
layout=>{
label=>WebGUI::International::get(105),
uiLevel=>5
},
privileges=>{
label=>WebGUI::International::get(107),
uiLevel=>9
}
);
$f = WebGUI::TabForm->new(\%tabs);
$f->hidden({name=>"wid",value=>$_[0]->get("wobjectId")});
$f->hidden({name=>"namespace",value=>$_[0]->get("namespace")}) if ($_[0]->get("wobjectId") eq "new");
$f->hidden({name=>"func",value=>"editSave"});
$f->getTab("properties")->readOnly(
-value=>$_[0]->get("wobjectId"),
-label=>WebGUI::International::get(499)
my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->template(
-name=>"proxiedTemplateId",
-value=>[$_[0]->getValue("proxiedTemplateId")],
-namespace=>$_[0]->get("proxiedNamespace")
);
$f->hidden({name=>"title",value=>$_[0]->name});
$f->hidden({name=>"displayTitle",value=>$_[0]->getValue("displayTitle")});
$f->getTab("layout")->select(
-name=>"templatePosition",
-label=>WebGUI::International::get(363),
-value=>[$_[0]->getValue("templatePosition")],
-uiLevel=>5,
-options=>WebGUI::Page::getTemplatePositions($session{page}{templateId}),
-subtext=>WebGUI::Page::drawTemplate($session{page}{templateId})
);
$f->getTab("privileges")->date(
-name=>"startDate",
-label=>WebGUI::International::get(497),
-value=>$_[0]->getValue("startDate")
$properties->yesNo(
-name=>"overrideTitle",
-value=>$_[0]->getValue("overrideTitle"),
-label=>WebGUI::International::get(7,$_[0]->get("namespace"))
);
$f->getTab("privileges")->date(
-name=>"endDate",
-label=>WebGUI::International::get(498),
-value=>$_[0]->getValue("endDate")
$layout->yesNo(
-name=>"overrideDisplayTitle",
-value=>$_[0]->getValue("overrideDisplayTitle"),
-label=>WebGUI::International::get(8,$_[0]->get("namespace"))
);
$a = WebGUI::SQL->read("select pageId,menuTitle from page where pageId<2 or pageId>25 order by menuTitle");
while (%page = $a->hash) {
$b = WebGUI::SQL->read("select wobjectId,title from wobject
where pageId=".$page{pageId}." and namespace<>'WobjectProxy' and
namespace<>'ExtraColumn' and endDate>=".time()." and pageId<>3 order by sequenceNumber");
while (%wobject = $b->hash) {
$wobjects{$wobject{wobjectId}} = $page{menuTitle}." / ".$wobject{title}." (".$wobject{wobjectId}.")";
}
$b->finish;
}
$a->finish;
$f->getTab("properties")->select(
-name=>"proxiedWobjectId",
-options=>\%wobjects,
$properties->yesNo(
-name=>"overrideDescription",
-value=>$_[0]->getValue("overrideTitle"),
-label=>WebGUI::International::get(9,$_[0]->get("namespace"))
);
$layout->yesNo(
-name=>"overrideTemplate",
-value=>$_[0]->getValue("overrideTitle"),
-label=>WebGUI::International::get(10,$_[0]->get("namespace"))
);
my @data = WebGUI::SQL->read("select page.urlizedTitle,wobject.title from wobject left join page on wobject.pageId=page.pageId
where wobject.wobjectId=".$_[0]->get("proxiedWobjectId"));
$properties->readonly(
-label=>WebGUI::International::get(1,$_[0]->get("namespace")),
-value=>[$_[0]->getValue("proxiedWobjectId")]
-value=>'<a href="'.WebGUI::URL::gateway($data[0]).'">'.$data[1].'</a>'
);
$output .= $f->print;
return $output;
return $_[0]->SUPER::www_edit(
-properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-headingId=>2,
-helpId=>1
);
}
#-------------------------------------------------------------------