Adding templates.
This commit is contained in:
parent
fc1e0eb763
commit
2b09ea9f64
9 changed files with 471 additions and 381 deletions
|
|
@ -26,7 +26,6 @@ our @ISA = qw(WebGUI::Wobject);
|
|||
our $namespace = "Product";
|
||||
our $name = WebGUI::International::get(1,$namespace);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
my ($w, $file, %data, $newId, $sth);
|
||||
|
|
@ -180,17 +179,6 @@ sub www_addRelatedSave {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
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 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();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteAccessory {
|
||||
return $_[0]->confirm(
|
||||
|
|
@ -271,36 +259,25 @@ sub www_deleteSpecificationConfirm {
|
|||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteTemplate {
|
||||
return $_[0]->confirm(
|
||||
WebGUI::International::get(57,$namespace),
|
||||
WebGUI::URL::page('func=deleteTemplateConfirm&wid='.$_[0]->get("wobjectId").'&tid='.$session{form}{tid}),
|
||||
'',
|
||||
($session{form}{tid} < 1000)
|
||||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteTemplateConfirm {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
$_[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();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
my ($f, $output, $proceed, %data, $sth, $templates, $template);
|
||||
my ($f, $output, $template);
|
||||
$output = helpIcon(1,$namespace);
|
||||
$output .= '<h1>'.WebGUI::International::get(6,$namespace).'</h1>';
|
||||
if ($_[0]->get("wobjectId") eq "new") {
|
||||
$template = 1;
|
||||
} else {
|
||||
$template = $_[0]->get("Product_templateId");
|
||||
$template = $_[0]->get("templateId");
|
||||
}
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->template(
|
||||
-name=>"templateId",
|
||||
-value=>$template,
|
||||
-namespace=>$namespace,
|
||||
-label=>WebGUI::International::get(61,$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->raw($_[0]->fileProperty("image1",7));
|
||||
|
|
@ -309,23 +286,7 @@ 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 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 Product_templateId,name from Product_template order by name");
|
||||
while (%data = $sth->hash) {
|
||||
$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;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +313,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{Product_templateId}=$session{form}{Product_templateId};
|
||||
$property{templateId}=$session{form}{templateId};
|
||||
$property{price}=$session{form}{price};
|
||||
$property{productNumber}=$session{form}{productNumber};
|
||||
$_[0]->SUPER::www_editSave(\%property);
|
||||
|
|
@ -470,35 +431,6 @@ sub www_editSpecificationSave {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editTemplate {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
my ($output, $data, $f);
|
||||
$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->{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));
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editTemplateSave {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
$_[0]->setCollateral("Product_template", "Product_templateId", {
|
||||
Product_templateId => $session{form}{tid},
|
||||
name => $session{form}{name},
|
||||
template => $session{form}{template}
|
||||
}, 0, 0);
|
||||
return $_[0]->www_edit();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveAccessoryDown {
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
|
||||
|
|
@ -571,183 +503,158 @@ sub www_moveSpecificationUp {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my ($output, %data, $sth, $file, $segment, $template);
|
||||
my ($output, %data, $sth, $file, $segment, $template, %var, @featureloop, @benefitloop, @specificationloop,
|
||||
@accessoryloop, @relatedloop);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$output = $_[0]->displayTitle;
|
||||
($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/;
|
||||
#---product description
|
||||
$segment = $_[0]->description;
|
||||
$template =~ s/\^Product_Description\;/$segment/;
|
||||
#---product price
|
||||
$segment = $_[0]->get("price");
|
||||
$template =~ s/\^Product_Price\;/$segment/;
|
||||
#---product number
|
||||
$segment = $_[0]->get("productNumber");
|
||||
$template =~ s/\^Product_Number\;/$segment/;
|
||||
#---product brochure
|
||||
$segment = "";
|
||||
#---brochure
|
||||
if ($_[0]->get("brochure")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("brochure"),$_[0]->get("wobjectId"));
|
||||
$segment = '<a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 align="absmiddle"> '
|
||||
$var{brochure} = '<a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 align="absmiddle"> '
|
||||
.WebGUI::International::get(13,$namespace).'</a>';
|
||||
$var{brochureURL} = $file->getURL;
|
||||
}
|
||||
$template =~ s/\^Product_Brochure\;/$segment/;
|
||||
#---product manual
|
||||
$segment = "";
|
||||
#---manual
|
||||
if ($_[0]->get("manual")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("manual"),$_[0]->get("wobjectId"));
|
||||
$segment = '<a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 align="absmiddle"> '
|
||||
$var{manual} = '<a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 align="absmiddle"> '
|
||||
.WebGUI::International::get(14,$namespace).'</a>';
|
||||
$var{manualURL} = $file->getURL;
|
||||
}
|
||||
$template =~ s/\^Product_Manual\;/$segment/;
|
||||
#---product warranty
|
||||
$segment = "";
|
||||
#---warranty
|
||||
if ($_[0]->get("warranty")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("warranty"),$_[0]->get("wobjectId"));
|
||||
$segment = '<a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 align="absmiddle"> '
|
||||
$var{warranty} = '<a href="'.$file->getURL.'"><img src="'.$file->getIcon.'" border=0 align="absmiddle"> '
|
||||
.WebGUI::International::get(15,$namespace).'</a>';
|
||||
$var{warrantyURL} = $file->getURL;
|
||||
}
|
||||
$template =~ s/\^Product_Warranty\;/$segment/;
|
||||
#---product thumbnail1
|
||||
$segment = "";
|
||||
#---image1
|
||||
if ($_[0]->get("image1")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId"));
|
||||
$segment = '<a href="'.$file->getURL.'"><img src="'.$file->getThumbnail.'" border=0></a>';
|
||||
$var{image1} = '<img src="'.$file->getURL.'" border=0>';
|
||||
$var{image1thumbnail} = '<a href="'.$file->getURL.'"><img src="'.$file->getThumbnail.'" border=0></a>';
|
||||
$var{image1url} = $file->getURL;
|
||||
}
|
||||
$template =~ s/\^Product_Thumbnail1\;/$segment/;
|
||||
#---product thumbnail2
|
||||
$segment = "";
|
||||
#---image2
|
||||
if ($_[0]->get("image2")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("image2"),$_[0]->get("wobjectId"));
|
||||
$segment = '<a href="'.$file->getURL.'"><img src="'.$file->getThumbnail.'" border=0></a>';
|
||||
$var{image2} = '<img src="'.$file->getURL.'" border=0>';
|
||||
$var{image2thumbnail} = '<a href="'.$file->getURL.'"><img src="'.$file->getThumbnail.'" border=0></a>';
|
||||
$var{image2url} = $file->getURL;
|
||||
}
|
||||
$template =~ s/\^Product_Thumbnail2\;/$segment/;
|
||||
#---product thumbnail3
|
||||
$segment = "";
|
||||
#---image3
|
||||
if ($_[0]->get("image3")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("image3"),$_[0]->get("wobjectId"));
|
||||
$segment = '<a href="'.$file->getURL.'"><img src="'.$file->getThumbnail.'" border=0></a>';
|
||||
$var{image3} = '<img src="'.$file->getURL.'" border=0>';
|
||||
$var{image3thumbnail} = '<a href="'.$file->getURL.'"><img src="'.$file->getThumbnail.'" border=0></a>';
|
||||
$var{image3url} = $file->getURL;
|
||||
}
|
||||
$template =~ s/\^Product_Thumbnail3\;/$segment/;
|
||||
#---product image1
|
||||
$segment = "";
|
||||
if ($_[0]->get("image1")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId"));
|
||||
$segment = '<img src="'.$file->getURL.'" border=0>';
|
||||
}
|
||||
$template =~ s/\^Product_Image1\;/$segment/;
|
||||
#---product image2
|
||||
$segment = "";
|
||||
if ($_[0]->get("image2")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("image2"),$_[0]->get("wobjectId"));
|
||||
$segment = '<img src="'.$file->getURL.'" border=0>';
|
||||
}
|
||||
$template =~ s/\^Product_Image2\;/$segment/;
|
||||
#---product image3
|
||||
$segment = "";
|
||||
if ($_[0]->get("image3")) {
|
||||
$file = WebGUI::Attachment->new($_[0]->get("image3"),$_[0]->get("wobjectId"));
|
||||
$segment = '<img src="'.$file->getURL.'" border=0>';
|
||||
}
|
||||
$template =~ s/\^Product_Image3\;/$segment/;
|
||||
#---product features
|
||||
$segment = "";
|
||||
$sth = WebGUI::SQL->read("select feature,Product_featureId from Product_feature where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
|
||||
|
||||
#---features
|
||||
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/>';
|
||||
$var{addFeature} = '<a href="'.WebGUI::URL::page('func=editFeature&fid=new&wid='
|
||||
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(34,$namespace).'</a>';
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select feature,Product_featureId from Product_feature where wobjectId="
|
||||
.$_[0]->get("wobjectId")." order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= deleteIcon('func=deleteFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{Product_featureId})
|
||||
$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 .= '·'.$data{feature}.'<br>';
|
||||
push(@featureloop,{feature=>$data{feature},featureId=>$data{Product_featureId},controls=>$segment});
|
||||
}
|
||||
$sth->finish;
|
||||
$template =~ s/\^Product_Features\;/$segment/;
|
||||
#---product benefits
|
||||
$segment = "";
|
||||
$sth = WebGUI::SQL->read("select benefit,Product_benefitId from Product_benefit where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
|
||||
$var{feature_loop} = \@featureloop;
|
||||
|
||||
#---benefits
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= '<a href="'.WebGUI::URL::page('func=editBenefit&fid=new&wid='
|
||||
$var{addBenefit} = '<a href="'.WebGUI::URL::page('func=editBenefit&fid=new&wid='
|
||||
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(55,$namespace).'</a><p/>';
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select benefit,Product_benefitId from Product_benefit where wobjectId="
|
||||
.$_[0]->get("wobjectId")." order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= deleteIcon('func=deleteBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{Product_benefitId})
|
||||
$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.= '·'.$data{benefit}.'<br>';
|
||||
push(@benefitloop,{benefit=>$data{benefit},benefitId=>$data{Product_benefitId},controls=>$segment});
|
||||
}
|
||||
$sth->finish;
|
||||
$template =~ s/\^Product_Benefits\;/$segment/;
|
||||
#---product specifications
|
||||
$segment = "";
|
||||
$sth = WebGUI::SQL->read("select name,value,units,Product_specificationId from Product_specification
|
||||
where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
|
||||
$var{benefit_loop} = \@benefitloop;
|
||||
|
||||
#---specifications
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= '<a href="'.WebGUI::URL::page('func=editSpecification&sid=new&wid='
|
||||
$var{addSpecification} = '<a href="'.WebGUI::URL::page('func=editSpecification&sid=new&wid='
|
||||
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(35,$namespace).'</a><p/>';
|
||||
}
|
||||
$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) {
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= deleteIcon('func=deleteSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{Product_specificationId})
|
||||
$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 .= '·<b>'.$data{name}.':</b> '.$data{value}.' '.$data{units}.'<br>';
|
||||
push(@specificationloop,{specificationId=>$data{Product_specificationId},
|
||||
controls=>$segment,specification=>$data{value},units=>$data{units},label=>$data{name}});
|
||||
}
|
||||
$sth->finish;
|
||||
$template =~ s/\^Product_Specifications\;/$segment/;
|
||||
#---product accessories
|
||||
$segment = "";
|
||||
$sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_accessory.accessoryWobjectId from Product_accessory,wobject,page
|
||||
where Product_accessory.wobjectId=".$_[0]->get("wobjectId")."
|
||||
and Product_accessory.accessoryWobjectId=wobject.wobjectId and wobject.pageId=page.pageId order by Product_accessory.sequenceNumber");
|
||||
$var{specification_loop} = \@specificationloop;
|
||||
|
||||
#---accessories
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= '<a href="'.WebGUI::URL::page('func=addAccessory&wid='
|
||||
$var{addaccessory} = '<a href="'.WebGUI::URL::page('func=addAccessory&wid='
|
||||
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(36,$namespace).'</a><p/>';
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_accessory.accessoryWobjectId
|
||||
from Product_accessory,wobject,page
|
||||
where Product_accessory.wobjectId=".$_[0]->get("wobjectId")."
|
||||
and Product_accessory.accessoryWobjectId=wobject.wobjectId
|
||||
and wobject.pageId=page.pageId order by Product_accessory.sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= deleteIcon('func=deleteAccessory&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId})
|
||||
$segment = deleteIcon('func=deleteAccessory&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId})
|
||||
.moveUpIcon('func=moveAccessoryUp&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId})
|
||||
.moveDownIcon('func=moveAccessoryDown&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId});
|
||||
}
|
||||
$segment .= '·<a href="'.WebGUI::URL::gateway($data{urlizedTitle}).'">'.$data{title}.'</a><br>';
|
||||
push(@accessoryloop,{URL=>WebGUI::URL::gateway($data{urlizedTitle}),title=>$data{title},
|
||||
accessory=>'<a href="'.WebGUI::URL::gateway($data{urlizedTitle}).'">'.$data{title}.'</a>',
|
||||
controls=>$segment});
|
||||
}
|
||||
$sth->finish;
|
||||
$template =~ s/\^Product_Accessories\;/$segment/;
|
||||
#---product related
|
||||
$segment = "";
|
||||
$sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_related.relatedWobjectId from Product_related,wobject,page
|
||||
where Product_related.wobjectId=".$_[0]->get("wobjectId")."
|
||||
and Product_related.relatedWobjectId=wobject.wobjectId and wobject.pageId=page.pageId order by Product_related.sequenceNumber");
|
||||
$var{accessory_loop} = \@accessoryloop;
|
||||
|
||||
#---related
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= '<a href="'.WebGUI::URL::page('func=addRelated&wid='
|
||||
$var{addrelatedproduct} = '<a href="'.WebGUI::URL::page('func=addRelated&wid='
|
||||
.$_[0]->get("wobjectId")).'">'.WebGUI::International::get(37,$namespace).'</a><p/>';
|
||||
}
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_related.relatedWobjectId
|
||||
from Product_related,wobject,page
|
||||
where Product_related.wobjectId=".$_[0]->get("wobjectId")."
|
||||
and Product_related.relatedWobjectId=wobject.wobjectId
|
||||
and wobject.pageId=page.pageId order by Product_related.sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
if ($session{var}{adminOn}) {
|
||||
$segment .= deleteIcon('func=deleteRelated&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId})
|
||||
$segment = deleteIcon('func=deleteRelated&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId})
|
||||
.moveUpIcon('func=moveRelatedUp&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId})
|
||||
.moveDownIcon('func=moveRelatedDown&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId});
|
||||
}
|
||||
$segment .= '·<a href="'.WebGUI::URL::gateway($data{urlizedTitle}).'">'.$data{title}.'</a><br>';
|
||||
push(@relatedloop,{URL=>WebGUI::URL::gateway($data{urlizedTitle}),title=>$data{title},
|
||||
specification=>'<a href="'.WebGUI::URL::gateway($data{urlizedTitle}).'">'.$data{title}.'</a>',
|
||||
controls=>$segment});
|
||||
}
|
||||
$sth->finish;
|
||||
$template =~ s/\^Product_Related\;/$segment/;
|
||||
$output .= $template;
|
||||
return $_[0]->processMacros($output);
|
||||
$var{relatedproduct_loop} = \@relatedloop;
|
||||
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue