Changed incrementers and table names to conform with namespace standards.

This commit is contained in:
JT Smith 2002-10-06 21:40:15 +00:00
parent 602cb9a7a7
commit fb7fb07b16
8 changed files with 238 additions and 155 deletions

View file

@ -15,6 +15,19 @@ save you many hours of grief.
third-party or custom plug-ins, you can disregard this
warning.
* DownloadManager.pm in lib/WebGUI/Wobject has been renamed to
FileManager.pm. Please delete DownloadManager.pm from your
installation after upgrading.
* UserSubmission.pm in lib/WebGUI/Wobject has been renamed to
USS.pm. Please delete UserSubmission.pm from your
installation after upgrading.
* Many of WebGUI's default data structures have been altered. If
you are using SQL Reports that access WebGUI's data
structures directly, please be sure to alter them after
the upgrade.
4.6.3
--------------------------------------------------------------------
* It has been reported that some people had a duplicate key error

View file

@ -1,6 +1,6 @@
insert into webguiVersion values ('4.7.0','upgrade',unix_timestamp());
update international set internationalId=728, namespace='WebGUI' where internationalId=12 and namespace='Product';
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (728,1,'WebGUI','UI Level', 1033832377);
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (739,1,'WebGUI','UI Level', 1033832377);
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (738,1,'WebGUI','9 Guru', 1033836704);
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (737,1,'WebGUI','8 Master', 1033836698);
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (736,1,'WebGUI','7 Expert', 1033836692);
@ -11,8 +11,78 @@ insert into international (internationalId,languageId,namespace,message,lastUpda
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (731,1,'WebGUI','2 Trained', 1033836651);
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (730,1,'WebGUI','1 Novice', 1033836642);
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (729,1,'WebGUI','0 Beginner', 1033836631);
INSERT INTO userProfileField VALUES ('uiLevel','WebGUI::International::get(728,\"WebGUI\");',0,0,'select','{\r\n0=>WebGUI::International::get(729,\"WebGUI\"),\r\n1=>WebGUI::International::get(730,\"WebGUI\"),\r\n2=>WebGUI::International::get(731,\"WebGUI\"),\r\n3=>WebGUI::International::get(732,\"WebGUI\"),\r\n4=>WebGUI::International::get(733,\"WebGUI\"),\r\n5=>WebGUI::International::get(734,\"WebGUI\"),\r\n6=>WebGUI::International::get(735,\"WebGUI\"),\r\n7=>WebGUI::International::get(736,\"WebGUI\"),\r\n8=>WebGUI::International::get(737,\"WebGUI\"),\r\n9=>WebGUI::International::get(738,\"WebGUI\")\r\n}','[5]',8,4,1);
INSERT INTO userProfileField VALUES ('uiLevel','WebGUI::International::get(739,\"WebGUI\");',0,0,'select','{\r\n0=>WebGUI::International::get(729,\"WebGUI\"),\r\n1=>WebGUI::International::get(730,\"WebGUI\"),\r\n2=>WebGUI::International::get(731,\"WebGUI\"),\r\n3=>WebGUI::International::get(732,\"WebGUI\"),\r\n4=>WebGUI::International::get(733,\"WebGUI\"),\r\n5=>WebGUI::International::get(734,\"WebGUI\"),\r\n6=>WebGUI::International::get(735,\"WebGUI\"),\r\n7=>WebGUI::International::get(736,\"WebGUI\"),\r\n8=>WebGUI::International::get(737,\"WebGUI\"),\r\n9=>WebGUI::International::get(738,\"WebGUI\")\r\n}','[5]',8,4,1);
INSERT INTO userProfileData VALUES (3,'uiLevel','9');
update incrementer set incrementerId='FAQ_questionId' where incrementerId='questionId';
update incrementer set incrementerId='LinkList_linkId' where incrementerId='linkId';
update incrementer set incrementerId='EventsCalendar_eventId' where incrementerId='eventId';
update incrementer set incrementerId='EventsCalendar_recurringEventId' where incrementerId='recurringEventId';
alter table FAQ_question change questionId FAQ_questionId int not null;
alter table LinkList_link change linkId LinkList_linkId int not null;
alter table EventsCalendar_event change eventId EventsCalendar_eventId int not null;
alter table EventsCalendar_event change recurringEventId EventsCalendar_recurringEventId int not null;
update incrementer set incrementerId='FileManager_fileId' where incrementerId='fileId';
update incrementer set incrementerId='USS_submissionId' where incrementerId='submissionId';
alter table DownloadManager_file change downloadId FileManager_fileId int not null;
alter table DownloadManager rename FileManager;
alter table DownloadManager_file rename FileManager_file;
update wobject set namespace='USS' where namespace='UserSubmission';
update help set namespace='USS' where namespace='UserSubmission';
update international set namespace='USS' where namespace='UserSubmission';
update international set namespace='FileManager' where namespace='DownloadManager';
update help set namespace='FileManager' where namespace='DownloadManager';
update wobject set namespace='FileManager' where namespace='DownloadManager';
alter table UserSubmission rename USS;
alter table UserSubmission_submission rename USS_submission;
alter table USS_submission change submissionId USS_submissionId int not null;
update incrementer set nextValue=nextValue+999 where incrementerId='EventsCalendar_eventId';
update incrementer set nextValue=nextValue+999 where incrementerId='EventsCalendar_recurringEventId';
update EventsCalendar_event set EventsCalendar_eventId=EventsCalendar_eventId+999;
update EventsCalendar_event set EventsCalendar_recurringEventId=EventsCalendar_recurringEventId+999;
update FAQ_question set FAQ_questionId=FAQ_questionId+999;
update LinkList_link set LinkList_linkId=LinkList_linkId+999;
update incrementer set nextValue=nextValue+999 where incrementerId='FAQ_questionId';
update incrementer set nextValue=nextValue+999 where incrementerId='LinkList_linkId';
update incrementer set nextValue=nextValue+974 where incrementerId='pageId';
update page set pageId=pageId+974 where pageId>25;
update page set parentId=parentId+974 where parentId>25;
update page set styleId=styleId+974 where styleId>25;
update incrementer set nextValue=nextValue+974 where incrementerId='styleId';
update style set styleId=styleId+974 where styleId>25;
update discussion set messageId=messageId+999;
update discussion set rid=rid+999;
update discussion set pid=pid+999 where pid<>0;
update incrementer set nextValue=nextValue+999 where incrementerId='messageId';
update messageLog set messageLogId=messageLogId+999;
update incrementer set nextValue=nextValue+999 where incrementerId='messageLogId';
update incrementer set nextValue=nextValue+999 where incrementerId='imageGroupId';
update imageGroup set imageGroupId=imageGroupId+999 where imageGroupId>0;
update images set imageGroupId=imageGroupId+999 where imageGroupId>0;
update incrementer set incrementerId='MailForm_fieldId' where incrementerId='mailFieldId';
update incrementer set incrementerId='MailForm_entryId' where incrementerId='mailEntryId';
alter table MailForm_entry change entryId MailForm_entryId int not null;
alter table MailForm_field change mailfieldId MailForm_fieldId int not null;
alter table MailForm_entry_data rename MailForm_entryData;
alter table MailForm_entryData change entryId MailForm_entryId int not null;
update incrementer set incrementerId='FileManager_fileId' where incrementerId='downloadId';
update incrementer set incrementerId='Product_featureId' where incrementerId='productFeatureId';
update incrementer set incrementerId='Product_benefitId' where incrementerId='productBenefitId';
update incrementer set incrementerId='Product_templateId' where incrementerId='productTemplateId';
update incrementer set incrementerId='Product_specificationId' where incrementerId='productSpecificationId';
alter table Product_template change productTemplateId Product_templateId int not null;
alter table Product change productTemplateId Product_templateId int not null default 1;
alter table Product_benefit change productBenefitId Product_benefitId int not null;
alter table Product_feature change productFeatureId Product_featureId int not null;
alter table Product_specification change productSpecificationId Product_specificationId int not null;

View file

@ -58,13 +58,13 @@ sub _calendarLayout {
|| epochToHuman($event{endDate},"%M %y") eq $thisMonth) {
$message = "";
if ($session{var}{adminOn}) {
$message = deleteIcon('func=deleteEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{eventId}
.'&rid='.$event{recurringEventId})
.editIcon('func=editEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{eventId})
$message = deleteIcon('func=deleteEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{EventsCalendar_eventId}
.'&rid='.$event{EventsCalendar_recurringEventId})
.editIcon('func=editEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{EventsCalendar_eventId})
.' ';
}
$message .= '<a href="'.WebGUI::URL::page('wid='.$_[0]->get("wobjectId")
.'&func=viewEvent&eid='.$event{eventId}).'">'.$event{name}.'</a>';
.'&func=viewEvent&eid='.$event{EventsCalendar_eventId}).'">'.$event{name}.'</a>';
$message .= '<br>';
if ($event{startDate} == $event{endDate}) {
$calendar->addcontent(epochToHuman($event{startDate},"%D"),$message);
@ -93,11 +93,11 @@ sub duplicate {
paginateAfter=>$_[0]->get("paginateAfter")
});
$sth = WebGUI::SQL->read("select * from EventsCalendar_event where wobjectId="
.$_[0]->get("wobjectId")." order by recurringEventId");
.$_[0]->get("wobjectId")." order by EventsCalendar_recurringEventId");
while (@row = $sth->array) {
$newEventId = getNextId("eventId");
$newEventId = getNextId("EventsCalendar_eventId");
if ($row[6] > 0 && $row[6] != $previousRecurringEventId) {
$row[6] = getNextId("recurringEventId");
$row[6] = getNextId("EventsCalendar_recurringEventId");
$previousRecurringEventId = $row[6];
}
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, ".$w->get("wobjectId").", ".
@ -138,9 +138,9 @@ sub www_deleteEvent {
sub www_deleteEventConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
if ($session{form}{rid} > 0) {
$_[0]->deleteCollateral("EventsCalendar_event","recurringEventId",$session{form}{rid});
$_[0]->deleteCollateral("EventsCalendar_event","EventsCalendar_recurringEventId",$session{form}{rid});
} else {
$_[0]->deleteCollateral("EventsCalendar_event","eventId",$session{form}{eid});
$_[0]->deleteCollateral("EventsCalendar_event","EventsCalendar_eventId",$session{form}{eid});
}
return "";
}
@ -206,7 +206,7 @@ sub www_editEvent {
$f->raw("</td><tr>");
$special = $f->printRowsOnly;
} else {
%event = WebGUI::SQL->quickHash("select * from EventsCalendar_event where eventId='$session{form}{eid}'");
%event = WebGUI::SQL->quickHash("select * from EventsCalendar_event where EventsCalendar_eventId='$session{form}{eid}'");
$f = WebGUI::HTMLForm->new;
$f->hidden("until");
$special = $f->printRowsOnly;
@ -234,19 +234,19 @@ sub www_editEventSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my (@startDate, @endDate, $until, @eventId, $i, $recurringEventId);
if ($session{form}{eid} eq "new") {
$session{form}{eid} = getNextId("eventId");
$session{form}{eid} = getNextId("EventsCalendar_eventId");
$startDate[0] = setToEpoch($session{form}{startDate});
$endDate[0] = setToEpoch($session{form}{endDate});
$until = setToEpoch($session{form}{until});
$eventId[0] = getNextId("eventId");
$eventId[0] = getNextId("EventsCalendar_eventId");
$session{form}{interval} = 1 if ($session{form}{interval} < 1);
if ($session{form}{recursEvery} eq "never") {
$recurringEventId = 0;
} else {
$recurringEventId = getNextId("recurringEventId");
$recurringEventId = getNextId("EventsCalendar_recurringEventId");
while ($startDate[$i] < $until) {
$i++;
$eventId[$i] = getNextId("eventId");
$eventId[$i] = getNextId("EventsCalendar_eventId");
if ($session{form}{recursEvery} eq "day") {
$startDate[$i] = addToDate($startDate[0],0,0,($i*$session{form}{interval}));
$endDate[$i] = addToDate($endDate[0],0,0,($i*$session{form}{interval}));
@ -274,7 +274,7 @@ sub www_editEventSave {
} else {
WebGUI::SQL->write("update EventsCalendar_event set name=".quote($session{form}{name}).",
description=".quote($session{form}{description}).", startDate='".setToEpoch($session{form}{startDate})."',
endDate='".setToEpoch($session{form}{endDate})."' where eventId=$session{form}{eid}");
endDate='".setToEpoch($session{form}{endDate})."' where EventsCalendar_eventId=$session{form}{eid}");
}
if ($session{form}{proceed}) {
$session{form}{eid} = "new";
@ -341,9 +341,9 @@ sub www_view {
}
%previous = %event;
if ($session{var}{adminOn}) {
$row[$i] .= deleteIcon('func=deleteEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{eventId}
.'&rid='.$event{recurringEventId})
.editIcon('func=editEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{eventId})
$row[$i] .= deleteIcon('func=deleteEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{EventsCalendar_eventId}
.'&rid='.$event{EventsCalendar_recurringEventId})
.editIcon('func=editEvent&wid='.$_[0]->get("wobjectId").'&eid='.$event{EventsCalendar_eventId})
.' ';
}
$row[$i] .= '<span class="eventTitle">'.$event{name}.'</span>';
@ -365,7 +365,7 @@ sub www_view {
sub www_viewEvent {
my ($output, %event);
tie %event, 'Tie::CPHash';
%event = WebGUI::SQL->quickHash("select * from EventsCalendar_event where eventId=$session{form}{eid}");
%event = WebGUI::SQL->quickHash("select * from EventsCalendar_event where EventsCalendar_eventId=$session{form}{eid}");
$output = '<h1>'.$event{name}.'</h1>';
$output .= '<table width="100%" cellspacing="0" cellpadding="5" border="0">';
$output .= '<tr>';
@ -377,7 +377,7 @@ sub www_viewEvent {
$output .= '<a href="'.WebGUI::URL::page('func=editEvent&eid='.$session{form}{eid}.'&wid='
.$session{form}{wid}).'">'.WebGUI::International::get(575).'</a><br>';
$output .= '<a href="'.WebGUI::URL::page('func=deleteEvent&eid='.$session{form}{eid}.
'&wid='.$session{form}{wid}.'&rid='.$event{recurringEventId}).'">'
'&wid='.$session{form}{wid}.'&rid='.$event{EventsCalendar_recurringEventId}).'">'
.WebGUI::International::get(576).'</a><br>';
}
$output .= '</td></tr>';

View file

@ -39,7 +39,7 @@ sub duplicate {
});
$sth = WebGUI::SQL->read("select * from FAQ_question where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newQuestionId = getNextId("questionId");
$newQuestionId = getNextId("FAQ_questionId");
WebGUI::SQL->write("insert into FAQ_question values (".$w->get("wobjectId").", $newQuestionId, "
.quote($data{question}).", ".quote($data{answer}).", $data{sequenceNumber})");
}
@ -71,8 +71,8 @@ sub www_deleteQuestion {
sub www_deleteQuestionConfirm {
my ($output);
if (WebGUI::Privilege::canEditPage()) {
$_[0]->deleteCollateral("FAQ_question","questionId",$session{form}{qid});
$_[0]->reorderCollateral("FAQ_question","questionId");
$_[0]->deleteCollateral("FAQ_question","FAQ_questionId",$session{form}{qid});
$_[0]->reorderCollateral("FAQ_question","FAQ_questionId");
return "";
} else {
return WebGUI::Privilege::insufficient();
@ -124,7 +124,7 @@ sub www_editQuestion {
my ($output, %question, $f);
tie %question, 'Tie::CPHash';
if (WebGUI::Privilege::canEditPage()) {
%question = WebGUI::SQL->quickHash("select * from FAQ_question where questionId='$session{form}{qid}'");
%question = WebGUI::SQL->quickHash("select * from FAQ_question where FAQ_questionId='$session{form}{qid}'");
$output = helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
$f = WebGUI::HTMLForm->new;
@ -148,8 +148,8 @@ sub www_editQuestion {
sub www_editQuestionSave {
my ($seq);
if (WebGUI::Privilege::canEditPage()) {
$_[0]->setCollateral("FAQ_question", "questionId", {
questionId => $session{form}{qid},
$_[0]->setCollateral("FAQ_question", "FAQ_questionId", {
FAQ_questionId => $session{form}{qid},
question => $session{form}{question},
answer => $session{form}{answer}
});
@ -167,14 +167,14 @@ sub www_editQuestionSave {
#-------------------------------------------------------------------
sub www_moveQuestionDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("FAQ_question","questionId",$session{form}{qid});
$_[0]->moveCollateralDown("FAQ_question","FAQ_questionId",$session{form}{qid});
return "";
}
#-------------------------------------------------------------------
sub www_moveQuestionUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("FAQ_question","questionId",$session{form}{qid});
$_[0]->moveCollateralUp("FAQ_question","FAQ_questionId",$session{form}{qid});
return "";
}
@ -196,16 +196,16 @@ sub www_view {
$sth = WebGUI::SQL->read("select * from FAQ_question where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
while (%question = $sth->hash) {
if ($_[0]->get("tocOn")) {
$output .= '<li><a href="#'.$question{questionId}.'"><span class="faqQuestion">'.$question{question}.'</span></a>';
$output .= '<li><a href="#'.$question{FAQ_questionId}.'"><span class="faqQuestion">'.$question{question}.'</span></a>';
}
if ($session{var}{adminOn}) {
$qNa .= deleteIcon('func=deleteQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{questionId})
.editIcon('func=editQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{questionId})
.moveUpIcon('func=moveQuestionUp&wid='.$_[0]->get("wobjectId").'&qid='.$question{questionId})
.moveDownIcon('func=moveQuestionDown&wid='.$_[0]->get("wobjectId").'&qid='.$question{questionId})
$qNa .= deleteIcon('func=deleteQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})
.editIcon('func=editQuestion&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})
.moveUpIcon('func=moveQuestionUp&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})
.moveDownIcon('func=moveQuestionDown&wid='.$_[0]->get("wobjectId").'&qid='.$question{FAQ_questionId})
.' ';
}
$qNa .= '<a name="'.$question{questionId}.'"><span class="faqQuestion">';
$qNa .= '<a name="'.$question{FAQ_questionId}.'"><span class="faqQuestion">';
if ($_[0]->get("qaOn")) {
$qNa .= $q.': ';
}

View file

@ -1,4 +1,4 @@
package WebGUI::Wobject::DownloadManager;
package WebGUI::Wobject::FileManager;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black LLC.
@ -26,7 +26,7 @@ use WebGUI::Utility;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Wobject);
our $namespace = "DownloadManager";
our $namespace = "FileManager";
our $name = WebGUI::International::get(1,$namespace);
#-------------------------------------------------------------------
@ -56,21 +56,21 @@ sub duplicate {
my ($file, $w, %row, $sth, $newDownloadId);
tie %row, 'Tie::CPHash';
$w = $_[0]->SUPER::duplicate($_[1]);
$w = WebGUI::Wobject::DownloadManager->new({wobjectId=>$w,namespace=>$namespace});
$w = WebGUI::Wobject::FileManager->new({wobjectId=>$w,namespace=>$namespace});
$w->set({
paginateAfter=>$_[0]->get("paginateAfter"),
displayThumbnails=>$_[0]->get("displayThumbnails")
});
$sth = WebGUI::SQL->read("select * from DownloadManager_file where wobjectId=".$_[0]->get("wobjectId"));
$sth = WebGUI::SQL->read("select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId"));
while (%row = $sth->hash) {
$newDownloadId = getNextId("downloadId");
$file = WebGUI::Attachment->new($row{downloadFile},$_[0]->get("wobjectId"),$row{downloadId});
$newDownloadId = getNextId("FileManager_fileId");
$file = WebGUI::Attachment->new($row{downloadFile},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w->get("wobjectId"),$newDownloadId);
$file = WebGUI::Attachment->new($row{alternateVersion1},$_[0]->get("wobjectId"),$row{downloadId});
$file = WebGUI::Attachment->new($row{alternateVersion1},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w->get("wobjectId"),$newDownloadId);
$file = WebGUI::Attachment->new($row{alternateVersion2},$_[0]->get("wobjectId"),$row{downloadId});
$file = WebGUI::Attachment->new($row{alternateVersion2},$_[0]->get("wobjectId"),$row{FileManager_fileId});
$file->copy($w->get("wobjectId"),$newDownloadId);
WebGUI::SQL->write("insert into DownloadManager_file values ($newDownloadId, ".$w->get("wobjectId").", ".
WebGUI::SQL->write("insert into FileManager_file values ($newDownloadId, ".$w->get("wobjectId").", ".
quote($row{fileTitle}).", ".quote($row{downloadFile}).", $row{groupToView}, ".
quote($row{briefSynopsis}).", $row{dateUploaded}, $row{sequenceNumber}, ".
quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).")");
@ -80,7 +80,7 @@ sub duplicate {
#-------------------------------------------------------------------
sub purge {
WebGUI::SQL->write("delete from DownloadManager_file where wobjectId=".$_[0]->get("wobjectId"));
WebGUI::SQL->write("delete from FileManager_file where wobjectId=".$_[0]->get("wobjectId"));
$_[0]->SUPER::purge();
}
@ -97,7 +97,7 @@ sub uiLevel {
#-------------------------------------------------------------------
sub www_deleteFile {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->setCollateral("DownloadManager_file","downloadId",{$session{form}{file}=>''},0,0);
$_[0]->setCollateral("FileManager_file","FileManager_fileId",{$session{form}{file}=>''},0,0);
return $_[0]->www_editDownload();
}
@ -114,8 +114,8 @@ sub www_deleteDownloadConfirm {
my ($output, $file);
$file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
$file->deleteNode;
$_[0]->deleteCollateral("DownloadManager_file","downloadId",$session{form}{did});
$_[0]->reorderCollateral("DownloadManager_file","downloadId");
$_[0]->deleteCollateral("FileManager_file","FileManager_fileId",$session{form}{did});
$_[0]->reorderCollateral("FileManager_file","FileManager_fileId");
return "";
}
@ -123,7 +123,7 @@ sub www_deleteDownloadConfirm {
sub www_download {
my (%download, $file);
tie %download,'Tie::CPHash';
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId=$session{form}{did}");
%download = WebGUI::SQL->quickHash("select * from FileManager_file where FileManager_fileId=$session{form}{did}");
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
if ($session{form}{alternateVersion} == 1) {
$file = WebGUI::Attachment->new($download{alternateVersion1},
@ -186,7 +186,7 @@ sub www_editDownload {
if ($session{form}{did} eq "") {
$session{form}{did} = "new";
} else {
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId='$session{form}{did}'");
%download = WebGUI::SQL->quickHash("select * from FileManager_file where FileManager_fileId='$session{form}{did}'");
}
$output .= helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
@ -228,14 +228,14 @@ sub www_editDownload {
sub www_editDownloadSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($file, %files);
$files{downloadId} = $_[0]->setCollateral("DownloadManager_file", "downloadId", {
downloadId => $session{form}{did},
$files{FileManager_fileId} = $_[0]->setCollateral("FileManager_file", "FileManager_fileId", {
FileManager_fileId => $session{form}{did},
fileTitle => $session{form}{fileTitle},
briefSynopsis => $session{form}{briefSynopsis},
dateUploaded => time(),
groupToView => $session{form}{groupToView}
});
$_[0]->reorderCollateral("DownloadManager_file","downloadId");
$_[0]->reorderCollateral("FileManager_file","FileManager_fileId");
$file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
$file->save("downloadFile");
$files{downloadFile} = $file->getFilename;
@ -246,7 +246,7 @@ sub www_editDownloadSave {
$file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{did});
$file->save("alternateVersion2");
$files{alternateVersion2} = $file->getFilename;
$_[0]->setCollateral("DownloadManager_file", "downloadId", \%files);
$_[0]->setCollateral("FileManager_file", "FileManager_fileId", \%files);
if ($session{form}{proceed}) {
$session{form}{did} = "new";
return $_[0]->www_editDownload();
@ -258,14 +258,14 @@ sub www_editDownloadSave {
#-------------------------------------------------------------------
sub www_moveDownloadDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("DownloadManager_file","downloadId",$session{form}{did});
$_[0]->moveCollateralDown("FileManager_file","FileManager_fileId",$session{form}{did});
return "";
}
#-------------------------------------------------------------------
sub www_moveDownloadUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("DownloadManager_file","downloadId",$session{form}{did});
$_[0]->moveCollateralUp("FileManager_file","FileManager_fileId",$session{form}{did});
return "";
}
@ -287,7 +287,7 @@ sub www_view {
$url = WebGUI::URL::append($url,"sortDirection=$session{form}{sortDirection}") if ($session{form}{sortDirection});
$url = WebGUI::URL::append($url,"sort=$session{form}{sort}") if ($session{form}{sort});
$session{form}{sort} = "sequenceNumber" if ($session{form}{sort} eq "");
$sql = "select * from DownloadManager_file where wobjectId=".$_[0]->get("wobjectId")." ";
$sql = "select * from FileManager_file where wobjectId=".$_[0]->get("wobjectId")." ";
$constraints = WebGUI::Search::buildConstraints([qw(fileTitle downloadFile alternateVersion1 alternateVersion2 briefSynopsis)]);
$sql .= " and ".$constraints if ($constraints ne "");
$sql .= " order by $session{form}{sort} ";
@ -311,33 +311,33 @@ sub www_view {
while (%download = $sth->hash) {
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
$file = WebGUI::Attachment->new($download{downloadFile},
$_[0]->get("wobjectId"), $download{downloadId});
$_[0]->get("wobjectId"), $download{FileManager_fileId});
$row[$i] = '<tr><td class="tableData" valign="top">';
if ($session{var}{adminOn}) {
$row[$i] .= deleteIcon('func=deleteDownload&wid='.$_[0]->get("wobjectId").'&did='.$download{downloadId})
.editIcon('func=editDownload&wid='.$_[0]->get("wobjectId").'&did='.$download{downloadId})
.moveUpIcon('func=moveDownloadUp&wid='.$_[0]->get("wobjectId").'&did='.$download{downloadId})
.moveDownIcon('func=moveDownloadDown&wid='.$_[0]->get("wobjectId").'&did='.$download{downloadId})
$row[$i] .= deleteIcon('func=deleteDownload&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId})
.editIcon('func=editDownload&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId})
.moveUpIcon('func=moveDownloadUp&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId})
.moveDownIcon('func=moveDownloadDown&wid='.$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId})
.' ';
}
$row[$i] .= '<a href="'.WebGUI::URL::page('func=download&wid='.$_[0]->get("wobjectId").
'&did='.$download{downloadId}).'">'.$download{fileTitle}.'</a>&nbsp;&middot;&nbsp;<a href="'.
'&did='.$download{FileManager_fileId}).'">'.$download{fileTitle}.'</a>&nbsp;&middot;&nbsp;<a href="'.
WebGUI::URL::page('func=download&wid='.
$_[0]->get("wobjectId").'&did='.$download{downloadId}).'"><img src="'.$file->getIcon.
$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}).'"><img src="'.$file->getIcon.
'" border=0 width=16 height=16 align="middle">'.$file->getType.'/'.$file->getSize.'</a>';
if ($download{alternateVersion1}) {
$alt1 = WebGUI::Attachment->new($download{alternateVersion1},
$_[0]->get("wobjectId"), $download{downloadId});
$_[0]->get("wobjectId"), $download{FileManager_fileId});
$row[$i] .= ' &middot; <a href="'.WebGUI::URL::page('func=download&wid='.
$_[0]->get("wobjectId").'&did='.$download{downloadId}.'&alternateVersion=1')
$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}.'&alternateVersion=1')
.'"><img src="'.$alt1->getIcon.'" border=0 width=16 height=16 align="middle">'.
$alt1->getType.'/'.$alt1->getSize.'</a>';
}
if ($download{alternateVersion2}) {
$alt2 = WebGUI::Attachment->new($download{alternateVersion2},
$_[0]->get("wobjectId"), $download{downloadId});
$_[0]->get("wobjectId"), $download{FileManager_fileId});
$row[$i] .= ' &middot; <a href="'.WebGUI::URL::page('func=download&wid='.
$_[0]->get("wobjectId").'&did='.$download{downloadId}.'&alternateVersion=2')
$_[0]->get("wobjectId").'&did='.$download{FileManager_fileId}.'&alternateVersion=2')
.'"><img src="'.$alt2->getIcon.'" border=0 width=16 height=16 align="middle">'.
$alt2->getType.'/'.$alt2->getSize.'</a>';
}

View file

@ -39,7 +39,7 @@ sub duplicate {
});
$sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId"));
while (@row = $sth->array) {
$newLinkId = getNextId("linkId");
$newLinkId = getNextId("LinkList_linkId");
WebGUI::SQL->write("insert into LinkList_link values (".$w->get("wobjectId").", $newLinkId, "
.quote($row[2]).", ".quote($row[3]).", ".quote($row[4]).", '$row[5]', '$row[6]')");
}
@ -67,8 +67,8 @@ sub www_deleteLink {
#-------------------------------------------------------------------
sub www_deleteLinkConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->deleteCollateral("LinkList_link","linkId",$session{form}{lid});
$_[0]->reorderCollateral("LinkList_link","linkId");
$_[0]->deleteCollateral("LinkList_link","LinkList_linkId",$session{form}{lid});
$_[0]->reorderCollateral("LinkList_link","LinkList_linkId");
return "";
}
@ -115,7 +115,7 @@ sub www_editLink {
my ($output, %link, $f, $linkId, $newWindow);
tie %link, 'Tie::CPHash';
$linkId = $session{form}{lid} || "new";
%link = WebGUI::SQL->quickHash("select * from LinkList_link where linkId='$session{form}{lid}'");
%link = WebGUI::SQL->quickHash("select * from LinkList_link where LinkList_linkId='$session{form}{lid}'");
if ($linkId eq "new") {
$newWindow = 1;
} else {
@ -140,8 +140,8 @@ sub www_editLink {
#-------------------------------------------------------------------
sub www_editLinkSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->setCollateral("LinkList_link", "linkId", {
linkId => $session{form}{lid},
$_[0]->setCollateral("LinkList_link", "LinkList_linkId", {
LinkList_linkId => $session{form}{lid},
description => $session{form}{description},
newWindow => $session{form}{newWindow},
url => $session{form}{url},
@ -158,14 +158,14 @@ sub www_editLinkSave {
#-------------------------------------------------------------------
sub www_moveLinkDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("LinkList_link","linkId",$session{form}{lid});
$_[0]->moveCollateralDown("LinkList_link","LinkList_linkId",$session{form}{lid});
return "";
}
#-------------------------------------------------------------------
sub www_moveLinkUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("LinkList_link","linkId",$session{form}{lid});
$_[0]->moveCollateralUp("LinkList_link","LinkList_linkId",$session{form}{lid});
return "";
}
@ -188,10 +188,10 @@ sub www_view {
$sth = WebGUI::SQL->read("select * from LinkList_link where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
while (%link = $sth->hash) {
if ($session{var}{adminOn}) {
$output .= deleteIcon('func=deleteLink&wid='.$_[0]->get("wobjectId").'&lid='.$link{linkId})
.editIcon('func=editLink&wid='.$_[0]->get("wobjectId").'&lid='.$link{linkId})
.moveUpIcon('func=moveLinkUp&wid='.$_[0]->get("wobjectId").'&lid='.$link{linkId})
.moveDownIcon('func=moveLinkDown&wid='.$_[0]->get("wobjectId").'&lid='.$link{linkId})
$output .= deleteIcon('func=deleteLink&wid='.$_[0]->get("wobjectId").'&lid='.$link{LinkList_linkId})
.editIcon('func=editLink&wid='.$_[0]->get("wobjectId").'&lid='.$link{LinkList_linkId})
.moveUpIcon('func=moveLinkUp&wid='.$_[0]->get("wobjectId").'&lid='.$link{LinkList_linkId})
.moveDownIcon('func=moveLinkDown&wid='.$_[0]->get("wobjectId").'&lid='.$link{LinkList_linkId})
.' ';
} else {
$output .= $indent.$_[0]->get("bullet");

View file

@ -52,7 +52,7 @@ sub duplicate {
});
$sth = WebGUI::SQL->read("select * from MailForm_field where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newFieldId = getNextId("mailFieldId");
$newFieldId = getNextId("MailForm_fieldId");
WebGUI::SQL->write(
"insert into MailForm_field values (".$w->get("wobjectId").", $newFieldId, $data{sequenceNumber}, ".
quote($data{name}).", ".
@ -92,8 +92,8 @@ sub www_deleteField {
#-------------------------------------------------------------------
sub www_deleteFieldConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->deleteCollateral("MailForm_field","mailFieldId",$session{form}{fid});
$_[0]->reorderCollateral("MailForm_field","mailFieldId");
$_[0]->deleteCollateral("MailForm_field","MailForm_fieldId",$session{form}{fid});
$_[0]->reorderCollateral("MailForm_field","MailForm_fieldId");
return "";
}
@ -183,7 +183,7 @@ sub www_editField {
yesNo => "Yes/No",
select => "Drop-Down Box" );
%field = WebGUI::SQL->quickHash("select * from MailForm_field where mailFieldId='$session{form}{fid}'");
%field = WebGUI::SQL->quickHash("select * from MailForm_field where MailForm_fieldId='$session{form}{fid}'");
$output = helpIcon(2,$_[0]->get("namespace"));
$output .= '<h1>'.WebGUI::International::get(20,$namespace).'</h1>';
$f = WebGUI::HTMLForm->new;
@ -210,8 +210,8 @@ sub www_editFieldSave {
my ($seq);
if ($session{form}{fid} eq "new") {
($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from MailForm_field where wobjectId=".$_[0]->get("wobjectId"));
$session{form}{fid} = getNextId("mailFieldId");
WebGUI::SQL->write("insert into MailForm_field (wobjectId,mailFieldId,sequenceNumber) values
$session{form}{fid} = getNextId("MailForm_fieldId");
WebGUI::SQL->write("insert into MailForm_field (wobjectId,MailForm_fieldId,sequenceNumber) values
(".$_[0]->get("wobjectId").",$session{form}{fid},".($seq+1).")");
}
WebGUI::SQL->write("update MailForm_field set name=".quote($session{form}{name}).
@ -219,7 +219,7 @@ sub www_editFieldSave {
", type=".quote($session{form}{type}).
", possibleValues=".quote($session{form}{possibleValues}).
", defaultValue=".quote($session{form}{defaultValue}).
" where mailFieldId=$session{form}{fid}");
" where MailForm_fieldId=$session{form}{fid}");
if ($session{form}{proceed}) {
$session{form}{fid} = "new";
return $_[0]->www_editField();
@ -231,14 +231,14 @@ sub www_editFieldSave {
#-------------------------------------------------------------------
sub www_moveFieldDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("MailForm_field","mailFieldId",$session{form}{fid});
$_[0]->moveCollateralDown("MailForm_field","MailForm_fieldId",$session{form}{fid});
return "";
}
#-------------------------------------------------------------------
sub www_moveFieldUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("MailForm_field","mailFieldId",$session{form}{fid});
$_[0]->moveCollateralUp("MailForm_field","MailForm_fieldId",$session{form}{fid});
return "";
}
@ -300,13 +300,13 @@ sub www_view {
# but show for admins
if ($session{var}{adminOn}) {
$row = "<tr><td class='formDescription' valign='middle'>\u".$data{name}." (hidden)&nbsp;</td><td class='tableData' valign='middle'>".$data{defaultValue};
$row .= $_[0]->_fieldAdminIcons($data{mailFieldId});
$row .= $_[0]->_fieldAdminIcons($data{MailForm_fieldId});
}
} elsif ($data{status} == 2) {
# read-only field
$row = "<tr><td class='formDescription' valign='middle'>\u".$data{name}."&nbsp;</td><td class='tableData' valign='middle'>".$data{defaultValue};
if ($session{var}{adminOn}) {
$row .= $_[0]->_fieldAdminIcons($data{mailFieldId});
$row .= $_[0]->_fieldAdminIcons($data{MailForm_fieldId});
}
$row .= "</td></tr>";
} else {
@ -391,7 +391,7 @@ sub _createField {
my $row = '<tr><td class="formDescription" valign="top">'.$data->{name}.'</td><td class="tableData">'.$f->printRowsOnly();
if ($session{var}{adminOn}) {
$row .= $self->_fieldAdminIcons($data->{mailFieldId});
$row .= $self->_fieldAdminIcons($data->{MailForm_fieldId});
}
$row .= '</td></tr>';
return $row;
@ -440,7 +440,7 @@ sub www_send {
$session{form}{bccField} = $_[0]->get("bccField") unless ($session{form}{bccField});
# store results
my $entryId = getNextId("mailEntryId");
my $entryId = getNextId("MailForm_entryId");
if ($_[0]->get("storeEntries")) {
WebGUI::SQL->write("insert into MailForm_entry values ($entryId, ".$_[0]->get("wobjectId").", ".$session{user}{userId}.", ".quote($session{user}{username}).", ".quote($session{env}{REMOTE_ADDR}).", ".quote(time()).")");
}

View file

@ -41,7 +41,7 @@ sub duplicate {
manual=>$_[0]->get("manual"),
brochure=>$_[0]->get("brochure"),
price=>$_[0]->get("price"),
productTemplateId=>$_[0]->get("productTemplateId"),
Product_templateId=>$_[0]->get("Product_templateId"),
productNumber=>$_[0]->get("productNumber")
});
$file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId"));
@ -58,21 +58,21 @@ sub duplicate {
$file->copy($w->get("wobjectId"));
$sth = WebGUI::SQL->read("select * from Product_feature where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newId = getNextId("productFeatureId");
$newId = getNextId("Product_featureId");
WebGUI::SQL->write("insert into Product_feature values (".$w->get("wobjectId").", $newId, "
.quote($data{feature}).", $data{sequenceNumber})");
}
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_benefit where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newId = getNextId("productBenefitId");
$newId = getNextId("Product_benefitId");
WebGUI::SQL->write("insert into Product_benefit values (".$w->get("wobjectId").", $newId, "
.quote($data{benefit}).", $data{sequenceNumber})");
}
$sth->finish;
$sth = WebGUI::SQL->read("select * from Product_specification where wobjectId=".$_[0]->get("wobjectId"));
while (%data = $sth->hash) {
$newId = getNextId("productSpecificationId");
$newId = getNextId("Product_specificationId");
WebGUI::SQL->write("insert into Product_specification values (".$w->get("wobjectId").", $newId, "
.quote($data{name}).", ".quote($data{value}).", ".quote($data{units}).", $data{sequenceNumber})");
}
@ -105,7 +105,7 @@ sub purge {
#-------------------------------------------------------------------
sub set {
$_[0]->SUPER::set($_[1],[qw(price productTemplateId productNumber image1 image2 image3 manual brochure warranty)]);
$_[0]->SUPER::set($_[1],[qw(price Product_templateId productNumber image1 image2 image3 manual brochure warranty)]);
}
#-------------------------------------------------------------------
@ -185,8 +185,8 @@ sub www_copyTemplate {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my (%data);
tie %data, 'Tie::CPHash';
%data = WebGUI::SQL->quickHash("select * from Product_template where productTemplateId=".$session{form}{tid});
WebGUI::SQL->write("insert into Product_template values (".getNextId("productTemplateId").","
%data = WebGUI::SQL->quickHash("select * from Product_template where Product_templateId=".$session{form}{tid});
WebGUI::SQL->write("insert into Product_template values (".getNextId("Product_templateId").","
.quote("Copy of ".$data{name}).",".quote($data{template}).")");
return $_[0]->www_edit();
}
@ -218,8 +218,8 @@ sub www_deleteBenefit {
#-------------------------------------------------------------------
sub www_deleteBenefitConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->deleteCollateral("Product_benefit","productBenefitId",$session{form}{bid});
$_[0]->reorderCollateral("Product_benefit","productBenefitId");
$_[0]->deleteCollateral("Product_benefit","Product_benefitId",$session{form}{bid});
$_[0]->reorderCollateral("Product_benefit","Product_benefitId");
return "";
}
@ -234,8 +234,8 @@ sub www_deleteFeature {
#-------------------------------------------------------------------
sub www_deleteFeatureConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->deleteCollateral("Product_feature","productFeatureId",$session{form}{fid});
$_[0]->reorderCollateral("Product_feature","productFeatureId");
$_[0]->deleteCollateral("Product_feature","Product_featureId",$session{form}{fid});
$_[0]->reorderCollateral("Product_feature","Product_featureId");
return "";
}
@ -266,8 +266,8 @@ sub www_deleteSpecification {
#-------------------------------------------------------------------
sub www_deleteSpecificationConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->deleteCollateral("Product_specification","productSpecificationId",$session{form}{sid});
$_[0]->reorderCollateral("Product_specification","productSpecificationId");
$_[0]->deleteCollateral("Product_specification","Product_specificationId",$session{form}{sid});
$_[0]->reorderCollateral("Product_specification","Product_specificationId");
return "";
}
@ -284,8 +284,8 @@ sub www_deleteTemplate {
#-------------------------------------------------------------------
sub www_deleteTemplateConfirm {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->deleteCollateral("Product_template","productTemplateId",$session{form}{tid});
WebGUI::SQL->write("update Product set productTemplateId=1 where productTemplateId=$session{form}{tid}");
$_[0]->deleteCollateral("Product_template","Product_templateId",$session{form}{tid});
WebGUI::SQL->write("update Product set Product_templateId=1 where Product_templateId=$session{form}{tid}");
return $_[0]->www_edit();
}
@ -298,7 +298,7 @@ sub www_edit {
if ($_[0]->get("wobjectId") eq "new") {
$template = 1;
} else {
$template = $_[0]->get("productTemplateId");
$template = $_[0]->get("Product_templateId");
}
$f = WebGUI::HTMLForm->new;
$f->text("price",WebGUI::International::get(10,$namespace),$_[0]->get("price"));
@ -309,19 +309,19 @@ sub www_edit {
$f->raw($_[0]->fileProperty("brochure",13));
$f->raw($_[0]->fileProperty("manual",14));
$f->raw($_[0]->fileProperty("warranty",15));
$templates = WebGUI::SQL->buildHashRef("select productTemplateId,name from Product_template order by name");
$f->select("productTemplateId",$templates,WebGUI::International::get(61,$namespace),[$template]);
$templates = WebGUI::SQL->buildHashRef("select Product_templateId,name from Product_template order by name");
$f->select("Product_templateId",$templates,WebGUI::International::get(61,$namespace),[$template]);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
unless ($_[0]->get("wobjectId") eq "new") {
$output .= '<hr size="1" /><p>';
$output .= '<a href="'.WebGUI::URL::page('func=editTemplate&tid=new&wid='.$_[0]->get("wobjectId")).'">'
.WebGUI::International::get(56,$namespace).'</a><p>';
tie %data, 'Tie::CPHash';
$sth = WebGUI::SQL->read("select productTemplateId,name from Product_template order by name");
$sth = WebGUI::SQL->read("select Product_templateId,name from Product_template order by name");
while (%data = $sth->hash) {
$output .= deleteIcon('func=deleteTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{productTemplateId})
.editIcon('func=editTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{productTemplateId})
.copyIcon('func=copyTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{productTemplateId})
$output .= deleteIcon('func=deleteTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{Product_templateId})
.editIcon('func=editTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{Product_templateId})
.copyIcon('func=copyTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{Product_templateId})
.' '.$data{name}.'<br>';
}
$sth->finish;
@ -352,7 +352,7 @@ sub www_editSave {
$file = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
$file->save("warranty");
$property{warranty}=$file->getFilename("warranty") if ($file->getFilename("warranty") ne "");
$property{productTemplateId}=$session{form}{productTemplateId};
$property{Product_templateId}=$session{form}{Product_templateId};
$property{price}=$session{form}{price};
$property{productNumber}=$session{form}{productNumber};
$_[0]->set(\%property);
@ -363,12 +363,12 @@ sub www_editSave {
sub www_editBenefit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f, $benefits);
$data = $_[0]->getCollateral("Product_benefit","productBenefitId",$session{form}{bid});
$data = $_[0]->getCollateral("Product_benefit","Product_benefitId",$session{form}{bid});
$output = helpIcon(6,$namespace);
$output .= '<h1>'.WebGUI::International::get(53,$namespace).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("bid",$data->{productBenefitId});
$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}]);
@ -382,8 +382,8 @@ sub www_editBenefit {
sub www_editBenefitSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$session{form}{benefit} = $session{form}{benefit_new} if ($session{form}{benefit_new} ne "");
$_[0]->setCollateral("Product_benefit", "productBenefitId", {
productBenefitId => $session{form}{bid},
$_[0]->setCollateral("Product_benefit", "Product_benefitId", {
Product_benefitId => $session{form}{bid},
benefit => $session{form}{benefit}
});
if ($session{form}{proceed}) {
@ -398,12 +398,12 @@ sub www_editBenefitSave {
sub www_editFeature {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f, $features);
$data = $_[0]->getCollateral("Product_feature","productFeatureId",$session{form}{fid});
$data = $_[0]->getCollateral("Product_feature","Product_featureId",$session{form}{fid});
$output = helpIcon(2,$namespace);
$output .= '<h1>'.WebGUI::International::get(22,$namespace).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("fid",$data->{productFeatureId});
$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}]);
@ -417,8 +417,8 @@ sub www_editFeature {
sub www_editFeatureSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$session{form}{feature} = $session{form}{feature_new} if ($session{form}{feature_new} ne "");
$_[0]->setCollateral("Product_feature", "productFeatureId", {
productFeatureId => $session{form}{fid},
$_[0]->setCollateral("Product_feature", "Product_featureId", {
Product_featureId => $session{form}{fid},
feature => $session{form}{feature}
});
if ($session{form}{proceed}) {
@ -433,12 +433,12 @@ sub www_editFeatureSave {
sub www_editSpecification {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f, $hashRef);
$data = $_[0]->getCollateral("Product_specification","productSpecificationId",$session{form}{sid});
$data = $_[0]->getCollateral("Product_specification","Product_specificationId",$session{form}{sid});
$output = helpIcon(3,$namespace);
$output .= '<h1>'.WebGUI::International::get(25,$namespace).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("sid",$data->{productSpecificationId});
$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}]);
@ -456,8 +456,8 @@ sub www_editSpecificationSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$session{form}{name} = $session{form}{name_new} if ($session{form}{name_new} ne "");
$session{form}{units} = $session{form}{units_new} if ($session{form}{units_new} ne "");
$_[0]->setCollateral("Product_specification", "productSpecificationId", {
productSpecificationId => $session{form}{sid},
$_[0]->setCollateral("Product_specification", "Product_specificationId", {
Product_specificationId => $session{form}{sid},
name => $session{form}{name},
value => $session{form}{value},
units => $session{form}{units}
@ -474,12 +474,12 @@ sub www_editSpecificationSave {
sub www_editTemplate {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
my ($output, $data, $f);
$data = $_[0]->getCollateral("Product_template","productTemplateId",$session{form}{tid});
$data = $_[0]->getCollateral("Product_template","Product_templateId",$session{form}{tid});
$output = helpIcon(7,$namespace);
$output .= '<h1>'.WebGUI::International::get(58,$namespace).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
$f->hidden("tid",$data->{productTemplateId});
$f->hidden("tid",$data->{Product_templateId});
$f->hidden("func","editTemplateSave");
$f->text("name",WebGUI::International::get(59,$namespace),$data->{name});
$f->HTMLArea("template",WebGUI::International::get(60,$namespace),$data->{template},'','','',($session{setting}{textAreaRows}+10));
@ -491,8 +491,8 @@ sub www_editTemplate {
#-------------------------------------------------------------------
sub www_editTemplateSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->setCollateral("Product_template", "productTemplateId", {
productTemplateId => $session{form}{tid},
$_[0]->setCollateral("Product_template", "Product_templateId", {
Product_templateId => $session{form}{tid},
name => $session{form}{name},
template => $session{form}{template}
}, 0, 0);
@ -516,28 +516,28 @@ sub www_moveAccessoryUp {
#-------------------------------------------------------------------
sub www_moveBenefitDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("Product_benefit","productBenefitId",$session{form}{bid});
$_[0]->moveCollateralDown("Product_benefit","Product_benefitId",$session{form}{bid});
return "";
}
#-------------------------------------------------------------------
sub www_moveBenefitUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("Product_benefit","productBenefitId",$session{form}{bid});
$_[0]->moveCollateralUp("Product_benefit","Product_benefitId",$session{form}{bid});
return "";
}
#-------------------------------------------------------------------
sub www_moveFeatureDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("Product_feature","productFeatureId",$session{form}{fid});
$_[0]->moveCollateralDown("Product_feature","Product_featureId",$session{form}{fid});
return "";
}
#-------------------------------------------------------------------
sub www_moveFeatureUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("Product_feature","productFeatureId",$session{form}{fid});
$_[0]->moveCollateralUp("Product_feature","Product_featureId",$session{form}{fid});
return "";
}
@ -558,14 +558,14 @@ sub www_moveRelatedUp {
#-------------------------------------------------------------------
sub www_moveSpecificationDown {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralDown("Product_specification","productSpecificationId",$session{form}{sid});
$_[0]->moveCollateralDown("Product_specification","Product_specificationId",$session{form}{sid});
return "";
}
#-------------------------------------------------------------------
sub www_moveSpecificationUp {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
$_[0]->moveCollateralUp("Product_specification","productSpecificationId",$session{form}{sid});
$_[0]->moveCollateralUp("Product_specification","Product_specificationId",$session{form}{sid});
return "";
}
@ -574,7 +574,7 @@ sub www_view {
my ($output, %data, $sth, $file, $segment, $template);
tie %data, 'Tie::CPHash';
$output = $_[0]->displayTitle;
($template) = WebGUI::SQL->quickArray("select template from Product_template where productTemplateId=".$_[0]->get("productTemplateId"));
($template) = WebGUI::SQL->quickArray("select template from Product_template where Product_templateId=".$_[0]->get("Product_templateId"));
#---product title
$segment = $_[0]->get("title");
$template =~ s/\^Product_Title\;/$segment/;
@ -655,17 +655,17 @@ sub www_view {
$template =~ s/\^Product_Image3\;/$segment/;
#---product features
$segment = "";
$sth = WebGUI::SQL->read("select feature,productFeatureId from Product_feature where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
$sth = WebGUI::SQL->read("select feature,Product_featureId from Product_feature where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
if ($session{var}{adminOn}) {
$segment .= '<a href="'.WebGUI::URL::page('func=editFeature&fid=new&wid='
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(34,$namespace).'</a><p/>';
}
while (%data = $sth->hash) {
if ($session{var}{adminOn}) {
$segment .= deleteIcon('func=deleteFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId})
.editIcon('func=editFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId})
.moveUpIcon('func=moveFeatureUp&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId})
.moveDownIcon('func=moveFeatureDown&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId});
$segment .= deleteIcon('func=deleteFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{Product_featureId})
.editIcon('func=editFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{Product_featureId})
.moveUpIcon('func=moveFeatureUp&wid='.$_[0]->get("wobjectId").'&fid='.$data{Product_featureId})
.moveDownIcon('func=moveFeatureDown&wid='.$_[0]->get("wobjectId").'&fid='.$data{Product_featureId});
}
$segment .= '&middot;'.$data{feature}.'<br>';
}
@ -673,17 +673,17 @@ sub www_view {
$template =~ s/\^Product_Features\;/$segment/;
#---product benefits
$segment = "";
$sth = WebGUI::SQL->read("select benefit,productBenefitId from Product_benefit where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
$sth = WebGUI::SQL->read("select benefit,Product_benefitId from Product_benefit where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
if ($session{var}{adminOn}) {
$segment .= '<a href="'.WebGUI::URL::page('func=editBenefit&fid=new&wid='
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(55,$namespace).'</a><p/>';
}
while (%data = $sth->hash) {
if ($session{var}{adminOn}) {
$segment .= deleteIcon('func=deleteBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId})
.editIcon('func=editBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId})
.moveUpIcon('func=moveBenefitUp&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId})
.moveDownIcon('func=moveBenefitDown&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId});
$segment .= deleteIcon('func=deleteBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{Product_benefitId})
.editIcon('func=editBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{Product_benefitId})
.moveUpIcon('func=moveBenefitUp&wid='.$_[0]->get("wobjectId").'&bid='.$data{Product_benefitId})
.moveDownIcon('func=moveBenefitDown&wid='.$_[0]->get("wobjectId").'&bid='.$data{Product_benefitId});
}
$segment.= '&middot;'.$data{benefit}.'<br>';
}
@ -691,7 +691,7 @@ sub www_view {
$template =~ s/\^Product_Benefits\;/$segment/;
#---product specifications
$segment = "";
$sth = WebGUI::SQL->read("select name,value,units,productSpecificationId from Product_specification
$sth = WebGUI::SQL->read("select name,value,units,Product_specificationId from Product_specification
where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
if ($session{var}{adminOn}) {
$segment .= '<a href="'.WebGUI::URL::page('func=editSpecification&sid=new&wid='
@ -699,10 +699,10 @@ sub www_view {
}
while (%data = $sth->hash) {
if ($session{var}{adminOn}) {
$segment .= deleteIcon('func=deleteSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId})
.editIcon('func=editSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId})
.moveUpIcon('func=moveSpecificationUp&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId})
.moveDownIcon('func=moveSpecificationDown&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId});
$segment .= deleteIcon('func=deleteSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{Product_specificationId})
.editIcon('func=editSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{Product_specificationId})
.moveUpIcon('func=moveSpecificationUp&wid='.$_[0]->get("wobjectId").'&sid='.$data{Product_specificationId})
.moveDownIcon('func=moveSpecificationDown&wid='.$_[0]->get("wobjectId").'&sid='.$data{Product_specificationId});
}
$segment .= '&middot;<b>'.$data{name}.':</b> '.$data{value}.' '.$data{units}.'<br>';
}