converting assets to new session system
This commit is contained in:
parent
0d8833512c
commit
2866a2c873
34 changed files with 1099 additions and 1099 deletions
|
|
@ -98,7 +98,7 @@ sub getEditForm {
|
|||
-hoverHelp=>WebGUI::International::get('515 description',"Asset_Event"),
|
||||
-value=>$self->getValue("eventLocation")
|
||||
);
|
||||
if ($session{form}{func} eq "add") {
|
||||
if ($self->session->form->process("func") eq "add") {
|
||||
my %recursEvery;
|
||||
tie %recursEvery, 'Tie::IxHash';
|
||||
%recursEvery = (
|
||||
|
|
@ -142,12 +142,12 @@ sub getEditForm {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
if ($session{form}{assetId} eq "new") {
|
||||
if ($self->session->form->process("assetId") eq "new") {
|
||||
$self->update({eventEndDate=>$self->get("eventStartDate")}) unless ($self->get("eventEndDate") >= $self->get("eventStartDate"));
|
||||
if ($session{form}{recursEvery} && $session{form}{recursEvery} ne "never") {
|
||||
my $until = WebGUI::DateTime::setToEpoch($session{form}{until});
|
||||
if ($self->session->form->process("recursEvery") && $self->session->form->process("recursEvery") ne "never") {
|
||||
my $until = WebGUI::DateTime::setToEpoch($self->session->form->process("until"));
|
||||
$until = $self->get("eventEndDate") unless ($until >= $self->get("eventEndDate"));
|
||||
my $interval = ($session{form}{interval} < 1) ? 1 : $session{form}{interval};
|
||||
my $interval = ($self->session->form->process("interval") < 1) ? 1 : $self->session->form->process("interval");
|
||||
my $recurringEventId = WebGUI::Id::generate();
|
||||
$self->update({EventsCalendar_recurringId=>$recurringEventId});
|
||||
my $start = $self->get("eventStartDate");
|
||||
|
|
@ -155,16 +155,16 @@ sub processPropertiesFromFormPost {
|
|||
my $i = 0;
|
||||
while ($start < $until) {
|
||||
$i++;
|
||||
if ($session{form}{recursEvery} eq "day") {
|
||||
if ($self->session->form->process("recursEvery") eq "day") {
|
||||
$start = WebGUI::DateTime::addToDate($self->get("eventStartDate"),0,0,($i*$interval));
|
||||
$end = WebGUI::DateTime::addToDate($self->get("eventEndDate"),0,0,($i*$interval));
|
||||
} elsif ($session{form}{recursEvery} eq "week") {
|
||||
} elsif ($self->session->form->process("recursEvery") eq "week") {
|
||||
$start = WebGUI::DateTime::addToDate($self->get("eventStartDate"),0,0,(7*$i*$interval));
|
||||
$end = WebGUI::DateTime::addToDate($self->get("eventEndDate"),0,0,(7*$i*$interval));
|
||||
} elsif ($session{form}{recursEvery} eq "month") {
|
||||
} elsif ($self->session->form->process("recursEvery") eq "month") {
|
||||
$start = WebGUI::DateTime::addToDate($self->get("eventStartDate"),0,($i*$interval),0);
|
||||
$end = WebGUI::DateTime::addToDate($self->get("eventEndDate"),0,($i*$interval),0);
|
||||
} elsif ($session{form}{recursEvery} eq "year") {
|
||||
} elsif ($self->session->form->process("recursEvery") eq "year") {
|
||||
$start = WebGUI::DateTime::addToDate($self->get("eventStartDate"),($i*$interval),0,0);
|
||||
$end = WebGUI::DateTime::addToDate($self->get("eventEndDate"),($i*$interval),0,0);
|
||||
}
|
||||
|
|
@ -212,14 +212,14 @@ sub view {
|
|||
$var{"end.date"} = epochToHuman($self->getValue("eventEndDate"),"%z");
|
||||
$var{"end.time"} = epochToHuman($self->getValue("eventEndDate"),"%Z");
|
||||
$var{canEdit} = $self->canEdit;
|
||||
$var{"edit.url"} = WebGUI::URL::page('func=edit');
|
||||
$var{"edit.url"} = $self->session->url->page('func=edit');
|
||||
$var{"edit.label"} = WebGUI::International::get(575,"Asset_Event");
|
||||
$var{"delete.url"} = WebGUI::URL::page('func=deleteEvent;rid='.$self->getValue("EventsCalendar_recurringId"));
|
||||
$var{"delete.url"} = $self->session->url->page('func=deleteEvent;rid='.$self->getValue("EventsCalendar_recurringId"));
|
||||
$var{"delete.label"} = WebGUI::International::get(576,"Asset_Event");
|
||||
my @others;
|
||||
my ($start, $garbage) = WebGUI::DateTime::dayStartEnd($self->get("eventStartDate"));
|
||||
my ($garbage, $end) = WebGUI::DateTime::dayStartEnd($self->get("eventEndDate"));
|
||||
my $sth = WebGUI::SQL->read("select assetId from EventsCalendar_event where ((eventStartDate >= $start and eventStartDate <= $end) or (eventEndDate >= $start and eventEndDate <= $end)) and assetId<>".quote($self->getId));
|
||||
my $sth = $self->session->db->read("select assetId from EventsCalendar_event where ((eventStartDate >= $start and eventStartDate <= $end) or (eventEndDate >= $start and eventEndDate <= $end)) and assetId<>".$self->session->db->quote($self->getId));
|
||||
while (my ($assetId) = $sth->array) {
|
||||
my $asset = WebGUI::Asset::Event->new($assetId);
|
||||
# deal with multiple versions of the same event with conflicting dates
|
||||
|
|
@ -241,12 +241,12 @@ sub www_deleteEvent {
|
|||
my ($output);
|
||||
$output = '<h1>'.WebGUI::International::get(42,"Asset_Event").'</h1>';
|
||||
$output .= WebGUI::International::get(75,"Asset_Event").'<p><blockquote>';
|
||||
$output .= '<a href="'.WebGUI::URL::page('func=deleteEventConfirm').'">'.WebGUI::International::get(76,"Asset_Event").'</a><p>';
|
||||
$output .= '<a href="'.WebGUI::URL::page('func=deleteEventConfirm;rid='.$session{form}{rid}).'">'
|
||||
.WebGUI::International::get(77,"Asset_Event").'</a><p>' if (($session{form}{rid} ne "") and ($session{form}{rid} ne "0"));
|
||||
$output .= '<a href="'.$self->session->url->page('func=deleteEventConfirm').'">'.WebGUI::International::get(76,"Asset_Event").'</a><p>';
|
||||
$output .= '<a href="'.$self->session->url->page('func=deleteEventConfirm;rid='.$self->session->form->process("rid")).'">'
|
||||
.WebGUI::International::get(77,"Asset_Event").'</a><p>' if (($self->session->form->process("rid") ne "") and ($self->session->form->process("rid") ne "0"));
|
||||
$output .= '<a href="'.$self->getUrl.'">'.WebGUI::International::get(78,"Asset_Event").'</a>';
|
||||
$output .= '</blockquote>';
|
||||
return WebGUI::Style::process($output,$self->getParent->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($output,$self->getParent->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,10 +254,10 @@ sub www_deleteEvent {
|
|||
sub www_deleteEventConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
if (($session{form}{rid} ne "") and ($session{form}{rid} ne "0")) {
|
||||
if (($self->session->form->process("rid") ne "") and ($self->session->form->process("rid") ne "0")) {
|
||||
my $series = $self->getParent->getLineage(["descendants"],{returnObjects=>1});
|
||||
foreach my $event (@{$series}) {
|
||||
$event->trash if $event->get("EventsCalendar_recurringId") eq $session{form}{rid};
|
||||
$event->trash if $event->get("EventsCalendar_recurringId") eq $self->session->form->process("rid");
|
||||
}
|
||||
} else {
|
||||
$self->trash;
|
||||
|
|
@ -278,7 +278,7 @@ sub www_edit {
|
|||
sub www_view {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canView);
|
||||
return WebGUI::Style::process($self->view,$self->getParent->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($self->view,$self->getParent->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -168,11 +168,11 @@ sub getIcon {
|
|||
my $self = shift;
|
||||
my $small = shift;
|
||||
if ($small && ref($self) eq '') {
|
||||
return $session{config}{extrasURL}.'/assets/small/file.gif';
|
||||
return $self->session->config->get("extrasURL").'/assets/small/file.gif';
|
||||
} elsif ($small) {
|
||||
return $self->getFileIconUrl;
|
||||
}
|
||||
return $session{config}{extrasURL}.'/assets/file.gif';
|
||||
return $self->session->config->get("extrasURL").'/assets/file.gif';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -202,9 +202,9 @@ sub processPropertiesFromFormPost {
|
|||
my %data;
|
||||
$data{filename} = $filename;
|
||||
$data{storageId} = $storage->getId;
|
||||
$data{title} = $filename unless ($session{form}{title});
|
||||
$data{menuTitle} = $filename unless ($session{form}{menuTitle});
|
||||
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
|
||||
$data{title} = $filename unless ($self->session->form->process("title"));
|
||||
$data{menuTitle} = $filename unless ($self->session->form->process("menuTitle"));
|
||||
$data{url} = $self->getParent->get('url').'/'.$filename unless ($self->session->form->process("url"));
|
||||
$self->update(\%data);
|
||||
}
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ sub processPropertiesFromFormPost {
|
|||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = WebGUI::SQL->read("select storageId from FileAsset where assetId=".quote($self->getId));
|
||||
my $sth = $self->session->db->read("select storageId from FileAsset where assetId=".$self->session->db->quote($self->getId));
|
||||
while (my ($storageId) = $sth->array) {
|
||||
WebGUI::Storage->get($storageId)->delete;
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ sub www_edit {
|
|||
-namespace=>"FileAsset"
|
||||
);
|
||||
$self->getAdminConsole->setHelp("file add/edit", "Asset_File");
|
||||
my $addEdit = ($session{form}{func} eq 'add') ? WebGUI::International::get('add','Wobject') : WebGUI::International::get('edit','Wobject');
|
||||
my $addEdit = ($self->session->form->process("func") eq 'add') ? WebGUI::International::get('add','Wobject') : WebGUI::International::get('edit','Wobject');
|
||||
return $self->getAdminConsole->render($tabform->print,$addEdit.' '.$self->getName);
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ sub www_edit {
|
|||
sub www_view {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
if ($session{var}{adminOn}) {
|
||||
if ($self->session->var->get("adminOn")) {
|
||||
return $self->getContainer->www_view;
|
||||
}
|
||||
WebGUI::HTTP::setRedirect($self->getFileUrl);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ sub definition {
|
|||
properties=>{
|
||||
thumbnailSize=>{
|
||||
fieldType=>'integer',
|
||||
defaultValue=>$session{setting}{thumbnailSize}
|
||||
defaultValue=>$self->session->setting->get("thumbnailSize")
|
||||
},
|
||||
parameters=>{
|
||||
fieldType=>'textarea',
|
||||
|
|
@ -148,7 +148,7 @@ sub getEditForm {
|
|||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/image.gif' unless ($small);
|
||||
return $self->session->config->get("extrasURL").'/assets/image.gif' unless ($small);
|
||||
$self->SUPER::getIcon(1);
|
||||
}
|
||||
|
||||
|
|
@ -196,10 +196,10 @@ sub processPropertiesFromFormPost {
|
|||
$self->update({parameters=>$parameters.' alt="'.$self->get("title").'"'});
|
||||
}
|
||||
my $storage = $self->getStorageLocation;
|
||||
$self->generateThumbnail($session{setting}{maxImageSize});
|
||||
$self->generateThumbnail($self->session->setting->get("maxImageSize"));
|
||||
$storage->deleteFile($self->get("filename"));
|
||||
$storage->renameFile('thumb-'.$self->get("filename"),$self->get("filename"));
|
||||
$self->generateThumbnail($session{form}{thumbnailSize});
|
||||
$self->generateThumbnail($self->session->form->process("thumbnailSize"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -242,8 +242,8 @@ sub www_edit {
|
|||
sub www_resize {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
if ($session{form}{newWidth} || $session{form}{newHeight}) {
|
||||
$self->getStorageLocation->resize($self->get("filename"),$session{form}{newWidth},$session{form}{newHeight});
|
||||
if ($self->session->form->process("newWidth") || $self->session->form->process("newHeight")) {
|
||||
$self->getStorageLocation->resize($self->get("filename"),$self->session->form->process("newWidth"),$self->session->form->process("newHeight"));
|
||||
$self->setSize($self->getStorageLocation->getFileSize($self->get("filename")));
|
||||
}
|
||||
$self->getAdminConsole->addSubmenuItem($self->getUrl('func=edit'),WebGUI::International::get("edit image","Asset_Image"));
|
||||
|
|
@ -286,7 +286,7 @@ A web executable method that redirects the user to the specified page, or displa
|
|||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
if ($session{var}{adminOn}) {
|
||||
if ($self->session->var->get("adminOn")) {
|
||||
return $self->www_edit;
|
||||
}
|
||||
my $storage = $self->getStorageLocation;
|
||||
|
|
|
|||
|
|
@ -60,18 +60,18 @@ sub unzip {
|
|||
if($filename =~ m/\.zip/i){
|
||||
my $zip = Archive::Zip->new();
|
||||
unless ($zip->read($filename) == $zip->AZ_OK){
|
||||
WebGUI::ErrorHandler::warn(WebGUI::International::get("zip_error","Asset_ZipArchive"));
|
||||
$self->session->errorHandler->warn(WebGUI::International::get("zip_error","Asset_ZipArchive"));
|
||||
return 0;
|
||||
}
|
||||
$zip->extractTree();
|
||||
} elsif($filename =~ m/\.tar/i){
|
||||
Archive::Tar->extract_archive($filepath.'/'.$filename,1);
|
||||
if (Archive::Tar->error){
|
||||
WebGUI::ErrorHandler::warn(Archive::Tar->error);
|
||||
$self->session->errorHandler->warn(Archive::Tar->error);
|
||||
return 0;
|
||||
}
|
||||
} else{
|
||||
WebGUI::ErrorHandler::warn(WebGUI::International::get("bad_archive","Asset_ZipArchive"));
|
||||
$self->session->errorHandler->warn(WebGUI::International::get("bad_archive","Asset_ZipArchive"));
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -179,8 +179,8 @@ If this evaluates to True, then the smaller icon is returned.
|
|||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/ziparchive.gif' unless ($small);
|
||||
return $session{config}{extrasURL}.'/assets/small/ziparchive.gif';
|
||||
return $self->session->config->get("extrasURL").'/assets/ziparchive.gif' unless ($small);
|
||||
return $self->session->config->get("extrasURL").'/assets/small/ziparchive.gif';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -201,22 +201,22 @@ sub processPropertiesFromFormPost {
|
|||
my $file = $self->get("filename");
|
||||
|
||||
#return unless $file;
|
||||
unless($session{form}{showPage}) {
|
||||
unless($self->session->form->process("showPage")) {
|
||||
$storage->delete;
|
||||
WebGUI::SQL->write("update FileAsset set filename=NULL where assetId=".quote($self->getId));
|
||||
WebGUI::Session::setScratch("za_error",WebGUI::International::get("za_show_error","Asset_ZipArchive"));
|
||||
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->scratch->set("za_error",WebGUI::International::get("za_show_error","Asset_ZipArchive"));
|
||||
return;
|
||||
}
|
||||
|
||||
unless($file =~ m/\.tar/i || $file =~ m/\.zip/i) {
|
||||
$storage->delete;
|
||||
WebGUI::SQL->write("update FileAsset set filename=NULL where assetId=".quote($self->getId));
|
||||
WebGUI::Session::setScratch("za_error",WebGUI::International::get("za_error","Asset_ZipArchive"));
|
||||
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->scratch->set("za_error",WebGUI::International::get("za_error","Asset_ZipArchive"));
|
||||
return;
|
||||
}
|
||||
|
||||
unless ($self->unzip($storage,$self->get("filename"))) {
|
||||
WebGUI::ErrorHandler::warn(WebGUI::International::get("unzip_error","Asset_ZipArchive"));
|
||||
$self->session->errorHandler->warn(WebGUI::International::get("unzip_error","Asset_ZipArchive"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -256,12 +256,12 @@ used to show the file to administrators.
|
|||
sub view {
|
||||
my $self = shift;
|
||||
my %var = %{$self->get};
|
||||
#WebGUI::ErrorHandler::warn($self->getId);
|
||||
#$self->session->errorHandler->warn($self->getId);
|
||||
$var{controls} = $self->getToolbar;
|
||||
if($session{scratch}{za_error}) {
|
||||
$var{error} = $session{scratch}{za_error};
|
||||
if($self->session->scratch->get("za_error")) {
|
||||
$var{error} = $self->session->scratch->get("za_error");
|
||||
}
|
||||
WebGUI::Session::deleteScratch("za_error");
|
||||
$self->session->scratch->delete("za_error");
|
||||
my $storage = $self->getStorageLocation;
|
||||
if($self->get("filename") ne "") {
|
||||
$var{fileUrl} = $storage->getUrl($self->get("showPage"));
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ sub edit {
|
|||
name=>"class",
|
||||
value=>"WebGUI::Asset::FilePile"
|
||||
});
|
||||
if ($session{form}{proceed}) {
|
||||
if ($self->session->form->process("proceed")) {
|
||||
$tabform->hidden({
|
||||
name=>"proceed",
|
||||
value=>$session{form}{proceed}
|
||||
value=>$self->session->form->process("proceed")
|
||||
});
|
||||
}
|
||||
$tabform->addTab("properties",WebGUI::International::get("properties","Asset"));
|
||||
|
|
@ -109,12 +109,12 @@ sub edit {
|
|||
my $clause;
|
||||
if (WebGUI::Grouping::isInGroup(3)) {
|
||||
my $contentManagers = WebGUI::Grouping::getUsersInGroup(4,1);
|
||||
push (@$contentManagers, $session{user}{userId});
|
||||
$clause = "userId in (".quoteAndJoin($contentManagers).")";
|
||||
push (@$contentManagers, $self->session->user->profileField("userId"));
|
||||
$clause = "userId in (".$self->session->db->quoteAndJoin($contentManagers).")";
|
||||
} else {
|
||||
$clause = "userId=".quote($self->get("ownerUserId"));
|
||||
$clause = "userId=".$self->session->db->quote($self->get("ownerUserId"));
|
||||
}
|
||||
my $users = WebGUI::SQL->buildHashRef("select userId,username from users where $clause order by username");
|
||||
my $users = $self->session->db->buildHashRef("select userId,username from users where $clause order by username");
|
||||
$tabform->getTab("security")->selectBox(
|
||||
-name=>"ownerUserId",
|
||||
-options=>$users,
|
||||
|
|
@ -162,7 +162,7 @@ sub editSave {
|
|||
$className = "WebGUI::Asset::File::Image" if ($storage->isImage($filename));
|
||||
foreach my $definition (@{$className->definition}) {
|
||||
foreach my $property (keys %{$definition->{properties}}) {
|
||||
$data{$property} = WebGUI::FormProcessor::process(
|
||||
$data{$property} = $self->session->form->process(
|
||||
$property,
|
||||
$definition->{properties}{$property}{fieldType},
|
||||
$definition->{properties}{$property}{defaultValue}
|
||||
|
|
@ -182,7 +182,7 @@ sub editSave {
|
|||
$newAsset->commit;
|
||||
}
|
||||
$tempStorage->delete;
|
||||
return $class->getParent->www_manageAssets if ($session{form}{proceed} eq "manageAssets");
|
||||
return $class->getParent->www_manageAssets if ($self->session->form->process("proceed") eq "manageAssets");
|
||||
return $class->getParent->www_view;
|
||||
}
|
||||
|
||||
|
|
@ -191,9 +191,9 @@ sub getIcon {
|
|||
my $self = shift;
|
||||
my $small = shift;
|
||||
if ($small) {
|
||||
return $session{config}{extrasURL}.'/assets/small/filePile.gif';
|
||||
return $self->session->config->get("extrasURL").'/assets/small/filePile.gif';
|
||||
}
|
||||
return $session{config}{extrasURL}.'/assets/filePile.gif';
|
||||
return $self->session->config->get("extrasURL").'/assets/filePile.gif';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ sub getName {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
unless ($session{form}{doit}) {
|
||||
unless ($self->session->form->process("doit")) {
|
||||
return $self->edit;
|
||||
} else {
|
||||
return $self->editSave;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ sub canAdd {
|
|||
#-------------------------------------------------------------------
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
return (($session{form}{func} eq "add" || ($session{form}{assetId} eq "new" && $session{form}{func} eq "editSave" && $session{form}{class} eq "WebGUI::Asset::Post")) && $self->getThread->getParent->canPost) || # account for new posts
|
||||
return (($self->session->form->process("func") eq "add" || ($self->session->form->process("assetId") eq "new" && $self->session->form->process("func") eq "editSave" && $self->session->form->process("class") eq "WebGUI::Asset::Post")) && $self->getThread->getParent->canPost) || # account for new posts
|
||||
|
||||
($self->isPoster && $self->getThread->getParent->get("editTimeout") > (WebGUI::DateTime::time() - $self->get("dateUpdated"))) ||
|
||||
$self->getThread->getParent->canModerate;
|
||||
|
|
@ -137,7 +137,7 @@ sub definition {
|
|||
},
|
||||
username => {
|
||||
fieldType=>"hidden",
|
||||
defaultValue=>$session{form}{visitorUsername} || $session{user}{alias} || $session{user}{username}
|
||||
defaultValue=>$self->session->form->process("visitorUsername") || $self->session->user->profileField("alias") || $self->session->user->profileField("username")
|
||||
},
|
||||
rating => {
|
||||
noFormPost=>1,
|
||||
|
|
@ -229,7 +229,7 @@ Formats the URL to approve a post.
|
|||
|
||||
sub getApproveUrl {
|
||||
my $self = shift;
|
||||
return $self->getUrl("revision=".$self->get("revisionDate").";func=approve;mlog=".$session{form}{mlog});
|
||||
return $self->getUrl("revision=".$self->get("revisionDate").";func=approve;mlog=".$self->session->form->process("mlog"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -284,7 +284,7 @@ Formats the url to deny a post.
|
|||
|
||||
sub getDenyUrl {
|
||||
my $self = shift;
|
||||
return $self->getUrl("revision=".$self->get("revisionDate").";func=deny;mlog=".$session{form}{mlog});
|
||||
return $self->getUrl("revision=".$self->get("revisionDate").";func=deny;mlog=".$self->session->form->process("mlog"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -398,8 +398,8 @@ sub getStorageLocation {
|
|||
#-------------------------------------------------------------------
|
||||
sub getSynopsisAndContentFromFormPost {
|
||||
my $self = shift;
|
||||
my $synopsis = $session{form}{synopsis};
|
||||
my $body = $session{form}{content};
|
||||
my $synopsis = $self->session->form->process("synopsis");
|
||||
my $body = $self->session->form->process("content");
|
||||
unless ($synopsis) {
|
||||
$body =~ s/\n/\^\-\;/ unless ($body =~ m/\^\-\;/);
|
||||
my @content = split(/\^\-\;/,$body);
|
||||
|
|
@ -526,9 +526,9 @@ Returns a boolean indicating whether this user has already rated this post.
|
|||
sub hasRated {
|
||||
my $self = shift;
|
||||
return 1 if $self->isPoster;
|
||||
my ($flag) = WebGUI::SQL->quickArray("select count(*) from Post_rating where assetId="
|
||||
.quote($self->getId)." and ((userId=".quote($session{user}{userId})." and userId<>'1') or (userId='1' and
|
||||
ipAddress=".quote($session{env}{REMOTE_ADDR})."))");
|
||||
my ($flag) = $self->session->db->quickArray("select count(*) from Post_rating where assetId="
|
||||
.$self->session->db->quote($self->getId)." and ((userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and userId<>'1') or (userId='1' and
|
||||
ipAddress=".$self->session->db->quote($self->session->env->get("REMOTE_ADDR"))."))");
|
||||
return $flag;
|
||||
}
|
||||
|
||||
|
|
@ -556,7 +556,7 @@ Returns a boolean indicating whether this post is marked read for the user.
|
|||
sub isMarkedRead {
|
||||
my $self = shift;
|
||||
return 1 if $self->isPoster;
|
||||
my ($isRead) = WebGUI::SQL->quickArray("select count(*) from Post_read where userId=".quote($session{user}{userId})." and postId=".quote($self->getId));
|
||||
my ($isRead) = $self->session->db->quickArray("select count(*) from Post_read where userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and postId=".$self->session->db->quote($self->getId));
|
||||
return $isRead;
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ Returns a boolean that is true if the current user created this post and is not
|
|||
|
||||
sub isPoster {
|
||||
my $self = shift;
|
||||
return ($session{user}{userId} ne "1" && $session{user}{userId} eq $self->get("ownerUserId"));
|
||||
return ($self->session->user->profileField("userId") ne "1" && $self->session->user->profileField("userId") eq $self->get("ownerUserId"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -599,8 +599,8 @@ Marks this post read for this user.
|
|||
sub markRead {
|
||||
my $self = shift;
|
||||
unless ($self->isMarkedRead) {
|
||||
WebGUI::SQL->write("insert into Post_read (userId, postId, threadId, readDate) values (".quote($session{user}{userId}).",
|
||||
".quote($self->getId).", ".quote($self->get("threadId")).", ".WebGUI::DateTime::time().")");
|
||||
$self->session->db->write("insert into Post_read (userId, postId, threadId, readDate) values (".$self->session->db->quote($self->session->user->profileField("userId")).",
|
||||
".$self->session->db->quote($self->getId).", ".$self->session->db->quote($self->get("threadId")).", ".WebGUI::DateTime::time().")");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -627,7 +627,7 @@ sub notifySubscribers {
|
|||
if ($lang{$u->profileField("language")}{message} eq "") {
|
||||
$lang{$u->profileField("language")}{var} = $self->getTemplateVars();
|
||||
$self->getThread->getParent->appendTemplateLabels($lang{$u->profileField("language")}{var});
|
||||
$lang{$u->profileField("language")}{var}{url} = WebGUI::URL::getSiteURL().$self->getUrl;
|
||||
$lang{$u->profileField("language")}{var}{url} = $self->session->url->getSiteURL().$self->getUrl;
|
||||
$lang{$u->profileField("language")}{var}{'notify.subscription.message'} =
|
||||
WebGUI::International::get(875,"Asset_Post",$u->profileField("language"));
|
||||
$lang{$u->profileField("language")}{subject} = WebGUI::International::get(523,"Asset_Post",$u->profileField("language"));
|
||||
|
|
@ -643,40 +643,40 @@ sub processPropertiesFromFormPost {
|
|||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
my %data;
|
||||
if ($session{form}{assetId} eq "new") {
|
||||
if ($self->session->form->process("assetId") eq "new") {
|
||||
if ($self->getParent->get("className") eq "WebGUI::Asset::Wobject::Collaboration") {
|
||||
$self->update({threadId=>$self->getId});
|
||||
} else {
|
||||
$self->update({threadId=>$self->getParent->get("threadId")});
|
||||
}
|
||||
if ($session{setting}{enableKarma} && $self->getThread->getParent->get("karmaPerPost")) {
|
||||
my $u = WebGUI::User->new($session{user}{userId});
|
||||
if ($self->session->setting->get("enableKarma") && $self->getThread->getParent->get("karmaPerPost")) {
|
||||
my $u = WebGUI::User->new($self->session->user->profileField("userId"));
|
||||
$u->addKarma($self->getThread->getParent->get("karmaPerPost"), $self->getId, "Collaboration post");
|
||||
}
|
||||
%data = (
|
||||
ownerUserId => $session{user}{userId},
|
||||
username => $session{form}{visitorName} || $session{user}{alias} || $session{user}{username},
|
||||
ownerUserId => $self->session->user->profileField("userId"),
|
||||
username => $self->session->form->process("visitorName") || $self->session->user->profileField("alias") || $self->session->user->profileField("username"),
|
||||
isHidden => 1,
|
||||
);
|
||||
$data{url} = $self->fixUrl($self->getThread->get("url")."/1") if ($self->isReply);
|
||||
if ($self->getThread->getParent->canModerate) {
|
||||
$self->getThread->lock if ($session{form}{'lock'});
|
||||
$self->getThread->stick if ($session{form}{stick});
|
||||
$self->getThread->stick if ($self->session->form->process("stick"));
|
||||
}
|
||||
}
|
||||
$data{groupIdView} =$self->getThread->getParent->get("groupIdView");
|
||||
$data{groupIdEdit} = $self->getThread->getParent->get("groupIdEdit");
|
||||
$data{startDate} = $self->getThread->getParent->get("startDate") unless ($session{form}{startDate});
|
||||
$data{endDate} = $self->getThread->getParent->get("endDate") unless ($session{form}{endDate});
|
||||
$data{startDate} = $self->getThread->getParent->get("startDate") unless ($self->session->form->process("startDate"));
|
||||
$data{endDate} = $self->getThread->getParent->get("endDate") unless ($self->session->form->process("endDate"));
|
||||
($data{synopsis}, $data{content}) = $self->getSynopsisAndContentFromFormPost;
|
||||
if ($self->getThread->getParent->get("addEditStampToPosts")) {
|
||||
$data{content} .= "\n\n --- (".WebGUI::International::get('Edited_on','Asset_Post')." ".WebGUI::DateTime::epochToHuman(undef,"%z %Z [GMT%O]").WebGUI::International::get('By','Asset_Post').$session{user}{alias}.") --- \n";
|
||||
$data{content} .= "\n\n --- (".WebGUI::International::get('Edited_on','Asset_Post')." ".WebGUI::DateTime::epochToHuman(undef,"%z %Z [GMT%O]").WebGUI::International::get('By','Asset_Post').$self->session->user->profileField("alias").") --- \n";
|
||||
if ($self->getValue("contentType") eq "mixed" || $self->getValue("contentType") eq "html") {
|
||||
$data{content} = '<p>'.$data{content}.'</p>';
|
||||
}
|
||||
}
|
||||
$self->update(\%data);
|
||||
$self->getThread->subscribe if ($session{form}{subscribe});
|
||||
$self->getThread->subscribe if ($self->session->form->process("subscribe"));
|
||||
if ($self->getThread->getParent->get("moderatePosts")) {
|
||||
$self->setStatusPending;
|
||||
} else {
|
||||
|
|
@ -691,17 +691,17 @@ sub processPropertiesFromFormPost {
|
|||
$self->setSize($storage->getFileSize($filename));
|
||||
foreach my $file (@{$storage->getFiles}) {
|
||||
if ($storage->isImage($file)) {
|
||||
$storage->generateThumbnail($file,$session{setting}{maxImageSize});
|
||||
$storage->generateThumbnail($file,$self->session->setting->get("maxImageSize"));
|
||||
$storage->deleteFile($file);
|
||||
$storage->renameFile('thumb-'.$file,$file);
|
||||
$storage->generateThumbnail($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
$session{form}{proceed} = "redirectToParent";
|
||||
$self->session->form->process("proceed") = "redirectToParent";
|
||||
# clear some cache
|
||||
WebGUI::Cache->new("wobject_".$self->getThread->getParent->getId."_".$session{user}{userId})->delete;
|
||||
WebGUI::Cache->new("cspost_".($self->getParent->getId)."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_1")->delete;
|
||||
WebGUI::Cache->new("wobject_".$self->getThread->getParent->getId."_".$self->session->user->profileField("userId"))->delete;
|
||||
WebGUI::Cache->new("cspost_".($self->getParent->getId)."_".$self->session->user->profileField("userId")."_".$self->session->scratch->get("discussionLayout")."_1")->delete;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -709,13 +709,13 @@ sub processPropertiesFromFormPost {
|
|||
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = WebGUI::SQL->read("select storageId from Post where assetId=".quote($self->getId));
|
||||
my $sth = $self->session->db->read("select storageId from Post where assetId=".$self->session->db->quote($self->getId));
|
||||
while (my ($storageId) = $sth->array) {
|
||||
WebGUI::Storage->get($storageId)->delete;
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::SQL->write("delete from Post_rating where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Post_read where postId=".quote($self->getId));
|
||||
$self->session->db->write("delete from Post_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Post_read where postId=".$self->session->db->quote($self->getId));
|
||||
return $self->SUPER::purge;
|
||||
}
|
||||
|
||||
|
|
@ -745,12 +745,12 @@ sub rate {
|
|||
my $self = shift;
|
||||
my $rating = shift || 3;
|
||||
unless ($self->hasRated) {
|
||||
WebGUI::SQL->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values ("
|
||||
.quote($self->getId).", ".quote($session{user}{userId}).", ".quote($session{env}{REMOTE_ADDR}).",
|
||||
".WebGUI::DateTime::time().", ".quote($rating).")");
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Post_rating where assetId=".quote($self->getId));
|
||||
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values ("
|
||||
.$self->session->db->quote($self->getId).", ".$self->session->db->quote($self->session->user->profileField("userId")).", ".$self->session->db->quote($self->session->env->get("REMOTE_ADDR")).",
|
||||
".WebGUI::DateTime::time().", ".$self->session->db->quote($rating).")");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Post_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
$count = $count || 1;
|
||||
my ($sum) = WebGUI::SQL->quickArray("select sum(rating) from Post_rating where assetId=".quote($self->getId));
|
||||
my ($sum) = $self->session->db->quickArray("select sum(rating) from Post_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
my $average = WebGUI::Utility::round($sum/$count);
|
||||
$self->update({rating=>$average});
|
||||
$self->getThread->rate($rating);
|
||||
|
|
@ -790,9 +790,9 @@ sub setStatusApproved {
|
|||
$self->commit;
|
||||
$self->getThread->incrementReplies($self->get("dateUpdated"),$self->getId) if $self->isReply;
|
||||
unless ($self->isPoster) {
|
||||
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',WebGUI::URL::getSiteURL().'/'.$self->getUrl,579);
|
||||
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',$self->session->url->getSiteURL().'/'.$self->getUrl,579);
|
||||
}
|
||||
$self->notifySubscribers unless ($session{form}{func} eq 'add');
|
||||
$self->notifySubscribers unless ($self->session->form->process("func") eq 'add');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -823,7 +823,7 @@ Sets the status of this post to denied.
|
|||
sub setStatusDenied {
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'denied'});
|
||||
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',WebGUI::URL::getSiteURL().'/'.$self->getUrl,580);
|
||||
WebGUI::MessageLog::addInternationalizedEntry($self->get("ownerUserId"),'',$self->session->url->getSiteURL().'/'.$self->getUrl,580);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -841,7 +841,7 @@ sub setStatusPending {
|
|||
} else {
|
||||
$self->update({status=>'pending'});
|
||||
WebGUI::MessageLog::addInternationalizedEntry('',$self->getThread->getParent->get("moderateGroupId"),
|
||||
WebGUI::URL::getSiteURL().'/'.$self->getUrl("revision=".$self->get("revisionDate")),578,'WebGUI','pending');
|
||||
$self->session->url->getSiteURL().'/'.$self->getUrl("revision=".$self->get("revisionDate")),578,'WebGUI','pending');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -860,12 +860,12 @@ sub trash {
|
|||
$self->getThread->decrementReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($threadLineage.'%')." and Post.assetId<>".quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($threadLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getThread->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
if ($self->getThread->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $forumLineage = $self->getThread->getParent->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($forumLineage.'%')." and Post.assetId<>".quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($forumLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and asset.assetId=Post.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getThread->getParent->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
}
|
||||
|
|
@ -880,7 +880,7 @@ Negates the markRead method.
|
|||
|
||||
sub unmarkRead {
|
||||
my $self = shift;
|
||||
WebGUI::SQL->write("delete from forumRead where userId=".quote($session{user}{userId})." and postId=".quote($self->getId));
|
||||
$self->session->db->write("delete from forumRead where userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and postId=".$self->session->db->quote($self->getId));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -931,7 +931,7 @@ sub www_approve {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteFile {
|
||||
my $self = shift;
|
||||
$self->getStorageLocation->deleteFile($session{form}{filename}) if $self->canEdit;
|
||||
$self->getStorageLocation->deleteFile($self->session->form->process("filename")) if $self->canEdit;
|
||||
return $self->www_edit;
|
||||
}
|
||||
|
||||
|
|
@ -956,7 +956,7 @@ sub www_edit {
|
|||
my %var;
|
||||
my $content;
|
||||
my $title;
|
||||
if ($session{form}{func} eq "add") { # new post
|
||||
if ($self->session->form->process("func") eq "add") { # new post
|
||||
$var{'form.header'} = WebGUI::Form::formHeader({action=>$self->getParent->getUrl})
|
||||
.WebGUI::Form::hidden({
|
||||
name=>"func",
|
||||
|
|
@ -968,12 +968,12 @@ sub www_edit {
|
|||
})
|
||||
.WebGUI::Form::hidden({
|
||||
name=>"class",
|
||||
value=>$session{form}{class}
|
||||
value=>$self->session->form->process("class")
|
||||
});
|
||||
$var{'isNewPost'} = 1;
|
||||
$content = $session{form}{content};
|
||||
$title = $session{form}{title};
|
||||
if ($session{form}{class} eq "WebGUI::Asset::Post") { # new reply
|
||||
$content = $self->session->form->process("content");
|
||||
$title = $self->session->form->process("title");
|
||||
if ($self->session->form->process("class") eq "WebGUI::Asset::Post") { # new reply
|
||||
$self->{_thread} = $self->getParent->getThread;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->getThread->canReply);
|
||||
$var{isReply} = 1;
|
||||
|
|
@ -983,22 +983,22 @@ sub www_edit {
|
|||
for my $i (1..5) {
|
||||
$var{'reply.userDefined'.$i} = WebGUI::HTML::filter($self->getParent->get('userDefined'.$i),"macros");
|
||||
}
|
||||
unless ($session{form}{content} || $session{form}{title}) {
|
||||
$content = "[quote]".$self->getParent->get("content")."[/quote]" if ($session{form}{withQuote});
|
||||
unless ($self->session->form->process("content") || $self->session->form->process("title")) {
|
||||
$content = "[quote]".$self->getParent->get("content")."[/quote]" if ($self->session->form->process("withQuote"));
|
||||
$title = $self->getParent->get("title");
|
||||
$title = "Re: ".$title unless ($title =~ /^Re:/);
|
||||
}
|
||||
$var{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||
name=>"subscribe",
|
||||
value=>$session{form}{subscribe}
|
||||
value=>$self->session->form->process("subscribe")
|
||||
});
|
||||
} elsif ($session{form}{class} eq "WebGUI::Asset::Post::Thread") { # new thread
|
||||
} elsif ($self->session->form->process("class") eq "WebGUI::Asset::Post::Thread") { # new thread
|
||||
return WebGUI::Privilege::insufficient() unless ($self->getThread->getParent->canPost);
|
||||
$var{isNewThread} = 1;
|
||||
if ($self->getThread->getParent->canModerate) {
|
||||
$var{'sticky.form'} = WebGUI::Form::yesNo({
|
||||
name=>'stick',
|
||||
value=>$session{form}{stick}
|
||||
value=>$self->session->form->process("stick")
|
||||
});
|
||||
$var{'lock.form'} = WebGUI::Form::yesNo({
|
||||
name=>'lock',
|
||||
|
|
@ -1007,10 +1007,10 @@ sub www_edit {
|
|||
}
|
||||
$var{'subscribe.form'} = WebGUI::Form::yesNo({
|
||||
name=>"subscribe",
|
||||
value=>$session{form}{subscribe} || 1
|
||||
value=>$self->session->form->process("subscribe") || 1
|
||||
});
|
||||
}
|
||||
$content .= "\n\n".$session{user}{signature} if ($session{user}{signature} && !$session{form}{content});
|
||||
$content .= "\n\n".$self->session->user->profileField("signature") if ($self->session->user->profileField("signature") && !$self->session->form->process("content"));
|
||||
} else { # edit
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$var{'form.header'} = WebGUI::Form::formHeader({action=>$self->getUrl})
|
||||
|
|
@ -1030,10 +1030,10 @@ sub www_edit {
|
|||
$content = $self->getValue("content");
|
||||
$title = $self->getValue("title");
|
||||
}
|
||||
if ($session{form}{title} || $session{form}{content} || $session{form}{synopsis}) {
|
||||
$var{'preview.title'} = WebGUI::HTML::filter($session{form}{title},"all");
|
||||
if ($self->session->form->process("title") || $self->session->form->process("content") || $self->session->form->process("synopsis")) {
|
||||
$var{'preview.title'} = WebGUI::HTML::filter($self->session->form->process("title"),"all");
|
||||
($var{'preview.synopsis'}, $var{'preview.content'}) = $self->getSynopsisAndContentFromFormPost;
|
||||
$var{'preview.content'} = $self->formatContent($var{'preview.content'},$session{form}{contentType});
|
||||
$var{'preview.content'} = $self->formatContent($var{'preview.content'},$self->session->form->process("contentType"));
|
||||
for my $i (1..5) {
|
||||
$var{'preview.userDefined'.$i} = WebGUI::HTML::filter($session{form}{'userDefined'.$i},"macros");
|
||||
}
|
||||
|
|
@ -1041,7 +1041,7 @@ sub www_edit {
|
|||
$var{'form.footer'} = WebGUI::Form::formFooter();
|
||||
$var{usePreview} = $self->getThread->getParent->get("usePreview");
|
||||
$var{'user.isModerator'} = $self->getThread->getParent->canModerate;
|
||||
$var{'user.isVisitor'} = ($session{user}{userId} eq '1');
|
||||
$var{'user.isVisitor'} = ($self->session->user->profileField("userId") eq '1');
|
||||
$var{'visitorName.form'} = WebGUI::Form::text({
|
||||
name=>"visitorName",
|
||||
value=>$self->getValue("visitorName")
|
||||
|
|
@ -1095,13 +1095,13 @@ sub www_edit {
|
|||
value=>$self->getValue("contentType") || "mixed"
|
||||
});
|
||||
my $startDate = $self->get("startDate");
|
||||
$startDate = WebGUI::DateTime::setToEpoch($session{form}{startDate}) if ($session{form}{startDate});
|
||||
$startDate = WebGUI::DateTime::setToEpoch($self->session->form->process("startDate")) if ($self->session->form->process("startDate"));
|
||||
$var{'startDate.form'} = WebGUI::Form::dateTime({
|
||||
name => 'startDate',
|
||||
value => $startDate
|
||||
});
|
||||
my $endDate = $self->get("endDate");
|
||||
$endDate = WebGUI::DateTime::setToEpoch($session{form}{endDate}) if ($session{form}{endDate});
|
||||
$endDate = WebGUI::DateTime::setToEpoch($self->session->form->process("endDate")) if ($self->session->form->process("endDate"));
|
||||
$var{'endDate.form'} = WebGUI::Form::dateTime({
|
||||
name => 'endDate',
|
||||
value => $endDate
|
||||
|
|
@ -1121,7 +1121,7 @@ The web method to rate a post.
|
|||
|
||||
sub www_rate {
|
||||
my $self = shift;
|
||||
$self->WebGUI::Asset::Post::rate($session{form}{rating}) if ($self->canView && !$self->hasRated);
|
||||
$self->WebGUI::Asset::Post::rate($self->session->form->process("rating")) if ($self->canView && !$self->hasRated);
|
||||
$self->www_view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ sub canReply {
|
|||
#-------------------------------------------------------------------
|
||||
sub canSubscribe {
|
||||
my $self = shift;
|
||||
return ($session{user}{userId} ne "1" && $self->canView);
|
||||
return ($self->session->user->profileField("userId") ne "1" && $self->canView);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -149,7 +149,7 @@ A string indicating the type of layout to use. Can be flat or nested.
|
|||
sub getLayoutUrl {
|
||||
my $self = shift;
|
||||
my $layout = shift;
|
||||
return $session{asset}->getUrl("layout=".$layout.'#id'.$session{asset}->getId) if (exists $session{asset});
|
||||
return $self->session->asset->getUrl("layout=".$layout.'#id'.$self->session->asset->getId) if (exists $self->session->asset);
|
||||
return $self->getUrl("layout=".$layout);
|
||||
}
|
||||
|
||||
|
|
@ -179,24 +179,24 @@ sub getNextThread {
|
|||
my $self = shift;
|
||||
unless (defined $self->{_next}) {
|
||||
my $sortBy = $self->getParent->getValue("sortBy");
|
||||
my ($id, $class, $version) = WebGUI::SQL->quickArray("
|
||||
my ($id, $class, $version) = $self->session->db->quickArray("
|
||||
select asset.assetId,asset.className,max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.parentId=".quote($self->get("parentId"))."
|
||||
where asset.parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and ".$sortBy.">".quote($self->get($sortBy))."
|
||||
and ".$sortBy.">".$self->session->db->quote($self->get($sortBy))."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".quote($session{scratch}{versionTag})."
|
||||
or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"))."
|
||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->profileField("userId"))." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." asc
|
||||
",WebGUI::SQL->getSlave);
|
||||
",$self->session->db->getSlave);
|
||||
$self->{_next} = WebGUI::Asset->new($id,$class,$version);
|
||||
# delete $self->{_next} unless ($self->{_next}->{_properties}{className} =~ /Thread/);
|
||||
};
|
||||
|
|
@ -217,23 +217,23 @@ sub getPreviousThread {
|
|||
my $self = shift;
|
||||
unless (defined $self->{_previous}) {
|
||||
my $sortBy = $self->getParent->getValue("sortBy");
|
||||
my ($id, $class, $version) = WebGUI::SQL->quickArray("
|
||||
my ($id, $class, $version) = $self->session->db->quickArray("
|
||||
select asset.assetId,asset.className,max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on asset.assetId=Thread.assetId
|
||||
left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.parentId=".quote($self->get("parentId"))."
|
||||
where asset.parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and ".$sortBy."<".quote($self->get($sortBy))."
|
||||
and ".$sortBy."<".$self->session->db->quote($self->get($sortBy))."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".quote($session{scratch}{versionTag})."
|
||||
or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1')
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"))."
|
||||
or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->profileField("userId"))." and assetData.ownerUserId<>'1')
|
||||
)
|
||||
group by assetData.assetId
|
||||
order by ".$sortBy." desc, assetData.revisionDate desc ",WebGUI::SQL->getSlave);
|
||||
order by ".$sortBy." desc, assetData.revisionDate desc ",$self->session->db->getSlave);
|
||||
$self->{_previous} = WebGUI::Asset::Post::Thread->new($id,$class,$version);
|
||||
# delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/);
|
||||
};
|
||||
|
|
@ -375,7 +375,7 @@ Returns a boolean indicating whether this thread is marked read for the user.
|
|||
sub isMarkedRead {
|
||||
my $self = shift;
|
||||
return 1 if $self->isPoster;
|
||||
my ($isRead) = WebGUI::SQL->quickArray("select count(*) from Post_read where userId=".quote($session{user}{userId})." and threadId=".quote($self->getId)." and postId=".quote($self->get("lastPostId")));
|
||||
my ($isRead) = $self->session->db->quickArray("select count(*) from Post_read where userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and threadId=".$self->session->db->quote($self->getId)." and postId=".$self->session->db->quote($self->get("lastPostId")));
|
||||
return $isRead;
|
||||
}
|
||||
|
||||
|
|
@ -446,18 +446,18 @@ sub rate {
|
|||
my $self = shift;
|
||||
my $rating = shift;
|
||||
unless ($self->hasRated) {
|
||||
WebGUI::SQL->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values ("
|
||||
.quote($self->getId).", ".quote($session{user}{userId}).", ".quote($session{env}{REMOTE_ADDR}).",
|
||||
".WebGUI::DateTime::time().", ".quote($rating).")");
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Post left join asset on Post.assetId=asset.assetId where Post.threadId=".quote($self->getId)." and Post.rating>0");
|
||||
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values ("
|
||||
.$self->session->db->quote($self->getId).", ".$self->session->db->quote($self->session->user->profileField("userId")).", ".$self->session->db->quote($self->session->env->get("REMOTE_ADDR")).",
|
||||
".WebGUI::DateTime::time().", ".$self->session->db->quote($rating).")");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Post left join asset on Post.assetId=asset.assetId where Post.threadId=".$self->session->db->quote($self->getId)." and Post.rating>0");
|
||||
$count = $count || 1;
|
||||
my ($sum) = WebGUI::SQL->quickArray("select sum(Post.rating) from Post left join asset on Post.assetId=asset.assetId where Post.threadId=".quote($self->getId)." and Post.rating>0");
|
||||
my ($sum) = $self->session->db->quickArray("select sum(Post.rating) from Post left join asset on Post.assetId=asset.assetId where Post.threadId=".$self->session->db->quote($self->getId)." and Post.rating>0");
|
||||
my $average = round($sum/$count);
|
||||
$self->update({rating=>$average});
|
||||
if ($session{setting}{useKarma}) {
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
my $poster = WebGUI::User->new($self->get("ownerUserId"));
|
||||
$poster->karma($rating*$self->getParent->get("karmaRatingMultiplier"),"collaboration rating","someone rated post ".$self->getId);
|
||||
my $rater = WebGUI::User->new($session{user}{userId});
|
||||
my $rater = WebGUI::User->new($self->session->user->profileField("userId"));
|
||||
$rater->karma(-$self->getParent->get("karmaSpentToRate"),"collaboration rating","spent karma to rate post ".$self->getId);
|
||||
}
|
||||
$self->getParent->recalculateRating;
|
||||
|
|
@ -549,8 +549,8 @@ Subscribes the user to this thread.
|
|||
sub subscribe {
|
||||
my $self = shift;
|
||||
$self->createSubscriptionGroup;
|
||||
WebGUI::Cache->new("cspost_".$self->getId."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_".$session{form}{pn})->delete;
|
||||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
WebGUI::Cache->new("cspost_".$self->getId."_".$self->session->user->profileField("userId")."_".$self->session->scratch->get("discussionLayout")."_".$self->session->form->process("pn"))->delete;
|
||||
WebGUI::Grouping::addUsersToGroups([$self->session->user->profileField("userId")],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -567,7 +567,7 @@ sub trash {
|
|||
$self->getParent->decrementThreads;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".quote($parentLineage.'%')." and Post.assetId<>".quote($self->getId)." and Post.assetId=asset.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
my ($id, $date) = $self->session->db->quickArray("select Post.assetId, Post.dateSubmitted from Post, asset where asset.lineage like ".$self->session->db->quote($parentLineage.'%')." and Post.assetId<>".$self->session->db->quote($self->getId)." and Post.assetId=asset.assetId and asset.state='published' order by Post.dateSubmitted desc");
|
||||
$self->getParent->setLastPost('','') ? $self->getParent->setLastPost($id,$date) : $id;
|
||||
}
|
||||
}
|
||||
|
|
@ -609,8 +609,8 @@ Negates the subscribe method.
|
|||
|
||||
sub unsubscribe {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new("cspost_".$self->getId."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_".$session{form}{pn})->delete;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
WebGUI::Cache->new("cspost_".$self->getId."_".$self->session->user->profileField("userId")."_".$self->session->scratch->get("discussionLayout")."_".$self->session->form->process("pn"))->delete;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$self->session->user->profileField("userId")],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -618,12 +618,12 @@ sub unsubscribe {
|
|||
sub view {
|
||||
my $self = shift;
|
||||
$self->markRead;
|
||||
$self->incrementViews unless ($session{form}{func} eq 'rate');
|
||||
WebGUI::Session::setScratch("discussionLayout",$session{form}{layout});
|
||||
$self->incrementViews unless ($self->session->form->process("func") eq 'rate');
|
||||
$self->session->scratch->set("discussionLayout",$self->session->form->process("layout"));
|
||||
my $var = $self->getTemplateVars;
|
||||
$self->getParent->appendTemplateLabels($var);
|
||||
|
||||
$var->{'user.isVisitor'} = ($session{user}{userId} eq '1');
|
||||
$var->{'user.isVisitor'} = ($self->session->user->profileField("userId") eq '1');
|
||||
$var->{'user.isModerator'} = $self->getParent->canModerate;
|
||||
$var->{'user.canPost'} = $self->getParent->canPost;
|
||||
$var->{'user.canReply'} = $self->canReply;
|
||||
|
|
@ -631,7 +631,7 @@ sub view {
|
|||
|
||||
$var->{'layout.nested.url'} = $self->getLayoutUrl("nested");
|
||||
$var->{'layout.flat.url'} = $self->getLayoutUrl("flat");
|
||||
my $layout = $session{scratch}{discussionLayout} || $session{user}{discussionLayout};
|
||||
my $layout = $self->session->scratch->get("discussionLayout") || $self->session->user->profileField("discussionLayout");
|
||||
$var->{'layout.isFlat'} = ($layout eq "flat");
|
||||
$var->{'layout.isNested'} = ($layout eq "nested" || !$var->{'layout.isFlat'});
|
||||
|
||||
|
|
@ -651,14 +651,14 @@ sub view {
|
|||
my $sql = "select asset.assetId, asset.className, assetData.revisionDate as revisionDate from asset
|
||||
left join assetData on assetData.assetId=asset.assetId
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate
|
||||
where asset.lineage like ".quote($self->get("lineage").'%')
|
||||
where asset.lineage like ".$self->session->db->quote($self->get("lineage").'%')
|
||||
." and asset.state='published'
|
||||
and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".quote($session{scratch}{versionTag});
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
|
||||
$sql .= " or assetData.status='pending'" if ($self->getParent->canModerate);
|
||||
$sql .= " or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1')
|
||||
$sql .= " or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->profileField("userId"))." and assetData.ownerUserId<>'1')
|
||||
))
|
||||
group by assetData.assetId
|
||||
order by ";
|
||||
|
|
@ -794,23 +794,23 @@ sub www_view {
|
|||
my $cache;
|
||||
my $output;
|
||||
my $useCache = (
|
||||
$session{form}{op} eq "" &&
|
||||
$session{form}{func} eq "" &&
|
||||
$session{form}{layout} eq "" &&
|
||||
$self->session->form->process("op") eq "" &&
|
||||
$self->session->form->process("func") eq "" &&
|
||||
$self->session->form->process("layout") eq "" &&
|
||||
(
|
||||
( $self->getParent->get("cacheTimeout") > 10 && $session{user}{userId} ne '1') ||
|
||||
( $self->getParent->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} eq '1')
|
||||
( $self->getParent->get("cacheTimeout") > 10 && $self->session->user->profileField("userId") ne '1') ||
|
||||
( $self->getParent->get("cacheTimeoutVisitor") > 10 && $self->session->user->profileField("userId") eq '1')
|
||||
) &&
|
||||
not $session{var}{adminOn}
|
||||
not $self->session->var->get("adminOn")
|
||||
);
|
||||
if ($useCache) {
|
||||
$cache = WebGUI::Cache->new("cspost_".($postId||$self->getId)."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_".$session{form}{pn});
|
||||
$cache = WebGUI::Cache->new("cspost_".($postId||$self->getId)."_".$self->session->user->profileField("userId")."_".$self->session->scratch->get("discussionLayout")."_".$self->session->form->process("pn"));
|
||||
$output = $cache->get;
|
||||
}
|
||||
unless ($output) {
|
||||
$output = $self->getParent->processStyle($self->view);
|
||||
my $ttl;
|
||||
if ($session{user}{userId} eq '1') {
|
||||
if ($self->session->user->profileField("userId") eq '1') {
|
||||
$ttl = $self->getParent->get("cacheTimeoutVisitor");
|
||||
} else {
|
||||
$ttl = $self->getParent->get("cacheTimeout");
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ A web executable method that redirects the user to the specified page, or displa
|
|||
sub www_view {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
if ($session{var}{adminOn}) {
|
||||
if ($self->session->var->get("adminOn")) {
|
||||
return $self->getContainer->www_view;
|
||||
}
|
||||
my $url = $self->get("redirectUrl");
|
||||
|
|
|
|||
|
|
@ -459,12 +459,12 @@ sub getRichEditor {
|
|||
$config{theme_advanced_source_editor_height} = $self->getValue("sourceEditorHeight") if ($self->getValue("sourceEditorHeight") > 0);
|
||||
}
|
||||
}
|
||||
my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation");
|
||||
my $language = WebGUI::International::getLanguage($self->session->user->profileField("language"),"languageAbbreviation");
|
||||
unless ($language) {
|
||||
$language = WebGUI::International::getLanguage("English","languageAbbreviation");
|
||||
}
|
||||
$config{language} = $language;
|
||||
$config{content_css} = $self->getValue("cssFile") || $session{config}{extrasURL}.'/tinymce2/defaultcontent.css';
|
||||
$config{content_css} = $self->getValue("cssFile") || $self->session->config->get("extrasURL").'/tinymce2/defaultcontent.css';
|
||||
$config{width} = $self->getValue("editorWidth") if ($self->getValue("editorWidth") > 0);
|
||||
$config{height} = $self->getValue("editorHeight") if ($self->getValue("editorHeight") > 0);
|
||||
$config{plugins} = join(",",@plugins);
|
||||
|
|
@ -476,8 +476,8 @@ sub getRichEditor {
|
|||
push(@directives,$key." : '".$config{$key}."'");
|
||||
}
|
||||
}
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce2/jscripts/tiny_mce/tiny_mce.js",{type=>"text/javascript"});
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce2/jscripts/webgui.js",{type=>"text/javascript"});
|
||||
$self->session->style->setScript($self->session->config->get("extrasURL")."/tinymce2/jscripts/tiny_mce/tiny_mce.js",{type=>"text/javascript"});
|
||||
$self->session->style->setScript($self->session->config->get("extrasURL")."/tinymce2/jscripts/webgui.js",{type=>"text/javascript"});
|
||||
return '<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
'.join(",\n ",@directives).'
|
||||
|
|
@ -489,7 +489,7 @@ sub getRichEditor {
|
|||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
return '<p>'.$self->getToolbar.'</p>' if ($session{var}{adminOn});
|
||||
return '<p>'.$self->getToolbar.'</p>' if ($self->session->var->get("adminOn"));
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ sub _drawQueryBuilder {
|
|||
|
||||
unless ($fieldCount) { # No fields found....
|
||||
return 'No metadata defined yet.
|
||||
<a href="'.WebGUI::URL::page('func=manageMetaData').
|
||||
<a href="'.$self->session->url->page('func=manageMetaData').
|
||||
'">Click here</a> to define metadata attributes.';
|
||||
}
|
||||
|
||||
|
|
@ -73,8 +73,8 @@ sub _drawQueryBuilder {
|
|||
# html
|
||||
my $output;
|
||||
$output .= '<script type="text/javascript" src="'.
|
||||
$session{config}{extrasURL}.'/wobject/Shortcut/querybuilder.js"></script>';
|
||||
$output .= '<link href="'.$session{config}{extrasURL}.
|
||||
$self->session->config->get("extrasURL").'/wobject/Shortcut/querybuilder.js"></script>';
|
||||
$output .= '<link href="'.$self->session->config->get("extrasURL").
|
||||
'/wobject/Shortcut/querybuilder.css" type="text/css" rel="stylesheet">';
|
||||
$output .= qq|<table cellspacing="0" cellpadding="0" border="0"><tr><td colspan="5" align="right">$shortcutCriteriaField</td></tr><tr><td></td><td></td><td></td><td></td><td class="qbtdright"></td></tr><tr><td></td><td></td><td></td><td></td><td class="qbtdright">$conjunctionField</td></tr>|;
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ sub definition {
|
|||
#-------------------------------------------------------------------
|
||||
sub discernUserId {
|
||||
my $self = shift;
|
||||
return ($self->canManage && WebGUI::Session::isAdminOn()) ? '1' : $session{user}{userId};
|
||||
return ($self->canManage && WebGUI::Session::isAdminOn()) ? '1' : $self->session->user->profileField("userId");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -233,7 +233,7 @@ sub getEditForm {
|
|||
-hoverHelp=>WebGUI::International::get('shortcut template title description', 'Asset_Shortcut'),
|
||||
-namespace=>"Shortcut"
|
||||
);
|
||||
if($session{setting}{metaDataEnabled}) {
|
||||
if($self->session->setting->get("metaDataEnabled")) {
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name=>"shortcutByCriteria",
|
||||
-value=>$self->getValue("shortcutByCriteria"),
|
||||
|
|
@ -294,7 +294,7 @@ sub getEditForm {
|
|||
|
||||
=head2 getExtraHeadTags ( )
|
||||
|
||||
Returns the extraHeadTags stored in the asset. Called in WebGUI::Style::generateAdditionalHeadTags if this asset is the $session{asset}. Also called in WebGUI::Layout::view for its child assets. Overriden here in Shortcut.pm.
|
||||
Returns the extraHeadTags stored in the asset. Called in $self->session->style->generateAdditionalHeadTags if this asset is the $self->session->asset. Also called in WebGUI::Layout::view for its child assets. Overriden here in Shortcut.pm.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ sub getOverrides {
|
|||
my $self = shift;
|
||||
my $i = 0;
|
||||
#cache by userId, assetId of this shortcut, and whether adminMode is on or not.
|
||||
my $cache = WebGUI::Cache->new(["shortcutOverrides",$self->getId,$session{user}{userId},$session{var}{adminOn}]);
|
||||
my $cache = WebGUI::Cache->new(["shortcutOverrides",$self->getId,$self->session->user->profileField("userId"),$self->session->var->get("adminOn")]);
|
||||
my $overridesRef = $cache->get;
|
||||
unless ($overridesRef->{cacheNotExpired}) {
|
||||
my %overrides;
|
||||
|
|
@ -389,7 +389,7 @@ sub getOverrides {
|
|||
$orig->{_propertyDefinitions} = \%properties;
|
||||
}
|
||||
$overrides{cacheNotExpired} = 1;
|
||||
my $sth = WebGUI::SQL->read("select fieldName, newValue from Shortcut_overrides where assetId=".quote($self->getId)." order by fieldName");
|
||||
my $sth = $self->session->db->read("select fieldName, newValue from Shortcut_overrides where assetId=".$self->session->db->quote($self->getId)." order by fieldName");
|
||||
while (my ($fieldName, $newValue) = $sth->array) {
|
||||
$overrides{overrides}{$fieldName}{fieldType} = $orig->{_propertyDefinitions}{$fieldName}{fieldType};
|
||||
$overrides{overrides}{$fieldName}{origValue} = $self->getShortcutOriginal->get($fieldName);
|
||||
|
|
@ -464,7 +464,7 @@ sub getShortcutByCriteria {
|
|||
if ($assetId) {
|
||||
$scratchId = "Shortcut_" . $assetId;
|
||||
if($session{scratch}{$scratchId} && !$self->getValue("disableContentLock")) {
|
||||
return $session{scratch}{$scratchId} unless ($session{var}{adminOn});
|
||||
return $session{scratch}{$scratchId} unless ($self->session->var->get("adminOn"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -495,10 +495,10 @@ sub getShortcutByCriteria {
|
|||
my $quotedField = $field;
|
||||
my $quotedValue = $value;
|
||||
unless ($field =~ /^\s*['"].*['"]\s*/) {
|
||||
$quotedField = quote($field);
|
||||
$quotedField = $self->session->db->quote($field);
|
||||
}
|
||||
unless ($value =~ /^\s*['"].*['"]\s*/) {
|
||||
$quotedValue = quote($value);
|
||||
$quotedValue = $self->session->db->quote($value);
|
||||
}
|
||||
|
||||
# transform replacement from "State = Wisconsin" to
|
||||
|
|
@ -513,7 +513,7 @@ sub getShortcutByCriteria {
|
|||
from metaData_values d, metaData_properties f, asset w
|
||||
where f.fieldId = d.fieldId
|
||||
and w.assetId = d.assetId
|
||||
and w.className=".quote($self->getShortcutDefault->get("className"));
|
||||
and w.className=".$self->session->db->quote($self->getShortcutDefault->get("className"));
|
||||
|
||||
|
||||
# Add constraint only if it has been modified.
|
||||
|
|
@ -523,7 +523,7 @@ sub getShortcutByCriteria {
|
|||
|
||||
# Execute the query with an unconditional read
|
||||
my @ids;
|
||||
my $sth = WebGUI::SQL->unconditionalRead($sql);
|
||||
my $sth = $self->session->db->unconditionalRead($sql);
|
||||
while (my ($data) = $sth->array) {
|
||||
push (@ids, $data);
|
||||
}
|
||||
|
|
@ -543,7 +543,7 @@ sub getShortcutByCriteria {
|
|||
}
|
||||
|
||||
# Store the matching assetId in user scratch.
|
||||
WebGUI::Session::setScratch($scratchId,$id) if ($scratchId);
|
||||
$self->session->scratch->set($scratchId,$id) if ($scratchId);
|
||||
|
||||
return WebGUI::Asset->newByDynamicClass($id);
|
||||
}
|
||||
|
|
@ -588,7 +588,7 @@ sub processPropertiesFromFormPost {
|
|||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
my $scratchId = "Shortcut_" . $self->getId;
|
||||
WebGUI::Session::deleteAllScratch($scratchId);
|
||||
$self->session->scratch->deleteAll($scratchId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -618,7 +618,7 @@ sub view {
|
|||
foreach my $prop (keys %{$self->{_shortcut}{_properties}}) {
|
||||
next if ($prop eq 'content' || $prop eq 'label' || $prop eq 'url');
|
||||
$var{'shortcut.'.$prop} = $self->{_shortcut}{_properties}{$prop};
|
||||
WebGUI::ErrorHandler::warn($prop.' = '.$self->{_shortcut}{_properties}{$prop});
|
||||
$self->session->errorHandler->warn($prop.' = '.$self->{_shortcut}{_properties}{$prop});
|
||||
}
|
||||
return $self->processTemplate(\%var,$self->getValue("templateId"));
|
||||
}
|
||||
|
|
@ -636,7 +636,7 @@ sub www_edit {
|
|||
sub www_getUserPrefsForm {
|
||||
#This is a form retrieved by "ajax".
|
||||
my $self = shift;
|
||||
return 'You are no longer logged in' if $session{user}{userId} eq '1';
|
||||
return 'You are no longer logged in' if $self->session->user->profileField("userId") eq '1';
|
||||
return 'You are not allowed to personalize this Dashboard.' unless $self->getParent->canPersonalize;
|
||||
my $output;
|
||||
my @fielden = $self->getPrefFieldsToShow;
|
||||
|
|
@ -692,7 +692,7 @@ sub www_purgeOverrideCache {
|
|||
sub www_deleteOverride {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
WebGUI::SQL->write('delete from Shortcut_overrides where assetId='.quote($self->getId).' and fieldName='.quote($session{form}{fieldName}));
|
||||
$self->session->db->write('delete from Shortcut_overrides where assetId='.$self->session->db->quote($self->getId).' and fieldName='.$self->session->db->quote($self->session->form->process("fieldName")));
|
||||
$self->uncacheOverrides;
|
||||
return $self->www_manageOverrides;
|
||||
}
|
||||
|
|
@ -733,7 +733,7 @@ sub www_editOverride {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my $i18n = WebGUI::International->new("Asset_Shortcut");
|
||||
my $fieldName = $session{form}{fieldName};
|
||||
my $fieldName = $self->session->form->process("fieldName");
|
||||
my %overrides = $self->getOverrides;
|
||||
my $output = '';
|
||||
my %props;
|
||||
|
|
@ -743,8 +743,8 @@ sub www_editOverride {
|
|||
$output .= '</table>';
|
||||
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(-name=>"func",-value=>"saveOverride");
|
||||
$f->hidden(-name=>"overrideFieldName",-value=>$session{form}{fieldName});
|
||||
$f->readOnly(-label=>$i18n->get("fieldName"),-value=>$session{form}{fieldName});
|
||||
$f->hidden(-name=>"overrideFieldName",-value=>$self->session->form->process("fieldName"));
|
||||
$f->readOnly(-label=>$i18n->get("fieldName"),-value=>$self->session->form->process("fieldName"));
|
||||
$f->readOnly(-label=>$i18n->get("Original Value"),-value=>$overrides{overrides}{$fieldName}{origValue});
|
||||
my %params;
|
||||
foreach my $key (keys %{$props{$fieldName}}) {
|
||||
|
|
@ -773,7 +773,7 @@ sub www_editOverride {
|
|||
sub www_saveOverride {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my $fieldName = $session{form}{overrideFieldName};
|
||||
my $fieldName = $self->session->form->process("overrideFieldName");
|
||||
my %overrides = $self->getOverrides;
|
||||
my $output = '';
|
||||
my %props;
|
||||
|
|
@ -781,10 +781,10 @@ sub www_saveOverride {
|
|||
%props = (%props,%{$def->{properties}});
|
||||
}
|
||||
my $fieldType = $props{$fieldName}{fieldType};
|
||||
my $value = WebGUI::FormProcessor::process($fieldName,$fieldType);
|
||||
$value = $session{form}{newOverrideValueText} || $value;
|
||||
WebGUI::SQL->write("delete from Shortcut_overrides where assetId=".quote($self->getId)." and fieldName=".quote($fieldName));
|
||||
WebGUI::SQL->write("insert into Shortcut_overrides values (".quote($self->getId).",".quote($fieldName).",".quote($value).")");
|
||||
my $value = $self->session->form->process($fieldName,$fieldType);
|
||||
$value = $self->session->form->process("newOverrideValueText") || $value;
|
||||
$self->session->db->write("delete from Shortcut_overrides where assetId=".$self->session->db->quote($self->getId)." and fieldName=".$self->session->db->quote($fieldName));
|
||||
$self->session->db->write("insert into Shortcut_overrides values (".$self->session->db->quote($self->getId).",".$self->session->db->quote($fieldName).",".$self->session->db->quote($value).")");
|
||||
$self->uncacheOverrides;
|
||||
return $self->www_manageOverrides;
|
||||
}
|
||||
|
|
@ -794,8 +794,8 @@ sub www_view {
|
|||
my $self = shift;
|
||||
if ($self->isDashlet) {
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
$session{asset} = $self->getParent;
|
||||
return $session{asset}->www_view;
|
||||
$self->session->asset = $self->getParent;
|
||||
return $self->session->asset->www_view;
|
||||
} else {
|
||||
return $self->getShortcut->www_view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ sub view {
|
|||
my $calledAsWebMethod = shift;
|
||||
my $output = $self->get("snippet");
|
||||
WebGUI::Macro::process(\$output);
|
||||
$output = '<p>'.$self->getToolbar.'</p>'.$output if ($session{var}{adminOn} && !$calledAsWebMethod);
|
||||
$output = '<p>'.$self->getToolbar.'</p>'.$output if ($self->session->var->get("adminOn") && !$calledAsWebMethod);
|
||||
return $output unless ($self->getValue("processAsTemplate"));
|
||||
return WebGUI::Asset::Template->processRaw($output);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ sub _execute {
|
|||
$t->param("webgui.status"=>$WebGUI::STATUS);
|
||||
return $t->output;
|
||||
} else {
|
||||
WebGUI::ErrorHandler::error("Error in template. ".$@);
|
||||
$self->session->errorHandler->error("Error in template. ".$@);
|
||||
return WebGUI::International::get('template error', 'Asset_Template').$@;
|
||||
}
|
||||
}
|
||||
|
|
@ -140,17 +140,17 @@ sub getEditForm {
|
|||
my $tabform = $self->SUPER::getEditForm();
|
||||
$tabform->hidden({
|
||||
name=>"returnUrl",
|
||||
value=>$session{form}{returnUrl}
|
||||
value=>$self->session->form->process("returnUrl")
|
||||
});
|
||||
if ($self->getValue("namespace") eq "") {
|
||||
my $namespaces = WebGUI::SQL->buildHashRef("select distinct(namespace),namespace
|
||||
my $namespaces = $self->session->db->buildHashRef("select distinct(namespace),namespace
|
||||
from template order by namespace");
|
||||
$tabform->getTab("properties")->combo(
|
||||
-name=>"namespace",
|
||||
-options=>$namespaces,
|
||||
-label=>WebGUI::International::get('namespace','Asset_Template'),
|
||||
-hoverHelp=>WebGUI::International::get('namespace description','Asset_Template'),
|
||||
-value=>[$session{form}{namespace}]
|
||||
-value=>[$self->session->form->process("namespace")]
|
||||
);
|
||||
} else {
|
||||
$tabform->getTab("meta")->readOnly(
|
||||
|
|
@ -199,8 +199,8 @@ Specify the namespace to build the list for.
|
|||
sub getList {
|
||||
my $class = shift;
|
||||
my $namespace = shift;
|
||||
my $sql = "select asset.assetId, assetData.revisionDate from template left join asset on asset.assetId=template.assetId left join assetData on assetData.revisionDate=template.revisionDate and assetData.assetId=template.assetId where template.namespace=".quote($namespace)." and template.showInForms=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=".quote($session{scratch}{versionTag}).")) order by assetData.title";
|
||||
my $sth = WebGUI::SQL->read($sql,WebGUI::SQL->getSlave);
|
||||
my $sql = "select asset.assetId, assetData.revisionDate from template left join asset on asset.assetId=template.assetId left join assetData on assetData.revisionDate=template.revisionDate and assetData.assetId=template.assetId where template.namespace=".$self->session->db->quote($namespace)." and template.showInForms=1 and asset.state='published' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")) order by assetData.title";
|
||||
my $sth = $self->session->db->read($sql,$self->session->db->getSlave);
|
||||
my %templates;
|
||||
tie %templates, 'Tie::IxHash';
|
||||
while (my ($id, $version) = $sth->array) {
|
||||
|
|
@ -230,7 +230,7 @@ sub process {
|
|||
return $self->processRaw($self->get("template"),$vars);
|
||||
# skip all the junk below here for now until we have time to bring it inline with the new system
|
||||
my $file = _getTemplateFile($self->get("templateId"));
|
||||
my $fileCacheDir = $session{config}{uploadsPath}.'/temp/templatecache';
|
||||
my $fileCacheDir = $self->session->config->get("uploadsPath").'/temp/templatecache';
|
||||
my %params = (
|
||||
filename=>$file->getPath,
|
||||
global_vars=>1,
|
||||
|
|
@ -241,34 +241,34 @@ sub process {
|
|||
strict=>0
|
||||
);
|
||||
my $error=0;
|
||||
if ($session{config}{templateCacheType} =~ /file/) {
|
||||
if ($self->session->config->get("templateCacheType") =~ /file/) {
|
||||
eval { mkpath($fileCacheDir) };
|
||||
if($@) {
|
||||
WebGUI::ErrorHandler::error("Could not create dir $fileCacheDir: $@\nTemplate file caching disabled");
|
||||
$self->session->errorHandler->error("Could not create dir $fileCacheDir: $@\nTemplate file caching disabled");
|
||||
$error++;
|
||||
}
|
||||
if(not -w $fileCacheDir) {
|
||||
WebGUI::ErrorHandler::error("Directory $fileCacheDir is not writable. Template file caching is disabled");
|
||||
$self->session->errorHandler->error("Directory $fileCacheDir is not writable. Template file caching is disabled");
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($session{config}{templateCacheType} eq "file" && not $error) {
|
||||
if ($self->session->config->get("templateCacheType") eq "file" && not $error) {
|
||||
# disabled until we can figure out what's wrong with it
|
||||
# $params{file_cache} = 1;
|
||||
} elsif ($session{config}{templateCacheType} eq "memory") {
|
||||
} elsif ($self->session->config->get("templateCacheType") eq "memory") {
|
||||
$params{cache} = 1;
|
||||
} elsif ($session{config}{templateCacheType} eq "ipc") {
|
||||
} elsif ($self->session->config->get("templateCacheType") eq "ipc") {
|
||||
$params{shared_cache} = 1;
|
||||
} elsif ($session{config}{templateCacheType} eq "memory-ipc") {
|
||||
} elsif ($self->session->config->get("templateCacheType") eq "memory-ipc") {
|
||||
$params{double_cache} = 1;
|
||||
} elsif ($session{config}{templateCacheType} eq "memory-file" && not $error) {
|
||||
} elsif ($self->session->config->get("templateCacheType") eq "memory-file" && not $error) {
|
||||
$params{double_file_cache} = 1;
|
||||
}
|
||||
my $template;
|
||||
unless (-e $file->getPath) {
|
||||
$file->saveFromScalar($self->get("template"));
|
||||
unless (-e $file->getPath) {
|
||||
WebGUI::ErrorHandler::error("Could not create file ".$file->getPath."\nTemplate file caching is disabled");
|
||||
$self->session->errorHandler->error("Could not create file ".$file->getPath."\nTemplate file caching is disabled");
|
||||
$params{scalarref} = \$template;
|
||||
delete $params{filename};
|
||||
}
|
||||
|
|
@ -335,7 +335,7 @@ sub www_edit {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_goBackToPage {
|
||||
my $self = shift;
|
||||
WebGUI::HTTP::setRedirect($session{form}{returnUrl}) if ($session{form}{returnUrl});
|
||||
WebGUI::HTTP::setRedirect($self->session->form->process("returnUrl")) if ($self->session->form->process("returnUrl"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -356,12 +356,12 @@ sub www_styleWizard {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my $output = "";
|
||||
if ($session{form}{step} == 2) {
|
||||
if ($self->session->form->process("step") == 2) {
|
||||
my $f = WebGUI::HTMLForm->new({action=>$self->getUrl});
|
||||
$f->hidden(name=>"func", value=>"styleWizard");
|
||||
$f->hidden(name=>"proceed", value=>"manageAssets") if ($session{form}{proceed});
|
||||
$f->hidden(name=>"proceed", value=>"manageAssets") if ($self->session->form->process("proceed"));
|
||||
$f->hidden(name=>"step", value=>3);
|
||||
$f->hidden(name=>"layout", value=>$session{form}{layout});
|
||||
$f->hidden(name=>"layout", value=>$self->session->form->process("layout"));
|
||||
$f->text(name=>"heading", value=>"My Site", label=>"Site Name");
|
||||
$f->file(name=>"logo", label=>"Logo", subtext=>"<br />JPEG, GIF, or PNG thats less than 200 pixels wide and 100 pixels tall");
|
||||
$f->color(name=>"pageBackgroundColor", value=>"#ccccdd", label=>"Page Background Color");
|
||||
|
|
@ -374,16 +374,16 @@ sub www_styleWizard {
|
|||
$f->color(name=>"visitedLinkColor", value=>"#ff00ff", label=>"Visited Link Color");
|
||||
$f->submit;
|
||||
$output = $f->print;
|
||||
} elsif ($session{form}{step} == 3) {
|
||||
my $storageId = WebGUI::FormProcessor::file("logo");
|
||||
} elsif ($self->session->form->process("step") == 3) {
|
||||
my $storageId = $self->session->form->file("logo");
|
||||
my $logo;
|
||||
if ($storageId) {
|
||||
my $storage = WebGUI::Storage::Image->get(WebGUI::FormProcessor::file("logo"));
|
||||
my $storage = WebGUI::Storage::Image->get($self->session->form->file("logo"));
|
||||
$logo = $self->addChild({
|
||||
className=>"WebGUI::Asset::File::Image",
|
||||
title=>WebGUI::FormProcessor::text("heading")." Logo",
|
||||
menuTitle=>WebGUI::FormProcessor::text("heading")." Logo",
|
||||
url=>WebGUI::FormProcessor::text("heading")." Logo",
|
||||
title=>$self->session->form->text("heading")." Logo",
|
||||
menuTitle=>$self->session->form->text("heading")." Logo",
|
||||
url=>$self->session->form->text("heading")." Logo",
|
||||
storageId=>$storage->getId,
|
||||
filename=>@{$storage->getFiles}[0],
|
||||
templateId=>"PBtmpl0000000000000088"
|
||||
|
|
@ -403,13 +403,13 @@ my $style = '<html>
|
|||
font-size: 12px;
|
||||
}
|
||||
body {
|
||||
background-color: '.WebGUI::FormProcessor::color("pageBackgroundColor").';
|
||||
background-color: '.$self->session->form->color("pageBackgroundColor").';
|
||||
font-family: helvetica;
|
||||
font-size: 14px;
|
||||
}
|
||||
.heading {
|
||||
background-color: '.WebGUI::FormProcessor::color("headingBackgroundColor").';
|
||||
color: '.WebGUI::FormProcessor::color("headingForegroundColor").';
|
||||
background-color: '.$self->session->form->color("headingBackgroundColor").';
|
||||
color: '.$self->session->form->color("headingForegroundColor").';
|
||||
font-size: 30px;
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
|
|
@ -430,10 +430,10 @@ my $style = '<html>
|
|||
padding: 5px;
|
||||
}
|
||||
.bodyContent {
|
||||
background-color: '.WebGUI::FormProcessor::color("bodyBackgroundColor").';
|
||||
color: '.WebGUI::FormProcessor::color("bodyForegroundColor").';
|
||||
background-color: '.$self->session->form->color("bodyBackgroundColor").';
|
||||
color: '.$self->session->form->color("bodyForegroundColor").';
|
||||
width: 55%; ';
|
||||
if ($session{form}{layout} == 1) {
|
||||
if ($self->session->form->process("layout") == 1) {
|
||||
$style .= '
|
||||
float: left;
|
||||
height: 75%;
|
||||
|
|
@ -449,9 +449,9 @@ if ($session{form}{layout} == 1) {
|
|||
$style .= '
|
||||
}
|
||||
.menu {
|
||||
background-color: '.WebGUI::FormProcessor::color("menuBackgroundColor").';
|
||||
background-color: '.$self->session->form->color("menuBackgroundColor").';
|
||||
width: 25%; ';
|
||||
if ($session{form}{layout} == 1) {
|
||||
if ($self->session->form->process("layout") == 1) {
|
||||
$style .= '
|
||||
margin-left: 10%;
|
||||
height: 75%;
|
||||
|
|
@ -468,10 +468,10 @@ if ($session{form}{layout} == 1) {
|
|||
$style .= '
|
||||
}
|
||||
a {
|
||||
color: '.WebGUI::FormProcessor::color("linkColor").';
|
||||
color: '.$self->session->form->color("linkColor").';
|
||||
}
|
||||
a:visited {
|
||||
color: '.WebGUI::FormProcessor::color("visitedLinkColor").';
|
||||
color: '.$self->session->form->color("visitedLinkColor").';
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
|
@ -484,17 +484,17 @@ if ($session{form}{layout} == 1) {
|
|||
$style .= '<div class="logo"><a href="^H(linkonly);">^AssetProxy('.$logo->get("url").');</a></div>';
|
||||
}
|
||||
$style .= '
|
||||
'.WebGUI::FormProcessor::text("heading").'
|
||||
'.$self->session->form->text("heading").'
|
||||
<div class="endFloat"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu">
|
||||
<div class="padding">^AssetProxy('.($session{form}{layout} == 1 ? 'flexmenu' : 'toplevelmenuhorizontal').');</div>
|
||||
<div class="padding">^AssetProxy('.($self->session->form->process("layout") == 1 ? 'flexmenu' : 'toplevelmenuhorizontal').');</div>
|
||||
</div>
|
||||
<div class="bodyContent">
|
||||
<div class="padding"><tmpl_var body.content></div>
|
||||
</div>';
|
||||
if ($session{form}{layout} == 1) {
|
||||
if ($self->session->form->process("layout") == 1) {
|
||||
$style .= '<div class="endFloat"></div>';
|
||||
}
|
||||
$style .= '
|
||||
|
|
@ -512,7 +512,7 @@ $style .= '
|
|||
})->www_edit;
|
||||
} else {
|
||||
$output = WebGUI::Form::formHeader({action=>$self->getUrl}).WebGUI::Form::hidden({name=>"func", value=>"styleWizard"});
|
||||
$output .= WebGUI::Form::hidden({name=>"proceed", value=>"manageAssets"}) if ($session{form}{proceed});
|
||||
$output .= WebGUI::Form::hidden({name=>"proceed", value=>"manageAssets"}) if ($self->session->form->process("proceed"));
|
||||
$output .= '<style type="text/css">
|
||||
.chooser { float: left; width: 150px; height: 150px; }
|
||||
.representation, .representation td { font-size: 12px; width: 120px; border: 1px solid black; }
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ Deletes the rendered page cache for this wobject.
|
|||
|
||||
sub deletePageCache {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId})->delete;
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$self->session->user->profileField("userId"))->delete;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -165,7 +165,7 @@ sub deleteCollateral {
|
|||
my $table = shift;
|
||||
my $keyName = shift;
|
||||
my $keyValue = shift;
|
||||
WebGUI::SQL->write("delete from $table where $keyName=".quote($keyValue));
|
||||
$self->session->db->write("delete from $table where $keyName=".$self->session->db->quote($keyValue));
|
||||
$self->updateHistory("deleted collateral item ".$keyName." ".$keyValue);
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ sub getCollateral {
|
|||
if ($keyValue eq "new" || $keyValue eq "") {
|
||||
return {$keyName=>"new"};
|
||||
} else {
|
||||
return WebGUI::SQL->quickHashRef("select * from $table where $keyName=".quote($keyValue),WebGUI::SQL->getSlave);
|
||||
return $self->session->db->quickHashRef("select * from $table where $keyName=".$self->session->db->quote($keyValue),$self->session->db->getSlave);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ Logs the view of the wobject to the passive profiling mechanism.
|
|||
|
||||
sub logView {
|
||||
my $self = shift;
|
||||
if ($session{setting}{passiveProfilingEnabled}) {
|
||||
if ($self->session->setting->get("passiveProfilingEnabled")) {
|
||||
WebGUI::PassiveProfiling::add($self->get("assetId"));
|
||||
# not sure what this will do in the new model
|
||||
# WebGUI::PassiveProfiling::addPage(); # add wobjects on asset to passive profile log
|
||||
|
|
@ -330,14 +330,14 @@ sub moveCollateralDown {
|
|||
unless (defined $setValue) {
|
||||
$setValue = $self->get($setName);
|
||||
}
|
||||
WebGUI::SQL->beginTransaction;
|
||||
my ($seq) = WebGUI::SQL->quickArray("select sequenceNumber from $table where $keyName=".quote($keyValue)." and $setName=".quote($setValue));
|
||||
my ($id) = WebGUI::SQL->quickArray("select $keyName from $table where $setName=".quote($setValue)." and sequenceNumber=$seq+1");
|
||||
$self->session->db->beginTransaction;
|
||||
my ($seq) = $self->session->db->quickArray("select sequenceNumber from $table where $keyName=".$self->session->db->quote($keyValue)." and $setName=".$self->session->db->quote($setValue));
|
||||
my ($id) = $self->session->db->quickArray("select $keyName from $table where $setName=".$self->session->db->quote($setValue)." and sequenceNumber=$seq+1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update $table set sequenceNumber=sequenceNumber+1 where $keyName=".quote($keyValue)." and $setName=" .quote($setValue));
|
||||
WebGUI::SQL->write("update $table set sequenceNumber=sequenceNumber-1 where $keyName=".quote($id)." and $setName=" .quote($setValue));
|
||||
$self->session->db->write("update $table set sequenceNumber=sequenceNumber+1 where $keyName=".$self->session->db->quote($keyValue)." and $setName=" .$self->session->db->quote($setValue));
|
||||
$self->session->db->write("update $table set sequenceNumber=sequenceNumber-1 where $keyName=".$self->session->db->quote($id)." and $setName=" .$self->session->db->quote($setValue));
|
||||
}
|
||||
WebGUI::SQL->commit;
|
||||
$self->session->db->commit;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -382,17 +382,17 @@ sub moveCollateralUp {
|
|||
unless (defined $setValue) {
|
||||
$setValue = $self->get($setName);
|
||||
}
|
||||
WebGUI::SQL->beginTransaction;
|
||||
my ($seq) = WebGUI::SQL->quickArray("select sequenceNumber from $table where $keyName=".quote($keyValue)." and $setName=".quote($setValue));
|
||||
my ($id) = WebGUI::SQL->quickArray("select $keyName from $table where $setName=".quote($setValue)
|
||||
$self->session->db->beginTransaction;
|
||||
my ($seq) = $self->session->db->quickArray("select sequenceNumber from $table where $keyName=".$self->session->db->quote($keyValue)." and $setName=".$self->session->db->quote($setValue));
|
||||
my ($id) = $self->session->db->quickArray("select $keyName from $table where $setName=".$self->session->db->quote($setValue)
|
||||
." and sequenceNumber=$seq-1");
|
||||
if ($id ne "") {
|
||||
WebGUI::SQL->write("update $table set sequenceNumber=sequenceNumber-1 where $keyName=".quote($keyValue)." and $setName="
|
||||
.quote($setValue));
|
||||
WebGUI::SQL->write("update $table set sequenceNumber=sequenceNumber+1 where $keyName=".quote($id)." and $setName="
|
||||
.quote($setValue));
|
||||
$self->session->db->write("update $table set sequenceNumber=sequenceNumber-1 where $keyName=".$self->session->db->quote($keyValue)." and $setName="
|
||||
.$self->session->db->quote($setValue));
|
||||
$self->session->db->write("update $table set sequenceNumber=sequenceNumber+1 where $keyName=".$self->session->db->quote($id)." and $setName="
|
||||
.$self->session->db->quote($setValue));
|
||||
}
|
||||
WebGUI::SQL->commit;
|
||||
$self->session->db->commit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -418,7 +418,7 @@ An HTML blob to be parsed into the current style.
|
|||
sub processStyle {
|
||||
my $self = shift;
|
||||
my $output = shift;
|
||||
return WebGUI::Style::process($output,$self->get("styleTemplateId"));
|
||||
return $self->session->style->process($output,$self->get("styleTemplateId"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -453,9 +453,9 @@ sub reorderCollateral {
|
|||
my $setName = shift || "assetId";
|
||||
my $setValue = shift || $self->get($setName);
|
||||
my $i = 1;
|
||||
my $sth = WebGUI::SQL->read("select $keyName from $table where $setName=".quote($setValue)." order by sequenceNumber");
|
||||
my $sth = $self->session->db->read("select $keyName from $table where $setName=".$self->session->db->quote($setValue)." order by sequenceNumber");
|
||||
while (my ($id) = $sth->array) {
|
||||
WebGUI::SQL->write("update $table set sequenceNumber=$i where $setName=".quote($setValue)." and $keyName=".quote($id));
|
||||
$self->session->db->write("update $table set sequenceNumber=$i where $setName=".$self->session->db->quote($setValue)." and $keyName=".$self->session->db->quote($id));
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -517,7 +517,7 @@ sub setCollateral {
|
|||
my $dbvalues = "";
|
||||
unless ($useSequence eq "0") {
|
||||
unless (exists $properties->{sequenceNumber}) {
|
||||
my ($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from $table where $setName=".quote($setValue));
|
||||
my ($seq) = $self->session->db->quickArray("select max(sequenceNumber) from $table where $setName=".$self->session->db->quote($setValue));
|
||||
$properties->{sequenceNumber} = $seq+1;
|
||||
}
|
||||
}
|
||||
|
|
@ -530,7 +530,7 @@ sub setCollateral {
|
|||
$dbvalues .= ',';
|
||||
}
|
||||
$dbkeys .= $key;
|
||||
$dbvalues .= quote($properties->{$key});
|
||||
$dbvalues .= $self->session->db->quote($properties->{$key});
|
||||
}
|
||||
$sql .= $dbkeys.') values ('.$dbvalues.')';
|
||||
$self->updateHistory("added collateral item ".$table." ".$properties->{$keyName});
|
||||
|
|
@ -539,13 +539,13 @@ sub setCollateral {
|
|||
foreach my $key (keys %{$properties}) {
|
||||
unless ($key eq "sequenceNumber") {
|
||||
$sql .= ',' if ($counter++ > 0);
|
||||
$sql .= $key."=".quote($properties->{$key});
|
||||
$sql .= $key."=".$self->session->db->quote($properties->{$key});
|
||||
}
|
||||
}
|
||||
$sql .= " where $keyName=".quote($properties->{$keyName});
|
||||
$sql .= " where $keyName=".$self->session->db->quote($properties->{$keyName});
|
||||
$self->updateHistory("edited collateral item ".$table." ".$properties->{$keyName});
|
||||
}
|
||||
WebGUI::SQL->write($sql);
|
||||
$self->session->db->write($sql);
|
||||
$self->reorderCollateral($table,$keyName,$setName,$setValue) if ($properties->{sequenceNumber} < 0);
|
||||
return $properties->{$keyName};
|
||||
}
|
||||
|
|
@ -559,7 +559,7 @@ sub www_edit {
|
|||
$tag =~ s/([a-z])([A-Z])/$1 $2/g; #Separate studly caps
|
||||
$tag =~ s/([A-Z]+(?![a-z]))/$1 /g; #Separate acronyms
|
||||
$self->getAdminConsole->setHelp(lc($tag)." add/edit", "Asset_".$tag2);
|
||||
my $addEdit = ($session{form}{func} eq 'add') ? WebGUI::International::get('add','Wobject') : WebGUI::International::get('edit','Wobject');
|
||||
my $addEdit = ($self->session->form->process("func") eq 'add') ? WebGUI::International::get('add','Wobject') : WebGUI::International::get('edit','Wobject');
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,$addEdit.' '.$self->getName);
|
||||
}
|
||||
|
||||
|
|
@ -577,10 +577,10 @@ sub www_view {
|
|||
unless ($self->canView) {
|
||||
if ($self->get("state") eq "published") { # no privileges, make em log in
|
||||
return WebGUI::Privilege::noAccess();
|
||||
} elsif ($session{var}{adminOn} && $self->get("state") =~ /^trash/) { # show em trash
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^trash/) { # show em trash
|
||||
WebGUI::HTTP::setRedirect($self->getUrl("func=manageTrash"));
|
||||
return "";
|
||||
} elsif ($session{var}{adminOn} && $self->get("state") =~ /^clipboard/) { # show em clipboard
|
||||
} elsif ($self->session->var->get("adminOn") && $self->get("state") =~ /^clipboard/) { # show em clipboard
|
||||
WebGUI::HTTP::setRedirect($self->getUrl("func=manageClipboard"));
|
||||
return "";
|
||||
} else { # tell em it doesn't exist anymore
|
||||
|
|
@ -588,7 +588,7 @@ sub www_view {
|
|||
return WebGUI::Asset->getNotFound->www_view;
|
||||
}
|
||||
}
|
||||
if ($self->get("encryptPage") && $session{env}{HTTPS} ne "on") {
|
||||
if ($self->get("encryptPage") && $self->session->env->get("HTTPS") ne "on") {
|
||||
WebGUI::HTTP::setRedirect($self->getUrl);
|
||||
return "";
|
||||
}
|
||||
|
|
@ -596,21 +596,21 @@ sub www_view {
|
|||
my $cache;
|
||||
my $output;
|
||||
my $useCache = (
|
||||
$session{form}{op} eq "" && $session{form}{pn} eq ""
|
||||
$self->session->form->process("op") eq "" && $self->session->form->process("pn") eq ""
|
||||
&& (
|
||||
( $self->get("cacheTimeout") > 10 && $session{user}{userId} ne '1')
|
||||
|| ( $self->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} eq '1')
|
||||
( $self->get("cacheTimeout") > 10 && $self->session->user->profileField("userId") ne '1')
|
||||
|| ( $self->get("cacheTimeoutVisitor") > 10 && $self->session->user->profileField("userId") eq '1')
|
||||
)
|
||||
&& !( $session{var}{adminOn} || $disableCache)
|
||||
&& !( $self->session->var->get("adminOn") || $disableCache)
|
||||
);
|
||||
if ($useCache) {
|
||||
$cache = WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId});
|
||||
$cache = WebGUI::Cache->new("wobject_".$self->getId."_".$self->session->user->profileField("userId"));
|
||||
$output = $cache->get;
|
||||
}
|
||||
unless ($output) {
|
||||
$output = $self->processStyle($self->view);
|
||||
my $ttl;
|
||||
if ($session{user}{userId} eq '1') {
|
||||
if ($self->session->user->profileField("userId") eq '1') {
|
||||
$ttl = $self->get("cacheTimeoutVisitor");
|
||||
} else {
|
||||
$ttl = $self->get("cacheTimeout");
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ sub view {
|
|||
$var{"description.first.sentence"} = $var{"description.first.2sentences"};
|
||||
$var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s;
|
||||
my $p = WebGUI::Paginator->new($self->getUrl,1);
|
||||
if ($session{form}{makePrintable} || $var{description} eq "") {
|
||||
if ($self->session->form->process("makePrintable") || $var{description} eq "") {
|
||||
$var{description} =~ s/\^\-\;//g;
|
||||
$p->setDataByArrayRef([$var{description}]);
|
||||
} else {
|
||||
|
|
@ -183,8 +183,8 @@ sub view {
|
|||
}
|
||||
$p->appendTemplateVars(\%var);
|
||||
my $templateId = $self->get("templateId");
|
||||
if ($session{form}{overrideTemplateId} ne "") {
|
||||
$templateId = $session{form}{overrideTemplateId};
|
||||
if ($self->session->form->process("overrideTemplateId") ne "") {
|
||||
$templateId = $self->session->form->process("overrideTemplateId");
|
||||
}
|
||||
return $self->processTemplate(\%var, $templateId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ sub appendTemplateLabels {
|
|||
#-------------------------------------------------------------------
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
return ((($session{form}{func} eq "add" || ($session{form}{assetId} eq "new" && $session{form}{func} eq "editSave" && $session{form}{class} eq "WebGUI::Asset::Post::Thread")) && $self->canPost) || # account for new posts
|
||||
return ((($self->session->form->process("func") eq "add" || ($self->session->form->process("assetId") eq "new" && $self->session->form->process("func") eq "editSave" && $self->session->form->process("class") eq "WebGUI::Asset::Post::Thread")) && $self->canPost) || # account for new posts
|
||||
$self->SUPER::canEdit());
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ sub canPost {
|
|||
#-------------------------------------------------------------------
|
||||
sub canSubscribe {
|
||||
my $self = shift;
|
||||
return ($session{user}{userId} ne "1" && $self->canView);
|
||||
return ($self->session->user->profileField("userId") ne "1" && $self->canView);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -502,7 +502,7 @@ sub getEditForm {
|
|||
-hoverHelp=>WebGUI::International::get('posts/page description', 'Asset_Collaboration'),
|
||||
-value=>$self->getValue("postsPerPage")
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
$tabform->getTab("properties")->integer(
|
||||
-name=>"karmaPerPost",
|
||||
-label=>WebGUI::International::get('karma/post', 'Asset_Collaboration'),
|
||||
|
|
@ -605,7 +605,7 @@ sub getEditForm {
|
|||
-name=>"richEditor",
|
||||
-label=>WebGUI::International::get('rich editor', 'Asset_Collaboration'),
|
||||
-hoverHelp=>WebGUI::International::get('rich editor description', 'Asset_Collaboration'),
|
||||
-options=>WebGUI::SQL->buildHashRef("select distinct(assetData.assetId), assetData.title from asset, assetData where asset.className='WebGUI::Asset::RichEdit' and asset.assetId=assetData.assetId order by assetData.title"),
|
||||
-options=>$self->session->db->buildHashRef("select distinct(assetData.assetId), assetData.title from asset, assetData where asset.className='WebGUI::Asset::RichEdit' and asset.assetId=assetData.assetId order by assetData.title"),
|
||||
-value=>[$self->getValue("richEditor")]
|
||||
);
|
||||
$tabform->getTab("display")->yesNo(
|
||||
|
|
@ -791,7 +791,7 @@ sub isSubscribed {
|
|||
#-------------------------------------------------------------------
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
my $updatePrivs = ($session{form}{groupIdView} ne $self->get("groupIdView") || $session{form}{moderateGroupId} ne $self->get("moderateGroupId"));
|
||||
my $updatePrivs = ($self->session->form->process("groupIdView") ne $self->get("groupIdView") || $self->session->form->process("moderateGroupId") ne $self->get("moderateGroupId"));
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
if ($self->get("subscriptionGroupId") eq "") {
|
||||
$self->createSubscriptionGroup;
|
||||
|
|
@ -804,8 +804,8 @@ sub processPropertiesFromFormPost {
|
|||
});
|
||||
}
|
||||
}
|
||||
WebGUI::Session::deleteScratch($self->getId."_sortBy");
|
||||
WebGUI::Session::deleteScratch($self->getId."_sortDir");
|
||||
$self->session->scratch->delete($self->getId."_sortBy");
|
||||
$self->session->scratch->delete($self->getId."_sortDir");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -827,11 +827,11 @@ Calculates the rating of this forum from its threads and stores the new value in
|
|||
|
||||
sub recalculateRating {
|
||||
my $self = shift;
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Thread left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Thread.assetId=Post.assetId where asset.parentId=".quote($self->getId)." and Post.rating>0");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Thread left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Thread.assetId=Post.assetId where asset.parentId=".$self->session->db->quote($self->getId)." and Post.rating>0");
|
||||
$count = $count || 1;
|
||||
my ($sum) = WebGUI::SQL->quickArray("select sum(Post.rating) from Thread left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Thread.assetId=Post.assetId where asset.parentId=".quote($self->getId)." and Post.rating>0");
|
||||
my ($sum) = $self->session->db->quickArray("select sum(Post.rating) from Thread left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Thread.assetId=Post.assetId where asset.parentId=".$self->session->db->quote($self->getId)." and Post.rating>0");
|
||||
my $average = round($sum/$count);
|
||||
$self->update({rating=>$average});
|
||||
}
|
||||
|
|
@ -870,8 +870,8 @@ Subscribes a user to this collaboration system.
|
|||
|
||||
sub subscribe {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId})->delete;
|
||||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$self->session->user->profileField("userId"))->delete;
|
||||
WebGUI::Grouping::addUsersToGroups([$self->session->user->profileField("userId")],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -884,8 +884,8 @@ Unsubscribes a user from this collaboration system
|
|||
|
||||
sub unsubscribe {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$session{user}{userId})->delete;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
WebGUI::Cache->new("wobject_".$self->getId."_".$self->session->user->profileField("userId"))->delete;
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$self->session->user->profileField("userId")],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -894,17 +894,17 @@ sub view {
|
|||
my $self = shift;
|
||||
my $scratchSortBy = $self->getId."_sortBy";
|
||||
my $scratchSortOrder = $self->getId."_sortDir";
|
||||
my $sortBy = $session{form}{sortBy} || $session{scratch}{$scratchSortBy} || $self->get("sortBy");
|
||||
my $sortBy = $self->session->form->process("sortBy") || $session{scratch}{$scratchSortBy} || $self->get("sortBy");
|
||||
my $sortOrder = $session{scratch}{$scratchSortOrder} || $self->get("sortOrder");
|
||||
if ($sortBy ne $session{scratch}{$scratchSortBy} && $session{form}{func} ne "editSave") {
|
||||
WebGUI::Session::setScratch($scratchSortBy,$session{form}{sortBy});
|
||||
} elsif ($session{form}{sortBy} && $session{form}{func} ne "editSave") {
|
||||
if ($sortBy ne $session{scratch}{$scratchSortBy} && $self->session->form->process("func") ne "editSave") {
|
||||
$self->session->scratch->set($scratchSortBy,$self->session->form->process("sortBy"));
|
||||
} elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") {
|
||||
if ($sortOrder eq "asc") {
|
||||
$sortOrder = "desc";
|
||||
} else {
|
||||
$sortOrder = "asc";
|
||||
}
|
||||
WebGUI::Session::setScratch($scratchSortOrder, $sortOrder);
|
||||
$self->session->scratch->set($scratchSortOrder, $sortOrder);
|
||||
}
|
||||
$sortBy ||= "dateUpdated";
|
||||
$sortOrder ||= "desc";
|
||||
|
|
@ -913,7 +913,7 @@ sub view {
|
|||
$var{"add.url"} = $self->getNewThreadUrl;
|
||||
$var{"rss.url"} = $self->getRssUrl;
|
||||
$var{'user.isModerator'} = $self->canModerate;
|
||||
$var{'user.isVisitor'} = ($session{user}{userId} eq '1');
|
||||
$var{'user.isVisitor'} = ($self->session->user->profileField("userId") eq '1');
|
||||
$var{'user.isSubscribed'} = $self->isSubscribed;
|
||||
$var{'sortby.title.url'} = $self->getSortByUrl("title");
|
||||
$var{'sortby.username.url'} = $self->getSortByUrl("username");
|
||||
|
|
@ -922,11 +922,11 @@ sub view {
|
|||
$var{'sortby.views.url'} = $self->getSortByUrl("views");
|
||||
$var{'sortby.replies.url'} = $self->getSortByUrl("replies");
|
||||
$var{'sortby.rating.url'} = $self->getSortByUrl("rating");
|
||||
WebGUI::Style::setLink($var{"rss.url"},{ rel=>'alternate', type=>'application/rss+xml', title=>'RSS' });
|
||||
$self->session->style->setLink($var{"rss.url"},{ rel=>'alternate', type=>'application/rss+xml', title=>'RSS' });
|
||||
$var{"search.url"} = $self->getSearchUrl;
|
||||
$var{"subscribe.url"} = $self->getSubscribeUrl;
|
||||
$var{"unsubscribe.url"} = $self->getUnsubscribeUrl;
|
||||
my $constraints = "(assetData.status='approved' or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1') or assetData.tagId=".quote($session{scratch}{versionTag});
|
||||
my $constraints = "(assetData.status='approved' or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->profileField("userId"))." and assetData.ownerUserId<>'1') or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
|
||||
if ($var{'user.isModerator'}) {
|
||||
$constraints .= " or assetData.status='pending'";
|
||||
}
|
||||
|
|
@ -936,7 +936,7 @@ sub view {
|
|||
left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Post.assetId=Thread.assetId and Thread.revisionDate = Post.revisionDate
|
||||
left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate = assetData.revisionDate
|
||||
where asset.parentId=".quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) and $constraints
|
||||
where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) and $constraints
|
||||
group by assetData.assetId order by Thread.isSticky desc, ".$sortBy." ".$sortOrder;
|
||||
my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage"));
|
||||
$self->appendPostListTemplateVars(\%var, $sql, $p);
|
||||
|
|
@ -954,11 +954,11 @@ The web method to display and use the forum search interface.
|
|||
|
||||
sub www_search {
|
||||
my $self = shift;
|
||||
WebGUI::Session::setScratch($self->getId."_all",$session{form}{all});
|
||||
WebGUI::Session::setScratch($self->getId."_atLeastOne",$session{form}{atLeastOne});
|
||||
WebGUI::Session::setScratch($self->getId."_exactPhrase",$session{form}{exactPhrase});
|
||||
WebGUI::Session::setScratch($self->getId."_without",$session{form}{without});
|
||||
WebGUI::Session::setScratch($self->getId."_numResults",$session{form}{numResults});
|
||||
$self->session->scratch->set($self->getId."_all",$self->session->form->process("all"));
|
||||
$self->session->scratch->set($self->getId."_atLeastOne",$self->session->form->process("atLeastOne"));
|
||||
$self->session->scratch->set($self->getId."_exactPhrase",$self->session->form->process("exactPhrase"));
|
||||
$self->session->scratch->set($self->getId."_without",$self->session->form->process("without"));
|
||||
$self->session->scratch->set($self->getId."_numResults",$self->session->form->process("numResults"));
|
||||
my %var;
|
||||
$var{'form.header'} = WebGUI::Form::formHeader({action=>$self->getUrl})
|
||||
.WebGUI::Form::hidden({ name=>"func", value=>"search" })
|
||||
|
|
@ -966,22 +966,22 @@ sub www_search {
|
|||
$var{'all.form'} = WebGUI::Form::text({
|
||||
name=>'all',
|
||||
value=>$session{scratch}{$self->getId."_all"},
|
||||
size=>($session{setting}{textBoxSize}-5)
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
$var{'exactphrase.form'} = WebGUI::Form::text({
|
||||
name=>'exactPhrase',
|
||||
value=>$session{scratch}{$self->getId."_exactPhrase"},
|
||||
size=>($session{setting}{textBoxSize}-5)
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
$var{'atleastone.form'} = WebGUI::Form::text({
|
||||
name=>'atLeastOne',
|
||||
value=>$session{scratch}{$self->getId."_atLeastOne"},
|
||||
size=>($session{setting}{textBoxSize}-5)
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
$var{'without.form'} = WebGUI::Form::text({
|
||||
name=>'without',
|
||||
value=>$session{scratch}{$self->getId."_without"},
|
||||
size=>($session{setting}{textBoxSize}-5)
|
||||
size=>($self->session->setting->get("textBoxSize")-5)
|
||||
});
|
||||
my %results;
|
||||
tie %results, 'Tie::IxHash';
|
||||
|
|
@ -996,8 +996,8 @@ sub www_search {
|
|||
$var{'form.footer'} = WebGUI::Form::formFooter();
|
||||
$var{'back.url'} = $self->getUrl;
|
||||
$self->appendTemplateLabels(\%var);
|
||||
$var{doit} = $session{form}{doit};
|
||||
if ($session{form}{doit}) {
|
||||
$var{doit} = $self->session->form->process("doit");
|
||||
if ($self->session->form->process("doit")) {
|
||||
my @fieldsToSearch = qw(assetData.title assetData.synopsis Post.content Post.username Post.userDefined1 Post.userDefined2 Post.userDefined3 Post.userDefined4 Post.userDefined5);
|
||||
my $all;
|
||||
if ($session{scratch}{$self->getId."_all"} ne "") {
|
||||
|
|
@ -1010,7 +1010,7 @@ sub www_search {
|
|||
my $allSub;
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$allSub .= " or " if ($allSub ne "");
|
||||
$allSub .= " $field like ".quote("%".$word."%");
|
||||
$allSub .= " $field like ".$self->session->db->quote("%".$word."%");
|
||||
}
|
||||
$all .= $allSub;
|
||||
$allSub = "";
|
||||
|
|
@ -1021,7 +1021,7 @@ sub www_search {
|
|||
if ($session{scratch}{$self->getId."_exactPhrase"} ne "") {
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$exactPhrase .= " or " if ($exactPhrase ne "");
|
||||
$exactPhrase .= " $field like ".quote("%".$session{scratch}{$self->getId."_exactPhrase"}."%");
|
||||
$exactPhrase .= " $field like ".$self->session->db->quote("%".$session{scratch}{$self->getId."_exactPhrase"}."%");
|
||||
}
|
||||
}
|
||||
my $atLeastOne;
|
||||
|
|
@ -1032,7 +1032,7 @@ sub www_search {
|
|||
foreach my $word (@words) {
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$atLeastOne .= " or " if ($atLeastOne ne "");
|
||||
$atLeastOne .= " $field like ".quote("%".$word."%");
|
||||
$atLeastOne .= " $field like ".$self->session->db->quote("%".$word."%");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1044,7 +1044,7 @@ sub www_search {
|
|||
foreach my $word (@words) {
|
||||
foreach my $field (@fieldsToSearch) {
|
||||
$without .= " and " if ($without ne "");
|
||||
$without .= " $field not like ".quote("%".$word."%");
|
||||
$without .= " $field not like ".$self->session->db->quote("%".$word."%");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1055,13 +1055,13 @@ sub www_search {
|
|||
left join assetData on assetData.assetId=asset.assetId
|
||||
left join Post on Post.assetId=assetData.assetId and assetData.revisionDate = Post.revisionDate
|
||||
where (asset.className='WebGUI::Asset::Post' or asset.className='WebGUI::Asset::Post::Thread')
|
||||
and asset.lineage like ".quote($self->get("lineage").'%')."
|
||||
and asset.assetId<>".quote($self->getId)."
|
||||
and asset.lineage like ".$self->session->db->quote($self->get("lineage").'%')."
|
||||
and asset.assetId<>".$self->session->db->quote($self->getId)."
|
||||
and (
|
||||
assetData.status in ('approved','archived')
|
||||
or assetData.tagId=".quote($session{scratch}{versionTag});
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag"));
|
||||
$sql .= " or assetData.status='pending'" if ($self->canModerate);
|
||||
$sql .= " or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1')
|
||||
$sql .= " or (assetData.ownerUserId=".$self->session->db->quote($self->session->user->profileField("userId"))." and assetData.ownerUserId<>'1')
|
||||
) ";
|
||||
$sql .= " and ($all) " if ($all ne "");
|
||||
$sql .= " and " if ($sql ne "" && $exactPhrase ne "");
|
||||
|
|
@ -1129,7 +1129,7 @@ sub _xml_encode {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
my $disableCache = ($session{form}{sortBy} ne "");
|
||||
my $disableCache = ($self->session->form->process("sortBy") ne "");
|
||||
return $self->SUPER::www_view($disableCache);
|
||||
}
|
||||
|
||||
|
|
@ -1140,7 +1140,7 @@ sub www_viewRSS {
|
|||
my $self = shift;
|
||||
my %var;
|
||||
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
# Set the required channel variables
|
||||
$var{'title'} = _xml_encode($self->get("title"));
|
||||
$var{'link'} = _xml_encode($self->getUrl);
|
||||
|
|
@ -1151,21 +1151,21 @@ sub www_viewRSS {
|
|||
$var{'webMaster'} = $WebGUI::Session::session{setting}{companyEmail};
|
||||
$var{'docs'} = "http://blogs.law.harvard.edu/tech/rss";
|
||||
|
||||
my $sth = WebGUI::SQL->read("select asset.assetId, asset.className, max(assetData.revisionDate)
|
||||
my $sth = $self->session->db->read("select asset.assetId, asset.className, max(assetData.revisionDate)
|
||||
from Thread
|
||||
left join asset on Thread.assetId=asset.assetId
|
||||
left join Post on Post.assetId=Thread.assetId and Thread.revisionDate=Post.revisionDate
|
||||
left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate=assetData.revisionDate
|
||||
where asset.parentId=".quote($self->getId)." and asset.state='published'
|
||||
where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published'
|
||||
and asset.className='WebGUI::Asset::Post::Thread'
|
||||
and (assetData.status='approved'
|
||||
or assetData.tagId=".quote($session{scratch}{versionTag}).")
|
||||
or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")
|
||||
group by assetData.assetId
|
||||
order by ".$self->getValue("sortBy")." ".$self->getValue("sortOrder"));
|
||||
my $i = 1;
|
||||
while (my ($id, $class, $version) = $sth->array) {
|
||||
my $post = WebGUI::Asset::Wobject::Collaboration->new($id, $class, $version);
|
||||
my $encUrl = _xml_encode(WebGUI::URL::getSiteURL().$post->getUrl);
|
||||
my $encUrl = _xml_encode($self->session->url->getSiteURL().$post->getUrl);
|
||||
|
||||
my @attachmentLoop = ();
|
||||
unless ($post->get("storageId") eq "") {
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ our @ISA = qw(WebGUI::Asset::Wobject);
|
|||
#-------------------------------------------------------------------
|
||||
sub canManage {
|
||||
my $self = shift;
|
||||
return 0 if $session{user}{userId} == 1;
|
||||
return 0 if $self->session->user->profileField("userId") == 1;
|
||||
return WebGUI::Grouping::isInGroup($self->get("adminsGroupId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canPersonalize {
|
||||
my $self = shift;
|
||||
return 0 if $session{user}{userId} == 1;
|
||||
return 0 if $self->session->user->profileField("userId") == 1;
|
||||
return WebGUI::Grouping::isInGroup($self->get("usersGroupId"));
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ sub getContentPositions {
|
|||
#-------------------------------------------------------------------
|
||||
sub discernUserId {
|
||||
my $self = shift;
|
||||
return ($self->canManage && WebGUI::Session::isAdminOn()) ? '1' : $session{user}{userId};
|
||||
return ($self->canManage && WebGUI::Session::isAdminOn()) ? '1' : $self->session->user->profileField("userId");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -119,7 +119,7 @@ sub getEditForm {
|
|||
-hoverHelp=>$i18n->get('dashboard usersGroupId description'),
|
||||
-value=>[$self->getValue("usersGroupId")]
|
||||
);
|
||||
if ($session{form}{func} ne "add") {
|
||||
if ($self->session->form->process("func") ne "add") {
|
||||
my @assetsToHide = split("\n",$self->getValue("assetsToHide"));
|
||||
my $children = $self->getLineage(["children"],{"returnObjects"=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"]});
|
||||
my %childIds;
|
||||
|
|
@ -164,7 +164,7 @@ sub isManaging {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
if ($session{form}{assetId} eq "new" && $session{form}{class} eq 'WebGUI::Asset::Wobject::Dashboard') {
|
||||
if ($self->session->form->process("assetId") eq "new" && $self->session->form->process("class") eq 'WebGUI::Asset::Wobject::Dashboard') {
|
||||
$self->initialize;
|
||||
if (ref $self->getParent eq 'WebGUI::Asset::Wobject::Layout') {
|
||||
$self->getParent->update({assetsToHide=>$self->getParent->get("assetsToHide")."\n".$self->getId});
|
||||
|
|
@ -203,14 +203,14 @@ sub view {
|
|||
|
||||
my @found;
|
||||
my $newStuff;
|
||||
my $showPerformance = WebGUI::ErrorHandler::canShowPerformanceIndicators();
|
||||
my $showPerformance = $self->session->errorHandler->canShowPerformanceIndicators();
|
||||
foreach my $position (@positions) {
|
||||
my @assets = split(",",$position);
|
||||
foreach my $asset (@assets) {
|
||||
foreach my $child (@{$children}) {
|
||||
if ($asset eq $child->getId) {
|
||||
unless (isIn($asset,@hidden) || !($child->canView)) {
|
||||
WebGUI::Style::setRawHeadTags($child->getExtraHeadTags);
|
||||
$self->session->style->setRawHeadTags($child->getExtraHeadTags);
|
||||
$child->{_properties}{title} = $child->getTitle;
|
||||
$child->{_properties}{title} = $child->getShortcut->getTitle if (ref $child eq 'WebGUI::Asset::Shortcut');
|
||||
if ($i == 1 || $i > $numPositions) {
|
||||
|
|
@ -221,7 +221,7 @@ sub view {
|
|||
shortcutUrl=>$child->getUrl,
|
||||
canPersonalize=>$self->canPersonalize,
|
||||
showReloadIcon=>$child->{_properties}{showReloadIcon},
|
||||
canEditUserPrefs=>(($session{user}{userId} ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getPrefFieldsToShow) > 0))
|
||||
canEditUserPrefs=>(($self->session->user->profileField("userId") ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getPrefFieldsToShow) > 0))
|
||||
});
|
||||
$newStuff .= 'available_dashlets["'.$child->getId.'"]=\''.$child->getUrl.'\';';
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ sub view {
|
|||
shortcutUrl=>$child->getUrl,
|
||||
canPersonalize=>$self->canPersonalize,
|
||||
showReloadIcon=>$child->{_properties}{showReloadIcon},
|
||||
canEditUserPrefs=>(($session{user}{userId} ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getPrefFieldsToShow) > 0))
|
||||
canEditUserPrefs=>(($self->session->user->profileField("userId") ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getPrefFieldsToShow) > 0))
|
||||
});
|
||||
$newStuff .= 'available_dashlets["'.$child->getId.'"]=\''.$child->getUrl.'\';';
|
||||
}
|
||||
|
|
@ -256,13 +256,13 @@ sub view {
|
|||
shortcutUrl=>$child->getUrl,
|
||||
showReloadIcon=>$child->{_properties}{showReloadIcon},
|
||||
canPersonalize=>$self->canPersonalize,
|
||||
canEditUserPrefs=>(($session{user}{userId} ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getPrefFieldsToShow) > 0))
|
||||
canEditUserPrefs=>(($self->session->user->profileField("userId") ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getPrefFieldsToShow) > 0))
|
||||
});
|
||||
$newStuff .= 'available_dashlets["'.$child->getId.'"]=\''.$child->getUrl.'\';';
|
||||
}
|
||||
}
|
||||
}
|
||||
$vars{showAdmin} = ($session{var}{adminOn} && $self->canEdit);
|
||||
$vars{showAdmin} = ($self->session->var->get("adminOn") && $self->canEdit);
|
||||
$vars{"dragger.init"} = '
|
||||
<script type="text/javascript">
|
||||
dragable_init("'.$self->getUrl.'");
|
||||
|
|
@ -276,13 +276,13 @@ sub view {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_setContentPositions {
|
||||
my $self = shift;
|
||||
return 'Visitors cannot save settings' if($session{user}{userId} eq '1');
|
||||
return 'Visitors cannot save settings' if($self->session->user->profileField("userId") eq '1');
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canPersonalize);
|
||||
return 'empty' unless $self->get("isInitialized");
|
||||
my $dummy = $self->initialize unless $self->get("isInitialized");
|
||||
my $u = WebGUI::User->new($self->discernUserId);
|
||||
my $success = $u->profileField($self->getId.'contentPositions',$session{form}{map}) eq $session{form}{map};
|
||||
return "Map set: ".$session{form}{map} if $success;
|
||||
my $success = $u->profileField($self->getId.'contentPositions',$self->session->form->process("map")) eq $self->session->form->process("map");
|
||||
return "Map set: ".$self->session->form->process("map") if $success;
|
||||
return "Map failed to set.";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ sub _createField {
|
|||
if (isIn($data->{type},qw(selectList checkList))) {
|
||||
my @defaultValues;
|
||||
if ($session{form}{$param{name}}) {
|
||||
@defaultValues = WebGUI::FormProcessor::selectList($param{name});
|
||||
@defaultValues = $self->session->form->selectList($param{name});
|
||||
} else {
|
||||
foreach (split(/\n/, $data->{value})) {
|
||||
s/\s+$//; # remove trailing spaces
|
||||
|
|
@ -118,7 +118,7 @@ sub _tonull {
|
|||
#-------------------------------------------------------------------
|
||||
sub _createTabInit {
|
||||
my $id = shift;
|
||||
my @tabCount = WebGUI::SQL->quickArray("select count(DataForm_tabId) from DataForm_tab where assetId=".quote($id));
|
||||
my @tabCount = $self->session->db->quickArray("select count(DataForm_tabId) from DataForm_tab where assetId=".$self->session->db->quote($id));
|
||||
my $output = '<script type="text/javascript">var numberOfTabs = '.$tabCount[0].'; initTabs();</script>';
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -181,9 +181,9 @@ sub duplicate {
|
|||
my (%dataField, %dataTab, $sthField, $sthTab, $newTabId);
|
||||
tie %dataTab, 'Tie::CPHash';
|
||||
tie %dataField, 'Tie::CPHash';
|
||||
$sthTab = WebGUI::SQL->read("select * from DataForm_tab where assetId=".quote($self->getId));
|
||||
$sthTab = $self->session->db->read("select * from DataForm_tab where assetId=".$self->session->db->quote($self->getId));
|
||||
while (%dataTab = $sthTab->hash) {
|
||||
$sthField = WebGUI::SQL->read("select * from DataForm_field where assetId=".quote($self->getId)." AND DataForm_tabId=".quote($dataTab{DataForm_tabId}));
|
||||
$sthField = $self->session->db->read("select * from DataForm_field where assetId=".$self->session->db->quote($self->getId)." AND DataForm_tabId=".$self->session->db->quote($dataTab{DataForm_tabId}));
|
||||
$dataTab{DataForm_tabId} = "new";
|
||||
$newTabId = $newAsset->setCollateral("DataForm_tab","DataForm_tabId",\%dataTab);
|
||||
while (%dataField = $sthField->hash) {
|
||||
|
|
@ -193,7 +193,7 @@ sub duplicate {
|
|||
}
|
||||
$sthField->finish;
|
||||
}
|
||||
$sthField = WebGUI::SQL->read("select * from DataForm_field where assetId=".quote($self->getId)." AND DataForm_tabId='0'");
|
||||
$sthField = $self->session->db->read("select * from DataForm_field where assetId=".$self->session->db->quote($self->getId)." AND DataForm_tabId='0'");
|
||||
while (%dataField = $sthField->hash) {
|
||||
$dataField{DataForm_fieldId} = "new";
|
||||
$newAsset->setCollateral("DataForm_field","DataForm_fieldId",\%dataField);
|
||||
|
|
@ -260,7 +260,7 @@ sub getEditForm {
|
|||
-hoverHelp=>WebGUI::International::get('74 description',"Asset_DataForm"),
|
||||
-value=>$self->getValue("mailData")
|
||||
);
|
||||
if ($self->getId eq "new" && $session{form}{proceed} ne "manageAssets") {
|
||||
if ($self->getId eq "new" && $self->session->form->process("proceed") ne "manageAssets") {
|
||||
$tabform->getTab("properties")->whatNext(
|
||||
-options=>{
|
||||
editField=>WebGUI::International::get(76,"Asset_DataForm"),
|
||||
|
|
@ -284,8 +284,8 @@ sub getListTemplateVars {
|
|||
#$var->{"entryId"} = $self->getId;
|
||||
#$var->{"delete.url"} = $self->getUrl.";func=deleteAllEntries";
|
||||
#$var->{"delete.label"} = WebGUI::International::get(91,"Asset_DataForm");
|
||||
my $fields = WebGUI::SQL->read("select DataForm_fieldId,name,label,isMailField,type from DataForm_field
|
||||
where assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
my $fields = $self->session->db->read("select DataForm_fieldId,name,label,isMailField,type from DataForm_field
|
||||
where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
while (my $field = $fields->hashRef) {
|
||||
push(@fieldLoop,{
|
||||
"field.name"=>$field->{name},
|
||||
|
|
@ -298,12 +298,12 @@ sub getListTemplateVars {
|
|||
$fields->finish;
|
||||
$var->{field_loop} = \@fieldLoop;
|
||||
my @recordLoop;
|
||||
my $entries = WebGUI::SQL->read("select ipAddress,username,userid,submissionDate,DataForm_entryId from DataForm_entry
|
||||
where assetId=".quote($self->getId)." order by submissionDate desc");
|
||||
my $entries = $self->session->db->read("select ipAddress,username,userid,submissionDate,DataForm_entryId from DataForm_entry
|
||||
where assetId=".$self->session->db->quote($self->getId)." order by submissionDate desc");
|
||||
while (my $record = $entries->hashRef) {
|
||||
my @dataLoop;
|
||||
my $dloop = WebGUI::SQL->read("select b.name, b.label, b.isMailField, a.value from DataForm_entryData a left join DataForm_field b
|
||||
on a.DataForm_fieldId=b.DataForm_fieldId where a.DataForm_entryId=".quote($record->{DataForm_entryId})."
|
||||
my $dloop = $self->session->db->read("select b.name, b.label, b.isMailField, a.value from DataForm_entryData a left join DataForm_field b
|
||||
on a.DataForm_fieldId=b.DataForm_fieldId where a.DataForm_entryId=".$self->session->db->quote($record->{DataForm_entryId})."
|
||||
order by b.sequenceNumber");
|
||||
while (my $data = $dloop->hashRef) {
|
||||
push(@dataLoop,{
|
||||
|
|
@ -340,10 +340,10 @@ sub getFormUrl {
|
|||
my $params = shift;
|
||||
my $url = $self->getUrl;
|
||||
unless ($self->defaultViewForm) {
|
||||
$url = WebGUI::URL::append($url, 'mode=form');
|
||||
$url = $self->session->url->append($url, 'mode=form');
|
||||
}
|
||||
if ($params) {
|
||||
$url = WebGUI::URL::append($url, $params);
|
||||
$url = $self->session->url->append($url, $params);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
|
@ -355,10 +355,10 @@ sub getListUrl {
|
|||
my $params = shift;
|
||||
my $url = $self->getUrl;
|
||||
if ($self->defaultViewForm) {
|
||||
$url = WebGUI::URL::append($url, 'mode=list');
|
||||
$url = $self->session->url->append($url, 'mode=list');
|
||||
}
|
||||
if ($params) {
|
||||
$url = WebGUI::URL::append($url, $params);
|
||||
$url = $self->session->url->append($url, $params);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
|
@ -389,7 +389,7 @@ sub getRecordTemplateVars {
|
|||
my @tabs;
|
||||
my $select = "select a.name, a.DataForm_fieldId, a.DataForm_tabId,a.label, a.status, a.isMailField, a.subtext, a.type, a.defaultValue, a.possibleValues, a.width, a.rows, a.extras, a.vertical";
|
||||
my $join;
|
||||
my $where = "where a.assetId=".quote($self->getId);
|
||||
my $where = "where a.assetId=".$self->session->db->quote($self->getId);
|
||||
if ($var->{entryId}) {
|
||||
$var->{"form.start"} .= WebGUI::Form::hidden({name=>"entryId",value=>$var->{entryId}});
|
||||
my $entry = $self->getCollateral("DataForm_entry","DataForm_entryId",$var->{entryId});
|
||||
|
|
@ -399,7 +399,7 @@ sub getRecordTemplateVars {
|
|||
$var->{date} = WebGUI::DateTime::epochToHuman($entry->{submissionDate});
|
||||
$var->{epoch} = $entry->{submissionDate};
|
||||
$var->{"edit.URL"} = $self->getFormUrl('entryId='.$var->{entryId});
|
||||
$where .= " and b.DataForm_entryId=".quote($var->{entryId});
|
||||
$where .= " and b.DataForm_entryId=".$self->session->db->quote($var->{entryId});
|
||||
$join = "left join DataForm_entryData as b on a.DataForm_fieldId=b.DataForm_fieldId";
|
||||
$select .= ", b.value";
|
||||
}
|
||||
|
|
@ -407,13 +407,13 @@ sub getRecordTemplateVars {
|
|||
tie %data, 'Tie::CPHash';
|
||||
my %tab;
|
||||
tie %tab, 'Tie::CPHash';
|
||||
my $tabsth = WebGUI::SQL->read("select * from DataForm_tab where assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
my $tabsth = $self->session->db->read("select * from DataForm_tab where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
while (%tab = $tabsth->hash) {
|
||||
my @fields;
|
||||
my $sth = WebGUI::SQL->read("$select from DataForm_field as a $join $where and a.DataForm_tabId=".quote($tab{DataForm_tabId})." order by a.sequenceNumber");
|
||||
my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId=".$self->session->db->quote($tab{DataForm_tabId})." order by a.sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
my $formValue = $session{form}{$data{name}};
|
||||
if ((not exists $data{value}) && $session{form}{func} ne "editSave" && $session{form}{func} ne "editFieldSave" && defined $formValue) {
|
||||
if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) {
|
||||
$data{value} = $formValue;
|
||||
$data{value} = WebGUI::DateTime::setToEpoch($data{value}) if ($data{type} eq "date");
|
||||
}
|
||||
|
|
@ -422,7 +422,7 @@ sub getRecordTemplateVars {
|
|||
WebGUI::Macro::process(\$defaultValue);
|
||||
$data{value} = $defaultValue;
|
||||
}
|
||||
my $hidden = (($data{status} eq "hidden" && !$session{var}{adminOn}) || ($data{isMailField} && !$self->get("mailData")));
|
||||
my $hidden = (($data{status} eq "hidden" && !$self->session->var->get("adminOn")) || ($data{isMailField} && !$self->get("mailData")));
|
||||
my $value = $data{value};
|
||||
$value = WebGUI::DateTime::epochToHuman($value,"%z") if ($data{type} eq "date");
|
||||
$value = WebGUI::DateTime::epochToHuman($value,"%z %Z") if ($data{type} eq "dateTime");
|
||||
|
|
@ -454,10 +454,10 @@ sub getRecordTemplateVars {
|
|||
}
|
||||
|
||||
my @fields;
|
||||
my $sth = WebGUI::SQL->read("$select from DataForm_field as a $join $where and a.DataForm_tabId = 0 order by a.sequenceNumber");
|
||||
my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId = 0 order by a.sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
my $formValue = $session{form}{$data{name}};
|
||||
if ((not exists $data{value}) && $session{form}{func} ne "editSave" && $session{form}{func} ne "editFieldSave" && defined $formValue) {
|
||||
if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) {
|
||||
$data{value} = $formValue;
|
||||
$data{value} = WebGUI::DateTime::setToEpoch($data{value}) if ($data{type} eq "date");
|
||||
}
|
||||
|
|
@ -466,7 +466,7 @@ sub getRecordTemplateVars {
|
|||
WebGUI::Macro::process(\$defaultValue);
|
||||
$data{value} = $defaultValue;
|
||||
}
|
||||
my $hidden = (($data{status} eq "hidden" && !$session{var}{adminOn}) || ($data{isMailField} && !$self->get("mailData")));
|
||||
my $hidden = (($data{status} eq "hidden" && !$self->session->var->get("adminOn")) || ($data{isMailField} && !$self->get("mailData")));
|
||||
my $value = $data{value};
|
||||
$value = WebGUI::DateTime::epochToHuman($value,"%z") if ($data{type} eq "date");
|
||||
$value = WebGUI::DateTime::epochToHuman($value) if ($data{type} eq "dateTime");
|
||||
|
|
@ -505,7 +505,7 @@ sub getRecordTemplateVars {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
if ($session{form}{assetId} eq "new") {
|
||||
if ($self->session->form->process("assetId") eq "new") {
|
||||
$self->setCollateral("DataForm_field","DataForm_fieldId",{
|
||||
DataForm_fieldId=>"new",
|
||||
name=>"from",
|
||||
|
|
@ -523,7 +523,7 @@ sub processPropertiesFromFormPost {
|
|||
isMailField=>1,
|
||||
width=>0,
|
||||
type=>"email",
|
||||
defaultValue=>$session{setting}{companyEmail}
|
||||
defaultValue=>$self->session->setting->get("companyEmail")
|
||||
});
|
||||
$self->setCollateral("DataForm_field","DataForm_fieldId",{
|
||||
DataForm_fieldId=>"new",
|
||||
|
|
@ -554,18 +554,18 @@ sub processPropertiesFromFormPost {
|
|||
defaultValue=>WebGUI::International::get(2,"Asset_DataForm")
|
||||
});
|
||||
}
|
||||
if ($session{form}{fid} eq "new") { # hack to get proceed to work.
|
||||
$session{whatNext} = $session{form}{proceed};
|
||||
if ($self->session->form->process("fid") eq "new") { # hack to get proceed to work.
|
||||
$session{whatNext} = $self->session->form->process("proceed");
|
||||
} else { $session{whatNext} = "nothing"; }
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
WebGUI::SQL->write("delete from DataForm_field where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from DataForm_entry where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from DataForm_entryData where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from DataForm_tab where assetId=".quote($self->getId));
|
||||
$self->session->db->write("delete from DataForm_field where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from DataForm_entry where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from DataForm_entryData where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from DataForm_tab where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->SUPER::purge();
|
||||
}
|
||||
|
||||
|
|
@ -592,14 +592,14 @@ sub sendEmail {
|
|||
if ($to =~ /\@/) {
|
||||
WebGUI::Mail::send($to, $subject, $message, $cc, $from, $bcc);
|
||||
} else {
|
||||
my ($userId) = WebGUI::SQL->quickArray("select userId from users where username=".quote($to));
|
||||
my ($userId) = $self->session->db->quickArray("select userId from users where username=".$self->session->db->quote($to));
|
||||
my $groupId;
|
||||
# if no user is found, try finding a matching group
|
||||
unless ($userId) {
|
||||
($groupId) = WebGUI::SQL->quickArray("select groupId from groups where groupName=".quote($to));
|
||||
($groupId) = $self->session->db->quickArray("select groupId from groups where groupName=".$self->session->db->quote($to));
|
||||
}
|
||||
unless ($userId || $groupId) {
|
||||
WebGUI::ErrorHandler::warn($self->getId.": Unable to send message, no user or group found.");
|
||||
$self->session->errorHandler->warn($self->getId.": Unable to send message, no user or group found.");
|
||||
} else {
|
||||
WebGUI::MessageLog::addEntry($userId, $groupId, $subject, $message, "", "", $from);
|
||||
if ($cc) {
|
||||
|
|
@ -618,10 +618,10 @@ sub view {
|
|||
my $passedVars = shift;
|
||||
my $var;
|
||||
##Priority encoding
|
||||
if ( $session{form}{mode} eq "form") {
|
||||
if ( $self->session->form->process("mode") eq "form") {
|
||||
$self->viewForm($passedVars);
|
||||
}
|
||||
elsif ( $session{form}{mode} eq "list") {
|
||||
elsif ( $self->session->form->process("mode") eq "list") {
|
||||
$self->viewList;
|
||||
}
|
||||
elsif( $self->defaultViewForm ) {
|
||||
|
|
@ -644,10 +644,10 @@ sub viewList {
|
|||
sub viewForm {
|
||||
my $self = shift;
|
||||
my $passedVars = shift;
|
||||
WebGUI::Style::setLink($session{config}{extrasURL}.'/tabs/tabs.css', {"type"=>"text/css"});
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/tabs/tabs.js', {"type"=>"text/javascript"});
|
||||
$self->session->style->setLink($self->session->config->get("extrasURL").'/tabs/tabs.css', {"type"=>"text/css"});
|
||||
$self->session->style->setScript($self->session->config->get("extrasURL").'/tabs/tabs.js', {"type"=>"text/javascript"});
|
||||
my $var;
|
||||
$var->{entryId} = $session{form}{entryId} if ($self->canEdit);
|
||||
$var->{entryId} = $self->session->form->process("entryId") if ($self->canEdit);
|
||||
$var = $passedVars || $self->getRecordTemplateVars($var);
|
||||
return $self->processTemplate($var,$self->get("templateId"));
|
||||
}
|
||||
|
|
@ -656,17 +656,17 @@ sub viewForm {
|
|||
sub www_deleteAllEntries {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my $assetId = $session{form}{entryId};
|
||||
my $assetId = $self->session->form->process("entryId");
|
||||
$self->deleteCollateral("DataForm_entry","assetId",$assetId);
|
||||
$session{form}{entryId} = 'list';
|
||||
$self->session->form->process("entryId") = 'list';
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteAllEntriesConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit && $session{form}{entryId}==$self->getId);
|
||||
WebGUI::SQL->write("delete from DataForm_entry where assetId=".quote($self->getId));
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit && $self->session->form->process("entryId")==$self->getId);
|
||||
$self->session->db->write("delete from DataForm_entry where assetId=".$self->session->db->quote($self->getId));
|
||||
return $self->www_view;
|
||||
}
|
||||
|
||||
|
|
@ -675,9 +675,9 @@ sub www_deleteAllEntriesConfirm {
|
|||
sub www_deleteEntry {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my $entryId = $session{form}{entryId};
|
||||
my $entryId = $self->session->form->process("entryId");
|
||||
$self->deleteCollateral("DataForm_entry","DataForm_entryId",$entryId);
|
||||
$session{form}{entryId} = 'list';
|
||||
$self->session->form->process("entryId") = 'list';
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -685,7 +685,7 @@ sub www_deleteEntry {
|
|||
sub www_deleteFieldConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->deleteCollateral("DataForm_field","DataForm_fieldId",$session{form}{fid});
|
||||
$self->deleteCollateral("DataForm_field","DataForm_fieldId",$self->session->form->process("fid"));
|
||||
$self->reorderCollateral("DataForm_field","DataForm_fieldId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -694,8 +694,8 @@ sub www_deleteFieldConfirm {
|
|||
sub www_deleteTabConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->deleteCollateral("DataForm_tab","DataForm_tabId",$session{form}{tid});
|
||||
$self->deleteCollateral("DataForm_field","DataForm_tabId",$session{form}{tid});
|
||||
$self->deleteCollateral("DataForm_tab","DataForm_tabId",$self->session->form->process("tid"));
|
||||
$self->deleteCollateral("DataForm_field","DataForm_tabId",$self->session->form->process("tid"));
|
||||
$self->reorderCollateral("DataForm_tab","DataForm_tabId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -721,16 +721,16 @@ sub www_editField {
|
|||
"editable" => WebGUI::International::get(6, "Asset_DataForm"),
|
||||
"required" => WebGUI::International::get(75, "Asset_DataForm")
|
||||
);
|
||||
$session{form}{fid} = "new" if ($session{form}{fid} eq "");
|
||||
unless ($session{form}{fid} eq "new") {
|
||||
%field = WebGUI::SQL->quickHash("select * from DataForm_field where DataForm_fieldId=".quote($session{form}{fid}));
|
||||
$self->session->form->process("fid") = "new" if ($self->session->form->process("fid") eq "");
|
||||
unless ($self->session->form->process("fid") eq "new") {
|
||||
%field = $self->session->db->quickHash("select * from DataForm_field where DataForm_fieldId=".$self->session->db->quote($self->session->form->process("fid")));
|
||||
}
|
||||
$tab = WebGUI::SQL->buildHashRef("select DataForm_tabId,label from DataForm_tab where assetId=".quote($self->getId));
|
||||
$tab = $self->session->db->buildHashRef("select DataForm_tabId,label from DataForm_tab where assetId=".$self->session->db->quote($self->getId));
|
||||
$tab->{0} = WebGUI::International::get("no tab","Asset_DataForm");
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "fid",
|
||||
-value => $session{form}{fid}
|
||||
-value => $self->session->form->process("fid")
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "func",
|
||||
|
|
@ -823,7 +823,7 @@ sub www_editField {
|
|||
-value=>$field{defaultValue},
|
||||
-subtext=>'<br />'.WebGUI::International::get(85,"Asset_DataForm")
|
||||
);
|
||||
if ($session{form}{fid} eq "new" && $session{form}{proceed} ne "manageAssets") {
|
||||
if ($self->session->form->process("fid") eq "new" && $self->session->form->process("proceed") ne "manageAssets") {
|
||||
$f->whatNext(
|
||||
-options=>{
|
||||
"editField"=>WebGUI::International::get(76,"Asset_DataForm"),
|
||||
|
|
@ -842,33 +842,33 @@ sub www_editField {
|
|||
sub www_editFieldSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$session{form}{name} = $session{form}{label} if ($session{form}{name} eq "");
|
||||
$session{form}{tid} = "0" if ($session{form}{tid} eq "");
|
||||
$session{form}{name} = WebGUI::URL::urlize($session{form}{name});
|
||||
$session{form}{name} =~ s/\-//g;
|
||||
$session{form}{name} =~ s/\///g;
|
||||
$self->session->form->process("name") = $self->session->form->process("label") if ($self->session->form->process("name") eq "");
|
||||
$self->session->form->process("tid") = "0" if ($self->session->form->process("tid") eq "");
|
||||
$self->session->form->process("name") = $self->session->url->urlize($self->session->form->process("name"));
|
||||
$self->session->form->process("name") =~ s/\-//g;
|
||||
$self->session->form->process("name") =~ s/\///g;
|
||||
$self->setCollateral("DataForm_field","DataForm_fieldId",{
|
||||
DataForm_fieldId=>$session{form}{fid},
|
||||
width=>$session{form}{width},
|
||||
name=>$session{form}{name},
|
||||
label=>$session{form}{label},
|
||||
DataForm_tabId=>$session{form}{tid},
|
||||
status=>$session{form}{status},
|
||||
type=>$session{form}{type},
|
||||
possibleValues=>$session{form}{possibleValues},
|
||||
defaultValue=>$session{form}{defaultValue},
|
||||
subtext=>$session{form}{subtext},
|
||||
rows=>$session{form}{rows},
|
||||
vertical=>$session{form}{vertical},
|
||||
extras=>$session{form}{extras},
|
||||
}, "1","1", _tonull("DataForm_tabId",$session{form}{tid}));
|
||||
if($session{form}{position}) {
|
||||
WebGUI::SQL->write("update DataForm_field set sequenceNumber=".quote($session{form}{position}).
|
||||
" where DataForm_fieldId=".quote($session{form}{fid}));
|
||||
DataForm_fieldId=>$self->session->form->process("fid"),
|
||||
width=>$self->session->form->process("width"),
|
||||
name=>$self->session->form->process("name"),
|
||||
label=>$self->session->form->process("label"),
|
||||
DataForm_tabId=>$self->session->form->process("tid"),
|
||||
status=>$self->session->form->process("status"),
|
||||
type=>$self->session->form->process("type"),
|
||||
possibleValues=>$self->session->form->process("possibleValues"),
|
||||
defaultValue=>$self->session->form->process("defaultValue"),
|
||||
subtext=>$self->session->form->process("subtext"),
|
||||
rows=>$self->session->form->process("rows"),
|
||||
vertical=>$self->session->form->process("vertical"),
|
||||
extras=>$self->session->form->process("extras"),
|
||||
}, "1","1", _tonull("DataForm_tabId",$self->session->form->process("tid")));
|
||||
if($self->session->form->process("position")) {
|
||||
$self->session->db->write("update DataForm_field set sequenceNumber=".$self->session->db->quote($self->session->form->process("position")).
|
||||
" where DataForm_fieldId=".$self->session->db->quote($self->session->form->process("fid")));
|
||||
}
|
||||
$self->reorderCollateral("DataForm_field","DataForm_fieldId", _tonull("DataForm_tabId",$session{form}{tid})) if ($session{form}{fid} ne "new");
|
||||
if ($session{whatNext} eq "editField" || $session{form}{proceed} eq "editField") {
|
||||
$session{form}{fid} = "new";
|
||||
$self->reorderCollateral("DataForm_field","DataForm_fieldId", _tonull("DataForm_tabId",$self->session->form->process("tid"))) if ($self->session->form->process("fid") ne "new");
|
||||
if ($session{whatNext} eq "editField" || $self->session->form->process("proceed") eq "editField") {
|
||||
$self->session->form->process("fid") = "new";
|
||||
return $self->www_editField;
|
||||
}
|
||||
return "";
|
||||
|
|
@ -880,14 +880,14 @@ sub www_editTab {
|
|||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
my (%tab, $f);
|
||||
tie %tab, 'Tie::CPHash';
|
||||
$session{form}{tid} = "new" if ($session{form}{tid} eq "");
|
||||
unless ($session{form}{tid} eq "new") {
|
||||
%tab = WebGUI::SQL->quickHash("select * from DataForm_tab where DataForm_tabId=".quote($session{form}{tid}));
|
||||
$self->session->form->process("tid") = "new" if ($self->session->form->process("tid") eq "");
|
||||
unless ($self->session->form->process("tid") eq "new") {
|
||||
%tab = $self->session->db->quickHash("select * from DataForm_tab where DataForm_tabId=".$self->session->db->quote($self->session->form->process("tid")));
|
||||
}
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "tid",
|
||||
-value => $session{form}{tid}
|
||||
-value => $self->session->form->process("tid")
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "func",
|
||||
|
|
@ -904,7 +904,7 @@ sub www_editTab {
|
|||
-value=>$tab{subtext},
|
||||
-subtext=>""
|
||||
);
|
||||
if ($session{form}{tid} eq "new") {
|
||||
if ($self->session->form->process("tid") eq "new") {
|
||||
$f->whatNext(
|
||||
-options=>{
|
||||
editTab=>WebGUI::International::get(103,"Asset_DataForm"),
|
||||
|
|
@ -923,17 +923,17 @@ sub www_editTab {
|
|||
sub www_editTabSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$session{form}{name} = $session{form}{label} if ($session{form}{name} eq "");
|
||||
$session{form}{name} = WebGUI::URL::urlize($session{form}{name});
|
||||
$session{form}{name} =~ s/\-//g;
|
||||
$session{form}{name} =~ s/\///g;
|
||||
$self->session->form->process("name") = $self->session->form->process("label") if ($self->session->form->process("name") eq "");
|
||||
$self->session->form->process("name") = $self->session->url->urlize($self->session->form->process("name"));
|
||||
$self->session->form->process("name") =~ s/\-//g;
|
||||
$self->session->form->process("name") =~ s/\///g;
|
||||
$self->setCollateral("DataForm_tab","DataForm_tabId",{
|
||||
DataForm_tabId=>$session{form}{tid},
|
||||
label=>$session{form}{label},
|
||||
subtext=>$session{form}{subtext}
|
||||
DataForm_tabId=>$self->session->form->process("tid"),
|
||||
label=>$self->session->form->process("label"),
|
||||
subtext=>$self->session->form->process("subtext")
|
||||
});
|
||||
if ($session{form}{proceed} eq "editTab") {
|
||||
$session{form}{tid} = "new";
|
||||
if ($self->session->form->process("proceed") eq "editTab") {
|
||||
$self->session->form->process("tid") = "new";
|
||||
return $self->www_editTab;
|
||||
}
|
||||
return "";
|
||||
|
|
@ -944,10 +944,10 @@ sub www_exportTab {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
WebGUI::HTTP::setFilename($self->get("url").".tab","text/plain");
|
||||
my %fields = WebGUI::SQL->buildHash("select DataForm_fieldId,name from DataForm_field where
|
||||
assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
my %fields = $self->session->db->buildHash("select DataForm_fieldId,name from DataForm_field where
|
||||
assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
my @data;
|
||||
my $entries = WebGUI::SQL->read("select * from DataForm_entry where assetId=".quote($self->getId));
|
||||
my $entries = $self->session->db->read("select * from DataForm_entry where assetId=".$self->session->db->quote($self->getId));
|
||||
my $i;
|
||||
my $noMailData = ($self->get("mailData") == 0);
|
||||
while (my $entryData = $entries->hashRef) {
|
||||
|
|
@ -958,8 +958,8 @@ sub www_exportTab {
|
|||
userId => $entryData->{userId},
|
||||
submissionDate => WebGUI::DateTime::epochToHuman($entryData->{submissionDate}),
|
||||
};
|
||||
my $values = WebGUI::SQL->read("select value,DataForm_fieldId from DataForm_entryData where
|
||||
DataForm_entryId=".quote($entryData->{DataForm_entryId}));
|
||||
my $values = $self->session->db->read("select value,DataForm_fieldId from DataForm_entryData where
|
||||
DataForm_entryId=".$self->session->db->quote($entryData->{DataForm_entryId}));
|
||||
while (my ($value, $fieldId) = $values->array) {
|
||||
next if (isIn($fields{$fieldId}, qw(to from cc bcc subject)) && $noMailData);
|
||||
$data[$i]{$fields{$fieldId}} = $value;
|
||||
|
|
@ -993,7 +993,7 @@ sub www_exportTab {
|
|||
sub www_moveFieldDown {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->moveCollateralDown("DataForm_field","DataForm_fieldId",$session{form}{fid},_tonull("DataForm_tabId",$session{form}{tid}));
|
||||
$self->moveCollateralDown("DataForm_field","DataForm_fieldId",$self->session->form->process("fid"),_tonull("DataForm_tabId",$self->session->form->process("tid")));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -1001,7 +1001,7 @@ sub www_moveFieldDown {
|
|||
sub www_moveFieldUp {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->moveCollateralUp("DataForm_field","DataForm_fieldId",$session{form}{fid},_tonull("DataForm_tabId",$session{form}{tid}));
|
||||
$self->moveCollateralUp("DataForm_field","DataForm_fieldId",$self->session->form->process("fid"),_tonull("DataForm_tabId",$self->session->form->process("tid")));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -1009,7 +1009,7 @@ sub www_moveFieldUp {
|
|||
sub www_moveTabRight {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->moveCollateralDown("DataForm_tab","DataForm_tabId",$session{form}{tid});
|
||||
$self->moveCollateralDown("DataForm_tab","DataForm_tabId",$self->session->form->process("tid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -1017,7 +1017,7 @@ sub www_moveTabRight {
|
|||
sub www_moveTabLeft {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||
$self->moveCollateralUp("DataForm_tab","DataForm_tabId",$session{form}{tid});
|
||||
$self->moveCollateralUp("DataForm_tab","DataForm_tabId",$self->session->form->process("tid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -1025,22 +1025,22 @@ sub www_moveTabLeft {
|
|||
sub www_process {
|
||||
my $self = shift;
|
||||
my $entryId = $self->setCollateral("DataForm_entry","DataForm_entryId",{
|
||||
DataForm_entryId=>$session{form}{entryId},
|
||||
DataForm_entryId=>$self->session->form->process("entryId"),
|
||||
assetId=>$self->getId,
|
||||
userId=>$session{user}{userId},
|
||||
username=>$session{user}{username},
|
||||
ipAddress=>$session{env}{REMOTE_ADDR},
|
||||
userId=>$self->session->user->profileField("userId"),
|
||||
username=>$self->session->user->profileField("username"),
|
||||
ipAddress=>$self->session->env->get("REMOTE_ADDR"),
|
||||
submissionDate=>time()
|
||||
},0);
|
||||
my ($var, %row, @errors, $updating, $hadErrors);
|
||||
$var->{entryId} = $entryId;
|
||||
tie %row, "Tie::CPHash";
|
||||
my $sth = WebGUI::SQL->read("select DataForm_fieldId,label,name,status,type,defaultValue,isMailField from DataForm_field
|
||||
where assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
my $sth = $self->session->db->read("select DataForm_fieldId,label,name,status,type,defaultValue,isMailField from DataForm_field
|
||||
where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
while (%row = $sth->hash) {
|
||||
my $value = $row{defaultValue};
|
||||
if ($row{status} eq "required" || $row{status} eq "editable") {
|
||||
$value = WebGUI::FormProcessor::process($row{name},$row{type},$row{defaultValue});
|
||||
$value = $self->session->form->process($row{name},$row{type},$row{defaultValue});
|
||||
WebGUI::Macro::filter(\$value);
|
||||
}
|
||||
if ($row{status} eq "required" && ($value =~ /^\s$/ || $value eq "" || not defined $value)) {
|
||||
|
|
@ -1055,15 +1055,15 @@ sub www_process {
|
|||
WebGUI::Macro::process(\$value);
|
||||
}
|
||||
unless ($hadErrors) {
|
||||
my ($exists) = WebGUI::SQL->quickArray("select count(*) from DataForm_entryData where DataForm_entryId=".quote($entryId)."
|
||||
and DataForm_fieldId=".quote($row{DataForm_fieldId}));
|
||||
my ($exists) = $self->session->db->quickArray("select count(*) from DataForm_entryData where DataForm_entryId=".$self->session->db->quote($entryId)."
|
||||
and DataForm_fieldId=".$self->session->db->quote($row{DataForm_fieldId}));
|
||||
if ($exists) {
|
||||
WebGUI::SQL->write("update DataForm_entryData set value=".quote($value)."
|
||||
where DataForm_entryId=".quote($entryId)." and DataForm_fieldId=".quote($row{DataForm_fieldId}));
|
||||
$self->session->db->write("update DataForm_entryData set value=".$self->session->db->quote($value)."
|
||||
where DataForm_entryId=".$self->session->db->quote($entryId)." and DataForm_fieldId=".$self->session->db->quote($row{DataForm_fieldId}));
|
||||
$updating = 1;
|
||||
} else {
|
||||
WebGUI::SQL->write("insert into DataForm_entryData (DataForm_entryId,DataForm_fieldId,assetId,value) values
|
||||
(".quote($entryId).", ".quote($row{DataForm_fieldId}).", ".quote($self->getId).", ".quote($value).")");
|
||||
$self->session->db->write("insert into DataForm_entryData (DataForm_entryId,DataForm_fieldId,assetId,value) values
|
||||
(".$self->session->db->quote($entryId).", ".$self->session->db->quote($row{DataForm_fieldId}).", ".$self->session->db->quote($self->getId).", ".$self->session->db->quote($value).")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1071,12 +1071,12 @@ sub www_process {
|
|||
$var->{error_loop} = \@errors;
|
||||
$var = $self->getRecordTemplateVars($var);
|
||||
if ($hadErrors && !$updating) {
|
||||
WebGUI::SQL->write("delete from DataForm_entryData where DataForm_entryId=".quote($entryId));
|
||||
$self->session->db->write("delete from DataForm_entryData where DataForm_entryId=".$self->session->db->quote($entryId));
|
||||
$self->deleteCollateral("DataForm_entry","DataForm_entryId",$entryId);
|
||||
$self->processStyle($self->view($var));
|
||||
} else {
|
||||
$self->sendEmail($var) if ($self->get("mailData") && !$updating);
|
||||
return WebGUI::Style::process($self->processTemplate($var,$self->get("acknowlegementTemplateId")),$self->get("styleTemplateId")) if $self->defaultViewForm;
|
||||
return $self->session->style->process($self->processTemplate($var,$self->get("acknowlegementTemplateId")),$self->get("styleTemplateId")) if $self->defaultViewForm;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ our @ISA = qw(WebGUI::Asset::Wobject);
|
|||
#-------------------------------------------------------------------
|
||||
#sub canManage {
|
||||
# my $self = shift;
|
||||
# my $userId = shift || $session{user}{userId};
|
||||
# my $userId = shift || $self->session->user->profileField("userId");
|
||||
# if ($userId eq $self->getValue("ownerUserId")) {
|
||||
# return 1;
|
||||
# }
|
||||
|
|
@ -96,7 +96,7 @@ The number of seconds since January 1, 1970.
|
|||
=cut
|
||||
|
||||
sub epochToArray {
|
||||
my $timeZone = $session{user}{timeZone} || "America/Chicago";
|
||||
my $timeZone = $self->session->user->profileField("timeZone") || "America/Chicago";
|
||||
use DateTime;
|
||||
return map {$_ += 0} split / /, DateTime->from_epoch( epoch =>shift, time_zone=>$timeZone)->strftime("%Y %m %d %H %M %S");
|
||||
}
|
||||
|
|
@ -194,9 +194,9 @@ sub view {
|
|||
$monthRangeLength = 72 if ($monthRangeLength > 72);
|
||||
#monthRangeLength is the number of months the user wishes to view
|
||||
# or the default number of the months per page the wobject is set to display.
|
||||
my $calMonthStart = $session{form}{calMonthStart} || 1;
|
||||
my $calMonthStart = $self->session->form->process("calMonthStart") || 1;
|
||||
$calMonthStart = int($calMonthStart);
|
||||
my $calMonthEnd = $session{form}{calMonthEnd} || ($calMonthStart + $monthRangeLength - 1);
|
||||
my $calMonthEnd = $self->session->form->process("calMonthEnd") || ($calMonthStart + $monthRangeLength - 1);
|
||||
$calMonthEnd = int($calMonthEnd);
|
||||
$calMonthEnd = ($calMonthStart + 72) if ($calMonthStart < $calMonthEnd - 72);
|
||||
$calMonthEnd = $calMonthStart if ($calMonthEnd < $calMonthStart);
|
||||
|
|
@ -249,7 +249,7 @@ sub view {
|
|||
} elsif ($endMonth eq "current") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,1,0);
|
||||
}
|
||||
#WebGUI::ErrorHandler::warn("calMonthStart:".$calMonthStart." calMonthEnd:".$calMonthEnd);
|
||||
#$self->session->errorHandler->warn("calMonthStart:".$calMonthStart." calMonthEnd:".$calMonthEnd);
|
||||
my @now = epochToArray(WebGUI::DateTime::time());
|
||||
my $calHasEvent = 0;
|
||||
#monthcount minus i is the number of months remaining to be processed.
|
||||
|
|
|
|||
|
|
@ -183,17 +183,17 @@ sub purge {
|
|||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $cookiebox = WebGUI::URL::escape($session{var}{sessionId});
|
||||
my $cookiebox = $self->session->url->escape($self->session->var->get("sessionId"));
|
||||
$cookiebox =~ s/[^A-Za-z0-9\-\.\_]//g; #removes all funky characters
|
||||
$cookiebox .= '.cookie';
|
||||
my $jar = HTTP::Cookies->new(File => $self->getCookieJar->getPath($cookiebox), AutoSave => 1, Ignore_Discard => 1);
|
||||
my (%var, %formdata, @formUpload, $redirect, $response, $header, $userAgent, $proxiedUrl, $request, $ttl);
|
||||
|
||||
if($session{form}{func}!~/editSave/i) {
|
||||
$proxiedUrl = $session{form}{FormAction} || $session{form}{proxiedUrl} || $self->get("proxiedUrl") ;
|
||||
if($self->session->form->process("func")!~/editSave/i) {
|
||||
$proxiedUrl = $self->session->form->process("FormAction") || $self->session->form->process("proxiedUrl") || $self->get("proxiedUrl") ;
|
||||
} else {
|
||||
$proxiedUrl = $self->get("proxiedUrl");
|
||||
$session{env}{REQUEST_METHOD}='GET';
|
||||
$self->session->env->get("REQUEST_METHOD")='GET';
|
||||
}
|
||||
|
||||
$redirect=0;
|
||||
|
|
@ -204,11 +204,11 @@ sub view {
|
|||
my $cachedHeader = WebGUI::Cache->new($proxiedUrl,"HEADER");
|
||||
$var{header} = $cachedHeader->get;
|
||||
$var{content} = $cachedContent->get;
|
||||
unless ($var{content} && $session{env}{REQUEST_METHOD}=~/GET/i) {
|
||||
unless ($var{content} && $self->session->env->get("REQUEST_METHOD")=~/GET/i) {
|
||||
$redirect=0;
|
||||
until($redirect == 5) { # We follow max 5 redirects to prevent bouncing/flapping
|
||||
$userAgent = new LWP::UserAgent;
|
||||
$userAgent->agent($session{env}{HTTP_USER_AGENT});
|
||||
$userAgent->agent($self->session->env->get("HTTP_USER_AGENT"));
|
||||
$userAgent->timeout($self->get("timeout"));
|
||||
$userAgent->env_proxy;
|
||||
|
||||
|
|
@ -226,13 +226,13 @@ sub view {
|
|||
$header = new HTTP::Headers;
|
||||
$header->referer($self->get("proxiedUrl")); # To get around referrer blocking
|
||||
|
||||
if($session{env}{REQUEST_METHOD}=~/GET/i || $redirect != 0) { # request_method is also GET after a redirection. Just to make sure we're
|
||||
if($self->session->env->get("REQUEST_METHOD")=~/GET/i || $redirect != 0) { # request_method is also GET after a redirection. Just to make sure we're
|
||||
# not posting the same data over and over again.
|
||||
if($redirect == 0) {
|
||||
foreach my $input_name (keys %{$session{form}}) {
|
||||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||
$input_name =~ s/^HttpProxy_//;
|
||||
$proxiedUrl=WebGUI::URL::append($proxiedUrl,"$input_name=$session{form}{'HttpProxy_'.$input_name}");
|
||||
$proxiedUrl=$self->session->url->append($proxiedUrl,"$input_name=$session{form}{'HttpProxy_'.$input_name}");
|
||||
}
|
||||
}
|
||||
$request = HTTP::Request->new(GET => $proxiedUrl, $header) || return "wrong url"; # Create GET request
|
||||
|
|
@ -245,7 +245,7 @@ sub view {
|
|||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||
$input_name =~ s/^HttpProxy_//;
|
||||
|
||||
my $uploadFile = $session{req}->tmpFileName($session{form}{'HttpProxy_'.$input_name});
|
||||
my $uploadFile = $self->session->request->tmpFileName($session{form}{'HttpProxy_'.$input_name});
|
||||
if(-r $uploadFile) { # Found uploaded file
|
||||
@formUpload=($uploadFile, qq/$session{form}{'HttpProxy_'.$input_name}/);
|
||||
$formdata{$input_name}=\@formUpload;
|
||||
|
|
@ -321,7 +321,7 @@ sub view {
|
|||
$var{content} = "<b>Getting <a href='$proxiedUrl'>$proxiedUrl</a> failed</b>".
|
||||
"<p><i>GET status line: ".$response->status_line."</i>";
|
||||
}
|
||||
if ($session{user}{userId} eq '1') {
|
||||
if ($self->session->user->profileField("userId") eq '1') {
|
||||
$ttl = $session{page}{cacheTimeoutVisitor};
|
||||
} else {
|
||||
$ttl = $session{page}{cacheTimeout};
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ sub start {
|
|||
$val = $self->{assetUrl}; # Form Action returns to us
|
||||
} else {
|
||||
$val =~ s/\n//g; # Bugfix 757068
|
||||
$val = WebGUI::URL::append($self->{assetUrl},'proxiedUrl='.WebGUI::URL::escape($val).';func=view'); # return to us
|
||||
$val = $self->session->url->append($self->{assetUrl},'proxiedUrl='.$self->session->url->escape($val).';func=view'); # return to us
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ from users
|
|||
left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
|
||||
left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
|
||||
where users.userId=?";
|
||||
my $sth = WebGUI::SQL->prepare($sql);
|
||||
my $sth = $self->session->db->prepare($sql);
|
||||
foreach my $userId (@userIds) {
|
||||
$sth->execute([ $userId ]);
|
||||
$nameHash{ $userId } = _defineUsername($sth->hashRef);
|
||||
|
|
@ -57,7 +57,7 @@ where users.userId=?";
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _fetchDepartments {
|
||||
return WebGUI::SQL->buildArray("select fieldData from userProfileData where fieldName='department' GROUP by fieldData");
|
||||
return $self->session->db->buildArray("select fieldData from userProfileData where fieldName='department' GROUP by fieldData");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ sub view {
|
|||
}
|
||||
else { $var{canViewReport} = 0; }
|
||||
|
||||
my $statusUserId = $session{scratch}{userId} || $session{user}{userId};
|
||||
my $statusUserId = $self->session->scratch->get("userId") || $self->session->user->profileField("userId");
|
||||
my $statusListString = $self->getValue("statusList");
|
||||
chop($statusListString);
|
||||
my @statusListArray = split("\n",$statusListString);
|
||||
|
|
@ -166,11 +166,11 @@ sub view {
|
|||
$statusListHashRef->{$status} = $status;
|
||||
}
|
||||
|
||||
#WebGUI::ErrorHandler::warn("VIEW: userId: ".$statusUserId."\n" );
|
||||
my ($status) = WebGUI::SQL->quickArray("select status from InOutBoard_status where userId=".quote($statusUserId)." and assetId=".quote($self->getId));
|
||||
#$self->session->errorHandler->warn("VIEW: userId: ".$statusUserId."\n" );
|
||||
my ($status) = $self->session->db->quickArray("select status from InOutBoard_status where userId=".$self->session->db->quote($statusUserId)." and assetId=".$self->session->db->quote($self->getId));
|
||||
|
||||
##Find all the users for which I am a delegate
|
||||
my @users = WebGUI::SQL->buildArray("select userId from InOutBoard_delegates where assetId=".quote($self->getId)." and delegateUserId=".quote($session{user}{userId}));
|
||||
my @users = $self->session->db->buildArray("select userId from InOutBoard_delegates where assetId=".$self->session->db->quote($self->getId)." and delegateUserId=".$self->session->db->quote($self->session->user->profileField("userId")));
|
||||
|
||||
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
if (@users) {
|
||||
|
|
@ -183,7 +183,7 @@ sub view {
|
|||
$f->selectBox(
|
||||
-name=>"delegate",
|
||||
-options=>\%nameHash,
|
||||
-value=>[ $session{scratch}{userId} ],
|
||||
-value=>[ $self->session->scratch->get("userId") ],
|
||||
-label=>WebGUI::International::get('delegate', "Asset_InOutBoard"),
|
||||
-extras=>q|onchange="this.form.submit();"|,
|
||||
);
|
||||
|
|
@ -204,7 +204,7 @@ sub view {
|
|||
);
|
||||
$f->submit;
|
||||
|
||||
my ($isInGroup) = WebGUI::SQL->quickArray("select count(*) from groupings where userId=".quote($session{user}{userId})." and groupId=".quote($self->get("inOutGroup")));
|
||||
my ($isInGroup) = $self->session->db->quickArray("select count(*) from groupings where userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and groupId=".$self->session->db->quote($self->get("inOutGroup")));
|
||||
if ($isInGroup) {
|
||||
$var{displayForm} = 1;
|
||||
$var{'form'} = $f->print;
|
||||
|
|
@ -231,8 +231,8 @@ left join InOutBoard on groupings.groupId=InOutBoard.inOutGroup
|
|||
left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
|
||||
left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
|
||||
left join userProfileData c on users.userId=c.userId and c.fieldName='department'
|
||||
left join InOutBoard_status on users.userId=InOutBoard_status.userId and InOutBoard_status.assetId=".quote($self->getId())."
|
||||
where users.userId<>'1' and InOutBoard.inOutGroup=".quote($self->get("inOutGroup"))."
|
||||
left join InOutBoard_status on users.userId=InOutBoard_status.userId and InOutBoard_status.assetId=".$self->session->db->quote($self->getId())."
|
||||
where users.userId<>'1' and InOutBoard.inOutGroup=".$self->session->db->quote($self->get("inOutGroup"))."
|
||||
group by userId
|
||||
order by department, lastName, firstName";
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ sub www_selectDelegates {
|
|||
#left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
|
||||
#left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
|
||||
#where users.userId<>'1' and users.status='Active' and users.userId<>%s
|
||||
#group by userId", quote($session{user}{userId});
|
||||
#group by userId", $self->session->db->quote($self->session->user->profileField("userId"));
|
||||
|
||||
#Comment the sql query below (lines 297 - 307) to show all users of the system in the delegate select list
|
||||
my $sql = sprintf "select users.username,
|
||||
|
|
@ -301,16 +301,16 @@ left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
|
|||
left join userProfileData c on users.userId=c.userId and c.fieldName='department'
|
||||
left join InOutBoard_status on users.userId=InOutBoard_status.userId and InOutBoard_status.assetId=%s
|
||||
where users.userId<>'1' and groupings.groupId=InOutBoard.inOutGroup and users.status='Active' and users.userId <> %s and groupings.userId=users.userId and InOutBoard.inOutGroup=%s
|
||||
group by userId", quote($self->getId), quote($session{user}{userId}), quote($self->getValue("inOutGroup")) ;
|
||||
group by userId", $self->session->db->quote($self->getId), $self->session->db->quote($self->session->user->profileField("userId")), $self->session->db->quote($self->getValue("inOutGroup")) ;
|
||||
my %userNames = ();
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
my $sth = $self->session->db->read($sql);
|
||||
while (my $data = $sth->hashRef) {
|
||||
$userNames{ $data->{userId} } = _defineUsername($data);
|
||||
}
|
||||
$sth->finish;
|
||||
$sql = sprintf "select delegateUserId from InOutBoard_delegates where userId=%s and assetId=%s",
|
||||
quote($session{user}{userId}), quote($self->getId);
|
||||
my $delegates = WebGUI::SQL->buildArrayRef($sql);
|
||||
$self->session->db->quote($self->session->user->profileField("userId")), $self->session->db->quote($self->getId);
|
||||
my $delegates = $self->session->db->buildArrayRef($sql);
|
||||
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "func",
|
||||
|
|
@ -335,36 +335,36 @@ group by userId", quote($self->getId), quote($session{user}{userId}), quote($sel
|
|||
#-------------------------------------------------------------------
|
||||
sub www_selectDelegatesEditSave {
|
||||
my $self = shift;
|
||||
my @delegates = WebGUI::FormProcessor::selectList("delegates");
|
||||
WebGUI::SQL->write("delete from InOutBoard_delegates where assetId=".quote($self->getId)." and userId=".quote($session{user}{userId}));
|
||||
my @delegates = $self->session->form->selectList("delegates");
|
||||
$self->session->db->write("delete from InOutBoard_delegates where assetId=".$self->session->db->quote($self->getId)." and userId=".$self->session->db->quote($self->session->user->profileField("userId")));
|
||||
|
||||
foreach my $delegate (@delegates) {
|
||||
WebGUI::SQL->write("insert into InOutBoard_delegates
|
||||
$self->session->db->write("insert into InOutBoard_delegates
|
||||
(userId,delegateUserId,assetId) values
|
||||
(".quote($session{user}{userId}).",".quote($delegate).",".quote($self->getId).")");
|
||||
(".$self->session->db->quote($self->session->user->profileField("userId")).",".$self->session->db->quote($delegate).",".$self->session->db->quote($self->getId).")");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#-------------------------------------------------------------------
|
||||
sub www_setStatus {
|
||||
my $self = shift;
|
||||
#WebGUI::ErrorHandler::warn("delegateId: ". $session{form}{delegate}."\n" );
|
||||
#WebGUI::ErrorHandler::warn("userId: ".$session{scratch}{userId} ."\n" );
|
||||
if ($session{form}{delegate} eq $session{scratch}{userId}) {
|
||||
#WebGUI::ErrorHandler::warn("Wrote data and removed scratch\n");
|
||||
my $sessionUserId = $session{scratch}{userId} || $session{user}{userId};
|
||||
#WebGUI::ErrorHandler::warn("user Id: ".$sessionUserId."\n");
|
||||
WebGUI::Session::deleteScratch("userId");
|
||||
WebGUI::SQL->write("delete from InOutBoard_status where userId=".quote($sessionUserId)." and assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("insert into InOutBoard_status (assetId,userId,status,dateStamp,message) values (".quote($self->getId).",".quote($sessionUserId).","
|
||||
.quote($session{form}{status}).",".WebGUI::DateTime::time().",".quote($session{form}{message}).")");
|
||||
WebGUI::SQL->write("insert into InOutBoard_statusLog (assetId,userId,createdBy,status,dateStamp,message) values (".quote($self->getId).",".quote($sessionUserId).",".quote($session{user}{userId}).","
|
||||
.quote($session{form}{status}).",".WebGUI::DateTime::time().",".quote($session{form}{message}).")");
|
||||
#$self->session->errorHandler->warn("delegateId: ". $self->session->form->process("delegate")."\n" );
|
||||
#$self->session->errorHandler->warn("userId: ".$self->session->scratch->get("userId") ."\n" );
|
||||
if ($self->session->form->process("delegate") eq $self->session->scratch->get("userId")) {
|
||||
#$self->session->errorHandler->warn("Wrote data and removed scratch\n");
|
||||
my $sessionUserId = $self->session->scratch->get("userId") || $self->session->user->profileField("userId");
|
||||
#$self->session->errorHandler->warn("user Id: ".$sessionUserId."\n");
|
||||
$self->session->scratch->delete("userId");
|
||||
$self->session->db->write("delete from InOutBoard_status where userId=".$self->session->db->quote($sessionUserId)." and assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("insert into InOutBoard_status (assetId,userId,status,dateStamp,message) values (".$self->session->db->quote($self->getId).",".$self->session->db->quote($sessionUserId).","
|
||||
.$self->session->db->quote($self->session->form->process("status")).",".WebGUI::DateTime::time().",".$self->session->db->quote($self->session->form->process("message")).")");
|
||||
$self->session->db->write("insert into InOutBoard_statusLog (assetId,userId,createdBy,status,dateStamp,message) values (".$self->session->db->quote($self->getId).",".$self->session->db->quote($sessionUserId).",".$self->session->db->quote($self->session->user->profileField("userId")).","
|
||||
.$self->session->db->quote($self->session->form->process("status")).",".WebGUI::DateTime::time().",".$self->session->db->quote($self->session->form->process("message")).")");
|
||||
}
|
||||
else {
|
||||
#WebGUI::ErrorHandler::warn("Set scratch, redisplay\n");
|
||||
#WebGUI::ErrorHandler::warn(sprintf "Delegate is %s\n", $session{form}{delegate});
|
||||
WebGUI::Session::setScratch("userId",$session{form}{delegate});
|
||||
#$self->session->errorHandler->warn("Set scratch, redisplay\n");
|
||||
#$self->session->errorHandler->warn(sprintf "Delegate is %s\n", $self->session->form->process("delegate"));
|
||||
$self->session->scratch->set("userId",$self->session->form->process("delegate"));
|
||||
}
|
||||
return $self->www_view;
|
||||
}
|
||||
|
|
@ -390,13 +390,13 @@ sub www_viewReport {
|
|||
-value=>"1"
|
||||
);
|
||||
my $startDate = WebGUI::DateTime::addToDate(WebGUI::DateTime::time(),0,0,-15);
|
||||
$startDate = WebGUI::FormProcessor::date("startDate") if ($session{form}{doit});
|
||||
$startDate = $self->session->form->date("startDate") if ($self->session->form->process("doit"));
|
||||
$f->date(
|
||||
-name=>"startDate",
|
||||
-label=>WebGUI::International::get(16, "Asset_InOutBoard"),
|
||||
-value=>$startDate
|
||||
);
|
||||
my $endDate = WebGUI::FormProcessor::date("endDate");
|
||||
my $endDate = $self->session->form->date("endDate");
|
||||
$f->date(
|
||||
-name=>"endDate",
|
||||
-label=>WebGUI::International::get(17, "Asset_InOutBoard"),
|
||||
|
|
@ -405,11 +405,11 @@ sub www_viewReport {
|
|||
my %depHash;
|
||||
%depHash = map { $_ => $_ } (_fetchDepartments(),
|
||||
WebGUI::International::get('all departments', 'Asset_InOutBoard'));
|
||||
my $defaultDepartment = $session{form}{selectDepartment}
|
||||
my $defaultDepartment = $self->session->form->process("selectDepartment")
|
||||
|| WebGUI::International::get('all departments', 'Asset_InOutBoard');
|
||||
my $departmentSQLclause = ($defaultDepartment eq WebGUI::International::get('all departments', 'Asset_InOutBoard'))
|
||||
? ''
|
||||
: 'and c.fieldData='.quote($defaultDepartment);
|
||||
: 'and c.fieldData='.$self->session->db->quote($defaultDepartment);
|
||||
$f->selectBox(
|
||||
-name=>"selectDepartment",
|
||||
-options=>\%depHash,
|
||||
|
|
@ -419,7 +419,7 @@ sub www_viewReport {
|
|||
my %paginHash;
|
||||
tie %paginHash, "Tie::IxHash"; ##Because default sort order is alpha
|
||||
%paginHash = (50 => 50, 100 => 100, 300 => 300, 500 => 500, 1000 => 1000, 10_000 => 10_000,);
|
||||
my $pageReportAfter = $session{form}{reportPagination} || 50;
|
||||
my $pageReportAfter = $self->session->form->process("reportPagination") || 50;
|
||||
$f->selectBox(
|
||||
-name=>"reportPagination",
|
||||
-options=>\%paginHash,
|
||||
|
|
@ -428,8 +428,8 @@ sub www_viewReport {
|
|||
);
|
||||
$f->submit(-value=>"Search");
|
||||
$var{'form'} = $f->print;
|
||||
my $url = $self->getUrl("func=viewReport&selectDepartment=$session{form}{selectDepartment}&reportPagination=$session{form}{reportPagination}&startDate=$session{form}{startDate}&endDate=$session{form}{endDate}&doit=1");
|
||||
if ($session{form}{doit}) {
|
||||
my $url = $self->getUrl("func=viewReport&selectDepartment=$self->session->form->process("selectDepartment")&reportPagination=$self->session->form->process("reportPagination")&startDate=$self->session->form->process("startDate")&endDate=$self->session->form->process("endDate")&doit=1");
|
||||
if ($self->session->form->process("doit")) {
|
||||
$var{showReport} = 1;
|
||||
$endDate = WebGUI::DateTime::addToTime($endDate,24,0,0);
|
||||
my $lastDepartment = "_none_";
|
||||
|
|
@ -450,16 +450,16 @@ left join groupings on groupings.userId=users.userId
|
|||
left join userProfileData a on users.userId=a.userId and a.fieldName='firstName'
|
||||
left join userProfileData b on users.userId=b.userId and b.fieldName='lastName'
|
||||
left join userProfileData c on users.userId=c.userId and c.fieldName='department'
|
||||
left join InOutBoard_statusLog on users.userId=InOutBoard_statusLog.userId and InOutBoard_statusLog.assetId=".quote($self->getId())."
|
||||
left join InOutBoard_statusLog on users.userId=InOutBoard_statusLog.userId and InOutBoard_statusLog.assetId=".$self->session->db->quote($self->getId())."
|
||||
where users.userId<>'1' and
|
||||
groupings.groupId=".quote($self->getValue("inOutGroup"))." and
|
||||
groupings.groupId=".$self->session->db->quote($self->getValue("inOutGroup"))." and
|
||||
groupings.userId=users.userId and
|
||||
InOutBoard_statusLog.dateStamp>=$startDate and
|
||||
InOutBoard_statusLog.dateStamp<=$endDate
|
||||
$departmentSQLclause
|
||||
group by InOutBoard_statusLog.dateStamp
|
||||
order by department, lastName, firstName, InOutBoard_statusLog.dateStamp";
|
||||
#WebGUI::ErrorHandler::warn("QUERY: $sql\n");
|
||||
#$self->session->errorHandler->warn("QUERY: $sql\n");
|
||||
$p->setDataByQuery($sql);
|
||||
my $rowdata = $p->getPageData();
|
||||
my @rows;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ sub getEditForm {
|
|||
tie my %searchRoot, 'Tie::IxHash';
|
||||
|
||||
# Unconditional read to catch intallation errors.
|
||||
my $sth = WebGUI::SQL->unconditionalRead("select distinct(indexName), indexName from IndexedSearch_docInfo");
|
||||
my $sth = $self->session->db->unconditionalRead("select distinct(indexName), indexName from IndexedSearch_docInfo");
|
||||
unless ($sth->errorCode < 1) {
|
||||
return "<p><b>" . WebGUI::International::get(1,"Asset_IndexedSearch") . $sth->errorMessage."</b></p>";
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ sub getEditForm {
|
|||
# Page roots
|
||||
#%searchRoot = ( 'any'=>WebGUI::International::get(15,"Asset_IndexedSearch"),
|
||||
# $session{page}{pageId}=>WebGUI::International::get(4,"Asset_IndexedSearch"),
|
||||
# WebGUI::SQL->buildHash("select pageId,title from page where parentId='0' and isSystem<>1 order by title")
|
||||
# $self->session->db->buildHash("select pageId,title from page where parentId='0' and isSystem<>1 order by title")
|
||||
# );
|
||||
#$tabform->getTab("properties")->checkList ( -name=>'searchRoot',
|
||||
# -options=>\%searchRoot,
|
||||
|
|
@ -187,7 +187,7 @@ sub getEditForm {
|
|||
|
||||
# Color picker for highlight colors
|
||||
$tabform->getTab("display")->raw ( -value=>'
|
||||
<script type="text/javascript" src="'.$session{config}{extrasURL}.'/wobject/IndexedSearch/ColorPicker2.js"></script>
|
||||
<script type="text/javascript" src="'.$self->session->config->get("extrasURL").'/wobject/IndexedSearch/ColorPicker2.js"></script>
|
||||
<script type="text/javascript">
|
||||
var cp = new ColorPicker("window");
|
||||
</script>'
|
||||
|
|
@ -210,8 +210,8 @@ sub getEditForm {
|
|||
sub getIcon {
|
||||
my $self = shift;
|
||||
my $small = shift;
|
||||
return $session{config}{extrasURL}.'/assets/small/search.gif' if ($small);
|
||||
return $session{config}{extrasURL}.'/assets/search.gif';
|
||||
return $self->session->config->get("extrasURL").'/assets/small/search.gif' if ($small);
|
||||
return $self->session->config->get("extrasURL").'/assets/search.gif';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -220,11 +220,11 @@ sub view {
|
|||
my (%var, @resultsLoop);
|
||||
|
||||
# Do some query handling
|
||||
$var{exactPhrase} = $session{form}{exactPhrase};
|
||||
$var{allWords} = $session{form}{allWords};
|
||||
$var{atLeastOne} = $session{form}{atLeastOne};
|
||||
$var{without} = $session{form}{without};
|
||||
$var{query} = $session{form}{query};
|
||||
$var{exactPhrase} = $self->session->form->process("exactPhrase");
|
||||
$var{allWords} = $self->session->form->process("allWords");
|
||||
$var{atLeastOne} = $self->session->form->process("atLeastOne");
|
||||
$var{without} = $self->session->form->process("without");
|
||||
$var{query} = $self->session->form->process("query");
|
||||
$var{query} .= qq/ +"$var{exactPhrase}"/ if ($var{exactPhrase});
|
||||
$var{query} .= " ".join(" ",map("+".$_,split(/\s+/,$var{allWords}))) if ($var{allWords});
|
||||
$var{query} .= qq{ $var{atLeastOne}} if ($var{atLeastOne});
|
||||
|
|
@ -255,16 +255,16 @@ sub view {
|
|||
$var{numberOfResults} = scalar(@$results);
|
||||
|
||||
# Deal with pagination
|
||||
my $url = "query=".WebGUI::URL::escape($var{query});
|
||||
map {$url .= "&users=".WebGUI::URL::escape($_)} $session{req}->param('users');
|
||||
map {$url .= "&namespaces=".WebGUI::URL::escape($_)} $session{req}->param('namespaces');
|
||||
map {$url .= "&contentTypes=".WebGUI::URL::escape($_)} $session{req}->param('contentTypes');
|
||||
my $url = "query=".$self->session->url->escape($var{query});
|
||||
map {$url .= "&users=".$self->session->url->escape($_)} $self->session->request->param('users');
|
||||
map {$url .= "&namespaces=".$self->session->url->escape($_)} $self->session->request->param('namespaces');
|
||||
map {$url .= "&contentTypes=".$self->session->url->escape($_)} $self->session->request->param('contentTypes');
|
||||
$url .= "&paginateAfter=".$self->getValue("paginateAfter");
|
||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page($url), $self->getValue("paginateAfter"));
|
||||
my $p = WebGUI::Paginator->new($self->session->url->page($url), $self->getValue("paginateAfter"));
|
||||
$p->setDataByArrayRef($results);
|
||||
$var{startNr} = 1;
|
||||
if($session{form}{pn}) {
|
||||
$var{startNr} = (($session{form}{pn} - 1) * $self->getValue("paginateAfter")) + 1;
|
||||
if($self->session->form->process("pn")) {
|
||||
$var{startNr} = (($self->session->form->process("pn") - 1) * $self->getValue("paginateAfter")) + 1;
|
||||
}
|
||||
|
||||
my @highlightColors = map { $self->getValue("highlight_$_") } (1..5);
|
||||
|
|
@ -291,10 +291,10 @@ sub view {
|
|||
my $namespaces = $self->_getNamespaces('restricted');
|
||||
foreach(keys %$namespaces) {
|
||||
my $selected = 0;
|
||||
if (scalar $session{req}->param('namespaces')) {
|
||||
$selected = isIn($_, $session{req}->param('namespaces'));
|
||||
if (scalar $self->session->request->param('namespaces')) {
|
||||
$selected = isIn($_, $self->session->request->param('namespaces'));
|
||||
} else {
|
||||
$selected = ($session{form}{namespaces} =~ /$_/);
|
||||
$selected = ($self->session->form->process("namespaces") =~ /$_/);
|
||||
}
|
||||
push(@{$var{namespaces}}, { value => $_, name => $namespaces->{$_}, selected => $selected });
|
||||
}
|
||||
|
|
@ -309,10 +309,10 @@ sub view {
|
|||
my $contentTypes = $self->_getContentTypes('restricted');
|
||||
foreach(keys %$contentTypes) {
|
||||
my $selected = 0;
|
||||
if (scalar $session{req}->param('contentTypes')) {
|
||||
$selected = isIn($_, $session{req}->param('contentTypes'));
|
||||
if (scalar $self->session->request->param('contentTypes')) {
|
||||
$selected = isIn($_, $self->session->request->param('contentTypes'));
|
||||
} else {
|
||||
$selected = ($session{form}{contentTypes} =~ /$_/);
|
||||
$selected = ($self->session->form->process("contentTypes") =~ /$_/);
|
||||
}
|
||||
unless(/^content$/) { # No shortcut in the detailed contentType list
|
||||
push(@{$var{contentTypes}}, { value => $_,
|
||||
|
|
@ -333,10 +333,10 @@ sub view {
|
|||
my $users = $self->_getUsers('restricted');
|
||||
foreach(keys %$users) {
|
||||
my $selected = 0;
|
||||
if (scalar $session{req}->param('users')) {
|
||||
$selected = isIn($_, $session{req}->param('users'));
|
||||
if (scalar $self->session->request->param('users')) {
|
||||
$selected = isIn($_, $self->session->request->param('users'));
|
||||
} else {
|
||||
$selected = ($session{form}{users} =~ /$_/);
|
||||
$selected = ($self->session->form->process("users") =~ /$_/);
|
||||
}
|
||||
push(@{$var{users}}, { value => $_, name => $users->{$_}, selected => $selected });
|
||||
}
|
||||
|
|
@ -344,7 +344,7 @@ sub view {
|
|||
# Create a loop with searchable page roots
|
||||
my $rootData;
|
||||
my @roots = split(/\n/, $self->get('searchRoot'));
|
||||
my %checked = map {$_=>1} $session{req}->param("searchRoot");
|
||||
my %checked = map {$_=>1} $self->session->request->param("searchRoot");
|
||||
#if (isIn('any', @roots)) {
|
||||
# foreach $rootData (WebGUI::Page->getAnonymousRoot->daughters) {
|
||||
# push (@{$var{searchRoots}}, {
|
||||
|
|
@ -400,7 +400,7 @@ sub _buildPageList {
|
|||
my ($self, @userSpecifiedRoots, @roots, @allowedRoots, $pageId, @pages);
|
||||
$self = shift;
|
||||
|
||||
@userSpecifiedRoots = $session{req}->param("searchRoot");
|
||||
@userSpecifiedRoots = $self->session->request->param("searchRoot");
|
||||
|
||||
if ((scalar(@userSpecifiedRoots) == 0)
|
||||
|| ($self->getValue("forceSearchRoots"))
|
||||
|
|
@ -436,11 +436,11 @@ sub _buildFilter {
|
|||
# }
|
||||
|
||||
# content-types
|
||||
if($session{form}{contentTypes} && ! isIn('any', $session{req}->param('contentTypes'))) {
|
||||
$filter{contentType} = [ $session{req}->param('contentTypes') ];
|
||||
if($self->session->form->process("contentTypes") && ! isIn('any', $self->session->request->param('contentTypes'))) {
|
||||
$filter{contentType} = [ $self->session->request->param('contentTypes') ];
|
||||
|
||||
# contentType "content" is a shortcut for "page", "wobject" and "wobjectDetail"
|
||||
if (isIn('content', $session{req}->param('contentTypes'))) {
|
||||
if (isIn('content', $self->session->request->param('contentTypes'))) {
|
||||
push(@{$filter{contentType}}, qw/Asset assetDetail/);
|
||||
}
|
||||
} elsif ($self->getValue('contentTypes') !~ /any/i) {
|
||||
|
|
@ -448,22 +448,22 @@ sub _buildFilter {
|
|||
}
|
||||
|
||||
# users
|
||||
if($session{form}{users} && ! isIn('any', $session{req}->param('users'))) {
|
||||
if($self->session->form->process("users") && ! isIn('any', $self->session->request->param('users'))) {
|
||||
$filter{ownerId} = [];
|
||||
foreach my $user ($session{req}->param('users')) {
|
||||
foreach my $user ($self->session->request->param('users')) {
|
||||
if ($user =~ /\D/) {
|
||||
$user =~ s/\*/%/g;
|
||||
($user) = WebGUI::SQL->buildArray("select userId from users where username like ".quote($user));
|
||||
($user) = $self->session->db->buildArray("select userId from users where username like ".$self->session->db->quote($user));
|
||||
}
|
||||
push(@{$filter{ownerId}}, quote($user)) if ($user =~ /^\d+$/);
|
||||
push(@{$filter{ownerId}}, $self->session->db->quote($user)) if ($user =~ /^\d+$/);
|
||||
}
|
||||
} elsif ($self->getValue('users') !~ /any/i) {
|
||||
$filter{ownerId} = [ split(/\n/, $self->getValue('users')) ];
|
||||
}
|
||||
|
||||
# namespaces
|
||||
if($session{form}{namespaces} && ! isIn('any', $session{req}->param('namespaces'))) {
|
||||
$filter{namespace} = [ $session{req}->param('namespaces') ];
|
||||
if($self->session->form->process("namespaces") && ! isIn('any', $self->session->request->param('namespaces'))) {
|
||||
$filter{namespace} = [ $self->session->request->param('namespaces') ];
|
||||
} elsif ($self->getValue('namespaces') !~ /any/i) {
|
||||
$filter{namespace} = [ split(/\n/, $self->getValue('namespaces')) ];
|
||||
}
|
||||
|
|
@ -479,11 +479,11 @@ sub _buildFilter {
|
|||
sub _getNamespaces {
|
||||
my ($self, $restricted) = @_;
|
||||
my %international;
|
||||
foreach my $class (@{$session{config}{assets}}) {
|
||||
foreach my $class (@{$self->session->config->get("assets")}) {
|
||||
my $load = 'use '.$class;
|
||||
eval($load);
|
||||
if ($@) {
|
||||
WebGUI::ErrorHandler::warn("Couldn't compile ".$class." because ".$@);
|
||||
$self->session->errorHandler->warn("Couldn't compile ".$class." because ".$@);
|
||||
} else {
|
||||
$international{$class} = eval{$class->getName()};
|
||||
}
|
||||
|
|
@ -496,7 +496,7 @@ sub _getNamespaces {
|
|||
}
|
||||
} else {
|
||||
$namespaces{any} = WebGUI::International::get(18,"Asset_IndexedSearch");
|
||||
foreach (WebGUI::SQL->buildArray("select distinct(namespace) from IndexedSearch_docInfo order by namespace")) {
|
||||
foreach ($self->session->db->buildArray("select distinct(namespace) from IndexedSearch_docInfo order by namespace")) {
|
||||
$namespaces{$_} = $international{$_} ||ucfirst($_);
|
||||
}
|
||||
}
|
||||
|
|
@ -525,7 +525,7 @@ sub _getContentTypes {
|
|||
%contentTypes = ( 'any' => $international{any},
|
||||
'content' => $international{content}, # shortcut for page, wobject and wobjectDetail
|
||||
);
|
||||
foreach (WebGUI::SQL->buildArray("select distinct(contentType) from IndexedSearch_docInfo order by contentType")) {
|
||||
foreach ($self->session->db->buildArray("select distinct(contentType) from IndexedSearch_docInfo order by contentType")) {
|
||||
$contentTypes{$_} = $international{$_} || ucfirst($_);
|
||||
}
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ sub _getContentTypes {
|
|||
sub _getSearchablePages {
|
||||
my $searchRoot = shift;
|
||||
my %pages;
|
||||
my $sth = WebGUI::SQL->read("select assetId from asset where parentId = ".quote($searchRoot));
|
||||
my $sth = $self->session->db->read("select assetId from asset where parentId = ".$self->session->db->quote($searchRoot));
|
||||
while (my %data = $sth->hash) {
|
||||
$pages{$data{assetId}} = 1;
|
||||
%pages = (%pages, _getSearchablePages($data{assetId}) );
|
||||
|
|
@ -555,7 +555,7 @@ sub _getUsers {
|
|||
}
|
||||
} else {
|
||||
%users = ( 'any' => WebGUI::International::get(25,"Asset_IndexedSearch"),
|
||||
WebGUI::SQL->buildHash("select userId, username from users order by username")
|
||||
$self->session->db->buildHash("select userId, username from users order by username")
|
||||
);
|
||||
}
|
||||
return \%users;
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ These methods are available from this package:
|
|||
sub _recurseCrumbTrail {
|
||||
my ($sth, %data, $output);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select asset.assetId,asset.parentId,assetData.menuTitle,asset.url from asset left join assetData on asset.assetId=assetData.assetId where asset.assetId=".quote($_[0])." group by assetData.assetId order by assetData.revisionDate desc");
|
||||
%data = $self->session->db->quickHash("select asset.assetId,asset.parentId,assetData.menuTitle,asset.url from asset left join assetData on asset.assetId=assetData.assetId where asset.assetId=".$self->session->db->quote($_[0])." group by assetData.assetId order by assetData.revisionDate desc");
|
||||
if ($data{assetId}) {
|
||||
$output .= _recurseCrumbTrail($data{parentId});
|
||||
}
|
||||
if ($data{assetId} ne "PBasset000000000000001" && $data{menuTitle}) {
|
||||
$output .= '<a class="crumbTrail" href="'.WebGUI::URL::gateway($data{url})
|
||||
$output .= '<a class="crumbTrail" href="'.$self->session->url->gateway($data{url})
|
||||
.'">'.$data{menuTitle}.'</a> > ';
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -113,7 +113,7 @@ sub create {
|
|||
if($options{stemmer}) {
|
||||
eval "use Lingua::Stem";
|
||||
if ($@) {
|
||||
WebGUI::ErrorHandler::warn("IndexedSearch: Can't use stemmer: $@");
|
||||
$self->session->errorHandler->warn("IndexedSearch: Can't use stemmer: $@");
|
||||
delete $options{stemmer};
|
||||
}
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ sub create {
|
|||
}
|
||||
$self->{_fts} = DBIx::FullTextSearch->create($self->getDbh, $self->getIndexName, %options);
|
||||
if (not defined $self->{_fts}) {
|
||||
WebGUI::ErrorHandler::error("IndexedSearch: Unable to create index.\n$DBIx::FullTextSearch::errstr");
|
||||
$self->session->errorHandler->error("IndexedSearch: Unable to create index.\n$DBIx::FullTextSearch::errstr");
|
||||
return undef;
|
||||
}
|
||||
$self->{_docId} = 1;
|
||||
|
|
@ -146,7 +146,7 @@ The name of table.
|
|||
|
||||
sub existsTable {
|
||||
my ($self, $table) = @_;
|
||||
return isIn($table, WebGUI::SQL->buildArray("show tables"));
|
||||
return isIn($table, $self->session->db->buildArray("show tables"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -175,23 +175,23 @@ A reference to an array of CSS color identificators.
|
|||
|
||||
sub getDetails {
|
||||
my ($self, $docIdList, %options) = @_;
|
||||
my $docIds = quoteAndJoin($docIdList);
|
||||
my $docIds = $self->session->db->quoteAndJoin($docIdList);
|
||||
my (@searchDetails);
|
||||
my $sql = "select * from IndexedSearch_docInfo where docId in ($docIds) and indexName = ".quote($self->getIndexName) ;
|
||||
my $sql = "select * from IndexedSearch_docInfo where docId in ($docIds) and indexName = ".$self->session->db->quote($self->getIndexName) ;
|
||||
$sql .= " ORDER BY FIELD(docId, $docIds)"; # Maintain $docIdList order
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
my $sth = $self->session->db->read($sql);
|
||||
while (my %data = $sth->hash) {
|
||||
if ($data{ownerId}) {
|
||||
($data{username}) = WebGUI::SQL->quickArray("select username from users where userId = ".quote($data{ownerId}));
|
||||
$data{userProfile} = WebGUI::URL::page("op=viewProfile&uid=$data{ownerId}");
|
||||
($data{username}) = $self->session->db->quickArray("select username from users where userId = ".$self->session->db->quote($data{ownerId}));
|
||||
$data{userProfile} = $self->session->url->page("op=viewProfile&uid=$data{ownerId}");
|
||||
}
|
||||
if ($data{bodyShortcut} =~ /^\s*select /i) {
|
||||
$data{body} = (WebGUI::SQL->quickArray($data{bodyShortcut}))[0];
|
||||
$data{body} = ($self->session->db->quickArray($data{bodyShortcut}))[0];
|
||||
} else {
|
||||
$data{body} = $data{bodyShortcut};
|
||||
}
|
||||
if ($data{headerShortcut} =~ /^\s*select /i) {
|
||||
$data{header} = (WebGUI::SQL->quickArray($data{headerShortcut}))[0];
|
||||
$data{header} = ($self->session->db->quickArray($data{headerShortcut}))[0];
|
||||
} else {
|
||||
$data{header} = $data{headerShortcut};
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ sub getDetails {
|
|||
$data{header} = WebGUI::Macro::filter($data{header});
|
||||
$data{header} = WebGUI::HTML::filter($data{header},'all');
|
||||
$data{header} = $self->highlight($data{header},undef, $options{highlightColors}) if ($options{highlight});
|
||||
$data{location} = WebGUI::URL::gateway($data{location});
|
||||
$data{location} = $self->session->url->gateway($data{location});
|
||||
}
|
||||
$data{crumbTrail} = _recurseCrumbTrail($data{assetId});
|
||||
$data{crumbTrail} =~ s/\s*\>\s*$//;
|
||||
|
|
@ -401,7 +401,7 @@ sub indexDocument {
|
|||
my ($self, $document) = @_;
|
||||
$self->{_fts}->index_document($document->{docId} || $self->{_docId}, $document->{text});
|
||||
my $docId = ($document->{docId} || $self->{_docId});
|
||||
WebGUI::SQL->write("insert into IndexedSearch_docInfo ( docId,
|
||||
$self->session->db->write("insert into IndexedSearch_docInfo ( docId,
|
||||
indexName,
|
||||
assetId,
|
||||
groupIdView,
|
||||
|
|
@ -414,17 +414,17 @@ sub indexDocument {
|
|||
ownerId,
|
||||
dateIndexed )
|
||||
values ( ".
|
||||
quote($docId).", ".
|
||||
quote($self->getIndexName).", ".
|
||||
quote($document->{assetId}).", ".
|
||||
quote($document->{groupIdView} || "7").", ".
|
||||
quote($document->{special_groupIdView} || "7").", ".
|
||||
quote($document->{namespace} || 'WebGUI')." , ".
|
||||
quote($document->{location}).", ".
|
||||
quote($document->{headerShortcut})." ,".
|
||||
quote($document->{bodyShortcut})." ,".
|
||||
quote($document->{contentType})." ,".
|
||||
quote($document->{ownerId} || 3).",
|
||||
$self->session->db->quote($docId).", ".
|
||||
$self->session->db->quote($self->getIndexName).", ".
|
||||
$self->session->db->quote($document->{assetId}).", ".
|
||||
$self->session->db->quote($document->{groupIdView} || "7").", ".
|
||||
$self->session->db->quote($document->{special_groupIdView} || "7").", ".
|
||||
$self->session->db->quote($document->{namespace} || 'WebGUI')." , ".
|
||||
$self->session->db->quote($document->{location}).", ".
|
||||
$self->session->db->quote($document->{headerShortcut})." ,".
|
||||
$self->session->db->quote($document->{bodyShortcut})." ,".
|
||||
$self->session->db->quote($document->{contentType})." ,".
|
||||
$self->session->db->quote($document->{ownerId} || 3).",
|
||||
".WebGUI::DateTime::time()." )"
|
||||
);
|
||||
$self->{_docId}++;
|
||||
|
|
@ -471,10 +471,10 @@ sub open {
|
|||
my ($self) = @_;
|
||||
$self->{_fts} = DBIx::FullTextSearch->open($self->getDbh, $self->getIndexName);
|
||||
if (not defined $self->{_fts}) {
|
||||
WebGUI::ErrorHandler::error("IndexedSearch: Unable to open index.\n$DBIx::FullTextSearch::errstr");
|
||||
$self->session->errorHandler->error("IndexedSearch: Unable to open index.\n$DBIx::FullTextSearch::errstr");
|
||||
return undef;
|
||||
}
|
||||
($self->{_docId}) = WebGUI::SQL->quickArray("select max(docId) from IndexedSearch_docInfo where indexName = ".quote($self->getIndexName));
|
||||
($self->{_docId}) = $self->session->db->quickArray("select max(docId) from IndexedSearch_docInfo where indexName = ".$self->session->db->quote($self->getIndexName));
|
||||
$self->{_docId}++;
|
||||
return $self->{_fts};
|
||||
}
|
||||
|
|
@ -552,7 +552,7 @@ sub recreate {
|
|||
$self->{_fts}->drop;
|
||||
}
|
||||
$self->{_fts} = $self->create($self->getIndexName, $self->getDbh, %options);
|
||||
WebGUI::SQL->write("delete from IndexedSearch_docInfo where indexName = ".quote($self->getIndexName));
|
||||
$self->session->db->write("delete from IndexedSearch_docInfo where indexName = ".$self->session->db->quote($self->getIndexName));
|
||||
return $self->{_fts};
|
||||
}
|
||||
|
||||
|
|
@ -591,18 +591,18 @@ sub search {
|
|||
my $noFtsSearch = ($query =~ /^\s*\*\s*$/); # query = '*', no full text search
|
||||
my @fts_docIds = $self->{_fts}->search($query) unless $noFtsSearch ;
|
||||
if(@fts_docIds || $noFtsSearch) {
|
||||
my $groups = quoteAndJoin($self->_getGroups);
|
||||
my $docIds = quoteAndJoin(\@fts_docIds);
|
||||
my $sql = "select docId from IndexedSearch_docInfo where indexName = ".quote($self->getIndexName);
|
||||
my $groups = $self->session->db->quoteAndJoin($self->_getGroups);
|
||||
my $docIds = $self->session->db->quoteAndJoin(\@fts_docIds);
|
||||
my $sql = "select docId from IndexedSearch_docInfo where indexName = ".$self->session->db->quote($self->getIndexName);
|
||||
$sql .= " and docId in ($docIds)" unless $noFtsSearch;
|
||||
$sql .= " and groupIdView in ($groups)";
|
||||
$sql .= " and special_groupIdView in ($groups)";
|
||||
foreach my $filterElement (keys %{$filter}) {
|
||||
$sql .= " AND $filterElement in (".quoteAndJoin($filter->{$filterElement}).")";
|
||||
$sql .= " AND $filterElement in (".$self->session->db->quoteAndJoin($filter->{$filterElement}).")";
|
||||
}
|
||||
# Keep @fts_docIds list order
|
||||
$sql .= " ORDER BY FIELD(docID,$docIds)" unless $noFtsSearch;
|
||||
my $filteredDocIds = WebGUI::SQL->buildArrayRef($sql);
|
||||
my $filteredDocIds = $self->session->db->buildArrayRef($sql);
|
||||
return $filteredDocIds if (ref $filteredDocIds eq 'ARRAY' and @{$filteredDocIds});
|
||||
}
|
||||
return undef;
|
||||
|
|
@ -618,7 +618,7 @@ Returns an array reference containing all groupIds of groups the user is in.
|
|||
|
||||
sub _getGroups {
|
||||
my @groups;
|
||||
foreach my $groupId (WebGUI::SQL->buildArray("select groupId from groups")) {
|
||||
foreach my $groupId ($self->session->db->buildArray("select groupId from groups")) {
|
||||
push(@groups, $groupId) if (WebGUI::Grouping::isInGroup($groupId));
|
||||
}
|
||||
return \@groups;
|
||||
|
|
|
|||
|
|
@ -149,14 +149,14 @@ sub view {
|
|||
$numPositions = $j if $template =~ m/position${j}\_loop/;
|
||||
}
|
||||
my @found;
|
||||
my $showPerformance = WebGUI::ErrorHandler::canShowPerformanceIndicators();
|
||||
my $showPerformance = $self->session->errorHandler->canShowPerformanceIndicators();
|
||||
foreach my $position (@positions) {
|
||||
my @assets = split(",",$position);
|
||||
foreach my $asset (@assets) {
|
||||
foreach my $child (@{$children}) {
|
||||
if ($asset eq $child->getId) {
|
||||
unless (isIn($asset,@hidden) || !($child->canView)) {
|
||||
WebGUI::Style::setRawHeadTags($child->getExtraHeadTags);
|
||||
$self->session->style->setRawHeadTags($child->getExtraHeadTags);
|
||||
my $t = [Time::HiRes::gettimeofday()] if ($showPerformance);
|
||||
my $view = $child->view;
|
||||
$view .= "Asset:".Time::HiRes::tv_interval($t) if ($showPerformance);
|
||||
|
|
@ -192,22 +192,22 @@ sub view {
|
|||
}
|
||||
}
|
||||
}
|
||||
$vars{showAdmin} = ($session{var}{adminOn} && $self->canEdit);
|
||||
$vars{showAdmin} = ($self->session->var->get("adminOn") && $self->canEdit);
|
||||
if ($vars{showAdmin}) {
|
||||
# under normal circumstances we don't put HTML stuff in our code, but this will make it much easier
|
||||
# for end users to work with our templates
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/draggable.js",{ type=>"text/javascript" });
|
||||
WebGUI::Style::setLink($session{config}{extrasURL}."/draggable.css",{ type=>"text/css", rel=>"stylesheet", media=>"all" });
|
||||
WebGUI::Style::setRawHeadTags('
|
||||
$self->session->style->setScript($self->session->config->get("extrasURL")."/draggable.js",{ type=>"text/javascript" });
|
||||
$self->session->style->setLink($self->session->config->get("extrasURL")."/draggable.css",{ type=>"text/css", rel=>"stylesheet", media=>"all" });
|
||||
$self->session->style->setRawHeadTags('
|
||||
<style type="text/css">
|
||||
.dragging, .empty {
|
||||
background-image: url("'.$session{config}{extrasURL}.'/opaque.gif");
|
||||
background-image: url("'.$self->session->config->get("extrasURL").'/opaque.gif");
|
||||
}
|
||||
</style>
|
||||
');
|
||||
$vars{"dragger.icon"} = WebGUI::Icon::dragIcon();
|
||||
$vars{"dragger.init"} = '
|
||||
<iframe id="dragSubmitter" style="display: none;" src="'.$session{config}{extrasURL}.'/spacer.gif"></iframe>
|
||||
<iframe id="dragSubmitter" style="display: none;" src="'.$self->session->config->get("extrasURL").'/spacer.gif"></iframe>
|
||||
<script type="text/javascript">
|
||||
dragable_init("'.$self->getUrl("func=setContentPositions;map=").'");
|
||||
</script>
|
||||
|
|
@ -221,9 +221,9 @@ sub www_setContentPositions {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->addRevision({
|
||||
contentPositions=>$session{form}{map}
|
||||
contentPositions=>$self->session->form->process("map")
|
||||
});
|
||||
return "Map set: ".$session{form}{map};
|
||||
return "Map set: ".$self->session->form->process("map");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ sub getCompareForm {
|
|||
name=>"listingId",
|
||||
vertical=>1,
|
||||
value=>\@ids,
|
||||
options=>WebGUI::SQL->buildHashRef("select listingId, concat('<a href=\\\"".
|
||||
options=>$self->session->db->buildHashRef("select listingId, concat('<a href=\\\"".
|
||||
$self->getUrl("func=viewDetail")."&listingId=',listingId,'\\\">', productName,'</a>') from Matrix_listing
|
||||
where assetId=".quote($self->getId)." and status='approved' order by productName")
|
||||
where assetId=".$self->session->db->quote($self->getId)." and status='approved' order by productName")
|
||||
})
|
||||
."<br />"
|
||||
.WebGUI::Form::submit({
|
||||
|
|
@ -150,9 +150,9 @@ sub hasRated {
|
|||
my $listingId = shift;
|
||||
return 1 unless (WebGUI::Grouping::isInGroup($self->get("groupToRate")));
|
||||
my $ratingTimeout = WebGUI::Grouping::isInGroup($self->get("privilegedGroup")) ? $self->get("ratingTimeoutPrivileged") : $self->get("ratingTimeout");
|
||||
my ($hasRated) = WebGUI::SQL->quickArray("select count(*) from Matrix_rating where
|
||||
((userId=".quote($session{user}{userId})." and userId<>'1') or (userId='1' and ipAddress=".quote($session{env}{HTTP_X_FORWARDED_FOR}).")) and
|
||||
listingId=".quote($listingId)." and timeStamp>".(WebGUI::DateTime::time()-$ratingTimeout));
|
||||
my ($hasRated) = $self->session->db->quickArray("select count(*) from Matrix_rating where
|
||||
((userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and userId<>'1') or (userId='1' and ipAddress=".$self->session->db->quote($self->session->env->get("HTTP_X_FORWARDED_FOR")).")) and
|
||||
listingId=".$self->session->db->quote($listingId)." and timeStamp>".(WebGUI::DateTime::time()-$ratingTimeout));
|
||||
return $hasRated;
|
||||
}
|
||||
|
||||
|
|
@ -160,20 +160,20 @@ sub hasRated {
|
|||
sub incrementCounter {
|
||||
my $listingId = shift;
|
||||
my $counter = shift;
|
||||
my ($lastIp) = WebGUI::SQL->quickArray("select ".$counter."LastIp from Matrix_listing where listingId = ".quote($listingId));
|
||||
unless ($lastIp eq $session{env}{HTTP_X_FORWARDED_FOR}) {
|
||||
WebGUI::SQL->write("update Matrix_listing set $counter=$counter+1, ".$counter."LastIp=".quote($session{env}{HTTP_X_FORWARDED_FOR})." where listingId=".quote($listingId));
|
||||
my ($lastIp) = $self->session->db->quickArray("select ".$counter."LastIp from Matrix_listing where listingId = ".$self->session->db->quote($listingId));
|
||||
unless ($lastIp eq $self->session->env->get("HTTP_X_FORWARDED_FOR")) {
|
||||
$self->session->db->write("update Matrix_listing set $counter=$counter+1, ".$counter."LastIp=".$self->session->db->quote($self->session->env->get("HTTP_X_FORWARDED_FOR"))." where listingId=".$self->session->db->quote($listingId));
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
WebGUI::SQL->write("delete from Matrix_listing where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Matrix_listingData where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Matrix_field where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Matrix_rating where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Matrix_ratingSummary where assetId=".quote($self->getId));
|
||||
$self->session->db->write("delete from Matrix_listing where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Matrix_listingData where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Matrix_field where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Matrix_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Matrix_ratingSummary where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->SUPER::purge;
|
||||
}
|
||||
|
||||
|
|
@ -184,18 +184,18 @@ sub setRatings {
|
|||
my $ratings = shift;
|
||||
foreach my $category ($self->getCategories) {
|
||||
if ($ratings->{$category}) {
|
||||
WebGUI::SQL->write("insert into Matrix_rating (userId, category, rating, timeStamp, listingId,ipAddress, assetId) values (
|
||||
".quote($session{user}{userId}).", ".quote($category).", ".quote($ratings->{$category}).", ".WebGUI::DateTime::time()
|
||||
.", ".quote($listingId).", ".quote($session{env}{HTTP_X_FORWARDED_FOR}).",".quote($self->getId).")");
|
||||
$self->session->db->write("insert into Matrix_rating (userId, category, rating, timeStamp, listingId,ipAddress, assetId) values (
|
||||
".$self->session->db->quote($self->session->user->profileField("userId")).", ".$self->session->db->quote($category).", ".$self->session->db->quote($ratings->{$category}).", ".WebGUI::DateTime::time()
|
||||
.", ".$self->session->db->quote($listingId).", ".$self->session->db->quote($self->session->env->get("HTTP_X_FORWARDED_FOR")).",".$self->session->db->quote($self->getId).")");
|
||||
}
|
||||
my $sql = "from Matrix_rating where listingId=".quote($listingId)." and category=".quote($category);
|
||||
my ($sum) = WebGUI::SQL->quickArray("select sum(rating) $sql");
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) $sql");
|
||||
my $sql = "from Matrix_rating where listingId=".$self->session->db->quote($listingId)." and category=".$self->session->db->quote($category);
|
||||
my ($sum) = $self->session->db->quickArray("select sum(rating) $sql");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) $sql");
|
||||
my $half = round($count/2);
|
||||
my $mean = $sum / ($count || 1);
|
||||
my ($median) = WebGUI::SQL->quickArray("select rating $sql limit $half,$half");
|
||||
WebGUI::SQL->write("replace into Matrix_ratingSummary (listingId, category, meanValue, medianValue, countValue,assetId) values (
|
||||
".quote($listingId).", ".quote($category).", $mean, ".quote($median).", $count, ".quote($self->getId).")");
|
||||
my ($median) = $self->session->db->quickArray("select rating $sql limit $half,$half");
|
||||
$self->session->db->write("replace into Matrix_ratingSummary (listingId, category, meanValue, medianValue, countValue,assetId) values (
|
||||
".$self->session->db->quote($listingId).", ".$self->session->db->quote($category).", $mean, ".$self->session->db->quote($median).", $count, ".$self->session->db->quote($self->getId).")");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,11 +203,11 @@ sub setRatings {
|
|||
sub www_approveListing {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless($self->canEdit);
|
||||
my $listing = WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
|
||||
WebGUI::SQL->write("update Matrix_listing set status='approved' where listingId=".quote($session{form}{listingId}));
|
||||
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
|
||||
$self->session->db->write("update Matrix_listing set status='approved' where listingId=".$self->session->db->quote($self->session->form->process("listingId")));
|
||||
WebGUI::MessageLog::addEntry($listing->{maintainerId},"","New Listing Approved","Your new listing, ".$listing->{productName}.", has been approved.",
|
||||
$self->formatURL("viewDetail",$session{form}{listingId}),"notice");
|
||||
WebGUI::MessageLog::completeEntry($session{form}{mlog});
|
||||
$self->formatURL("viewDetail",$self->session->form->process("listingId")),"notice");
|
||||
WebGUI::MessageLog::completeEntry($self->session->form->process("mlog"));
|
||||
return $self->www_viewDetail;
|
||||
}
|
||||
|
||||
|
|
@ -215,9 +215,9 @@ sub www_approveListing {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_click {
|
||||
my $self = shift;
|
||||
incrementCounter($session{form}{listingId},"clicks");
|
||||
my $listing = WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
|
||||
if ($session{form}{m}) {
|
||||
incrementCounter($self->session->form->process("listingId"),"clicks");
|
||||
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
|
||||
if ($self->session->form->process("m")) {
|
||||
WebGUI::HTTP::setRedirect($listing->{manufacturerUrl});
|
||||
} else {
|
||||
WebGUI::HTTP::setRedirect($listing->{productUrl});
|
||||
|
|
@ -231,7 +231,7 @@ sub www_compare {
|
|||
my $self = shift;
|
||||
my @cmsList = @_;
|
||||
unless (scalar(@cmsList)) {
|
||||
@cmsList = WebGUI::FormProcessor::checkList("listingId");
|
||||
@cmsList = $self->session->form->checkList("listingId");
|
||||
}
|
||||
my ( %var, @prodcol, @datecol);
|
||||
my $max = WebGUI::Grouping::isInGroup($self->get("privilegedGroup")) ? $self->get("maxComparisonsPrivileged") : $self->get("maxComparisons");
|
||||
|
|
@ -243,8 +243,8 @@ sub www_compare {
|
|||
}
|
||||
foreach my $cms (@cmsList) {
|
||||
incrementCounter($cms,"compares");
|
||||
my $data = WebGUI::SQL->quickHashRef("select listingId, productName, versionNumber, lastUpdated
|
||||
from Matrix_listing where listingId=".quote($cms));
|
||||
my $data = $self->session->db->quickHashRef("select listingId, productName, versionNumber, lastUpdated
|
||||
from Matrix_listing where listingId=".$self->session->db->quote($cms));
|
||||
push(@prodcol, {
|
||||
name=>$data->{productName} || "__untitled__",
|
||||
version=>$data->{versionNumber},
|
||||
|
|
@ -265,10 +265,10 @@ sub www_compare {
|
|||
foreach my $cms (@cmsList) {
|
||||
$select .= ", ".$tableCount.".value";
|
||||
$from .= " left join Matrix_listingData ".$tableCount." on a.fieldId="
|
||||
.$tableCount.".fieldId and ".$tableCount.".listingId=".quote($cms);
|
||||
.$tableCount.".fieldId and ".$tableCount.".listingId=".$self->session->db->quote($cms);
|
||||
$tableCount++;
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("$select $from where a.category=".quote($category)." order by a.label");
|
||||
my $sth = $self->session->db->read("$select $from where a.category=".$self->session->db->quote($category)." order by a.label");
|
||||
while (my @row = $sth->array) {
|
||||
my @columnloop;
|
||||
my $first = 1;
|
||||
|
|
@ -316,8 +316,8 @@ sub www_copy {
|
|||
sub www_deleteListing {
|
||||
my $self = shift;
|
||||
my $output = sprintf WebGUI::International::get('delete listing confirmation','Asset_Matrix'),
|
||||
$self->getUrl("func=deleteListingConfirm&listingId=".$session{form}{listingId}),
|
||||
$self->formatURL("viewDetail",$session{form}{listingId});
|
||||
$self->getUrl("func=deleteListingConfirm&listingId=".$self->session->form->process("listingId")),
|
||||
$self->formatURL("viewDetail",$self->session->form->process("listingId"));
|
||||
return $self->processStyle($output);
|
||||
}
|
||||
|
||||
|
|
@ -325,14 +325,14 @@ sub www_deleteListing {
|
|||
sub www_deleteListingConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless($self->canEdit);
|
||||
my $listing = WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
|
||||
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
|
||||
WebGUI::Asset::Wobject::Collaboration->new($listing->{forumId})->purge;
|
||||
WebGUI::SQL->write("delete from Matrix_listing where listingId=".quote($session{form}{listingId}));
|
||||
WebGUI::SQL->write("delete from Matrix_listingData where listingId=".quote($session{form}{listingId}));
|
||||
WebGUI::SQL->write("delete from Matrix_rating where listingId=".quote($session{form}{listingId}));
|
||||
WebGUI::SQL->write("delete from Matrix_ratingSummary where listingId=".quote($session{form}{listingId}));
|
||||
$self->session->db->write("delete from Matrix_listing where listingId=".$self->session->db->quote($self->session->form->process("listingId")));
|
||||
$self->session->db->write("delete from Matrix_listingData where listingId=".$self->session->db->quote($self->session->form->process("listingId")));
|
||||
$self->session->db->write("delete from Matrix_rating where listingId=".$self->session->db->quote($self->session->form->process("listingId")));
|
||||
$self->session->db->write("delete from Matrix_ratingSummary where listingId=".$self->session->db->quote($self->session->form->process("listingId")));
|
||||
WebGUI::MessageLog::addEntry($listing->{maintainerId},"","Listing Deleted","Your listing, ".$listing->{productName}.", has been deleted from the matrix.","","notice");
|
||||
WebGUI::MessageLog::completeEntry($session{form}{mlog});
|
||||
WebGUI::MessageLog::completeEntry($self->session->form->process("mlog"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -440,8 +440,8 @@ sub www_edit {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editListing {
|
||||
my $self = shift;
|
||||
my $listing= WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
|
||||
return WebGUI::International('no edit rights','Asset_Matrix') unless (($session{form}{listingId} eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
|
||||
my $listing= $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
|
||||
return WebGUI::International('no edit rights','Asset_Matrix') unless (($self->session->form->process("listingId") eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
|
||||
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name=>"func",
|
||||
|
|
@ -449,7 +449,7 @@ sub www_editListing {
|
|||
);
|
||||
$f->hidden(
|
||||
-name=>"listingId",
|
||||
-value=>$session{form}{listingId}
|
||||
-value=>$self->session->form->process("listingId")
|
||||
);
|
||||
$f->text(
|
||||
-name=>"productName",
|
||||
|
|
@ -487,7 +487,7 @@ sub www_editListing {
|
|||
-name=>"maintainerId",
|
||||
-value=>[$listing->{maintainerId}],
|
||||
-label=>WebGUI::International::get('listing maintainer','Asset_Matrix'),
|
||||
-options=>WebGUI::SQL->buildHashRef("select userId,username from users order by username")
|
||||
-options=>$self->session->db->buildHashRef("select userId,username from users order by username")
|
||||
);
|
||||
}
|
||||
my %goodBad = (
|
||||
|
|
@ -500,14 +500,14 @@ sub www_editListing {
|
|||
foreach my $category ($self->getCategories()) {
|
||||
$f->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
|
||||
my $a;
|
||||
if ($session{form}{listingId} ne "new") {
|
||||
$a = WebGUI::SQL->read("select a.name, a.fieldType, a.defaultValue, a.description, a.label, b.value, a.fieldId
|
||||
if ($self->session->form->process("listingId") ne "new") {
|
||||
$a = $self->session->db->read("select a.name, a.fieldType, a.defaultValue, a.description, a.label, b.value, a.fieldId
|
||||
from Matrix_field a left join Matrix_listingData b on a.fieldId=b.fieldId and
|
||||
listingId=".quote($session{form}{listingId})." where
|
||||
a.category=".quote($category)." order by a.label");
|
||||
listingId=".$self->session->db->quote($self->session->form->process("listingId"))." where
|
||||
a.category=".$self->session->db->quote($category)." order by a.label");
|
||||
} else {
|
||||
$a = WebGUI::SQL->read("select name, fieldType, defaultValue, description, label, fieldId
|
||||
from Matrix_field where category=".quote($category)." and assetId=".quote($self->getId));
|
||||
$a = $self->session->db->read("select name, fieldType, defaultValue, description, label, fieldId
|
||||
from Matrix_field where category=".$self->session->db->quote($category)." and assetId=".$self->session->db->quote($self->getId));
|
||||
}
|
||||
while (my $field = $a->hashRef) {
|
||||
if ($field->{fieldType} eq "text") {
|
||||
|
|
@ -546,9 +546,9 @@ sub www_editListing {
|
|||
-name=>$field->{name},
|
||||
-value=>[$value],
|
||||
-label=>$field->{label},
|
||||
-options=>WebGUI::SQL->buildHashRef("select distinct value,value from Matrix_listingData
|
||||
where fieldId=".quote($field->{fieldId})." and
|
||||
assetId=".quote($self->getId)." order by value"),
|
||||
-options=>$self->session->db->buildHashRef("select distinct value,value from Matrix_listingData
|
||||
where fieldId=".$self->session->db->quote($field->{fieldId})." and
|
||||
assetId=".$self->session->db->quote($self->getId)." order by value"),
|
||||
-subtext=>"<br />".$field->{description}
|
||||
);
|
||||
}
|
||||
|
|
@ -564,26 +564,26 @@ sub www_editListing {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editListingSave {
|
||||
my $self = shift;
|
||||
my $listing = WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
|
||||
return WebGUI::International('no edit rights','Asset_Matrix') unless (($session{form}{listingId} eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
|
||||
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
|
||||
return WebGUI::International('no edit rights','Asset_Matrix') unless (($self->session->form->process("listingId") eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
|
||||
my %data = (
|
||||
listingId => $session{form}{listingId},
|
||||
listingId => $self->session->form->process("listingId"),
|
||||
lastUpdated => WebGUI::DateTime::time(),
|
||||
productName => $session{form}{productName},
|
||||
productUrl => $session{form}{productUrl},
|
||||
manufacturerName => $session{form}{manufacturerName},
|
||||
manufacturerUrl => $session{form}{manufacturerUrl},
|
||||
description => $session{form}{description},
|
||||
versionNumber=>$session{form}{versionNumber}
|
||||
productName => $self->session->form->process("productName"),
|
||||
productUrl => $self->session->form->process("productUrl"),
|
||||
manufacturerName => $self->session->form->process("manufacturerName"),
|
||||
manufacturerUrl => $self->session->form->process("manufacturerUrl"),
|
||||
description => $self->session->form->process("description"),
|
||||
versionNumber=>$self->session->form->process("versionNumber")
|
||||
);
|
||||
my $isNew = 0;
|
||||
if ($session{form}{listingId} eq "new") {
|
||||
$data{maintainerId} = $session{user}{userId} if ($session{form}{listingId} eq "new");
|
||||
if ($self->session->form->process("listingId") eq "new") {
|
||||
$data{maintainerId} = $self->session->user->profileField("userId") if ($self->session->form->process("listingId") eq "new");
|
||||
my $forum = $self->addChild({
|
||||
className=>"WebGUI::Asset::Wobject::Collaboration",
|
||||
title=>$session{form}{productName},
|
||||
menuTitle=>$session{form}{productName},
|
||||
url=>$session{form}{productName},
|
||||
title=>$self->session->form->process("productName"),
|
||||
menuTitle=>$self->session->form->process("productName"),
|
||||
url=>$self->session->form->process("productName"),
|
||||
groupIdView=>7,
|
||||
groupIdEdit=>3,
|
||||
startDate=>time(),
|
||||
|
|
@ -618,23 +618,23 @@ sub www_editListingSave {
|
|||
$data{status} = "pending";
|
||||
$isNew = 1;
|
||||
}
|
||||
$data{maintainerId} = $session{form}{maintainerId} if ($self->canEdit);
|
||||
$data{maintainerId} = $self->session->form->process("maintainerId") if ($self->canEdit);
|
||||
$data{assetId} = $self->getId;
|
||||
$session{form}{listingId} = WebGUI::SQL->setRow("Matrix_listing","listingId",\%data);
|
||||
$self->session->form->process("listingId") = $self->session->db->setRow("Matrix_listing","listingId",\%data);
|
||||
if ($data{status} eq "pending") {
|
||||
WebGUI::MessageLog::addEntry($self->get("ownerUserId"),$self->get("groupIdEdit"),"New Listing Added","A new listing, ".$data{productName}.", is waiting to be added.",
|
||||
WebGUI::URL::getSiteURL()."/".$self->formatURL("viewDetail",$session{form}{listingId}),"pending");
|
||||
$self->session->url->getSiteURL()."/".$self->formatURL("viewDetail",$self->session->form->process("listingId")),"pending");
|
||||
}
|
||||
my $a = WebGUI::SQL->read("select fieldId, name, fieldType from Matrix_field");
|
||||
my $a = $self->session->db->read("select fieldId, name, fieldType from Matrix_field");
|
||||
while (my ($id, $name, $type) = $a->array) {
|
||||
my $value;
|
||||
if ($type eq "goodBad") {
|
||||
$value = WebGUI::FormProcessor::selectBox($name);
|
||||
$value = $self->session->form->selectBox($name);
|
||||
} else {
|
||||
$value = WebGUI::FormProcessor::process($name,$type);
|
||||
$value = $self->session->form->process($name,$type);
|
||||
}
|
||||
WebGUI::SQL->write("replace into Matrix_listingData (assetId, listingId, fieldId, value) values (
|
||||
".quote($self->getId).", ".quote($session{form}{listingId}).", ".quote($id).", ".quote($value).")");
|
||||
$self->session->db->write("replace into Matrix_listingData (assetId, listingId, fieldId, value) values (
|
||||
".$self->session->db->quote($self->getId).", ".$self->session->db->quote($self->session->form->process("listingId")).", ".$self->session->db->quote($id).", ".$self->session->db->quote($value).")");
|
||||
}
|
||||
$a->finish;
|
||||
return $self->www_viewDetail;
|
||||
|
|
@ -644,7 +644,7 @@ sub www_editListingSave {
|
|||
sub www_editField {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless($self->canEdit);
|
||||
my $field = WebGUI::SQL->getRow("Matrix_field","fieldId",$session{form}{fieldId});
|
||||
my $field = $self->session->db->getRow("Matrix_field","fieldId",$self->session->form->process("fieldId"));
|
||||
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name=>"func",
|
||||
|
|
@ -652,7 +652,7 @@ sub www_editField {
|
|||
);
|
||||
$f->hidden(
|
||||
-name=>"fieldId",
|
||||
-value=>$session{form}{fieldId}
|
||||
-value=>$self->session->form->process("fieldId")
|
||||
);
|
||||
$f->text(
|
||||
-name=>"name",
|
||||
|
|
@ -705,14 +705,14 @@ sub www_editField {
|
|||
sub www_editFieldSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless($self->canEdit);
|
||||
WebGUI::SQL->setRow("Matrix_field","fieldId",{
|
||||
fieldId=>$session{form}{fieldId},
|
||||
name=>$session{form}{name},
|
||||
label=>$session{form}{label},
|
||||
fieldType=>$session{form}{fieldType},
|
||||
description=>$session{form}{description},
|
||||
defaultValue=>$session{form}{defaultValue},
|
||||
category=>$session{form}{category},
|
||||
$self->session->db->setRow("Matrix_field","fieldId",{
|
||||
fieldId=>$self->session->form->process("fieldId"),
|
||||
name=>$self->session->form->process("name"),
|
||||
label=>$self->session->form->process("label"),
|
||||
fieldType=>$self->session->form->process("fieldType"),
|
||||
description=>$self->session->form->process("description"),
|
||||
defaultValue=>$self->session->form->process("defaultValue"),
|
||||
category=>$self->session->form->process("category"),
|
||||
assetId=>$self->getId
|
||||
});
|
||||
return $self->www_listFields();
|
||||
|
|
@ -724,7 +724,7 @@ sub www_listFields {
|
|||
return WebGUI::Privilege::insufficient() unless($self->canEdit);
|
||||
my $output = sprintf WebGUI::International::get('list fields','Asset_Matrix'),
|
||||
$self->getUrl("func=editField&fieldId=new");
|
||||
my $sth = WebGUI::SQL->read("select fieldId, label from Matrix_field where assetId=".quote($self->getId)." order by label");
|
||||
my $sth = $self->session->db->read("select fieldId, label from Matrix_field where assetId=".$self->session->db->quote($self->getId)." order by label");
|
||||
while (my ($id, $label) = $sth->array) {
|
||||
$output .= '<a href="'.$self->getUrl("func=editField&fieldId=".$id).'">'.$label.'</a><br />';
|
||||
}
|
||||
|
|
@ -736,7 +736,7 @@ sub www_listFields {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_rate {
|
||||
my $self = shift;
|
||||
my $hasRated = $self->hasRated($session{form}{listingId});
|
||||
my $hasRated = $self->hasRated($self->session->form->process("listingId"));
|
||||
my $sameRating = 1;
|
||||
my $first = 1;
|
||||
my $lastRating;
|
||||
|
|
@ -751,7 +751,7 @@ sub www_rate {
|
|||
$lastRating = $session{form}{$category};
|
||||
}
|
||||
return $self->www_viewDetail("",1) if ($hasRated || $sameRating); # Throw out ratings that are all the same number, or if the user rates twice.
|
||||
$self->setRatings($session{form}{listingId},$session{form});
|
||||
$self->setRatings($self->session->form->process("listingId"),$session{form});
|
||||
return $self->www_viewDetail;
|
||||
}
|
||||
|
||||
|
|
@ -759,31 +759,31 @@ sub www_rate {
|
|||
sub www_search {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
my @list = WebGUI::SQL->buildArray("select listingId from Matrix_listing");
|
||||
if ($session{form}{doit}) {
|
||||
my @list = $self->session->db->buildArray("select listingId from Matrix_listing");
|
||||
if ($self->session->form->process("doit")) {
|
||||
my $count;
|
||||
my $keyword;
|
||||
if ($session{form}{keyword}) {
|
||||
$keyword = " and (a.value like ".quote('%'.$session{form}{keyword}.'%')." or a.value='Any')";
|
||||
if ($self->session->form->process("keyword")) {
|
||||
$keyword = " and (a.value like ".$self->session->db->quote('%'.$self->session->form->process("keyword").'%')." or a.value='Any')";
|
||||
}
|
||||
my $sth = WebGUI::SQL->read("select name,fieldType from Matrix_field");
|
||||
my $sth = $self->session->db->read("select name,fieldType from Matrix_field");
|
||||
while (my ($name,$fieldType) = $sth->array) {
|
||||
next unless ($session{form}{$name});
|
||||
push(@list,0);
|
||||
my $where;
|
||||
if ($fieldType ne "goodBad") {
|
||||
$where = "("
|
||||
."a.value like ".quote("%".$session{form}{$name}."%")
|
||||
."a.value like ".$self->session->db->quote("%".$session{form}{$name}."%")
|
||||
." or a.value='Any'"
|
||||
#." or a.value<".quote($session{form}{$name})
|
||||
#." or a.value<".$self->session->db->quote($session{form}{$name})
|
||||
." or a.value='Free'"
|
||||
.")";
|
||||
} else {
|
||||
$where = "a.value<>'no'";
|
||||
}
|
||||
@list = WebGUI::SQL->buildArray("select a.listingId from Matrix_listingData a left join Matrix_field b
|
||||
@list = $self->session->db->buildArray("select a.listingId from Matrix_listingData a left join Matrix_field b
|
||||
on (a.fieldId=b.fieldId)
|
||||
where a.listingId in (".quoteAndJoin(\@list).") and $where and b.name=".quote($name));
|
||||
where a.listingId in (".$self->session->db->quoteAndJoin(\@list).") and $where and b.name=".$self->session->db->quote($name));
|
||||
$count = scalar(@list);
|
||||
last unless ($count > 0);
|
||||
}
|
||||
|
|
@ -811,13 +811,13 @@ sub www_search {
|
|||
$var{'form.footer'} = "</form>";
|
||||
$var{'form.keyword'} = WebGUI::Form::text({
|
||||
name=>"keyword",
|
||||
value=>$session{form}{keyword}
|
||||
value=>$self->session->form->process("keyword")
|
||||
});
|
||||
$var{'form.submit'} = WebGUI::Form::submit({
|
||||
value=>"search"
|
||||
});
|
||||
foreach my $category ($self->getCategories()) {
|
||||
my $sth = WebGUI::SQL->read("select name, fieldType, label, description from Matrix_field where category = ".quote($category)." order by label");
|
||||
my $sth = $self->session->db->read("select name, fieldType, label, description from Matrix_field where category = ".$self->session->db->quote($category)." order by label");
|
||||
my @loop;
|
||||
while (my $data = $sth->hashRef) {
|
||||
$data->{description} =~ s/\n//g;
|
||||
|
|
@ -839,7 +839,7 @@ sub www_search {
|
|||
push(@loop,$data);
|
||||
}
|
||||
$sth->finish;
|
||||
$var{WebGUI::URL::urlize($category)."_loop"} = \@loop;
|
||||
$var{$self->session->url->urlize($category)."_loop"} = \@loop;
|
||||
}
|
||||
return $self->processStyle($self->processTemplate(\%var,$self->get("searchTemplateId")));
|
||||
}
|
||||
|
|
@ -851,22 +851,22 @@ sub view {
|
|||
my (%var);
|
||||
$var{'compare.form'} = $self->getCompareForm;
|
||||
$var{'search.url'} = $self->getUrl("func=search");
|
||||
$var{'isLoggedIn'} = ($session{user}{userId} ne "1");
|
||||
$var{'isLoggedIn'} = ($self->session->user->profileField("userId") ne "1");
|
||||
$var{'field.list.url'} = $self->getUrl('func=listFields');
|
||||
$var{'listing.add.url'} = $self->formatURL("editListing","new");
|
||||
|
||||
my $data = WebGUI::SQL->quickHashRef("select views, productName, listingId from Matrix_listing
|
||||
where assetId=".quote($self->getId)." and status='approved' order by views desc limit 1");
|
||||
my $data = $self->session->db->quickHashRef("select views, productName, listingId from Matrix_listing
|
||||
where assetId=".$self->session->db->quote($self->getId)." and status='approved' order by views desc limit 1");
|
||||
$var{'best.views.url'} = $self->formatURL("viewDetail",$data->{listingId});
|
||||
$var{'best.views.count'} = $data->{views};
|
||||
$var{'best.views.name'} = $data->{productName};
|
||||
my $data = WebGUI::SQL->quickHashRef("select compares, productName, listingId from Matrix_listing
|
||||
where assetId=".quote($self->getId)." and status='approved' order by compares desc limit 1");
|
||||
my $data = $self->session->db->quickHashRef("select compares, productName, listingId from Matrix_listing
|
||||
where assetId=".$self->session->db->quote($self->getId)." and status='approved' order by compares desc limit 1");
|
||||
$var{'best.compares.url'} = $self->formatURL("viewDetail",$data->{listingId});
|
||||
$var{'best.compares.count'} = $data->{compares};
|
||||
$var{'best.compares.name'} = $data->{productName};
|
||||
my $data = WebGUI::SQL->quickHashRef("select clicks, productName, listingId from Matrix_listing
|
||||
where assetId=".quote($self->getId)." and status='approved' order by clicks desc limit 1");
|
||||
my $data = $self->session->db->quickHashRef("select clicks, productName, listingId from Matrix_listing
|
||||
where assetId=".$self->session->db->quote($self->getId)." and status='approved' order by clicks desc limit 1");
|
||||
$var{'best.clicks.url'} = $self->formatURL("viewDetail",$data->{listingId});
|
||||
$var{'best.clicks.count'} = $data->{clicks};
|
||||
$var{'best.clicks.name'} = $data->{productName};
|
||||
|
|
@ -885,15 +885,15 @@ sub view {
|
|||
Matrix_ratingSummary
|
||||
on
|
||||
Matrix_listing.listingId=Matrix_ratingSummary.listingId and
|
||||
Matrix_ratingSummary.category=".quote($category)."
|
||||
Matrix_ratingSummary.category=".$self->session->db->quote($category)."
|
||||
where
|
||||
Matrix_listing.assetId=".quote($self->getId)." and
|
||||
Matrix_listing.assetId=".$self->session->db->quote($self->getId)." and
|
||||
Matrix_listing.status='approved' and
|
||||
Matrix_ratingSummary.countValue > 0
|
||||
order by
|
||||
Matrix_ratingSummary.meanValue
|
||||
";
|
||||
my $data = WebGUI::SQL->quickHashRef($sql." desc limit 1");
|
||||
my $data = $self->session->db->quickHashRef($sql." desc limit 1");
|
||||
push(@best,{
|
||||
url=>$self->formatURL("viewDetail",$data->{listingId}),
|
||||
category=>$category,
|
||||
|
|
@ -902,7 +902,7 @@ sub view {
|
|||
median=>$data->{medianValue},
|
||||
count=>$data->{countValue}
|
||||
});
|
||||
$data = WebGUI::SQL->quickHashRef($sql." asc limit 1");
|
||||
$data = $self->session->db->quickHashRef($sql." asc limit 1");
|
||||
push(@worst,{
|
||||
url=>$self->formatURL("viewDetail",$data->{listingId}),
|
||||
category=>$category,
|
||||
|
|
@ -915,10 +915,10 @@ sub view {
|
|||
$var{'best_rating_loop'} = \@best;
|
||||
$var{'worst_rating_loop'} = \@worst;
|
||||
$var{'ratings.details.url'} = $self->getUrl("func=viewRatingDetails");
|
||||
my $data = WebGUI::SQL->quickHashRef("select lastUpdated, productName, listingId from Matrix_listing
|
||||
where assetId=".quote($self->getId)." and status='approved' order by lastUpdated desc limit 1");
|
||||
my $data = $self->session->db->quickHashRef("select lastUpdated, productName, listingId from Matrix_listing
|
||||
where assetId=".$self->session->db->quote($self->getId)." and status='approved' order by lastUpdated desc limit 1");
|
||||
my @lastUpdated;
|
||||
my $sth = WebGUI::SQL->read("select listingId,lastUpdated,productName from Matrix_listing order by lastUpdated desc limit 20");
|
||||
my $sth = $self->session->db->read("select listingId,lastUpdated,productName from Matrix_listing order by lastUpdated desc limit 20");
|
||||
while (my ($listingId, $lastUpdated, $productName) = $sth->array) {
|
||||
push(@lastUpdated, {
|
||||
url => $self->formatURL("viewDetail",$listingId),
|
||||
|
|
@ -932,10 +932,10 @@ sub view {
|
|||
$var{'best.updated.name'} = $data->{productName};
|
||||
|
||||
# site stats
|
||||
($var{'user.count'}) = WebGUI::SQL->quickArray("select count(*) from users");
|
||||
($var{'current.user.count'}) = WebGUI::SQL->quickArray("select count(*)+0 from userSession where lastPageView>".(WebGUI::DateTime::time()-600));
|
||||
($var{'listing.count'}) = WebGUI::SQL->quickArray("select count(*) from Matrix_listing where status = 'approved' and assetId=".quote($self->getId));
|
||||
my $sth = WebGUI::SQL->read("select listingId,productName from Matrix_listing where status='pending'");
|
||||
($var{'user.count'}) = $self->session->db->quickArray("select count(*) from users");
|
||||
($var{'current.user.count'}) = $self->session->db->quickArray("select count(*)+0 from userSession where lastPageView>".(WebGUI::DateTime::time()-600));
|
||||
($var{'listing.count'}) = $self->session->db->quickArray("select count(*) from Matrix_listing where status = 'approved' and assetId=".$self->session->db->quote($self->getId));
|
||||
my $sth = $self->session->db->read("select listingId,productName from Matrix_listing where status='pending'");
|
||||
while (my ($id,$name) = $sth->array) {
|
||||
push(@{$var{pending_list}},{
|
||||
url=>$self->formatURL("viewDetail",$id),
|
||||
|
|
@ -949,16 +949,16 @@ sub view {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_viewDetail {
|
||||
my $self = shift;
|
||||
my $listingId = shift || $session{form}{listingId};
|
||||
my $listingId = shift || $self->session->form->process("listingId");
|
||||
my $hasRated = shift || $self->hasRated($listingId);
|
||||
my %var;
|
||||
my $listing = WebGUI::SQL->getRow("Matrix_listing","listingId",$listingId);
|
||||
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$listingId);
|
||||
my $forum = WebGUI::Asset::Wobject::Collaboration->new($listing->{forumId});
|
||||
$var{"discussion"} = $forum->view;
|
||||
if ($session{form}{do} eq "sendEmail") {
|
||||
if ($session{form}{body} ne "") {
|
||||
if ($self->session->form->process("do") eq "sendEmail") {
|
||||
if ($self->session->form->process("body") ne "") {
|
||||
my $u = WebGUI::User->new($listing->{maintainerId});
|
||||
WebGUI::Mail::send($u->profileField("email"),$listing->{productName}." - ".$session{form}{subject},$session{form}{body},"",$session{form}{from});
|
||||
WebGUI::Mail::send($u->profileField("email"),$listing->{productName}." - ".$self->session->form->process("subject"),$self->session->form->process("body"),"",$self->session->form->process("from"));
|
||||
}
|
||||
$var{'email.wasSent'} = 1;
|
||||
} else {
|
||||
|
|
@ -966,10 +966,10 @@ sub www_viewDetail {
|
|||
}
|
||||
$var{'edit.url'} = $self->formatURL("editListing",$listingId);
|
||||
$var{id} = $listingId;
|
||||
$var{'user.canEdit'} = ($session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
|
||||
$var{'user.canEdit'} = ($self->session->user->profileField("userId") eq $listing->{maintainerId} || $self->canEdit);
|
||||
$var{'user.canApprove'} = $self->canEdit;
|
||||
$var{'approve.url'} = $self->getUrl("func=approveListing&listingId=".$listingId."&mlog=".$session{form}{mlog});
|
||||
$var{'delete.url'} = $self->getUrl("func=deleteListing&listingId=".$listingId."&mlog=".$session{form}{mlog});
|
||||
$var{'approve.url'} = $self->getUrl("func=approveListing&listingId=".$listingId."&mlog=".$self->session->form->process("mlog"));
|
||||
$var{'delete.url'} = $self->getUrl("func=deleteListing&listingId=".$listingId."&mlog=".$self->session->form->process("mlog"));
|
||||
$var{'isPending'} = ($listing->{status} eq "pending");
|
||||
$var{'lastUpdated.epoch'} = $listing->{lastupdated};
|
||||
$var{'lastUpdated.date'} = WebGUI::DateTime::epochToHuman($listing->{lastUpdated},"%z");
|
||||
|
|
@ -1000,7 +1000,7 @@ sub www_viewDetail {
|
|||
$f->email(
|
||||
-extras=>'class="content"',
|
||||
-name=>"from",
|
||||
-value=>$session{user}{email},
|
||||
-value=>$self->session->user->profileField("email"),
|
||||
-label=>WebGUI::International::get('your email','Asset_Matrix'),
|
||||
);
|
||||
$f->selectBox(
|
||||
|
|
@ -1027,8 +1027,8 @@ sub www_viewDetail {
|
|||
$var{views} = $listing->{views};
|
||||
$var{compares} = $listing->{compares};
|
||||
$var{clicks} = $listing->{clicks};
|
||||
my $sth = WebGUI::SQL->read("select a.value, b.name, b.label, b.description, category from Matrix_listingData a left join
|
||||
Matrix_field b on a.fieldId=b.fieldId where listingId=".quote($listingId)." order by b.label");
|
||||
my $sth = $self->session->db->read("select a.value, b.name, b.label, b.description, category from Matrix_listingData a left join
|
||||
Matrix_field b on a.fieldId=b.fieldId where listingId=".$self->session->db->quote($listingId)." order by b.label");
|
||||
while (my $data = $sth->hashRef) {
|
||||
$data->{description} =~ s/\n//g;
|
||||
$data->{description} =~ s/\r//g;
|
||||
|
|
@ -1037,7 +1037,7 @@ sub www_viewDetail {
|
|||
$data->{class} = lc($data->{value});
|
||||
$data->{class} =~ s/\s/_/g;
|
||||
$data->{class} =~ s/\W//g;
|
||||
my $cat = WebGUI::URL::urlize($data->{category})."_loop";
|
||||
my $cat = $self->session->url->urlize($data->{category})."_loop";
|
||||
push(@{$var{$cat}},$data);
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -1069,8 +1069,8 @@ sub www_viewDetail {
|
|||
-value=>"rate"
|
||||
);
|
||||
foreach my $category ($self->getCategories) {
|
||||
my ($mean,$median,$count) = WebGUI::SQL->quickArray("select meanValue, medianValue, countValue from Matrix_ratingSummary
|
||||
where listingId=".quote($listingId)." and category=".quote($category));
|
||||
my ($mean,$median,$count) = $self->session->db->quickArray("select meanValue, medianValue, countValue from Matrix_ratingSummary
|
||||
where listingId=".$self->session->db->quote($listingId)." and category=".$self->session->db->quote($category));
|
||||
$ratingsTable .= '<tr><th>'.$category.'</th><td>'.$mean.'</td><td>'.$median.'</td><td>'.$count.'</td></tr>';
|
||||
$f->selectBox(
|
||||
-name=>$category,
|
||||
|
|
@ -1115,15 +1115,15 @@ sub www_viewRatingDetails {
|
|||
Matrix_ratingSummary
|
||||
on
|
||||
Matrix_listing.listingId=Matrix_ratingSummary.listingId and
|
||||
Matrix_ratingSummary.category=".quote($category)."
|
||||
Matrix_ratingSummary.category=".$self->session->db->quote($category)."
|
||||
where
|
||||
Matrix_listing.assetId=".quote($self->getId)." and
|
||||
Matrix_listing.assetId=".$self->session->db->quote($self->getId)." and
|
||||
Matrix_listing.status='approved' and
|
||||
Matrix_ratingSummary.countValue > 0
|
||||
order by
|
||||
Matrix_ratingSummary.meanValue desc
|
||||
";
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
my $sth = $self->session->db->read($sql);
|
||||
while (my $data = $sth->hashRef) {
|
||||
push(@detailloop,{
|
||||
url=>$self->formatURL("viewDetail",$data->{listingId}),
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ sub getEditForm {
|
|||
);
|
||||
$tabform->hidden({
|
||||
name=>"returnUrl",
|
||||
value=>$session{form}{returnUrl}
|
||||
value=>$self->session->form->process("returnUrl")
|
||||
});
|
||||
my ($descendantsChecked, $ancestorsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my @assetsToInclude = split("\n",$self->getValue("assetsToInclude"));
|
||||
|
|
@ -282,11 +282,11 @@ sub getToolbar {
|
|||
my $self = shift;
|
||||
if ($self->getToolbarState) {
|
||||
my $returnUrl;
|
||||
if (exists $session{asset}) {
|
||||
$returnUrl = ";proceed=goBackToPage;returnUrl=".WebGUI::URL::escape($session{asset}->getUrl);
|
||||
if (exists $self->session->asset) {
|
||||
$returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl);
|
||||
}
|
||||
my $toolbar;
|
||||
if (!$self->isLocked || $self->get("isLockedBy") eq $session{user}{userId}) {
|
||||
if (!$self->isLocked || $self->get("isLockedBy") eq $self->session->user->profileField("userId")) {
|
||||
$toolbar = editIcon('func=edit'.$returnUrl,$self->get("url"));
|
||||
}
|
||||
my $i18n = WebGUI::International->new("Asset");
|
||||
|
|
@ -308,8 +308,8 @@ sub view {
|
|||
my $self = shift;
|
||||
# we've got to determine what our start point is based upon user conditions
|
||||
my $start;
|
||||
$session{asset} = WebGUI::Asset->newByUrl unless (exists $session{asset});
|
||||
my $current = $session{asset};
|
||||
$self->session->asset = WebGUI::Asset->newByUrl unless (exists $self->session->asset);
|
||||
my $current = $self->session->asset;
|
||||
if ($self->get("startType") eq "specificUrl") {
|
||||
$start = WebGUI::Asset->newByUrl($self->get("startPoint"));
|
||||
} elsif ($self->get("startType") eq "relativeToRoot") {
|
||||
|
|
@ -334,7 +334,7 @@ sub view {
|
|||
}
|
||||
$var->{'currentPage.menuTitle'} = $current->getMenuTitle;
|
||||
$var->{'currentPage.title'} = $current->getTitle;
|
||||
$var->{'currentPage.isHome'} = ($current->getId eq $session{setting}{defaultPage});
|
||||
$var->{'currentPage.isHome'} = ($current->getId eq $self->session->setting->get("defaultPage"));
|
||||
$var->{'currentPage.url'} = $current->getUrl;
|
||||
$var->{'currentPage.hasChild'} = $current->hasChildren;
|
||||
my $currentLineage = $current->get("lineage");
|
||||
|
|
@ -370,8 +370,8 @@ sub view {
|
|||
$pageData->{"page.isSystem"} = $asset->get("isSystem");
|
||||
$pageData->{"page.isHidden"} = $asset->get("isHidden");
|
||||
$pageData->{"page.isViewable"} = $asset->canView;
|
||||
$pageData->{'page.isContainer'} = isIn($asset->get('className'), @{$session{config}{assetContainers}});
|
||||
$pageData->{'page.isUtility'} = isIn($asset->get('className'), @{$session{config}{utilityAssets}});
|
||||
$pageData->{'page.isContainer'} = isIn($asset->get('className'), @{$self->session->config->get("assetContainers")});
|
||||
$pageData->{'page.isUtility'} = isIn($asset->get('className'), @{$self->session->config->get("utilityAssets")});
|
||||
$pageData->{"page.url"} = $asset->getUrl;
|
||||
my $indent = $pageData->{"page.relDepth"};
|
||||
$pageData->{"page.indent_loop"} = [];
|
||||
|
|
@ -433,14 +433,14 @@ sub view {
|
|||
($lastChildren{@{$var->{page_loop}}[$counter]->{"page.parent.assetId"}}
|
||||
eq @{$var->{page_loop}}[$counter]->{"page.assetId"});
|
||||
}
|
||||
#use Data::Dumper;WebGUI::ErrorHandler::warn(Dumper($var));
|
||||
#use Data::Dumper;$self->session->errorHandler->warn(Dumper($var));
|
||||
return $self->processTemplate($var,$self->get("templateId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_goBackToPage {
|
||||
my $self = shift;
|
||||
WebGUI::HTTP::setRedirect($session{form}{returnUrl}) if ($session{form}{returnUrl});
|
||||
WebGUI::HTTP::setRedirect($self->session->form->process("returnUrl")) if ($self->session->form->process("returnUrl"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -449,16 +449,16 @@ sub www_goBackToPage {
|
|||
# we eventually should reaadd this
|
||||
sub www_preview {
|
||||
my $self = shift;
|
||||
$session{var}{adminOn} = 0;
|
||||
$self->session->var->get("adminOn") = 0;
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $nav = WebGUI::Navigation->new( depth=>$session{form}{depth},
|
||||
method=>$session{form}{method},
|
||||
startAt=>$session{form}{startAt},
|
||||
stopAtLevel=>$session{form}{stopAtLevel},
|
||||
templateId=>$session{form}{templateId},
|
||||
showSystemPages=>$session{form}{showSystemPages},
|
||||
showHiddenPages=>$session{form}{showHiddenPages},
|
||||
showUnprivilegedPages=>$session{form}{showUnprivilegedPages},
|
||||
my $nav = WebGUI::Navigation->new( depth=>$self->session->form->process("depth"),
|
||||
method=>$self->session->form->process("method"),
|
||||
startAt=>$self->session->form->process("startAt"),
|
||||
stopAtLevel=>$self->session->form->process("stopAtLevel"),
|
||||
templateId=>$self->session->form->process("templateId"),
|
||||
showSystemPages=>$self->session->form->process("showSystemPages"),
|
||||
showHiddenPages=>$self->session->form->process("showHiddenPages"),
|
||||
showUnprivilegedPages=>$self->session->form->process("showUnprivilegedPages"),
|
||||
'reverse'=>$session{form}{'reverse'},
|
||||
);
|
||||
my $output = qq(
|
||||
|
|
@ -468,22 +468,22 @@ sub www_preview {
|
|||
</td><td class="tableHeader" valign="top">Output</td></tr>
|
||||
<tr><td class="tableHeader" valign="top">
|
||||
<font size=1>
|
||||
Identifier: $session{form}{identifier}<br />
|
||||
startAt: $session{form}{startAt}<br />
|
||||
method: $session{form}{method}<br />
|
||||
stopAtLevel: $session{form}{stopAtLevel}<br />
|
||||
depth: $session{form}{depth}<br />
|
||||
templateId: $session{form}{templateId}<br />
|
||||
Identifier: $self->session->form->process("identifier")<br />
|
||||
startAt: $self->session->form->process("startAt")<br />
|
||||
method: $self->session->form->process("method")<br />
|
||||
stopAtLevel: $self->session->form->process("stopAtLevel")<br />
|
||||
depth: $self->session->form->process("depth")<br />
|
||||
templateId: $self->session->form->process("templateId")<br />
|
||||
reverse: $session{form}{'reverse'}<br />
|
||||
showSystemPages: $session{form}{showSystemPages}<br />
|
||||
showHiddenPages: $session{form}{showHiddenPages}<br />
|
||||
showUnprivilegedPages: $session{form}{showUnprivilegedPages}<br />
|
||||
showSystemPages: $self->session->form->process("showSystemPages")<br />
|
||||
showHiddenPages: $self->session->form->process("showHiddenPages")<br />
|
||||
showUnprivilegedPages: $self->session->form->process("showUnprivilegedPages")<br />
|
||||
</font>
|
||||
</td><td class="tableData" valign="top">
|
||||
) . $nav->build . qq(</td></tr></table>);
|
||||
|
||||
# Because of the way the system is set up, the preview is cached. So let's remove it again...
|
||||
WebGUI::Cache->new($nav->{_identifier}."$session{page}{pageId}", "Navigation-".$session{config}{configFile})->delete;
|
||||
WebGUI::Cache->new($nav->{_identifier}."$session{page}{pageId}", "Navigation-".$self->session->config->getFilename)->delete;
|
||||
|
||||
return _submenu($output,"preview");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ our @ISA = qw(WebGUI::Asset::Wobject);
|
|||
#-------------------------------------------------------------------
|
||||
sub _hasVoted {
|
||||
my $self = shift;
|
||||
my ($hasVoted) = WebGUI::SQL->quickArray("select count(*) from Poll_answer
|
||||
where assetId=".quote($self->getId)." and ((userId=".quote($session{user}{userId})."
|
||||
and userId<>'1') or (userId=".quote($session{user}{userId})." and ipAddress='$session{env}{REMOTE_ADDR}'))");
|
||||
my ($hasVoted) = $self->session->db->quickArray("select count(*) from Poll_answer
|
||||
where assetId=".$self->session->db->quote($self->getId)." and ((userId=".$self->session->db->quote($self->session->user->profileField("userId"))."
|
||||
and userId<>'1') or (userId=".$self->session->db->quote($self->session->user->profileField("userId"))." and ipAddress='$self->session->env->get("REMOTE_ADDR")'))");
|
||||
return $hasVoted;
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ sub definition {
|
|||
sub duplicate {
|
||||
my $self = shift;
|
||||
my $newAsset = $self->SUPER::duplicate(shift);
|
||||
my $sth = WebGUI::SQL->read("select * from Poll_answer where assetId=".quote($self->getId));
|
||||
my $sth = $self->session->db->read("select * from Poll_answer where assetId=".$self->session->db->quote($self->getId));
|
||||
while (my $data = $sth->hashRef) {
|
||||
$newAsset->setVote($data->{answer}, $data->{userId}, $data->{ipAddress});
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ sub getEditForm {
|
|||
-hoverHelp=>WebGUI::International::get('4 description',"Asset_Poll"),
|
||||
-value=>[$self->getValue("voteGroup")]
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
$tabform->getTab("properties")->integer(
|
||||
-name=>"karmaPerVote",
|
||||
-label=>WebGUI::International::get(20,"Asset_Poll"),
|
||||
|
|
@ -238,7 +238,7 @@ sub getEditForm {
|
|||
-name=>"resetVotes",
|
||||
-label=>WebGUI::International::get(10,"Asset_Poll"),
|
||||
-hoverHelp=>WebGUI::International::get('10 description',"Asset_Poll")
|
||||
) if $session{form}{func} ne 'add';
|
||||
) if $self->session->form->process("func") ne 'add';
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
|
|
@ -247,19 +247,19 @@ sub processPropertiesFromFormPost {
|
|||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
my (@answer, $i, $property);
|
||||
@answer = split("\n",$session{form}{answers});
|
||||
@answer = split("\n",$self->session->form->process("answers"));
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
$property->{'a'.$i} = $answer[($i-1)];
|
||||
}
|
||||
$self->update($property);
|
||||
WebGUI::SQL->write("delete from Poll_answer where assetId=".quote($self->getId)) if ($session{form}{resetVotes});
|
||||
$self->session->db->write("delete from Poll_answer where assetId=".$self->session->db->quote($self->getId)) if ($self->session->form->process("resetVotes"));
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
WebGUI::SQL->write("delete from Poll_answer where assetId=".quote($self->getId));
|
||||
$self->session->db->write("delete from Poll_answer where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->SUPER::purge();
|
||||
}
|
||||
|
||||
|
|
@ -269,8 +269,8 @@ sub setVote {
|
|||
my $answer = shift;
|
||||
my $userId = shift;
|
||||
my $ip = shift;
|
||||
WebGUI::SQL->write("insert into Poll_answer (assetId, answer, userId, ipAddress) values (".quote($self->getId).",
|
||||
".quote($answer).", ".quote($userId).", '$ip')");
|
||||
$self->session->db->write("insert into Poll_answer (assetId, answer, userId, ipAddress) values (".$self->session->db->quote($self->getId).",
|
||||
".$self->session->db->quote($answer).", ".$self->session->db->quote($userId).", '$ip')");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -280,7 +280,7 @@ sub view {
|
|||
$var{question} = $self->get("question");
|
||||
if ($self->get("active") eq "0") {
|
||||
$showPoll = 0;
|
||||
} elsif (WebGUI::Grouping::isInGroup($self->get("voteGroup"),$session{user}{userId})) {
|
||||
} elsif (WebGUI::Grouping::isInGroup($self->get("voteGroup"),$self->session->user->profileField("userId"))) {
|
||||
if ($self->_hasVoted()) {
|
||||
$showPoll = 0;
|
||||
} else {
|
||||
|
|
@ -290,7 +290,7 @@ sub view {
|
|||
$showPoll = 0;
|
||||
}
|
||||
$var{canVote} = $showPoll;
|
||||
my ($totalResponses) = WebGUI::SQL->quickArray("select count(*) from Poll_answer where assetId=".quote($self->getId));
|
||||
my ($totalResponses) = $self->session->db->quickArray("select count(*) from Poll_answer where assetId=".$self->session->db->quote($self->getId));
|
||||
$var{"responses.label"} = WebGUI::International::get(12,"Asset_Poll");
|
||||
$var{"responses.total"} = $totalResponses;
|
||||
$var{"form.start"} = WebGUI::Form::formHeader({action=>$self->getUrl});
|
||||
|
|
@ -300,8 +300,8 @@ sub view {
|
|||
$totalResponses = 1 if ($totalResponses < 1);
|
||||
for (my $i=1; $i<=20; $i++) {
|
||||
if ($self->get('a'.$i) =~ /\C/) {
|
||||
my ($tally) = WebGUI::SQL->quickArray("select count(*) from Poll_answer where answer='a"
|
||||
.$i."' and assetId=".quote($self->getId)." group by answer");
|
||||
my ($tally) = $self->session->db->quickArray("select count(*) from Poll_answer where answer='a"
|
||||
.$i."' and assetId=".$self->session->db->quote($self->getId)." group by answer");
|
||||
push(@answers,{
|
||||
"answer.form"=>WebGUI::Form::radio({name=>"answer",value=>"a".$i}),
|
||||
"answer.text"=>$self->get('a'.$i),
|
||||
|
|
@ -330,10 +330,10 @@ sub view {
|
|||
sub www_vote {
|
||||
my $self = shift;
|
||||
my $u;
|
||||
if ($session{form}{answer} ne "" && WebGUI::Grouping::isInGroup($self->get("voteGroup")) && !($self->_hasVoted())) {
|
||||
$self->setVote($session{form}{answer},$session{user}{userId},$session{env}{REMOTE_ADDR});
|
||||
if ($session{setting}{useKarma}) {
|
||||
$u = WebGUI::User->new($session{user}{userId});
|
||||
if ($self->session->form->process("answer") ne "" && WebGUI::Grouping::isInGroup($self->get("voteGroup")) && !($self->_hasVoted())) {
|
||||
$self->setVote($self->session->form->process("answer"),$self->session->user->profileField("userId"),$self->session->env->get("REMOTE_ADDR"));
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
$u = WebGUI::User->new($self->session->user->profileField("userId"));
|
||||
$u->karma($self->get("karmaPerVote"),"Poll (".$self->getId.")","Voted on this poll.");
|
||||
}
|
||||
$self->deletePageCache;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ sub _save {
|
|||
return "";
|
||||
}
|
||||
$file->generateThumbnail($filename);
|
||||
WebGUI::SQL->write("update Product set $_[0]=".quote($file->getId)." where assetId=".quote($self->getId)." and revisionDate=".quote($self->get("revisionDate")));
|
||||
$self->session->db->write("update Product set $_[0]=".$self->session->db->quote($file->getId)." where assetId=".$self->session->db->quote($self->getId)." and revisionDate=".$self->session->db->quote($self->get("revisionDate")));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -86,7 +86,7 @@ sub addRevision {
|
|||
if ($self->get($field)) {
|
||||
my $newStorage = WebGUI::Storage->get($self->get($field))->copy;
|
||||
$newSelf->update({$field=>$newStorage->getId});
|
||||
WebGUI::SQL->write("update Product set $field=".quote($newStorage->getId)." where assetId=".quote($newSelf->getId)." and revisionDate=".quote($newSelf->get("revisionDate")));
|
||||
$self->session->db->write("update Product set $field=".$self->session->db->quote($newStorage->getId)." where assetId=".$self->session->db->quote($newSelf->getId)." and revisionDate=".$self->session->db->quote($newSelf->get("revisionDate")));
|
||||
}
|
||||
}
|
||||
return $newSelf;
|
||||
|
|
@ -158,7 +158,7 @@ sub duplicate {
|
|||
$self->_duplicateFile($newAsset,"brochure");
|
||||
$self->_duplicateFile($newAsset,"warranty");
|
||||
|
||||
$sth = WebGUI::SQL->read("select * from Product_feature where assetId=".quote($self->getId));
|
||||
$sth = $self->session->db->read("select * from Product_feature where assetId=".$self->session->db->quote($self->getId));
|
||||
while ($row = $sth->hashRef) {
|
||||
$row->{"Product_featureId"} = "new";
|
||||
$row->{"assetId"} = $newAsset->getId;
|
||||
|
|
@ -166,7 +166,7 @@ sub duplicate {
|
|||
}
|
||||
$sth->finish;
|
||||
|
||||
$sth = WebGUI::SQL->read("select * from Product_benefit where assetId=".quote($self->getId));
|
||||
$sth = $self->session->db->read("select * from Product_benefit where assetId=".$self->session->db->quote($self->getId));
|
||||
while ($row = $sth->hashRef) {
|
||||
$row->{"Product_benefitId"} = "new";
|
||||
$row->{"assetId"} = $newAsset->getId;
|
||||
|
|
@ -174,7 +174,7 @@ sub duplicate {
|
|||
}
|
||||
$sth->finish;
|
||||
|
||||
$sth = WebGUI::SQL->read("select * from Product_specification where assetId=".quote($self->getId));
|
||||
$sth = $self->session->db->read("select * from Product_specification where assetId=".$self->session->db->quote($self->getId));
|
||||
while ($row = $sth->hashRef) {
|
||||
$row->{"Product_specificationId"} = "new";
|
||||
$row->{"assetId"} = $newAsset->getId;
|
||||
|
|
@ -182,15 +182,15 @@ sub duplicate {
|
|||
}
|
||||
$sth->finish;
|
||||
|
||||
$sth = WebGUI::SQL->read("select * from Product_accessory where assetId=".quote($self->getId));
|
||||
$sth = $self->session->db->read("select * from Product_accessory where assetId=".$self->session->db->quote($self->getId));
|
||||
while (%data = $sth->hash) {
|
||||
WebGUI::SQL->write("insert into Product_accessory (assetId,accessoryAssetId,sequenceNumber) values (".quote($newAsset->getId).", ".quote($data{accessoryAssetId}).", $data{sequenceNumber})");
|
||||
$self->session->db->write("insert into Product_accessory (assetId,accessoryAssetId,sequenceNumber) values (".$self->session->db->quote($newAsset->getId).", ".$self->session->db->quote($data{accessoryAssetId}).", $data{sequenceNumber})");
|
||||
}
|
||||
$sth->finish;
|
||||
|
||||
$sth = WebGUI::SQL->read("select * from Product_related where assetId=".quote($self->getId));
|
||||
$sth = $self->session->db->read("select * from Product_related where assetId=".$self->session->db->quote($self->getId));
|
||||
while (%data = $sth->hash) {
|
||||
WebGUI::SQL->write("insert into Product_related (assetId,relatedAssetId,sequenceNumber) values (".quote($newAsset->getId).", ".quote($data{relatedAssetId}).", $data{sequenceNumber})");
|
||||
$self->session->db->write("insert into Product_related (assetId,relatedAssetId,sequenceNumber) values (".$self->session->db->quote($newAsset->getId).", ".$self->session->db->quote($data{relatedAssetId}).", $data{sequenceNumber})");
|
||||
}
|
||||
$sth->finish;
|
||||
return $newAsset;
|
||||
|
|
@ -278,7 +278,7 @@ sub getThumbnailUrl {
|
|||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my $self = shift;
|
||||
my $sth = WebGUI::SQL->read("select image1, image2, image3, brochure, manual, warranty from Product where assetId=".quote($self->getId));
|
||||
my $sth = $self->session->db->read("select image1, image2, image3, brochure, manual, warranty from Product where assetId=".$self->session->db->quote($self->getId));
|
||||
while (my @array = $sth->array) {
|
||||
foreach my $id (@array){
|
||||
next if ($id eq "");
|
||||
|
|
@ -286,11 +286,11 @@ sub purge {
|
|||
}
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::SQL->write("delete from Product_accessory where assetId=".quote($self->getId)." or accessoryAssetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Product_related where assetId=".quote($self->getId)." or relatedAssetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Product_benefit where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Product_feature where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("delete from Product_specification where assetId=".quote($self->getId));
|
||||
$self->session->db->write("delete from Product_accessory where assetId=".$self->session->db->quote($self->getId)." or accessoryAssetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Product_related where assetId=".$self->session->db->quote($self->getId)." or relatedAssetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Product_benefit where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Product_feature where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("delete from Product_specification where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->SUPER::purge();
|
||||
}
|
||||
|
||||
|
|
@ -317,9 +317,9 @@ sub www_addAccessory {
|
|||
-name => "func",
|
||||
-value => "addAccessorySave",
|
||||
);
|
||||
@usedAccessories = WebGUI::SQL->buildArray("select accessoryAssetId from Product_accessory where assetId=".quote($self->getId));
|
||||
@usedAccessories = $self->session->db->buildArray("select accessoryAssetId from Product_accessory where assetId=".$self->session->db->quote($self->getId));
|
||||
push(@usedAccessories,$self->getId);
|
||||
$accessory = WebGUI::SQL->buildHashRef("select asset.assetId, assetData.title from asset left join assetData on assetData.assetId=asset.assetId where asset.className='WebGUI::Asset::Wobject::Product' and asset.assetId not in (".quoteAndJoin(\@usedAccessories).") and (assetData.status='approved' or assetData.tagId=".quote($session{scratch}{versionTag}).") group by assetData.assetId");
|
||||
$accessory = $self->session->db->buildHashRef("select asset.assetId, assetData.title from asset left join assetData on assetData.assetId=asset.assetId where asset.className='WebGUI::Asset::Wobject::Product' and asset.assetId not in (".$self->session->db->quoteAndJoin(\@usedAccessories).") and (assetData.status='approved' or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).") group by assetData.assetId");
|
||||
$f->selectBox(
|
||||
-name => "accessoryAccessId",
|
||||
-options => $accessory,
|
||||
|
|
@ -339,10 +339,10 @@ sub www_addAccessory {
|
|||
sub www_addAccessorySave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
return "" unless ($session{form}{accessoryAccessId});
|
||||
my ($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from Product_accessory where assetId=".quote($self->getId()));
|
||||
WebGUI::SQL->write("insert into Product_accessory (assetId,accessoryAssetId,sequenceNumber) values (".quote($self->getId()).",".quote($session{form}{accessoryAccessId}).",".($seq+1).")");
|
||||
return "" unless($session{form}{proceed});
|
||||
return "" unless ($self->session->form->process("accessoryAccessId"));
|
||||
my ($seq) = $self->session->db->quickArray("select max(sequenceNumber) from Product_accessory where assetId=".$self->session->db->quote($self->getId()));
|
||||
$self->session->db->write("insert into Product_accessory (assetId,accessoryAssetId,sequenceNumber) values (".$self->session->db->quote($self->getId()).",".$self->session->db->quote($self->session->form->process("accessoryAccessId")).",".($seq+1).")");
|
||||
return "" unless($self->session->form->process("proceed"));
|
||||
return $self->www_addAccessory();
|
||||
}
|
||||
|
||||
|
|
@ -356,9 +356,9 @@ sub www_addRelated {
|
|||
-name => "func",
|
||||
-value => "addRelatedSave",
|
||||
);
|
||||
@usedRelated = WebGUI::SQL->buildArray("select relatedAssetId from Product_related where assetId=".quote($self->getId));
|
||||
@usedRelated = $self->session->db->buildArray("select relatedAssetId from Product_related where assetId=".$self->session->db->quote($self->getId));
|
||||
push(@usedRelated,$self->getId);
|
||||
$related = WebGUI::SQL->buildHashRef("select assetId,title from asset where className='WebGUI::Asset::Wobject::Product' and assetId not in (".quoteAndJoin(\@usedRelated).")");
|
||||
$related = $self->session->db->buildHashRef("select assetId,title from asset where className='WebGUI::Asset::Wobject::Product' and assetId not in (".$self->session->db->quoteAndJoin(\@usedRelated).")");
|
||||
$f->selectBox(
|
||||
-name => "relatedAssetId",
|
||||
-options => $related,
|
||||
|
|
@ -378,10 +378,10 @@ sub www_addRelated {
|
|||
sub www_addRelatedSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
return "" unless ($session{form}{relatedAssetId});
|
||||
my ($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from Product_related where assetId=".quote($self->getId));
|
||||
WebGUI::SQL->write("insert into Product_related (assetId,relatedAssetId,sequenceNumber) values (".quote($self->getId).",".quote($session{form}{relatedAssetId}).",".($seq+1).")");
|
||||
return "" unless($session{form}{proceed});
|
||||
return "" unless ($self->session->form->process("relatedAssetId"));
|
||||
my ($seq) = $self->session->db->quickArray("select max(sequenceNumber) from Product_related where assetId=".$self->session->db->quote($self->getId));
|
||||
$self->session->db->write("insert into Product_related (assetId,relatedAssetId,sequenceNumber) values (".$self->session->db->quote($self->getId).",".$self->session->db->quote($self->session->form->process("relatedAssetId")).",".($seq+1).")");
|
||||
return "" unless($self->session->form->process("proceed"));
|
||||
return $self->www_addRelated();
|
||||
}
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ sub www_addRelatedSave {
|
|||
sub www_deleteAccessoryConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
WebGUI::SQL->write("delete from Product_accessory where assetId=".quote($self->getId())." and accessoryAssetId=".quote($session{form}{aid}));
|
||||
$self->session->db->write("delete from Product_accessory where assetId=".$self->session->db->quote($self->getId())." and accessoryAssetId=".$self->session->db->quote($self->session->form->process("aid")));
|
||||
$self->reorderCollateral("Product_accessory","accessoryAssetId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -398,7 +398,7 @@ sub www_deleteAccessoryConfirm {
|
|||
sub www_deleteBenefitConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->deleteCollateral("Product_benefit","Product_benefitId",$session{form}{bid});
|
||||
$self->deleteCollateral("Product_benefit","Product_benefitId",$self->session->form->process("bid"));
|
||||
$self->reorderCollateral("Product_benefit","Product_benefitId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -407,7 +407,7 @@ sub www_deleteBenefitConfirm {
|
|||
sub www_deleteFeatureConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->deleteCollateral("Product_feature","Product_featureId",$session{form}{fid});
|
||||
$self->deleteCollateral("Product_feature","Product_featureId",$self->session->form->process("fid"));
|
||||
$self->reorderCollateral("Product_feature","Product_featureId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@ sub www_deleteFeatureConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteFileConfirm {
|
||||
my $self = shift;
|
||||
my $column = $session{form}{file};
|
||||
my $column = $self->session->form->process("file");
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
my $store = $self->get($column);
|
||||
my $file = WebGUI::Storage->get($store);
|
||||
|
|
@ -428,7 +428,7 @@ sub www_deleteFileConfirm {
|
|||
sub www_deleteRelatedConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
WebGUI::SQL->write("delete from Product_related where assetId=".quote($self->getId)." and relatedAssetId=".quote($session{form}{rid}));
|
||||
$self->session->db->write("delete from Product_related where assetId=".$self->session->db->quote($self->getId)." and relatedAssetId=".$self->session->db->quote($self->session->form->process("rid")));
|
||||
$self->reorderCollateral("Product_related","relatedAssetId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -437,7 +437,7 @@ sub www_deleteRelatedConfirm {
|
|||
sub www_deleteSpecificationConfirm {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->deleteCollateral("Product_specification","Product_specificationId",$session{form}{sid});
|
||||
$self->deleteCollateral("Product_specification","Product_specificationId",$self->session->form->process("sid"));
|
||||
$self->reorderCollateral("Product_specification","Product_specificationId");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ sub www_editBenefit {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
my ($data, $f, $benefits);
|
||||
$data = $self->getCollateral("Product_benefit","Product_benefitId",$session{form}{bid});
|
||||
$data = $self->getCollateral("Product_benefit","Product_benefitId",$self->session->form->process("bid"));
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "bid",
|
||||
|
|
@ -478,7 +478,7 @@ sub www_editBenefit {
|
|||
-name => "func",
|
||||
-value => "editBenefitSave",
|
||||
);
|
||||
$benefits = WebGUI::SQL->buildHashRef("select benefit,benefit from Product_benefit order by benefit");
|
||||
$benefits = $self->session->db->buildHashRef("select benefit,benefit from Product_benefit order by benefit");
|
||||
$f->combo(
|
||||
-name => "benefit",
|
||||
-options => $benefits,
|
||||
|
|
@ -499,14 +499,14 @@ sub www_editBenefit {
|
|||
sub www_editBenefitSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$session{form}{benefit} = $session{form}{benefit_new} if ($session{form}{benefit_new} ne "");
|
||||
$self->session->form->process("benefit") = $self->session->form->process("benefit_new") if ($self->session->form->process("benefit_new") ne "");
|
||||
$self->setCollateral("Product_benefit", "Product_benefitId", {
|
||||
Product_benefitId => $session{form}{bid},
|
||||
benefit => $session{form}{benefit}
|
||||
Product_benefitId => $self->session->form->process("bid"),
|
||||
benefit => $self->session->form->process("benefit")
|
||||
});
|
||||
|
||||
return "" unless($session{form}{proceed});
|
||||
$session{form}{bid} = "new";
|
||||
return "" unless($self->session->form->process("proceed"));
|
||||
$self->session->form->process("bid") = "new";
|
||||
return $self->www_editBenefit();
|
||||
}
|
||||
|
||||
|
|
@ -515,7 +515,7 @@ sub www_editFeature {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
my ($data, $f, $features);
|
||||
$data = $self->getCollateral("Product_feature","Product_featureId",$session{form}{fid});
|
||||
$data = $self->getCollateral("Product_feature","Product_featureId",$self->session->form->process("fid"));
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "fid",
|
||||
|
|
@ -525,7 +525,7 @@ sub www_editFeature {
|
|||
-name => "func",
|
||||
-value => "editFeatureSave",
|
||||
);
|
||||
$features = WebGUI::SQL->buildHashRef("select feature,feature from Product_feature order by feature");
|
||||
$features = $self->session->db->buildHashRef("select feature,feature from Product_feature order by feature");
|
||||
$f->combo(
|
||||
-name => "feature",
|
||||
-options => $features,
|
||||
|
|
@ -546,13 +546,13 @@ sub www_editFeature {
|
|||
sub www_editFeatureSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$session{form}{feature} = $session{form}{feature_new} if ($session{form}{feature_new} ne "");
|
||||
$self->session->form->process("feature") = $self->session->form->process("feature_new") if ($self->session->form->process("feature_new") ne "");
|
||||
$self->setCollateral("Product_feature", "Product_featureId", {
|
||||
Product_featureId => $session{form}{fid},
|
||||
feature => $session{form}{feature}
|
||||
Product_featureId => $self->session->form->process("fid"),
|
||||
feature => $self->session->form->process("feature")
|
||||
});
|
||||
return "" unless($session{form}{proceed});
|
||||
$session{form}{fid} = "new";
|
||||
return "" unless($self->session->form->process("proceed"));
|
||||
$self->session->form->process("fid") = "new";
|
||||
return $self->www_editFeature();
|
||||
}
|
||||
|
||||
|
|
@ -561,7 +561,7 @@ sub www_editSpecification {
|
|||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
my ($data, $f, $hashRef);
|
||||
$data = $self->getCollateral("Product_specification","Product_specificationId",$session{form}{sid});
|
||||
$data = $self->getCollateral("Product_specification","Product_specificationId",$self->session->form->process("sid"));
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "sid",
|
||||
|
|
@ -571,7 +571,7 @@ sub www_editSpecification {
|
|||
-name => "func",
|
||||
-value => "editSpecificationSave",
|
||||
);
|
||||
$hashRef = WebGUI::SQL->buildHashRef("select name,name from Product_specification order by name");
|
||||
$hashRef = $self->session->db->buildHashRef("select name,name from Product_specification order by name");
|
||||
$f->combo(
|
||||
-name => "name",
|
||||
-options => $hashRef,
|
||||
|
|
@ -585,7 +585,7 @@ sub www_editSpecification {
|
|||
-hoverHelp => WebGUI::International::get('27 description','Asset_Product'),
|
||||
-value => $data->{value},
|
||||
);
|
||||
$hashRef = WebGUI::SQL->buildHashRef("select units,units from Product_specification order by units");
|
||||
$hashRef = $self->session->db->buildHashRef("select units,units from Product_specification order by units");
|
||||
$f->combo(
|
||||
-name => "units",
|
||||
-options => $hashRef,
|
||||
|
|
@ -606,17 +606,17 @@ sub www_editSpecification {
|
|||
sub www_editSpecificationSave {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$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 "");
|
||||
$self->session->form->process("name") = $self->session->form->process("name_new") if ($self->session->form->process("name_new") ne "");
|
||||
$self->session->form->process("units") = $self->session->form->process("units_new") if ($self->session->form->process("units_new") ne "");
|
||||
$self->setCollateral("Product_specification", "Product_specificationId", {
|
||||
Product_specificationId => $session{form}{sid},
|
||||
name => $session{form}{name},
|
||||
value => $session{form}{value},
|
||||
units => $session{form}{units}
|
||||
Product_specificationId => $self->session->form->process("sid"),
|
||||
name => $self->session->form->process("name"),
|
||||
value => $self->session->form->process("value"),
|
||||
units => $self->session->form->process("units")
|
||||
});
|
||||
|
||||
return "" unless($session{form}{proceed});
|
||||
$session{form}{sid} = "new";
|
||||
return "" unless($self->session->form->process("proceed"));
|
||||
$self->session->form->process("sid") = "new";
|
||||
return $self->www_editSpecification();
|
||||
}
|
||||
|
||||
|
|
@ -624,7 +624,7 @@ sub www_editSpecificationSave {
|
|||
sub www_moveAccessoryDown {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralDown("Product_accessory","accessoryAssetId",$session{form}{aid});
|
||||
$self->moveCollateralDown("Product_accessory","accessoryAssetId",$self->session->form->process("aid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -632,7 +632,7 @@ sub www_moveAccessoryDown {
|
|||
sub www_moveAccessoryUp {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralUp("Product_accessory","accessoryAssetId",$session{form}{aid});
|
||||
$self->moveCollateralUp("Product_accessory","accessoryAssetId",$self->session->form->process("aid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +640,7 @@ sub www_moveAccessoryUp {
|
|||
sub www_moveBenefitDown {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralDown("Product_benefit","Product_benefitId",$session{form}{bid});
|
||||
$self->moveCollateralDown("Product_benefit","Product_benefitId",$self->session->form->process("bid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -648,7 +648,7 @@ sub www_moveBenefitDown {
|
|||
sub www_moveBenefitUp {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralUp("Product_benefit","Product_benefitId",$session{form}{bid});
|
||||
$self->moveCollateralUp("Product_benefit","Product_benefitId",$self->session->form->process("bid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -656,7 +656,7 @@ sub www_moveBenefitUp {
|
|||
sub www_moveFeatureDown {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralDown("Product_feature","Product_featureId",$session{form}{fid});
|
||||
$self->moveCollateralDown("Product_feature","Product_featureId",$self->session->form->process("fid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +664,7 @@ sub www_moveFeatureDown {
|
|||
sub www_moveFeatureUp {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralUp("Product_feature","Product_featureId",$session{form}{fid});
|
||||
$self->moveCollateralUp("Product_feature","Product_featureId",$self->session->form->process("fid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -672,7 +672,7 @@ sub www_moveFeatureUp {
|
|||
sub www_moveRelatedDown {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralDown("Product_related","relatedAssetId",$session{form}{rid});
|
||||
$self->moveCollateralDown("Product_related","relatedAssetId",$self->session->form->process("rid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -680,7 +680,7 @@ sub www_moveRelatedDown {
|
|||
sub www_moveRelatedUp {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralUp("Product_related","relatedAssetId",$session{form}{rid});
|
||||
$self->moveCollateralUp("Product_related","relatedAssetId",$self->session->form->process("rid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ sub www_moveRelatedUp {
|
|||
sub www_moveSpecificationDown {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralDown("Product_specification","Product_specificationId",$session{form}{sid});
|
||||
$self->moveCollateralDown("Product_specification","Product_specificationId",$self->session->form->process("sid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -696,14 +696,14 @@ sub www_moveSpecificationDown {
|
|||
sub www_moveSpecificationUp {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$self->moveCollateralUp("Product_specification","Product_specificationId",$session{form}{sid});
|
||||
$self->moveCollateralUp("Product_specification","Product_specificationId",$self->session->form->process("sid"));
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my (%data, $sth, $file, $segment, %var, @featureloop, @benefitloop, @specificationloop, @accessoryloop, @relatedloop);
|
||||
tie %data, 'Tie::CPHash';
|
||||
my $brochure = $self->get("brochure");
|
||||
|
|
@ -755,7 +755,7 @@ sub view {
|
|||
#---features
|
||||
$var{"addFeature.url"} = $self->getUrl('func=editFeature&fid=new');
|
||||
$var{"addFeature.label"} = WebGUI::International::get(34,'Asset_Product');
|
||||
$sth = WebGUI::SQL->read("select feature,Product_featureId from Product_feature where assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
$sth = $self->session->db->read("select feature,Product_featureId from Product_feature where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
$segment = deleteIcon('func=deleteFeatureConfirm&fid='.$data{Product_featureId},$self->get("url"),WebGUI::International::get(3,'Asset_Product'))
|
||||
.editIcon('func=editFeature&fid='.$data{Product_featureId},$self->get("url"))
|
||||
|
|
@ -772,7 +772,7 @@ sub view {
|
|||
#---benefits
|
||||
$var{"addBenefit.url"} = $self->getUrl('func=editBenefit&fid=new');
|
||||
$var{"addBenefit.label"} = WebGUI::International::get(55,'Asset_Product');
|
||||
$sth = WebGUI::SQL->read("select benefit,Product_benefitId from Product_benefit where assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
$sth = $self->session->db->read("select benefit,Product_benefitId from Product_benefit where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
$segment = deleteIcon('func=deleteBenefitConfirm&bid='.$data{Product_benefitId},$self->get("url"),WebGUI::International::get(48,'Asset_Product'))
|
||||
.editIcon('func=editBenefit&bid='.$data{Product_benefitId},$self->get("url"))
|
||||
|
|
@ -789,7 +789,7 @@ sub view {
|
|||
#---specifications
|
||||
$var{"addSpecification.url"} = $self->getUrl('func=editSpecification&sid=new');
|
||||
$var{"addSpecification.label"} = WebGUI::International::get(35,'Asset_Product');
|
||||
$sth = WebGUI::SQL->read("select name,value,units,Product_specificationId from Product_specification where assetId=".quote($self->getId)." order by sequenceNumber");
|
||||
$sth = $self->session->db->read("select name,value,units,Product_specificationId from Product_specification where assetId=".$self->session->db->quote($self->getId)." order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
$segment = deleteIcon('func=deleteSpecificationConfirm&sid='.$data{Product_specificationId},$self->get("url"),WebGUI::International::get(5,'Asset_Product'))
|
||||
.editIcon('func=editSpecification&sid='.$data{Product_specificationId},$self->get("url"))
|
||||
|
|
@ -808,8 +808,8 @@ sub view {
|
|||
#---accessories
|
||||
$var{"addaccessory.url"} = $self->getUrl('func=addAccessory');
|
||||
$var{"addaccessory.label"} = WebGUI::International::get(36,'Asset_Product');
|
||||
$sth = WebGUI::SQL->read("select Product_accessory.accessoryAssetId from Product_accessory
|
||||
where Product_accessory.assetId=".quote($self->getId)."
|
||||
$sth = $self->session->db->read("select Product_accessory.accessoryAssetId from Product_accessory
|
||||
where Product_accessory.assetId=".$self->session->db->quote($self->getId)."
|
||||
order by Product_accessory.sequenceNumber");
|
||||
while (my ($id) = $sth->array) {
|
||||
$segment = deleteIcon('func=deleteAccessoryConfirm&aid='.$id,$self->get("url"),WebGUI::International::get(2,'Asset_Product'))
|
||||
|
|
@ -828,9 +828,9 @@ sub view {
|
|||
#---related
|
||||
$var{"addrelatedproduct.url"} = $self->getUrl('func=addRelated');
|
||||
$var{"addrelatedproduct.label"} = WebGUI::International::get(37,'Asset_Product');
|
||||
$sth = WebGUI::SQL->read("select Product_related.relatedAssetId
|
||||
$sth = $self->session->db->read("select Product_related.relatedAssetId
|
||||
from Product_related
|
||||
where Product_related.assetId=".quote($self->getId)."
|
||||
where Product_related.assetId=".$self->session->db->quote($self->getId)."
|
||||
order by Product_related.sequenceNumber");
|
||||
while (my ($id) = $sth->array) {
|
||||
$segment = deleteIcon('func=deleteRelatedConfirm&rid='.$id,$self->get("url"),WebGUI::International::get(4,'Asset_Product'))
|
||||
|
|
|
|||
|
|
@ -331,8 +331,8 @@ sub _processQuery {
|
|||
my $url = $self->getUrl('func=view');
|
||||
foreach (keys %{$session{form}}) {
|
||||
unless ($_ eq "pn" || $_ eq "func" || $_ =~ /identifier/i || $_ =~ /password/i) {
|
||||
$url = WebGUI::URL::append($url, WebGUI::URL::escape($_)
|
||||
.'='.WebGUI::URL::escape($session{form}{$_}));
|
||||
$url = $self->session->url->append($url, $self->session->url->escape($_)
|
||||
.'='.$self->session->url->escape($session{form}{$_}));
|
||||
}
|
||||
}
|
||||
my $paginateAfter = $self->get("paginateAfter");
|
||||
|
|
@ -340,7 +340,7 @@ sub _processQuery {
|
|||
my $p = WebGUI::Paginator->new($url,$paginateAfter);
|
||||
my $error = $p->setDataByQuery($query,$dbh,1,$placeholderParams);
|
||||
if ($error ne "") {
|
||||
WebGUI::ErrorHandler::warn("There was a problem with the query: ".$error);
|
||||
$self->session->errorHandler->warn("There was a problem with the query: ".$error);
|
||||
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(11,"Asset_SQLReport")." ".$error});
|
||||
} else {
|
||||
my $first = 1;
|
||||
|
|
@ -390,12 +390,12 @@ sub _processQuery {
|
|||
}
|
||||
} else {
|
||||
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(10,"Asset_SQLReport")});
|
||||
WebGUI::ErrorHandler::warn("SQLReport [".$self->getId."] The SQL query is improperly formatted.");
|
||||
$self->session->errorHandler->warn("SQLReport [".$self->getId."] The SQL query is improperly formatted.");
|
||||
}
|
||||
$dbLink->disconnect;
|
||||
} else {
|
||||
push(@{$self->{_debug_loop}},{'debug.output'=>WebGUI::International::get(12,"Asset_SQLReport")});
|
||||
WebGUI::ErrorHandler::warn("SQLReport [".$self->getId."] Could not connect to database.");
|
||||
$self->session->errorHandler->warn("SQLReport [".$self->getId."] Could not connect to database.");
|
||||
}
|
||||
return \%var;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,8 +145,8 @@ Clears the session variables from session used by the stock list edit form
|
|||
|
||||
sub _clearStockEditSession {
|
||||
my $self = shift;
|
||||
$session{form}{symbol} = "";
|
||||
$session{form}{stockId} = "";
|
||||
$self->session->form->process("symbol") = "";
|
||||
$self->session->form->process("stockId") = "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -381,9 +381,9 @@ sub view {
|
|||
my $self = shift;
|
||||
my $var = {};
|
||||
#Set some template variables
|
||||
$var->{'extrasFolder'} = $session{config}{extrasURL}."/wobject/StockData";
|
||||
$var->{'extrasFolder'} = $self->session->config->get("extrasURL")."/wobject/StockData";
|
||||
$var->{'editUrl'} = $self->getUrl("func=editStocks");
|
||||
$var->{'isVisitor'} = $session{user}{userId} eq 1;
|
||||
$var->{'isVisitor'} = $self->session->user->profileField("userId") eq 1;
|
||||
$var->{'stock.display.url'} = $self->getUrl("func=displayStock&symbol=");
|
||||
|
||||
#Build list of stocks as an array
|
||||
|
|
@ -430,9 +430,9 @@ sub www_displayStock {
|
|||
my $var = {};
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView();
|
||||
|
||||
$var->{'extrasFolder'} = $session{config}{extrasURL}."/wobject/StockData";
|
||||
$var->{'extrasFolder'} = $self->session->config->get("extrasURL")."/wobject/StockData";
|
||||
|
||||
my $symbol = $session{form}{symbol};
|
||||
my $symbol = $self->session->form->process("symbol");
|
||||
my $data = $self->_getStocks([$symbol]);
|
||||
#Append Template Variables for stock symbol
|
||||
$self->_appendStockVars($var,$data,$symbol);
|
||||
|
|
@ -442,7 +442,7 @@ sub www_displayStock {
|
|||
$var->{'lastUpdate.intl'} = WebGUI::DateTime::epochToHuman($luEpoch,"%y-%m-%d");
|
||||
$var->{'lastUpdate.us'} = WebGUI::DateTime::epochToHuman($luEpoch,"%m/%d/%y");
|
||||
|
||||
$session{setting}{showDebug} = 0;
|
||||
$self->session->setting->get("showDebug") = 0;
|
||||
return $self->processTemplate($var, $self->get("displayTemplateId"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@ sub addSection {
|
|||
sub completeResponse {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
WebGUI::SQL->setRow("Survey_response","Survey_responseId",{
|
||||
$self->session->db->setRow("Survey_response","Survey_responseId",{
|
||||
'Survey_responseId'=>$responseId,
|
||||
isComplete=>1
|
||||
});
|
||||
WebGUI::Session::deleteScratch($self->getResponseIdString);
|
||||
$self->session->scratch->delete($self->getResponseIdString);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -140,7 +140,7 @@ sub duplicate {
|
|||
Survey_id=>$newSurveyId
|
||||
});
|
||||
|
||||
my $section = WebGUI::SQL->read("select * from Survey_section where Survey_id=".quote($self->get("Survey_id"))
|
||||
my $section = $self->session->db->read("select * from Survey_section where Survey_id=".$self->session->db->quote($self->get("Survey_id"))
|
||||
." order by sequenceNumber");
|
||||
while ($sdata = $section->hashRef) {
|
||||
$oldSectionId = $sdata->{Survey_sectionId};
|
||||
|
|
@ -148,17 +148,17 @@ sub duplicate {
|
|||
$sdata->{Survey_Id} = $newSurveyId;
|
||||
$sdata->{Survey_sectionId} = $newAsset->setCollateral("Survey_section", "Survey_sectionId",$sdata,1,0, "Survey_id");
|
||||
|
||||
my $questions = WebGUI::SQL->read("select * from Survey_question where Survey_id=".quote($self->get("Survey_id"))
|
||||
." and Survey_sectionId=".quote($oldSectionId)." order by sequenceNumber");
|
||||
my $questions = $self->session->db->read("select * from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id"))
|
||||
." and Survey_sectionId=".$self->session->db->quote($oldSectionId)." order by sequenceNumber");
|
||||
while ($qdata = $questions->hashRef) {
|
||||
my $answers = WebGUI::SQL->read("select * from Survey_answer where Survey_questionId=".quote($qdata->{Survey_questionId})
|
||||
my $answers = $self->session->db->read("select * from Survey_answer where Survey_questionId=".$self->session->db->quote($qdata->{Survey_questionId})
|
||||
." order by sequenceNumber");
|
||||
$qdata->{Survey_questionId} = "new";
|
||||
$qdata->{Survey_id} = $newSurveyId;
|
||||
$qdata->{Survey_sectionId} = $sdata->{Survey_sectionId};
|
||||
$qdata->{Survey_questionId} = $newAsset->setCollateral("Survey_question","Survey_questionId",$qdata,1,0,"Survey_id");
|
||||
while ($adata = $answers->hashRef) {
|
||||
my $responses = WebGUI::SQL->read("select * from Survey_questionResponse where Survey_answerId=".quote($adata->{Survey_answerId}));
|
||||
my $responses = $self->session->db->read("select * from Survey_questionResponse where Survey_answerId=".$self->session->db->quote($adata->{Survey_answerId}));
|
||||
$adata->{Survey_answerId} = "new";
|
||||
$adata->{Survey_questionId} = $qdata->{Survey_questionId};
|
||||
$adata->{Survey_id} = $newSurveyId;
|
||||
|
|
@ -192,15 +192,15 @@ sub generateResponseId {
|
|||
}
|
||||
my $ipAddress = $self->getIp;
|
||||
my $userId = $self->getUserId;
|
||||
my $responseId = WebGUI::SQL->setRow("Survey_response","Survey_responseId",{
|
||||
my $responseId = $self->session->db->setRow("Survey_response","Survey_responseId",{
|
||||
'Survey_responseId'=>"new",
|
||||
userId=>$userId,
|
||||
ipAddress=>$ipAddress,
|
||||
username=>$session{user}{username},
|
||||
username=>$self->session->user->profileField("username"),
|
||||
startDate=>WebGUI::DateTime::time(),
|
||||
'Survey_id'=>$self->get("Survey_id")
|
||||
});
|
||||
WebGUI::Session::setScratch($varname,$responseId);
|
||||
$self->session->scratch->set($varname,$responseId);
|
||||
return $responseId;
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ sub getEditForm {
|
|||
#-------------------------------------------------------------------
|
||||
sub getIp {
|
||||
my $self = shift;
|
||||
my $ip = ($self->get("anonymous")) ? substr(md5_hex($session{env}{REMOTE_ADDR}),0,8) : $session{env}{REMOTE_ADDR};
|
||||
my $ip = ($self->get("anonymous")) ? substr(md5_hex($self->session->env->get("REMOTE_ADDR")),0,8) : $self->session->env->get("REMOTE_ADDR");
|
||||
return $ip;
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ sub getMenuVars {
|
|||
#-------------------------------------------------------------------
|
||||
sub getQuestionCount {
|
||||
my $self = shift;
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey_question where Survey_id=".quote($self->get("Survey_id")));
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id")));
|
||||
return ($count < $self->getValue("questionsPerResponse")) ? $count : $self->getValue("questionsPerResponse");
|
||||
}
|
||||
|
||||
|
|
@ -396,7 +396,7 @@ sub getQuestionsLoop {
|
|||
sub getQuestionResponseCount {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse where Survey_responseId=".quote($responseId));
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Survey_questionResponse where Survey_responseId=".$self->session->db->quote($responseId));
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ sub getQuestionVars {
|
|||
my $self = shift;
|
||||
my $questionId = shift;
|
||||
my %var;
|
||||
my $question = WebGUI::SQL->getRow("Survey_question","Survey_questionId",$questionId);
|
||||
my $question = $self->session->db->getRow("Survey_question","Survey_questionId",$questionId);
|
||||
$var{'question.question'} = $question->{question};
|
||||
$var{'question.allowComment'} = $question->{allowComment};
|
||||
$var{'question.id'} = $question->{Survey_questionId};
|
||||
|
|
@ -415,7 +415,7 @@ sub getQuestionVars {
|
|||
$var{'question.comment.label'} = WebGUI::International::get(51,'Asset_Survey');
|
||||
|
||||
my $answer;
|
||||
($answer) = WebGUI::SQL->quickArray("select Survey_answerId from Survey_answer where Survey_questionId=".quote($question->{Survey_questionId}));
|
||||
($answer) = $self->session->db->quickArray("select Survey_answerId from Survey_answer where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId}));
|
||||
$var{'question.answer.field'} = WebGUI::Form::hidden({
|
||||
name=>'answerId_'.$questionId,
|
||||
value=>$answer
|
||||
|
|
@ -433,7 +433,7 @@ sub getQuestionVars {
|
|||
name=>'textResponse_'.$questionId
|
||||
});
|
||||
} else {
|
||||
my $answer = WebGUI::SQL->buildHashRef("select Survey_answerId,answer from Survey_answer where Survey_questionId=".quote($question->{Survey_questionId})." order by sequenceNumber");
|
||||
my $answer = $self->session->db->buildHashRef("select Survey_answerId,answer from Survey_answer where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId})." order by sequenceNumber");
|
||||
if ($question->{randomizeAnswers}) {
|
||||
$answer = randomizeHash($answer);
|
||||
}
|
||||
|
|
@ -450,12 +450,12 @@ sub getQuestionVars {
|
|||
sub getRandomQuestionIds {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
my @usedQuestionIds = WebGUI::SQL->buildArray("select Survey_questionId from Survey_questionResponse where Survey_responseId=".quote($responseId));
|
||||
my $where = " where Survey_id=".quote($self->get("Survey_id"));
|
||||
my @usedQuestionIds = $self->session->db->buildArray("select Survey_questionId from Survey_questionResponse where Survey_responseId=".$self->session->db->quote($responseId));
|
||||
my $where = " where Survey_id=".$self->session->db->quote($self->get("Survey_id"));
|
||||
if ($#usedQuestionIds+1 > 0) {
|
||||
$where .= " and Survey_questionId not in (".quoteAndJoin(\@usedQuestionIds).")";
|
||||
$where .= " and Survey_questionId not in (".$self->session->db->quoteAndJoin(\@usedQuestionIds).")";
|
||||
}
|
||||
my @questions = WebGUI::SQL->buildArray("select Survey_questionId from Survey_question".$where);
|
||||
my @questions = $self->session->db->buildArray("select Survey_questionId from Survey_question".$where);
|
||||
randomizeArray(\@questions);
|
||||
return @questions;
|
||||
}
|
||||
|
|
@ -465,8 +465,8 @@ sub getResponseCount {
|
|||
my $self = shift;
|
||||
my $ipAddress = $self->getIp;
|
||||
my $userId = $self->getUserId;
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey_response where Survey_id=".quote($self->get("Survey_id"))." and
|
||||
((userId<>'1' and userId=".quote($userId).") or ( userId='1' and ipAddress=".quote($ipAddress)."))");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Survey_response where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." and
|
||||
((userId<>'1' and userId=".$self->session->db->quote($userId).") or ( userId='1' and ipAddress=".$self->session->db->quote($ipAddress)."))");
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
|
@ -475,23 +475,23 @@ sub getResponseCount {
|
|||
sub getResponseDrivenQuestionIds {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
my $previousResponse = WebGUI::SQL->quickHashRef("select Survey_questionId, Survey_answerId from Survey_questionResponse
|
||||
where Survey_responseId=".quote($responseId)." order by dateOfResponse desc");
|
||||
my $previousResponse = $self->session->db->quickHashRef("select Survey_questionId, Survey_answerId from Survey_questionResponse
|
||||
where Survey_responseId=".$self->session->db->quote($responseId)." order by dateOfResponse desc");
|
||||
my $questionId;
|
||||
my @questions;
|
||||
if ($previousResponse->{Survey_answerId}) {
|
||||
($questionId) = WebGUI::SQL->quickArray("select gotoQuestion from Survey_answer where
|
||||
Survey_answerId=".quote($previousResponse->{Survey_answerId}));
|
||||
($questionId) = $self->session->db->quickArray("select gotoQuestion from Survey_answer where
|
||||
Survey_answerId=".$self->session->db->quote($previousResponse->{Survey_answerId}));
|
||||
unless ($questionId) {
|
||||
($questionId) = WebGUI::SQL->quickArray("select gotoQuestion from Survey_question where
|
||||
Survey_questionId=".quote($previousResponse->{Survey_questionId}));
|
||||
($questionId) = $self->session->db->quickArray("select gotoQuestion from Survey_question where
|
||||
Survey_questionId=".$self->session->db->quote($previousResponse->{Survey_questionId}));
|
||||
}
|
||||
unless ($questionId) { # terminate survey
|
||||
$self->completeResponse($responseId);
|
||||
return ();
|
||||
}
|
||||
} else {
|
||||
($questionId) = WebGUI::SQL->quickArray("select Survey_questionId from Survey_question where Survey_id=".quote($self->getValue("Survey_id"))."
|
||||
($questionId) = $self->session->db->quickArray("select Survey_questionId from Survey_question where Survey_id=".$self->session->db->quote($self->getValue("Survey_id"))."
|
||||
order by sequenceNumber");
|
||||
}
|
||||
push(@questions,$questionId);
|
||||
|
|
@ -502,16 +502,16 @@ sub getResponseDrivenQuestionIds {
|
|||
sub getSectionDrivenQuestionIds {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
my @usedQuestionIds = WebGUI::SQL->buildArray("select Survey_questionId from Survey_questionResponse where Survey_responseId=".quote($responseId));
|
||||
my @usedQuestionIds = $self->session->db->buildArray("select Survey_questionId from Survey_questionResponse where Survey_responseId=".$self->session->db->quote($responseId));
|
||||
my @questions;
|
||||
my $where = " where Survey_question.Survey_id=".quote($self->get("Survey_id"));
|
||||
my $where = " where Survey_question.Survey_id=".$self->session->db->quote($self->get("Survey_id"));
|
||||
$where .= " and Survey_question.Survey_sectionId=Survey_section.Survey_sectionId";
|
||||
|
||||
if ($#usedQuestionIds+1 > 0) {
|
||||
$where .= " and Survey_questionId not in (".quoteAndJoin(\@usedQuestionIds).")";
|
||||
$where .= " and Survey_questionId not in (".$self->session->db->quoteAndJoin(\@usedQuestionIds).")";
|
||||
}
|
||||
|
||||
my $sth = WebGUI::SQL->read("select Survey_questionId, Survey_question.Survey_sectionId from Survey_question,
|
||||
my $sth = $self->session->db->read("select Survey_questionId, Survey_question.Survey_sectionId from Survey_question,
|
||||
Survey_section $where order by Survey_section.sequenceNumber, Survey_question.sequenceNumber");
|
||||
|
||||
my $loopCount=0;
|
||||
|
|
@ -546,19 +546,19 @@ sub getResponseIdString {
|
|||
sub getSequentialQuestionIds {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
my @usedQuestionIds = WebGUI::SQL->buildArray("select Survey_questionId from Survey_questionResponse where Survey_responseId=".quote($responseId));
|
||||
my $where = " where Survey_id=".quote($self->get("Survey_id"));
|
||||
my @usedQuestionIds = $self->session->db->buildArray("select Survey_questionId from Survey_questionResponse where Survey_responseId=".$self->session->db->quote($responseId));
|
||||
my $where = " where Survey_id=".$self->session->db->quote($self->get("Survey_id"));
|
||||
if ($#usedQuestionIds+1 > 0) {
|
||||
$where .= " and Survey_questionId not in (".quoteAndJoin(\@usedQuestionIds).")";
|
||||
$where .= " and Survey_questionId not in (".$self->session->db->quoteAndJoin(\@usedQuestionIds).")";
|
||||
}
|
||||
my @questions = WebGUI::SQL->buildArray("select Survey_questionId from Survey_question $where order by sequenceNumber");
|
||||
my @questions = $self->session->db->buildArray("select Survey_questionId from Survey_question $where order by sequenceNumber");
|
||||
return @questions;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getUserId {
|
||||
my $self = shift;
|
||||
my $userId = ($self->get("anonymous") && $session{user}{userId} != 1) ? substr(md5_hex($session{user}{userId}),0,8) : $session{user}{userId};
|
||||
my $userId = ($self->get("anonymous") && $self->session->user->profileField("userId") != 1) ? substr(md5_hex($self->session->user->profileField("userId")),0,8) : $self->session->user->profileField("userId");
|
||||
return $userId;
|
||||
}
|
||||
|
||||
|
|
@ -566,19 +566,19 @@ sub getUserId {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
if ($session{form}{assetId} eq "new") {
|
||||
if ($self->session->form->process("assetId") eq "new") {
|
||||
$self->addSection(WebGUI::International::get(107, 'Asset_Survey'));
|
||||
}
|
||||
|
||||
}
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Survey where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
if ($count < 2) { ### Check for other wobjects using this survey.
|
||||
WebGUI::SQL->write("delete from Survey_question where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::SQL->write("delete from Survey_answer where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::SQL->write("delete from Survey_response where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::SQL->write("delete from Survey_section where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
$self->session->db->write("delete from Survey_question where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
$self->session->db->write("delete from Survey_answer where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
$self->session->db->write("delete from Survey_response where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
$self->session->db->write("delete from Survey_section where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
}
|
||||
$_[0]->SUPER::purge();
|
||||
}
|
||||
|
|
@ -588,7 +588,7 @@ sub purge {
|
|||
sub responseIsComplete {
|
||||
my $self = shift;
|
||||
my $responseId = shift;
|
||||
my $response = WebGUI::SQL->getRow("Survey_response","Survey_responseId",$responseId);
|
||||
my $response = $self->session->db->getRow("Survey_response","Survey_responseId",$responseId);
|
||||
return $response->{isComplete};
|
||||
}
|
||||
|
||||
|
|
@ -605,7 +605,7 @@ sub setAnswerType {
|
|||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my $var = $self->getMenuVars;
|
||||
$var->{'question.add.url'} = $self->getUrl('func=editQuestion;qid=new');
|
||||
$var->{'question.add.label'} = WebGUI::International::get(30,'Asset_Survey');
|
||||
|
|
@ -614,14 +614,14 @@ sub view {
|
|||
my @sectionEdit;
|
||||
|
||||
# Get Sections
|
||||
my $sth = WebGUI::SQL->read("select Survey_sectionId,sectionName from Survey_section where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my $sth = $self->session->db->read("select Survey_sectionId,sectionName from Survey_section where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
while (my %sectionData = $sth->hash) {
|
||||
my @edit;
|
||||
|
||||
# Get Questions for this section
|
||||
my $sth2 = WebGUI::SQL->read("select Survey_questionId,question from Survey_question
|
||||
where Survey_id=".quote($self->get("Survey_id"))."
|
||||
and Survey_sectionId=".quote($sectionData{Survey_sectionId})." order by sequenceNumber");
|
||||
my $sth2 = $self->session->db->read("select Survey_questionId,question from Survey_question
|
||||
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))."
|
||||
and Survey_sectionId=".$self->session->db->quote($sectionData{Survey_sectionId})." order by sequenceNumber");
|
||||
while (my %data = $sth2->hash) {
|
||||
push(@edit,{
|
||||
'question.edit.controls'=>
|
||||
|
|
@ -656,13 +656,13 @@ sub view {
|
|||
$var->{'response.Count'} = $self->getResponseCount;
|
||||
$var->{'user.isFirstResponse'} = ($var->{'response.Count'} == 0 && !(exists $var->{'response.id'}));
|
||||
$var->{'user.canRespondAgain'} = ($var->{'response.Count'} < $self->get("maxResponsesPerUser"));
|
||||
if (($var->{'user.isFirstResponse'}) || ($session{form}{startNew} && $var->{'user.canRespondAgain'})) {
|
||||
if (($var->{'user.isFirstResponse'}) || ($self->session->form->process("startNew") && $var->{'user.canRespondAgain'})) {
|
||||
$var->{'response.Id'} = $self->generateResponseId;
|
||||
}
|
||||
if ($var->{'response.Id'}) {
|
||||
$var->{'questions.soFar.count'} = $self->getQuestionResponseCount($var->{'response.Id'});
|
||||
($var->{'questions.correct.count'}) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse a, Survey_answer b where a.Survey_responseId="
|
||||
.quote($var->{'response.Id'})." and a.Survey_answerId=b.Survey_answerId and b.isCorrect=1");
|
||||
($var->{'questions.correct.count'}) = $self->session->db->quickArray("select count(*) from Survey_questionResponse a, Survey_answer b where a.Survey_responseId="
|
||||
.$self->session->db->quote($var->{'response.Id'})." and a.Survey_answerId=b.Survey_answerId and b.isCorrect=1");
|
||||
if ($var->{'questions.soFar.count'} > 0) {
|
||||
$var->{'questions.correct.percent'} = round(($var->{'questions.correct.count'}/$var->{'questions.soFar.count'})*100)
|
||||
}
|
||||
|
|
@ -696,10 +696,10 @@ sub view {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteAnswerConfirm {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
my ($answerCount) = WebGUI::SQL->quickArray("select count(*) from Survey_answer where Survey_questionId=".quote($session{form}{qid}));
|
||||
my ($answerCount) = $self->session->db->quickArray("select count(*) from Survey_answer where Survey_questionId=".$self->session->db->quote($self->session->form->process("qid")));
|
||||
return $_[0]->i18n("cannot delete the last answer") unless($answerCount);
|
||||
WebGUI::SQL->write("delete from Survey_questionResponse where Survey_answerId=".quote($session{form}{aid}));
|
||||
$_[0]->deleteCollateral("Survey_answer","Survey_answerId",$session{form}{aid});
|
||||
$self->session->db->write("delete from Survey_questionResponse where Survey_answerId=".$self->session->db->quote($self->session->form->process("aid")));
|
||||
$_[0]->deleteCollateral("Survey_answer","Survey_answerId",$self->session->form->process("aid"));
|
||||
$_[0]->reorderCollateral("Survey_answer","Survey_answerId","Survey_id");
|
||||
return $_[0]->www_editQuestion;
|
||||
}
|
||||
|
|
@ -707,9 +707,9 @@ sub www_deleteAnswerConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteQuestionConfirm {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
WebGUI::SQL->write("delete from Survey_answer where Survey_questionId=".quote($session{form}{qid}));
|
||||
WebGUI::SQL->write("delete from Survey_questionResponse where Survey_questionId=".quote($session{form}{qid}));
|
||||
$_[0]->deleteCollateral("Survey_question","Survey_questionId",$session{form}{qid});
|
||||
$self->session->db->write("delete from Survey_answer where Survey_questionId=".$self->session->db->quote($self->session->form->process("qid")));
|
||||
$self->session->db->write("delete from Survey_questionResponse where Survey_questionId=".$self->session->db->quote($self->session->form->process("qid")));
|
||||
$_[0]->deleteCollateral("Survey_question","Survey_questionId",$self->session->form->process("qid"));
|
||||
$_[0]->reorderCollateral("Survey_question","Survey_questionId","Survey_id");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -718,14 +718,14 @@ sub www_deleteQuestionConfirm {
|
|||
sub www_deleteSectionConfirm {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
my $none = WebGUI::International::get(107, 'Asset_Survey');
|
||||
my ($sectionName) = WebGUI::SQL->quickArray("select sectionName from Survey_section where Survey_sectionId="
|
||||
.quote($session{form}{sid}));
|
||||
my ($sectionName) = $self->session->db->quickArray("select sectionName from Survey_section where Survey_sectionId="
|
||||
.$self->session->db->quote($self->session->form->process("sid")));
|
||||
if ($sectionName =~ /$none/) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
}
|
||||
|
||||
WebGUI::SQL->write("delete from Survey_section where Survey_sectionId=".quote($session{form}{sid}));
|
||||
$_[0]->deleteCollateral("Survey_section","Survey_sectionId",$session{form}{sid});
|
||||
$self->session->db->write("delete from Survey_section where Survey_sectionId=".$self->session->db->quote($self->session->form->process("sid")));
|
||||
$_[0]->deleteCollateral("Survey_section","Survey_sectionId",$self->session->form->process("sid"));
|
||||
$_[0]->reorderCollateral("Survey_section","Survey_sectionId","Survey_id");
|
||||
return "";
|
||||
}
|
||||
|
|
@ -733,29 +733,29 @@ sub www_deleteSectionConfirm {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deleteResponse {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
return WebGUI::Style::process($_[0]->confirm(WebGUI::International::get(72,'Asset_Survey'),
|
||||
$_[0]->getUrl('func=deleteResponseConfirm;responseId='.$session{form}{responseId})),$_[0]->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($_[0]->confirm(WebGUI::International::get(72,'Asset_Survey'),
|
||||
$_[0]->getUrl('func=deleteResponseConfirm;responseId='.$self->session->form->process("responseId"))),$_[0]->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteResponseConfirm {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
WebGUI::SQL->write("delete from Survey_response where Survey_responseId=".quote($session{form}{responseId}));
|
||||
WebGUI::SQL->write("delete from Survey_questionResponse where Survey_responseId=".quote($session{form}{responseId}));
|
||||
$self->session->db->write("delete from Survey_response where Survey_responseId=".$self->session->db->quote($self->session->form->process("responseId")));
|
||||
$self->session->db->write("delete from Survey_questionResponse where Survey_responseId=".$self->session->db->quote($self->session->form->process("responseId")));
|
||||
return $_[0]->www_viewGradebook;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteAllResponses {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
return WebGUI::Style::process($_[0]->confirm(WebGUI::International::get(74,'Asset_Survey'),$_[0]->getUrl('func=deleteAllResponsesConfirm')),$_[0]->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($_[0]->confirm(WebGUI::International::get(74,'Asset_Survey'),$_[0]->getUrl('func=deleteAllResponsesConfirm')),$_[0]->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteAllResponsesConfirm {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
WebGUI::SQL->write("delete from Survey_response where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::SQL->write("delete from Survey_questionResponse where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
$self->session->db->write("delete from Survey_response where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
$self->session->db->write("delete from Survey_questionResponse where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -763,8 +763,8 @@ sub www_deleteAllResponsesConfirm {
|
|||
sub www_editSave {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
my $output = $_[0]->SUPER::www_editSave();
|
||||
if ($session{form}{proceed} eq "addQuestion") {
|
||||
$session{form}{qid} = "new";
|
||||
if ($self->session->form->process("proceed") eq "addQuestion") {
|
||||
$self->session->form->process("qid") = "new";
|
||||
return $_[0]->www_editQuestion;
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -777,11 +777,11 @@ sub www_editAnswer {
|
|||
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
|
||||
$answer = $self->getCollateral("Survey_answer","Survey_answerId",$session{form}{aid});
|
||||
$answer = $self->getCollateral("Survey_answer","Survey_answerId",$self->session->form->process("aid"));
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
$f->hidden(
|
||||
-name => "assetId",
|
||||
-value => $session{form}{assetId}
|
||||
-value => $self->session->form->process("assetId")
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "func",
|
||||
|
|
@ -789,7 +789,7 @@ sub www_editAnswer {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "qid",
|
||||
-value => $session{form}{qid}
|
||||
-value => $self->session->form->process("qid")
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "aid",
|
||||
|
|
@ -815,8 +815,8 @@ sub www_editAnswer {
|
|||
);
|
||||
}
|
||||
if ($self->get("questionOrder") eq "response") {
|
||||
$question = WebGUI::SQL->buildHashRef("select Survey_questionId,question
|
||||
from Survey_question where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
$question = $self->session->db->buildHashRef("select Survey_questionId,question
|
||||
from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
$question = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$question) };
|
||||
$f->selectBox(
|
||||
-name=>"gotoQuestion",
|
||||
|
|
@ -852,19 +852,19 @@ sub www_editAnswer {
|
|||
sub www_editAnswerSave {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->setCollateral("Survey_answer", "Survey_answerId", {
|
||||
Survey_answerId => $session{form}{aid},
|
||||
Survey_questionId => $session{form}{qid},
|
||||
answer => $session{form}{answer},
|
||||
isCorrect => $session{form}{isCorrect},
|
||||
Survey_answerId => $self->session->form->process("aid"),
|
||||
Survey_questionId => $self->session->form->process("qid"),
|
||||
answer => $self->session->form->process("answer"),
|
||||
isCorrect => $self->session->form->process("isCorrect"),
|
||||
Survey_id=>$_[0]->get("Survey_id"),
|
||||
gotoQuestion => $session{form}{gotoQuestion}
|
||||
gotoQuestion => $self->session->form->process("gotoQuestion")
|
||||
},1,0,"Survey_Id");
|
||||
if ($session{form}{proceed} eq "addQuestion") {
|
||||
$session{form}{qid} = "new";
|
||||
} elsif ($session{form}{proceed} eq "addAnswer") {
|
||||
$session{form}{aid} = "new";
|
||||
if ($self->session->form->process("proceed") eq "addQuestion") {
|
||||
$self->session->form->process("qid") = "new";
|
||||
} elsif ($self->session->form->process("proceed") eq "addAnswer") {
|
||||
$self->session->form->process("aid") = "new";
|
||||
return $_[0]->www_editAnswer();
|
||||
} elsif ($session{form}{proceed} eq "backToPage") {
|
||||
} elsif ($self->session->form->process("proceed") eq "backToPage") {
|
||||
return "";
|
||||
}
|
||||
return $_[0]->www_editQuestion();
|
||||
|
|
@ -878,7 +878,7 @@ sub www_editQuestion {
|
|||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
|
||||
tie %data, 'Tie::CPHash';
|
||||
$question = $self->getCollateral("Survey_question","Survey_questionId",$session{form}{qid});
|
||||
$question = $self->getCollateral("Survey_question","Survey_questionId",$self->session->form->process("qid"));
|
||||
$answerFieldType = $question->{answerFieldType} || "radioList";
|
||||
|
||||
$f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
|
||||
|
|
@ -917,8 +917,8 @@ sub www_editQuestion {
|
|||
-hoverHelp => WebGUI::International::get('16 description','Asset_Survey')
|
||||
);
|
||||
|
||||
my $sectionList = WebGUI::SQL->buildHashRef("select Survey_sectionId,sectionName
|
||||
from Survey_section where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my $sectionList = $self->session->db->buildHashRef("select Survey_sectionId,sectionName
|
||||
from Survey_section where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
|
||||
$f->selectBox(
|
||||
-name => "section",
|
||||
|
|
@ -928,8 +928,8 @@ sub www_editQuestion {
|
|||
);
|
||||
|
||||
if ($self->get("questionOrder") eq "response") {
|
||||
my $ql = WebGUI::SQL->buildHashRef("select Survey_questionId,question
|
||||
from Survey_question where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my $ql = $self->session->db->buildHashRef("select Survey_questionId,question
|
||||
from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
$ql = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$ql) };
|
||||
$f->selectBox(
|
||||
-name => "gotoQuestion",
|
||||
|
|
@ -969,8 +969,8 @@ sub www_editQuestion {
|
|||
) {
|
||||
$output .= '<a href="'.$self->getUrl('func=editAnswer;aid=new;qid='
|
||||
.$question->{Survey_questionId}).'">'.WebGUI::International::get(23,'Asset_Survey').'</a><p />';
|
||||
$sth = WebGUI::SQL->read("select Survey_answerId,answer from Survey_answer
|
||||
where Survey_questionId=".quote($question->{Survey_questionId})." order by sequenceNumber");
|
||||
$sth = $self->session->db->read("select Survey_answerId,answer from Survey_answer
|
||||
where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId})." order by sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
$output .=
|
||||
deleteIcon('func=deleteAnswerConfirm;qid='.$question->{Survey_questionId}.';aid='.$data{Survey_answerId},
|
||||
|
|
@ -990,47 +990,47 @@ sub www_editQuestion {
|
|||
sub www_editQuestionSave {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
|
||||
$session{form}{qid} = $_[0]->setCollateral("Survey_question", "Survey_questionId", {
|
||||
question=>$session{form}{question},
|
||||
Survey_questionId=>$session{form}{qid},
|
||||
$self->session->form->process("qid") = $_[0]->setCollateral("Survey_question", "Survey_questionId", {
|
||||
question=>$self->session->form->process("question"),
|
||||
Survey_questionId=>$self->session->form->process("qid"),
|
||||
Survey_id=>$_[0]->get("Survey_id"),
|
||||
allowComment=>$session{form}{allowComment},
|
||||
gotoQuestion=>$session{form}{gotoQuestion},
|
||||
answerFieldType=>$session{form}{answerFieldType},
|
||||
randomizeAnswers=>$session{form}{randomizeAnswers},
|
||||
Survey_sectionId=>$session{form}{section}
|
||||
allowComment=>$self->session->form->process("allowComment"),
|
||||
gotoQuestion=>$self->session->form->process("gotoQuestion"),
|
||||
answerFieldType=>$self->session->form->process("answerFieldType"),
|
||||
randomizeAnswers=>$self->session->form->process("randomizeAnswers"),
|
||||
Survey_sectionId=>$self->session->form->process("section")
|
||||
},1,0,"Survey_id");
|
||||
if ($session{form}{proceed} eq "addMultipleChoiceAnswer") {
|
||||
$session{form}{aid} = "new";
|
||||
if ($self->session->form->process("proceed") eq "addMultipleChoiceAnswer") {
|
||||
$self->session->form->process("aid") = "new";
|
||||
return $_[0]->www_editAnswer();
|
||||
} elsif ($session{form}{proceed} eq "addTextAnswer") {
|
||||
$_[0]->setAnswerType("text",$session{form}{qid});
|
||||
$_[0]->addAnswer(0,$session{form}{qid});
|
||||
} elsif ($session{form}{proceed} eq "addBooleanAnswer") {
|
||||
$_[0]->addAnswer(31,$session{form}{qid});
|
||||
$_[0]->addAnswer(32,$session{form}{qid});
|
||||
} elsif ($session{form}{proceed} eq "addOpinionAnswer") {
|
||||
$_[0]->addAnswer(33,$session{form}{qid});
|
||||
$_[0]->addAnswer(34,$session{form}{qid});
|
||||
$_[0]->addAnswer(35,$session{form}{qid});
|
||||
$_[0]->addAnswer(36,$session{form}{qid});
|
||||
$_[0]->addAnswer(37,$session{form}{qid});
|
||||
$_[0]->addAnswer(38,$session{form}{qid});
|
||||
$_[0]->addAnswer(39,$session{form}{qid});
|
||||
} elsif ($session{form}{proceed} eq "addFrequencyAnswer") {
|
||||
$_[0]->addAnswer(40,$session{form}{qid});
|
||||
$_[0]->addAnswer(41,$session{form}{qid});
|
||||
$_[0]->addAnswer(42,$session{form}{qid});
|
||||
$_[0]->addAnswer(43,$session{form}{qid});
|
||||
$_[0]->addAnswer(39,$session{form}{qid});
|
||||
} elsif ($session{form}{proceed} eq "addHTMLAreaAnswer") {
|
||||
$_[0]->setAnswerType("HTMLArea",$session{form}{qid});
|
||||
$_[0]->addAnswer(0,$session{form}{qid});
|
||||
} elsif ($session{form}{proceed} eq "addTextAreaAnswer") {
|
||||
$_[0]->setAnswerType("textArea",$session{form}{qid});
|
||||
$_[0]->addAnswer(0,$session{form}{qid});
|
||||
} elsif ($session{form}{proceed} eq "addQuestion") {
|
||||
$session{form}{qid} = "new";
|
||||
} elsif ($self->session->form->process("proceed") eq "addTextAnswer") {
|
||||
$_[0]->setAnswerType("text",$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(0,$self->session->form->process("qid"));
|
||||
} elsif ($self->session->form->process("proceed") eq "addBooleanAnswer") {
|
||||
$_[0]->addAnswer(31,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(32,$self->session->form->process("qid"));
|
||||
} elsif ($self->session->form->process("proceed") eq "addOpinionAnswer") {
|
||||
$_[0]->addAnswer(33,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(34,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(35,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(36,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(37,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(38,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(39,$self->session->form->process("qid"));
|
||||
} elsif ($self->session->form->process("proceed") eq "addFrequencyAnswer") {
|
||||
$_[0]->addAnswer(40,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(41,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(42,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(43,$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(39,$self->session->form->process("qid"));
|
||||
} elsif ($self->session->form->process("proceed") eq "addHTMLAreaAnswer") {
|
||||
$_[0]->setAnswerType("HTMLArea",$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(0,$self->session->form->process("qid"));
|
||||
} elsif ($self->session->form->process("proceed") eq "addTextAreaAnswer") {
|
||||
$_[0]->setAnswerType("textArea",$self->session->form->process("qid"));
|
||||
$_[0]->addAnswer(0,$self->session->form->process("qid"));
|
||||
} elsif ($self->session->form->process("proceed") eq "addQuestion") {
|
||||
$self->session->form->process("qid") = "new";
|
||||
return $_[0]->www_editQuestion();
|
||||
}
|
||||
return "";
|
||||
|
|
@ -1042,7 +1042,7 @@ sub www_editSection {
|
|||
$self = shift;
|
||||
my $none = WebGUI::International::get(107, 'Asset_Survey');
|
||||
return WebGUI::Privilege::insufficient() unless ($self->canEdit);
|
||||
$section = $self->getCollateral("Survey_section","Survey_sectionId",$session{form}{sid});
|
||||
$section = $self->getCollateral("Survey_section","Survey_sectionId",$self->session->form->process("sid"));
|
||||
|
||||
if ($section->{sectionName} =~ /$none/) {
|
||||
return WebGUI::Privilege::vitalComponent;
|
||||
|
|
@ -1075,9 +1075,9 @@ sub www_editSection {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editSectionSave {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$session{form}{sid} = $_[0]->setCollateral("Survey_section", "Survey_sectionId", {
|
||||
sectionName => $session{form}{sectionName},
|
||||
Survey_sectionId=>$session{form}{sid},
|
||||
$self->session->form->process("sid") = $_[0]->setCollateral("Survey_section", "Survey_sectionId", {
|
||||
sectionName => $self->session->form->process("sectionName"),
|
||||
Survey_sectionId=>$self->session->form->process("sid"),
|
||||
Survey_id=>$_[0]->get("Survey_id"),
|
||||
},1,0,"Survey_id");
|
||||
return "";
|
||||
|
|
@ -1086,73 +1086,73 @@ sub www_editSectionSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_exportAnswers {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
WebGUI::HTTP::setFilename(WebGUI::URL::escape($_[0]->get("title")."_answers.tab"),"text/tab");
|
||||
return WebGUI::SQL->quickTab("select * from Survey_answer where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::HTTP::setFilename($self->session->url->escape($_[0]->get("title")."_answers.tab"),"text/tab");
|
||||
return $self->session->db->quickTab("select * from Survey_answer where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_exportComposite {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
WebGUI::HTTP::setFilename(WebGUI::URL::escape($_[0]->get("title")."_composite.tab"),"text/tab");
|
||||
return WebGUI::SQL->quickTab("select b.question, c.response, a.userId, a.username, a.ipAddress, c.comment, c.dateOfResponse from Survey_response a
|
||||
WebGUI::HTTP::setFilename($self->session->url->escape($_[0]->get("title")."_composite.tab"),"text/tab");
|
||||
return $self->session->db->quickTab("select b.question, c.response, a.userId, a.username, a.ipAddress, c.comment, c.dateOfResponse from Survey_response a
|
||||
left join Survey_questionResponse c on a.Survey_responseId=c.Survey_responseId
|
||||
left join Survey_question b on c.Survey_questionId=b.Survey_questionId
|
||||
where a.Survey_id=".quote($_[0]->get("Survey_id"))." order by a.userId, a.ipAddress, b.sequenceNumber");
|
||||
where a.Survey_id=".$self->session->db->quote($_[0]->get("Survey_id"))." order by a.userId, a.ipAddress, b.sequenceNumber");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_exportQuestions {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
WebGUI::HTTP::setFilename(WebGUI::URL::escape($_[0]->get("title")."_questions.tab"),"text/tab");
|
||||
return WebGUI::SQL->quickTab("select * from Survey_question where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::HTTP::setFilename($self->session->url->escape($_[0]->get("title")."_questions.tab"),"text/tab");
|
||||
return $self->session->db->quickTab("select * from Survey_question where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_exportResponses {
|
||||
return "" unless (WebGUI::Grouping::isInGroup($_[0]->get("groupToViewReports")));
|
||||
WebGUI::HTTP::setFilename(WebGUI::URL::escape($_[0]->get("title")."_responses.tab"),"text/tab");
|
||||
return WebGUI::SQL->quickTab("select * from Survey_response where Survey_id=".quote($_[0]->get("Survey_id")));
|
||||
WebGUI::HTTP::setFilename($self->session->url->escape($_[0]->get("title")."_responses.tab"),"text/tab");
|
||||
return $self->session->db->quickTab("select * from Survey_response where Survey_id=".$self->session->db->quote($_[0]->get("Survey_id")));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveAnswerDown {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->moveCollateralDown("Survey_answer","Survey_answerId",$session{form}{aid},"Survey_id");
|
||||
$_[0]->moveCollateralDown("Survey_answer","Survey_answerId",$self->session->form->process("aid"),"Survey_id");
|
||||
return $_[0]->www_editQuestion;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveAnswerUp {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->moveCollateralUp("Survey_answer","Survey_answerId",$session{form}{aid},"Survey_id");
|
||||
$_[0]->moveCollateralUp("Survey_answer","Survey_answerId",$self->session->form->process("aid"),"Survey_id");
|
||||
return $_[0]->www_editQuestion;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveQuestionDown {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->moveCollateralDown("Survey_question","Survey_questionId",$session{form}{qid},"Survey_id");
|
||||
$_[0]->moveCollateralDown("Survey_question","Survey_questionId",$self->session->form->process("qid"),"Survey_id");
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveQuestionUp {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->moveCollateralUp("Survey_question","Survey_questionId",$session{form}{qid},"Survey_id");
|
||||
$_[0]->moveCollateralUp("Survey_question","Survey_questionId",$self->session->form->process("qid"),"Survey_id");
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveSectionDown {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->moveCollateralDown("Survey_section","Survey_sectionId",$session{form}{sid},"Survey_id");
|
||||
$_[0]->moveCollateralDown("Survey_section","Survey_sectionId",$self->session->form->process("sid"),"Survey_id");
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveSectionUp {
|
||||
return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit);
|
||||
$_[0]->moveCollateralUp("Survey_section","Survey_sectionId",$session{form}{sid},"Survey_id");
|
||||
$_[0]->moveCollateralUp("Survey_section","Survey_sectionId",$self->session->form->process("sid"),"Survey_id");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -1162,33 +1162,33 @@ sub www_respond {
|
|||
return "" unless (WebGUI::Grouping::isInGroup($self->get("groupToTakeSurvey")));
|
||||
my $varname = $self->getResponseIdString;
|
||||
return "" unless ($session{scratch}{$varname});
|
||||
my $userId = ($self->get("anonymous")) ? substr(md5_hex($session{user}{userId}),0,8) : $session{user}{userId};
|
||||
my $userId = ($self->get("anonymous")) ? substr(md5_hex($self->session->user->profileField("userId")),0,8) : $self->session->user->profileField("userId");
|
||||
my $terminate = 0;
|
||||
foreach my $key (keys %{$session{form}}) {
|
||||
if ($key =~ /^answerId_(.+)$/) {
|
||||
my $id = $1;
|
||||
my ($previousResponse) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse
|
||||
where Survey_answerId=".quote($session{form}{"answerId_".$id})." and Survey_responseId=".quote($session{scratch}{$varname}));
|
||||
my ($previousResponse) = $self->session->db->quickArray("select count(*) from Survey_questionResponse
|
||||
where Survey_answerId=".$self->session->db->quote($session{form}{"answerId_".$id})." and Survey_responseId=".$self->session->db->quote($session{scratch}{$varname}));
|
||||
next if ($previousResponse);
|
||||
my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$session{form}{"answerId_".$id});
|
||||
if ($self->get("questionOrder") eq "response" && $answer->{gotoQuestion} eq "") {
|
||||
$terminate = 1;
|
||||
}
|
||||
my $response = $session{form}{"textResponse_".$id} || $answer->{answer};
|
||||
WebGUI::SQL->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values (
|
||||
".quote($answer->{Survey_answerId}).", ".quote($answer->{Survey_questionId}).", ".quote($session{scratch}{$varname}).", ".quote($answer->{Survey_id}).",
|
||||
".quote($session{form}{"comment_".$id}).", ".quote($response).", ".WebGUI::DateTime::time().")");
|
||||
$self->session->db->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values (
|
||||
".$self->session->db->quote($answer->{Survey_answerId}).", ".$self->session->db->quote($answer->{Survey_questionId}).", ".$self->session->db->quote($session{scratch}{$varname}).", ".$self->session->db->quote($answer->{Survey_id}).",
|
||||
".$self->session->db->quote($session{form}{"comment_".$id}).", ".$self->session->db->quote($response).", ".WebGUI::DateTime::time().")");
|
||||
}
|
||||
}
|
||||
my $responseCount = $self->getQuestionResponseCount($session{scratch}{$varname});
|
||||
if ($terminate || $responseCount >= $self->getValue("questionsPerResponse") || $responseCount >= $self->getQuestionCount) {
|
||||
WebGUI::SQL->setRow("Survey_response","Survey_responseId",{
|
||||
$self->session->db->setRow("Survey_response","Survey_responseId",{
|
||||
isComplete=>1,
|
||||
endDate=>WebGUI::DateTime::time(),
|
||||
Survey_responseId=>$session{scratch}{$varname}
|
||||
});
|
||||
}
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -1209,14 +1209,14 @@ sub www_view {
|
|||
sub www_viewGradebook {
|
||||
my $self = shift;
|
||||
return "" unless (WebGUI::Grouping::isInGroup($self->get("groupToViewReports")));
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my $var = $self->getMenuVars;
|
||||
$var->{title} = WebGUI::International::get(71,'Asset_Survey');
|
||||
my $p = WebGUI::Paginator->new($self->getUrl('func=viewGradebook'));
|
||||
$p->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate from Survey_response
|
||||
where Survey_id=".quote($self->get("Survey_id"))." order by username,ipAddress,startDate");
|
||||
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by username,ipAddress,startDate");
|
||||
my $users = $p->getPageData;
|
||||
($var->{'question.count'}) = WebGUI::SQL->quickArray("select count(*) from Survey_question where Survey_id=".quote($self->get("Survey_id")));
|
||||
($var->{'question.count'}) = $self->session->db->quickArray("select count(*) from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id")));
|
||||
if ($var->{'question.count'} > $self->get("questionsPerResponse")) {
|
||||
$var->{'question.count'} = $self->get("questionsPerResponse");
|
||||
}
|
||||
|
|
@ -1225,8 +1225,8 @@ sub www_viewGradebook {
|
|||
$var->{'response.percent.label'} = WebGUI::International::get(54,'Asset_Survey');
|
||||
my @responseloop;
|
||||
foreach my $user (@$users) {
|
||||
my ($correctCount) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse a left join
|
||||
Survey_answer b on a.Survey_answerId=b.Survey_answerId where a.Survey_responseId=".quote($user->{Survey_responseId})
|
||||
my ($correctCount) = $self->session->db->quickArray("select count(*) from Survey_questionResponse a left join
|
||||
Survey_answer b on a.Survey_answerId=b.Survey_answerId where a.Survey_responseId=".$self->session->db->quote($user->{Survey_responseId})
|
||||
." and b.isCorrect=1");
|
||||
push(@responseloop, {
|
||||
'response.url'=>$self->getUrl('func=viewIndividualSurvey;responseId='.$user->{Survey_responseId}),
|
||||
|
|
@ -1237,7 +1237,7 @@ sub www_viewGradebook {
|
|||
}
|
||||
$var->{response_loop} = \@responseloop;
|
||||
$p->appendTemplateVars($var);
|
||||
return WebGUI::Style::process($self->processTemplate($var,$self->getValue("gradebookTemplateId")),$self->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($self->processTemplate($var,$self->getValue("gradebookTemplateId")),$self->getValue("styleTemplateId"));
|
||||
# return $self->processTemplate($self->getValue("gradebookTemplateId"),$var,"Survey/Gradebook");
|
||||
}
|
||||
|
||||
|
|
@ -1246,12 +1246,12 @@ sub www_viewGradebook {
|
|||
sub www_viewIndividualSurvey {
|
||||
my $self = shift;
|
||||
return "" unless (WebGUI::Grouping::isInGroup($self->get("groupToViewReports")));
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my $var = $self->getMenuVars;
|
||||
$var->{'title'} = WebGUI::International::get(70,'Asset_Survey');
|
||||
$var->{'delete.url'} = $self->getUrl('func=deleteResponse;responseId='.$session{form}{responseId});
|
||||
$var->{'delete.url'} = $self->getUrl('func=deleteResponse;responseId='.$self->session->form->process("responseId"));
|
||||
$var->{'delete.label'} = WebGUI::International::get(69,'Asset_Survey');
|
||||
my $response = WebGUI::SQL->getRow("Survey_response","Survey_responseId",$session{form}{responseId});
|
||||
my $response = $self->session->db->getRow("Survey_response","Survey_responseId",$self->session->form->process("responseId"));
|
||||
$var->{'start.date.label'} = WebGUI::International::get(76,'Asset_Survey');
|
||||
$var->{'start.date.epoch'} = $response->{startDate};
|
||||
$var->{'start.date.human'} = epochToHuman($response->{startDate},"%z");
|
||||
|
|
@ -1268,23 +1268,23 @@ sub www_viewIndividualSurvey {
|
|||
$var->{'answer.label'} = WebGUI::International::get(19,'Asset_Survey');
|
||||
$var->{'response.label'} = WebGUI::International::get(66,'Asset_Survey');
|
||||
$var->{'comment.label'} = WebGUI::International::get(57,'Asset_Survey');
|
||||
my $questions = WebGUI::SQL->read("select Survey_questionId,question,answerFieldType from Survey_question
|
||||
where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my $questions = $self->session->db->read("select Survey_questionId,question,answerFieldType from Survey_question
|
||||
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my @questionloop;
|
||||
while (my $qdata = $questions->hashRef) {
|
||||
my @aid;
|
||||
my @answer;
|
||||
if ($qdata->{answerFieldType} eq "radioList") {
|
||||
my $sth = WebGUI::SQL->read("select Survey_answerId,answer from Survey_answer
|
||||
where Survey_questionId=".quote($qdata->{Survey_questionId})." and isCorrect=1 order by sequenceNumber");
|
||||
my $sth = $self->session->db->read("select Survey_answerId,answer from Survey_answer
|
||||
where Survey_questionId=".$self->session->db->quote($qdata->{Survey_questionId})." and isCorrect=1 order by sequenceNumber");
|
||||
while (my $adata = $sth->hashRef) {
|
||||
push(@aid,$adata->{Survey_answerId});
|
||||
push(@answer,$adata->{answer});
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
my $rdata = WebGUI::SQL->quickHashRef("select Survey_answerId,response,comment from Survey_questionResponse
|
||||
where Survey_questionId=".quote($qdata->{Survey_questionId})." and Survey_responseId=".quote($session{form}{responseId}));
|
||||
my $rdata = $self->session->db->quickHashRef("select Survey_answerId,response,comment from Survey_questionResponse
|
||||
where Survey_questionId=".$self->session->db->quote($qdata->{Survey_questionId})." and Survey_responseId=".$self->session->db->quote($self->session->form->process("responseId")));
|
||||
push(@questionloop,{
|
||||
question => $qdata->{question},
|
||||
'question.id'=>$qdata->{Survey_questionId},
|
||||
|
|
@ -1297,7 +1297,7 @@ sub www_viewIndividualSurvey {
|
|||
}
|
||||
$questions->finish;
|
||||
$var->{question_loop} = \@questionloop;
|
||||
return WebGUI::Style::process($self->processTemplate($var, $self->getValue("responseTemplateId")),$self->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($self->processTemplate($var, $self->getValue("responseTemplateId")),$self->getValue("styleTemplateId"));
|
||||
# return $self->processTemplate($self->getValue("responseTemplateId"),$var,"Survey/Response");
|
||||
}
|
||||
|
||||
|
|
@ -1305,12 +1305,12 @@ sub www_viewIndividualSurvey {
|
|||
sub www_viewStatisticalOverview {
|
||||
my $self = shift;
|
||||
return "" unless (WebGUI::Grouping::isInGroup($self->get("groupToViewReports")));
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my $var = $self->getMenuVars;
|
||||
$var->{title} = WebGUI::International::get(58,'Asset_Survey');
|
||||
my $p = WebGUI::Paginator->new($self->getUrl('func=viewStatisticalOverview'));
|
||||
$p->setDataByQuery("select Survey_questionId,question,answerFieldType,allowComment from Survey_question
|
||||
where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber");
|
||||
my $questions = $p->getPageData;
|
||||
my @questionloop;
|
||||
$var->{'answer.label'} = WebGUI::International::get(19,'Asset_Survey');
|
||||
|
|
@ -1320,12 +1320,12 @@ sub www_viewStatisticalOverview {
|
|||
$var->{'show.comments.label'} = WebGUI::International::get(56,'Asset_Survey');
|
||||
foreach my $question (@$questions) {
|
||||
my @answerloop;
|
||||
my ($totalResponses) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse where Survey_questionId=".quote($question->{Survey_questionId}));
|
||||
my ($totalResponses) = $self->session->db->quickArray("select count(*) from Survey_questionResponse where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId}));
|
||||
if ($question->{answerFieldType} eq "radioList") {
|
||||
my $sth = WebGUI::SQL->read("select Survey_answerId,answer,isCorrect from Survey_answer where
|
||||
Survey_questionId=".quote($question->{Survey_questionId})." order by sequenceNumber");
|
||||
my $sth = $self->session->db->read("select Survey_answerId,answer,isCorrect from Survey_answer where
|
||||
Survey_questionId=".$self->session->db->quote($question->{Survey_questionId})." order by sequenceNumber");
|
||||
while (my $answer = $sth->hashRef) {
|
||||
my ($numResponses) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse where Survey_answerId=".quote($answer->{Survey_answerId}));
|
||||
my ($numResponses) = $self->session->db->quickArray("select count(*) from Survey_questionResponse where Survey_answerId=".$self->session->db->quote($answer->{Survey_answerId}));
|
||||
my $responsePercent;
|
||||
if ($totalResponses) {
|
||||
$responsePercent = round(($numResponses/$totalResponses)*100);
|
||||
|
|
@ -1333,7 +1333,7 @@ sub www_viewStatisticalOverview {
|
|||
$responsePercent = 0;
|
||||
}
|
||||
my @commentloop;
|
||||
my $sth2 = WebGUI::SQL->read("select comment from Survey_questionResponse where Survey_answerId=".quote($answer->{Survey_answerId}));
|
||||
my $sth2 = $self->session->db->read("select comment from Survey_questionResponse where Survey_answerId=".$self->session->db->quote($answer->{Survey_answerId}));
|
||||
while (my ($comment) = $sth2->array) {
|
||||
push(@commentloop,{
|
||||
'answer.comment'=>$comment
|
||||
|
|
@ -1350,7 +1350,7 @@ sub www_viewStatisticalOverview {
|
|||
}
|
||||
$sth->finish;
|
||||
} else {
|
||||
my $sth = WebGUI::SQL->read("select response,comment from Survey_questionResponse where Survey_questionId=".quote($question->{Survey_questionId}));
|
||||
my $sth = $self->session->db->read("select response,comment from Survey_questionResponse where Survey_questionId=".$self->session->db->quote($question->{Survey_questionId}));
|
||||
while (my $response = $sth->hashRef) {
|
||||
push(@answerloop,{
|
||||
'answer.response'=>$response->{response},
|
||||
|
|
@ -1371,7 +1371,7 @@ sub www_viewStatisticalOverview {
|
|||
$var->{question_loop} = \@questionloop;
|
||||
$p->appendTemplateVars($var);
|
||||
|
||||
return WebGUI::Style::process($self->processTemplate($var, $self->getValue("overviewTemplateId")),$self->getValue("styleTemplateId"));
|
||||
return $self->session->style->process($self->processTemplate($var, $self->getValue("overviewTemplateId")),$self->getValue("styleTemplateId"));
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ sub _get_rss_data {
|
|||
my $ua = LWP::UserAgent->new(timeout => 5);
|
||||
my $response = $ua->get($url);
|
||||
if (!$response->is_success()) {
|
||||
WebGUI::ErrorHandler::warn("Error retrieving url '$url': " .
|
||||
$self->session->errorHandler->warn("Error retrieving url '$url': " .
|
||||
$response->status_line());
|
||||
return undef;
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ sub _get_rss_data {
|
|||
my $encoding = 'utf8';
|
||||
if (lc($xmlEncoding) ne lc($encoding)) {
|
||||
eval { from_to($xml, $xmlEncoding, $encoding) };
|
||||
WebGUI::ErrorHandler::warn($@) if ($@);
|
||||
$self->session->errorHandler->warn($@) if ($@);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ sub _get_rss_data {
|
|||
XML::RSSLite::parseXML($rss_lite, \$xml);
|
||||
};
|
||||
if ($@) {
|
||||
WebGUI::ErrorHandler::warn("error parsing rss for url $url :".$@);
|
||||
$self->session->errorHandler->warn("error parsing rss for url $url :".$@);
|
||||
#Returning undef on a parse failure is a change from previous behaviour,
|
||||
#but it SHOULDN'T have a major effect.
|
||||
return undef;
|
||||
|
|
@ -285,10 +285,10 @@ sub _get_rss_data {
|
|||
$rss_lite = {channel => $rss_lite};
|
||||
if (!($rss->{channel} =
|
||||
_find_record($rss_lite, qr/^channel$/))) {
|
||||
WebGUI::ErrorHandler::warn("unable to find channel info for url $url");
|
||||
$self->session->errorHandler->warn("unable to find channel info for url $url");
|
||||
}
|
||||
if (!($rss->{items} = _find_record($rss_lite, qr/^items?$/))) {
|
||||
WebGUI::ErrorHandler::warn("unable to find item info for url $url");
|
||||
$self->session->errorHandler->warn("unable to find item info for url $url");
|
||||
$rss->{items} = [];
|
||||
}
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ Returns the rendered output of the wobject.
|
|||
sub view {
|
||||
my $self = shift;
|
||||
my $rssFlavor = shift;
|
||||
$self->logView() if ($session{setting}{passiveProfilingEnabled});
|
||||
$self->logView() if ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
|
||||
my $maxHeadlines = $self->get('maxHeadlines') || 1000000;
|
||||
my @urls = split(/\s+/,$self->get('rssUrl'));
|
||||
|
|
@ -517,7 +517,7 @@ sub view {
|
|||
|
||||
#Looks like a kludge, but what this does is put in the proper
|
||||
#XSLT stylesheet so the RSS doesn't look like total ass.
|
||||
my $siteURL=WebGUI::URL::getSiteURL().WebGUI::URL::gateway();
|
||||
my $siteURL=$self->session->url->getSiteURL().$self->session->url->gateway();
|
||||
$rss=~s|<\?xml version="1\.0" encoding="UTF\-8"\?>|<\?xml version="1\.0" encoding="UTF\-8"\?>\n<?xml\-stylesheet type="text/xsl" href="${siteURL}xslt/rss$rssFlavor.xsl"\?>\n|;
|
||||
return $rss;
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ sub _constructRSSHeadTitleLink{
|
|||
my $rssFeedSuffix=WebGUI::International::get('RSS Feed Title Suffix','Asset_SyndicatedContent');
|
||||
my $title = ($rssTitle) ? ($rssTitle." ".$rssFeedSuffix) : $rssFeedSuffix;
|
||||
$title =~ s/\"/"/g;
|
||||
WebGUI::Style::setLink($var->{'rss.url'},
|
||||
$self->session->style->setLink($var->{'rss.url'},
|
||||
{ rel=> 'alternate',
|
||||
type=> 'application/rss+xml',
|
||||
title=> ($rssTitle) ? ($rssTitle." ".$rssFeedSuffix) : $rssFeedSuffix }
|
||||
|
|
@ -548,7 +548,7 @@ sub _constructRSS{
|
|||
#They've chosen to emit this as an RSS feed, in one of the four flavors we support.
|
||||
$rssObject->channel(
|
||||
title=>$var->{'channel.title'} || $self->get('title'),
|
||||
link=>WebGUI::URL::page('',1),
|
||||
link=>$self->session->url->page('',1),
|
||||
description=>$var->{'channel.description'} || ''
|
||||
);
|
||||
foreach my $item (@{$var->{item_loop}}) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ sub _create_cache_key {
|
|||
$cache_key = $_[0]->get('sharedCache')
|
||||
? Digest::MD5::md5_hex($call, $param_str)
|
||||
: Digest::MD5::md5_hex($call, $param_str, $session{'var'}{'sessionId'});
|
||||
WebGUI::ErrorHandler::warn(($_[0]->get('sharedCache')?'shared':'session')
|
||||
$self->session->errorHandler->warn(($_[0]->get('sharedCache')?'shared':'session')
|
||||
. " cache_key=$cache_key md5_hex($call, $param_str)");
|
||||
return $cache_key;
|
||||
}
|
||||
|
|
@ -258,11 +258,11 @@ sub view {
|
|||
@seen{@exclude_params} = ();
|
||||
for (keys %{$session{'form'}}) {
|
||||
unless (exists $seen{$_}) {
|
||||
$query_string .= WebGUI::URL::escape($_) . '='
|
||||
. WebGUI::URL::escape($session{'form'}{$_}) . ';';
|
||||
$query_string .= $self->session->url->escape($_) . '='
|
||||
. $self->session->url->escape($session{'form'}{$_}) . ';';
|
||||
}
|
||||
}
|
||||
$url = WebGUI::URL::page($query_string);
|
||||
$url = $self->session->url->page($query_string);
|
||||
|
||||
|
||||
# snag our SOAP call and preprocess if needed
|
||||
|
|
@ -282,7 +282,7 @@ sub view {
|
|||
($session{'form'}{'disableWobjects'} && grep /^$call$/,
|
||||
$session{'form'}{'disableWobjects'})) {
|
||||
|
||||
WebGUI::ErrorHandler::warn("disabling soap call $call");
|
||||
$self->session->errorHandler->warn("disabling soap call $call");
|
||||
$var{'disableWobject'} = 1;
|
||||
return $self->processTemplate(\%var,$self->get("templateId"));
|
||||
}
|
||||
|
|
@ -302,9 +302,9 @@ sub view {
|
|||
&& grep /^$call$/, @targetWobjects) {
|
||||
|
||||
$cache_key = $session{'form'}{'cache'};
|
||||
WebGUI::ErrorHandler::warn("passed a cache_key for $call");
|
||||
$self->session->errorHandler->warn("passed a cache_key for $call");
|
||||
} else {
|
||||
WebGUI::ErrorHandler::warn("cache_key not applicable to $call ");
|
||||
$self->session->errorHandler->warn("cache_key not applicable to $call ");
|
||||
$cache_key = _create_cache_key($self, $call, $param_str);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -326,7 +326,7 @@ sub view {
|
|||
# the solution is to normalize all params to another table
|
||||
eval "\$arr_ref = [$param_str];";
|
||||
eval { @params = @$arr_ref; };
|
||||
WebGUI::ErrorHandler::debug(WebGUI::International::get(22, "Asset_WSClient")) if $@ && $self->get('debugMode');
|
||||
$self->session->errorHandler->debug(WebGUI::International::get(22, "Asset_WSClient")) if $@ && $self->get('debugMode');
|
||||
|
||||
if ($self->get('execute_by_default') || grep /^$call$/,
|
||||
@targetWobjects) {
|
||||
|
|
@ -335,12 +335,12 @@ sub view {
|
|||
# valid looking uri, but I haven't hunted for the relevant RFC yet
|
||||
if ($self->get("uri") =~ m!.+/.+!) {
|
||||
|
||||
WebGUI::ErrorHandler::debug('uri=' . $self->get("uri"))
|
||||
$self->session->errorHandler->debug('uri=' . $self->get("uri"))
|
||||
if $self->get('debugMode');
|
||||
$soap = $self->_instantiate_soap;
|
||||
|
||||
} else {
|
||||
WebGUI::ErrorHandler::debug(WebGUI::International::get(23, "Asset_WSClient")) if $self->get('debugMode');
|
||||
$self->session->errorHandler->debug(WebGUI::International::get(23, "Asset_WSClient")) if $self->get('debugMode');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -355,14 +355,14 @@ sub view {
|
|||
# otherwise)". That "not stated otherwise" bit is important.
|
||||
my $return = $soap->$call(@params);
|
||||
|
||||
WebGUI::ErrorHandler::debug("$call(" . (join ',', @params) . ')')
|
||||
$self->session->errorHandler->debug("$call(" . (join ',', @params) . ')')
|
||||
if $self->get('debugMode');
|
||||
|
||||
# The possible return types I've come across include a SOAP object,
|
||||
# a hash reference, a blessed object or a simple scalar. Each type
|
||||
# requires different handling (woohoo!) before being passed to the
|
||||
# template system
|
||||
WebGUI::ErrorHandler::debug(WebGUI::International::get(24, "Asset_WSClient") . (ref $return ? ref $return : 'scalar')) if $self->get('debugMode');
|
||||
$self->session->errorHandler->debug(WebGUI::International::get(24, "Asset_WSClient") . (ref $return ? ref $return : 'scalar')) if $self->get('debugMode');
|
||||
|
||||
# SOAP object
|
||||
if ((ref $return) =~ /SOAP/i) {
|
||||
|
|
@ -374,7 +374,7 @@ sub view {
|
|||
|
||||
# blessed object, to be stripped with Data::Structure::Util
|
||||
} elsif ( ref $return) {
|
||||
WebGUI::ErrorHandler::warn("Data::Structure::Util::unbless($return)");
|
||||
$self->session->errorHandler->warn("Data::Structure::Util::unbless($return)");
|
||||
@result = Data::Structure::Util::unbless($return);
|
||||
|
||||
# scalar value, we hope
|
||||
|
|
@ -390,18 +390,18 @@ sub view {
|
|||
|
||||
# did the soap call fault?
|
||||
if ($@) {
|
||||
WebGUI::ErrorHandler::debug($@) if $self->get('debugMode');
|
||||
$self->session->errorHandler->debug($@) if $self->get('debugMode');
|
||||
$var{'soapError'} = $@;
|
||||
WebGUI::ErrorHandler::debug(WebGUI::International::get(25, "Asset_WSClient") . $var{'soapError'})
|
||||
$self->session->errorHandler->debug(WebGUI::International::get(25, "Asset_WSClient") . $var{'soapError'})
|
||||
if $self->get('debugMode');
|
||||
}
|
||||
|
||||
# cached data was found
|
||||
} else {
|
||||
WebGUI::ErrorHandler::warn("Using cached data");
|
||||
$self->session->errorHandler->warn("Using cached data");
|
||||
}
|
||||
|
||||
WebGUI::ErrorHandler::debug(Dumper(@result)) if
|
||||
$self->session->errorHandler->debug(Dumper(@result)) if
|
||||
$self->get('debugMode');
|
||||
|
||||
# Do we need to decode utf8 data? Will only decode if modules were
|
||||
|
|
@ -475,7 +475,7 @@ sub view {
|
|||
|
||||
|
||||
} else {
|
||||
WebGUI::ErrorHandler::debug(WebGUI::International::get(26, "Asset_WSClient") . $@) if $self->get('debugMode');
|
||||
$self->session->errorHandler->debug(WebGUI::International::get(26, "Asset_WSClient") . $@) if $self->get('debugMode');
|
||||
}
|
||||
|
||||
# did they request a funky http header?
|
||||
|
|
@ -483,7 +483,7 @@ sub view {
|
|||
$self->get("httpHeader")) {
|
||||
|
||||
WebGUI::HTTP::setMimeType($self->get("httpHeader"));
|
||||
WebGUI::ErrorHandler::warn("changed mimetype: " . $session{'header'}{'mimetype'});
|
||||
$self->session->errorHandler->warn("changed mimetype: " . $session{'header'}{'mimetype'});
|
||||
}
|
||||
|
||||
# Note, we still process our template below even though it will never
|
||||
|
|
@ -507,7 +507,7 @@ sub _instantiate_soap {
|
|||
# we don't use fault handling with wsdls becuase they seem to behave
|
||||
# differently. Not sure if that is by design.
|
||||
if ( ($self->get("uri") =~ m/\.wsdl\s*$/i) || ($self->get("uri") =~ m/\.\w*\?wsdl\s*$/i) ) {
|
||||
WebGUI::ErrorHandler::debug('wsdl=' . $self->get('uri'))
|
||||
$self->session->errorHandler->debug('wsdl=' . $self->get('uri'))
|
||||
if $self->get('debugMode');
|
||||
|
||||
# instantiate SOAP service
|
||||
|
|
@ -515,7 +515,7 @@ sub _instantiate_soap {
|
|||
|
||||
# standard uri namespace
|
||||
} else {
|
||||
WebGUI::ErrorHandler::debug('uri=' . $self->get('uri'))
|
||||
$self->session->errorHandler->debug('uri=' . $self->get('uri'))
|
||||
if $self->get('debugMode');
|
||||
|
||||
# instantiate SOAP service, with fault handling
|
||||
|
|
@ -529,7 +529,7 @@ sub _instantiate_soap {
|
|||
# proxy the call if requested
|
||||
if ($self->get("proxy") && $soap) {
|
||||
|
||||
WebGUI::ErrorHandler::debug('proxy=' . $self->get('proxy'))
|
||||
$self->session->errorHandler->debug('proxy=' . $self->get('proxy'))
|
||||
if $self->get('debugMode');
|
||||
$soap->proxy($self->get('proxy'),
|
||||
options => {compress_threshold => 10000});
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ sub _getLocationData {
|
|||
my $ua = LWP::UserAgent->new;
|
||||
$ua->timeout(10);
|
||||
$oldagent = $ua->agent();
|
||||
$ua->agent($session{env}{HTTP_USER_AGENT}); # Act as a proxy.
|
||||
$ua->agent($self->session->env->get("HTTP_USER_AGENT")); # Act as a proxy.
|
||||
my $response = $ua->get('http://www.srh.noaa.gov/port/port_zc.php?inputstring='.$location);
|
||||
my $document = $response->content;
|
||||
$document =~ s/\n/ /g;
|
||||
|
|
@ -102,7 +102,7 @@ sub _getLocationData {
|
|||
cityState => $1 || $location,
|
||||
sky => $2 || 'N/A',
|
||||
tempF => $3 || 'N/A',
|
||||
iconUrl => $session{config}{extrasURL}.'/wobject/WeatherData/'.$self->_chooseWeatherConditionsIcon($2).'.jpg'
|
||||
iconUrl => $self->session->config->get("extrasURL").'/wobject/WeatherData/'.$self->_chooseWeatherConditionsIcon($2).'.jpg'
|
||||
};
|
||||
$cache->set($locData, 60*60) if $locData->{sky} ne 'NULL';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue