WebGUI 3.1.0 release
This commit is contained in:
parent
d1c1445ea1
commit
71cd27d3bc
56 changed files with 2025 additions and 238 deletions
|
|
@ -25,14 +25,15 @@ sub copy {
|
|||
if ($_[0] ne "") {
|
||||
$oldFile = $session{setting}{attachmentDirectoryLocal}.'/'.$_[1];
|
||||
if ($_[3] ne "") {
|
||||
$oldFile .= '/'.$_[3]
|
||||
$oldFile .= '/'.$_[3];
|
||||
}
|
||||
$oldFile .= '/'.$_[0];
|
||||
$newFile = $session{setting}{attachmentDirectoryLocal}.'/'.$_[2];
|
||||
if ($_[4] ne "") {
|
||||
$newFile .= '/'.$_[4]
|
||||
}
|
||||
mkdir ($newFile,0755);
|
||||
if ($_[4] ne "") {
|
||||
$newFile .= '/'.$_[4];
|
||||
mkdir ($newFile,0755);
|
||||
}
|
||||
$newFile .= '/'.$_[0];
|
||||
$a = FileHandle->new($oldFile,"r");
|
||||
$b = FileHandle->new(">".$newFile);
|
||||
|
|
@ -44,6 +45,54 @@ sub copy {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub deleteSubmission {
|
||||
my ($dir);
|
||||
$dir = $session{setting}{attachmentDirectoryLocal}.'/'.$_[0].'/'.$_[1];
|
||||
rmtree($dir);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getType {
|
||||
my ($extension, $icon, %type);
|
||||
$extension = lc($_[0]);
|
||||
$extension =~ s/.*?\.(.*?)$/$1/;
|
||||
if ($extension eq "doc" || $extension eq "dot" || $extension eq "wri") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/doc.gif";
|
||||
} elsif ($extension eq "txt" || $extension eq "log" || $extension eq "config" || $extension eq "conf") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/txt.gif";
|
||||
} elsif ($extension eq "xls" || $extension eq "xlt" || $extension eq "csv") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/xls.gif";
|
||||
} elsif ($extension eq "html" || $extension eq "htm" || $extension eq "xml") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/html.gif";
|
||||
} elsif ($extension eq "ram" || $extension eq "mpeg" || $extension eq "mpg" ||
|
||||
$extension eq "wav" || $extension eq "mp3" || $extension eq "avi") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/html.gif";
|
||||
} elsif ($extension eq "html" || $extension eq "htm" || $extension eq "xml") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/html.gif";
|
||||
} elsif ($extension eq "rar" || $extension eq "tar" || $extension eq "gz" || $extension eq "Z") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/rar.gif";
|
||||
} elsif ($extension eq "mdb") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/mdb.gif";
|
||||
} elsif ($extension eq "ppt") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/ppt.gif";
|
||||
} elsif ($extension eq "tiff" || $extension eq "tif" || $extension eq "bmp" ||
|
||||
$extension eq "psd" ||$extension eq "psp" || $extension eq "gif" ||
|
||||
$extension eq "jpg" || $extension eq "jpeg") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/psp.gif";
|
||||
} elsif ($extension eq "zip") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/zip.gif";
|
||||
} elsif ($extension eq "mov") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/mov.gif";
|
||||
} elsif ($extension eq "pdf") {
|
||||
$icon = $session{setting}{lib}."/fileIcons/pdf.gif";
|
||||
} else {
|
||||
$icon = $session{setting}{lib}."/fileIcons/unknown.gif";
|
||||
}
|
||||
%type = (extension => $extension, icon => $icon);
|
||||
return %type;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purgeWidget {
|
||||
my ($dir);
|
||||
|
|
@ -54,7 +103,7 @@ sub purgeWidget {
|
|||
#-------------------------------------------------------------------
|
||||
# eg: save(formVarName,widgetId,optionallySubmissionId);
|
||||
sub save {
|
||||
my ($file, $filename, $bytesread, $buffer, $urlizedFilename, $path);
|
||||
my (%type, $file, $filename, $bytesread, $buffer, $urlizedFilename, $path);
|
||||
$filename = $session{cgi}->upload($_[0]);
|
||||
if (defined $filename) {
|
||||
if ($filename =~ /([^\/\\]+)$/) {
|
||||
|
|
@ -62,6 +111,12 @@ sub save {
|
|||
} else {
|
||||
$urlizedFilename = $filename;
|
||||
}
|
||||
%type = getType($urlizedFilename);
|
||||
if ($type{extension} eq "pl" || $type{extension} eq "perl" || $type{extension} eq "sh" ||
|
||||
$type{extension} eq "cgi" || $type{extension} eq "php" || $type{extension} eq "asp") {
|
||||
$urlizedFilename =~ s/\./\_/g;
|
||||
$urlizedFilename .= ".txt";
|
||||
}
|
||||
$urlizedFilename = urlize($urlizedFilename);
|
||||
$path = $session{setting}{attachmentDirectoryLocal}."/".$_[1]."/";
|
||||
mkdir ($path,0755);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Form;
|
|||
use strict qw(vars subs);
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _fixQuotes {
|
||||
|
|
@ -40,6 +41,16 @@ sub file {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub groupList {
|
||||
my ($output, %hash, @array);
|
||||
tie %hash, 'Tie::IxHash';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = $_[1];
|
||||
$output = selectList($_[0],\%hash,\@array);
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub hidden {
|
||||
my ($output, $name, $value);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ sub _recurseCrumbTrail {
|
|||
$output .= _recurseCrumbTrail($data{parentId});
|
||||
}
|
||||
if ($data{title} ne "") {
|
||||
$output .= '<a class="crumbTrail" href="'.$session{env}{SCRIPT_NAME}.'/'.$data{urlizedTitle}.'">'.$data{title}.'</a> > ';
|
||||
$output .= '<a class="crumbTrail" href="'.$session{config}{scripturl}.
|
||||
'/'.$data{urlizedTitle}.'">'.$data{title}.'</a> > ';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
38
lib/WebGUI/Macro/Execute.pm
Normal file
38
lib/WebGUI/Macro/Execute.pm
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package WebGUI::Macro::Execute;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my (@param, $temp);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] =~ /passwd/ || $param[0] =~ /shadow/ || $param[0] =~ /WebGUI.conf/) {
|
||||
$temp = "SECURITY VIOLATION";
|
||||
} else {
|
||||
$temp = "<pre>".`$param[0]`."</pre>";
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^Execute\((.*?)\)\;/_replacement($1)/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -35,7 +35,8 @@ sub _reversePageTree {
|
|||
if ($_[1] == $data[0]) {
|
||||
$output .= '<span class="selectedMenuItem">';
|
||||
}
|
||||
$output .= '<a class="verticalMenu" href="'.$session{env}{SCRIPT_NAME}.'/'.$data[3].'">'.$data[2].'</a><br>';
|
||||
$output .= '<a class="verticalMenu" href="'.$session{config}{scripturl}.
|
||||
'/'.$data[3].'">'.$data[2].'</a><br>';
|
||||
if ($_[1] == $data[0]) {
|
||||
$output .= '</span>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use WebGUI::Session;
|
|||
sub _replacement {
|
||||
my (@param, $temp);
|
||||
@param = WebGUI::Macro::getParams($1);
|
||||
$temp = '<a class="homeLink" href="'.$session{env}{SCRIPT_NAME}.'/home">';
|
||||
$temp = '<a class="homeLink" href="'.$session{config}{scripturl}.'/home">';
|
||||
if ($param[0] ne "") {
|
||||
$temp .= $param[0];
|
||||
} else {
|
||||
|
|
|
|||
40
lib/WebGUI/Macro/I_imageWithTags.pm
Normal file
40
lib/WebGUI/Macro/I_imageWithTags.pm
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package WebGUI::Macro::I_imageWithTags;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my (@param, $temp, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
%data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
|
||||
$temp = '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/images/'.
|
||||
$data{imageId}.'/'.$data{filename}.'" '.$data{parameters}.'>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^I\((.*?)\)\;/_replacement($1)/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
43
lib/WebGUI/Macro/Include.pm
Normal file
43
lib/WebGUI/Macro/Include.pm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package WebGUI::Macro::Include;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use FileHandle;
|
||||
use WebGUI::Macro;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my (@param, $temp, $file);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] =~ /passwd/ || $param[0] =~ /shadow/ || $param[0] =~ /WebGUI.conf/) {
|
||||
$temp = "SECURITY VIOLATION";
|
||||
} else {
|
||||
$file = FileHandle->new($param[0],"r");
|
||||
while (<$file>) {
|
||||
$temp .= $_;
|
||||
}
|
||||
$file->close;
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^Include\((.*?)\)\;/_replacement($1)/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
25
lib/WebGUI/Macro/PageTitle.pm
Normal file
25
lib/WebGUI/Macro/PageTitle.pm
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package WebGUI::Macro::PageTitle;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^PageTitle\;/$session{page}{title}/g;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -39,7 +39,8 @@ sub traversePageTree {
|
|||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.'<a class="verticalMenu" href="'.$session{env}{SCRIPT_NAME}.'/'.$data[0].'">'.$data[1].'</a><br>';
|
||||
$output .= $depth.'<a class="verticalMenu" href="'.
|
||||
$session{config}{scripturl}.'/'.$data[0].'">'.$data[1].'</a><br>';
|
||||
$output .= traversePageTree($data[2],$_[1]+1,$toLevel);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^\/\;/$session{ENV}{SCRIPT_NAME}/g;
|
||||
$output =~ s/\^\/\;/$session{config}{scripturl}/g;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
39
lib/WebGUI/Macro/i_imageNoTags.pm
Normal file
39
lib/WebGUI/Macro/i_imageNoTags.pm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package WebGUI::Macro::i_imageNoTags;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my (@param, $temp, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
%data = WebGUI::SQL->quickHash("select * from images where name='$param[0]'");
|
||||
$temp = $session{setting}{attachmentDirectoryWeb}.'/images/'.$data{imageId}.'/'.$data{filename};
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, $temp);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^i\((.*?)\)\;/_replacement($1)/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -28,7 +28,8 @@ sub _replacement {
|
|||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}.
|
||||
'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ sub _replacement {
|
|||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ use WebGUI::SQL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @data, $pageTitle, $parentId, $sth, $first);
|
||||
$pageTitle = $1;
|
||||
my ($temp, @data, $pageTitle, $parentId, $sth, $first, @param);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
($parentId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$pageTitle'");
|
||||
($parentId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='$param[0]'");
|
||||
$sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId='$parentId' order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
|
|
@ -31,7 +31,8 @@ sub _replacement {
|
|||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}.
|
||||
'/'.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -44,7 +45,7 @@ sub process {
|
|||
my ($output,@data, $pageTitle, $parentId, $sth, $first, $temp);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^s\((.*?)\)\;/_replacement($1)/ge;
|
||||
$output =~ s/\^s\;/_replacement()/ge;
|
||||
#$output =~ s/\^s\;/_replacement()/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ sub _replacement {
|
|||
} else {
|
||||
$temp .= " · ";
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{env}{SCRIPT_NAME}.'/'.$data[1].'">'.$data[0].'</a>';
|
||||
$temp .= '<a class="horizontalMenu" href="'.$session{config}{scripturl}.'/'
|
||||
.$data[1].'">'.$data[0].'</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use WebGUI::Operation::Account;
|
|||
use WebGUI::Operation::Admin;
|
||||
use WebGUI::Operation::Group;
|
||||
use WebGUI::Operation::Help;
|
||||
use WebGUI::Operation::Image;
|
||||
use WebGUI::Operation::Package;
|
||||
use WebGUI::Operation::Page;
|
||||
use WebGUI::Operation::Search;
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ sub www_viewMessageLog {
|
|||
if ($data[2] ne "") {
|
||||
$row[$i] .= '</a>';
|
||||
}
|
||||
$row[$i] .= '</td><td class="tableData">'.epochToHuman($data[3],"%m/%d/%Y @ %H:%m%p").'</td></tr>';
|
||||
$row[$i] .= '</td><td class="tableData">'.epochToHuman($data[3],"%m/%d/%Y @ %H:%n%p").'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ sub www_viewHelp {
|
|||
tie %help, 'Tie::CPHash';
|
||||
%help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid} and namespace='$namespace' and language='$session{user}{language}'");
|
||||
$output = '<h1>'.WebGUI::International::get(93).': '.$help{action}.' '.$help{object}.'</h1>';
|
||||
$help{body} =~ s/\n/\<br\>/g;
|
||||
$output .= $help{body};
|
||||
$output .= '<p><b>'.WebGUI::International::get(94).':';
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}' and action<>'$help{action}' and language='$session{user}{language}' order by action");
|
||||
|
|
|
|||
240
lib/WebGUI/Operation/Image.pm
Normal file
240
lib/WebGUI/Operation/Image.pm
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
package WebGUI::Operation::Image;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::Attachment;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_addImage &www_addImageSave &www_editImage &www_editImageSave &www_viewImage
|
||||
&www_deleteImage &www_deleteImageConfirm &www_listImages &www_deleteImageFile);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addImage {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$output = helpLink(20);
|
||||
$output .= '<h1>'.WebGUI::International::get(382).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","addImageSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(383),
|
||||
WebGUI::Form::text("name",20,128,"Name"));
|
||||
$output .= tableFormRow(WebGUI::International::get(384),
|
||||
WebGUI::Form::file("filename"));
|
||||
$output .= tableFormRow(WebGUI::International::get(385),
|
||||
WebGUI::Form::textArea("parameters",'',50,5));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addImageSave {
|
||||
my ($imageId, $file);
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$imageId = getNextId("imageId");
|
||||
$file = WebGUI::Attachment::save("filename","images",$imageId);
|
||||
WebGUI::SQL->write("insert into images values ($imageId, ".quote($session{form}{name}).
|
||||
", ".quote($file).", ".quote($session{form}{parameters}).", $session{user}{userId}, ".
|
||||
quote($session{user}{username}).", ".time().")");
|
||||
return www_listImages();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteImage {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$output .= helpLink(23);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(392).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.
|
||||
'?op=deleteImageConfirm&iid='.$session{form}{iid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listImages">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteImageConfirm {
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
WebGUI::Attachment::deleteSubmission("images",$session{form}{iid});
|
||||
WebGUI::SQL->write("delete from images where imageId=$session{form}{iid}");
|
||||
return www_listImages();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteImageFile {
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
WebGUI::Attachment::deleteSubmission("images",$session{form}{iid});
|
||||
WebGUI::SQL->write("update images set filename='' where imageId=$session{form}{iid}");
|
||||
return www_editImage();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editImage {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
|
||||
$output = helpLink(20);
|
||||
$output .= '<h1>'.WebGUI::International::get(382).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editImageSave");
|
||||
$output .= WebGUI::Form::hidden("iid",$session{form}{iid});
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(389),
|
||||
$data{imageId});
|
||||
$output .= tableFormRow(WebGUI::International::get(383),
|
||||
WebGUI::Form::text("name",20,128,$data{name}));
|
||||
if ($data{filename} ne "") {
|
||||
$output .= tableFormRow(WebGUI::International::get(384),
|
||||
'<a href="'.$session{page}{url}.'?op=deleteImageFile&iid='.$data{imageId}.'">'.
|
||||
WebGUI::International::get(391).'</a>');
|
||||
} else {
|
||||
$output .= tableFormRow(WebGUI::International::get(384),
|
||||
WebGUI::Form::file("filename"));
|
||||
}
|
||||
$output .= tableFormRow(WebGUI::International::get(385),
|
||||
WebGUI::Form::textArea("parameters",$data{parameters},50,5));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
if ($data{filename} ne "") {
|
||||
$output .= '<p>'.WebGUI::International::get(390).'<p><img src="'.
|
||||
$session{setting}{attachmentDirectoryWeb}.'/images/'.$session{form}{iid}.
|
||||
'/'.$data{filename}.'">';
|
||||
}
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editImageSave {
|
||||
my ($file);
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$file = WebGUI::Attachment::save("filename","images",$session{form}{iid});
|
||||
if ($file ne "") {
|
||||
$file = ", filename=".quote($file);
|
||||
}
|
||||
WebGUI::SQL->write("update images set imageId=$session{form}{iid}, name=".quote($session{form}{name}).
|
||||
$file.", parameters=".quote($session{form}{parameters}).", userId=$session{user}{userId}, ".
|
||||
" username=".quote($session{user}{username}).", dateUploaded=".time());
|
||||
return www_listImages();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listImages {
|
||||
my ($output, $sth, %data, @row, $dataRows, $prevNextBar, $i, $search);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
$output = helpLink(26);
|
||||
$output .= '<h1>'.WebGUI::International::get(393).'</h1>';
|
||||
$output .= '<table class="tableData" align="center" width="75%"><tr><td>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=addImage">'.WebGUI::International::get(395).'</a>';
|
||||
$output .= '</td>'.formHeader().'<td align="right">';
|
||||
$output .= WebGUI::Form::hidden("op","listImages");
|
||||
$output .= WebGUI::Form::text("keyword",20,50);
|
||||
$output .= WebGUI::Form::submit(WebGUI::International::get(170));
|
||||
$output .= '</td></form></tr></table><p>';
|
||||
if ($session{form}{keyword} ne "") {
|
||||
$search = " where (name like '%".$session{form}{keyword}.
|
||||
"%' or filename like '%".$session{form}{keyword}."%') ";
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select * from images $search order by name");
|
||||
while (%data = $sth->hash) {
|
||||
$row[$i] = '<tr class="tableData"><td>';
|
||||
if ($session{user}{userId} == $data{userId}) {
|
||||
$row[$i] .= '<a href="'.$session{page}{url}.'?op=deleteImage&iid='.$data{imageId}.
|
||||
'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>';
|
||||
$row[$i] .= '<a href="'.$session{page}{url}.'?op=editImage&iid='.$data{imageId}.
|
||||
'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a>';
|
||||
} else {
|
||||
$row[$i] .= '<a href="'.$session{page}{url}.'?op=viewImage&iid='.$data{imageId}.
|
||||
'"><img src="'.$session{setting}{lib}.'/view.gif" border=0></a>';
|
||||
}
|
||||
$row[$i] .= '</td>';
|
||||
$row[$i] .= '<td>'.$data{name}.'</td>';
|
||||
$row[$i] .= '<td>'.$data{username}.'</td>';
|
||||
$row[$i] .= '<td>'.WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y").'</td>';
|
||||
$row[$i] .= '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
($dataRows, $prevNextBar) = paginate(50,$session{page}{url}.'?op=listImages',\@row);
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$output .= $dataRows;
|
||||
$output .= '</table>';
|
||||
$output .= $prevNextBar;
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewImage {
|
||||
my ($output, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(4)) {
|
||||
%data = WebGUI::SQL->quickHash("select * from images where imageId=$session{form}{iid}");
|
||||
$output .= '<h1>'.WebGUI::International::get(396).'</h1>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listImages">'.WebGUI::International::get(397).'</a>';
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(389),$data{imageId});
|
||||
$output .= tableFormRow(WebGUI::International::get(383),$data{name});
|
||||
$output .= tableFormRow(WebGUI::International::get(384),$data{filename});
|
||||
$output .= tableFormRow(WebGUI::International::get(385),$data{parameters});
|
||||
$output .= tableFormRow(WebGUI::International::get(387),$data{username});
|
||||
$output .= tableFormRow(WebGUI::International::get(388),
|
||||
WebGUI::DateTime::epochToHuman($data{dateUploaded},"%M/%D/%y"));
|
||||
$output .= '</table>';
|
||||
$output .= '<p><img src="'.$session{setting}{attachmentDirectoryWeb}.'/images/'.$session{form}{iid}.
|
||||
'/'.$data{filename}.'">';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -29,6 +29,7 @@ our @EXPORT = qw(&www_editUserGroupSave &www_deleteGrouping &www_editGrouping &w
|
|||
#-------------------------------------------------------------------
|
||||
sub www_addUser {
|
||||
my ($output, %hash, @array);
|
||||
tie %hash, 'Tie::IxHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= helpLink(5);
|
||||
$output .= '<h1>'.WebGUI::International::get(163).'</h1>';
|
||||
|
|
@ -178,8 +179,10 @@ sub www_editGroupingSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUser {
|
||||
my ($output, %user, %hash, @array, %gender, $sth);
|
||||
my ($output, %user, %hash, @array, %gender, $sth, %data);
|
||||
tie %user, 'Tie::CPHash';
|
||||
tie %hash, 'Tie::CPHash';
|
||||
tie %data, 'Tie::IxHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%gender = ('male'=>WebGUI::International::get(339),'female'=>WebGUI::International::get(340));
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId=$session{form}{uid}");
|
||||
|
|
@ -196,16 +199,16 @@ sub www_editUser {
|
|||
$output .= tableFormRow(WebGUI::International::get(378),$session{form}{uid});
|
||||
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,30,$user{username}));
|
||||
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,30,"password"));
|
||||
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
%data = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
$array[0] = $user{authMethod};
|
||||
$output .= tableFormRow(WebGUI::International::get(164),WebGUI::Form::selectList("authMethod",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(164),WebGUI::Form::selectList("authMethod",\%data,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(165),WebGUI::Form::text("ldapURL",20,2048,$user{ldapURL}));
|
||||
$output .= tableFormRow(WebGUI::International::get(166),WebGUI::Form::text("connectDN",20,255,$user{connectDN}));
|
||||
$output .= tableFormRow(WebGUI::International::get(56),WebGUI::Form::text("email",20,255,$user{email}));
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international");
|
||||
%data = WebGUI::SQL->buildHash("select distinct(language) from international");
|
||||
@array = [];
|
||||
$array[0] = $user{language};
|
||||
$output .= tableFormRow(WebGUI::International::get(304),WebGUI::Form::selectList("language",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(304),WebGUI::Form::selectList("language",\%data,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(314),WebGUI::Form::text("firstName",20,50,$user{firstName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(315),WebGUI::Form::text("middleName",20,50,$user{middleName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(316),WebGUI::Form::text("lastName",20,50,$user{lastName}));
|
||||
|
|
@ -239,16 +242,20 @@ sub www_editUser {
|
|||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editUserGroupSave");
|
||||
$output .= WebGUI::Form::hidden("uid",$session{form}{uid});
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
%data = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
@array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}");
|
||||
$output .= WebGUI::Form::selectList("groups",\%hash,\@array,5,1);
|
||||
$output .= WebGUI::Form::selectList("groups",\%data,\@array,5,1);
|
||||
$output .= '<br>'.WebGUI::Form::submit(WebGUI::International::get(62));
|
||||
$output .= '<p>'.WebGUI::International::get(373).'<p></form>';
|
||||
$output .= '<table><tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select groups.groupId,groups.groupName,groupings.expireDate from groupings,groups where groupings.groupId=groups.groupId and groupings.userId=$session{form}{uid} order by groups.groupName");
|
||||
while (%hash = $sth->hash) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='.$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.
|
||||
'?op=editGrouping&uid='.$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='.
|
||||
$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'.
|
||||
$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
|
||||
$session{page}{url}.'?op=editGrouping&uid='.$session{form}{uid}.
|
||||
'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}.
|
||||
'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td class="tableData">'.$hash{groupName}.'</td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,11 @@ sub finish {
|
|||
return $_[0]->{_sth}->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getColumnNames {
|
||||
return @{$_[0]->{_sth}->{NAME}};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getNextId {
|
||||
my ($id);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ sub _getPageInfo {
|
|||
}
|
||||
}
|
||||
%page = WebGUI::SQL->quickHash("select * from page where pageId='".$pageId."'",$_[1]);
|
||||
$page{url} = $ENV{SCRIPT_NAME}."/".$page{urlizedTitle};
|
||||
$page{url} = $_[3]."/".$page{urlizedTitle};
|
||||
return %page;
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +107,13 @@ sub open {
|
|||
foreach ($config->param) {
|
||||
$CONFIG{$_} = $config->param($_);
|
||||
}
|
||||
if( defined( $CONFIG{scripturl} ) ) {
|
||||
# get rid of leading "/" if present.
|
||||
$CONFIG{scripturl} =~ s/^\///;
|
||||
} else {
|
||||
# default to the "real" path to script.
|
||||
$CONFIG{scripturl} = $ENV{SCRIPT_NAME};
|
||||
}
|
||||
$dbh = DBI->connect($CONFIG{dsn}, $CONFIG{dbuser}, $CONFIG{dbpass}, { RaiseError => 0, AutoCommit => 1 });
|
||||
$query = CGI->new();
|
||||
foreach ($query->param) {
|
||||
|
|
@ -119,7 +126,7 @@ sub open {
|
|||
%VARS = _getSessionVars($COOKIES{wgSession},$dbh,$SETTINGS{sessionTimeout});
|
||||
%USER = _getUserInfo($VARS{sessionId},$dbh);
|
||||
$CGI::POST_MAX=1024 * $SETTINGS{maxAttachmentSize};
|
||||
%PAGE = _getPageInfo("",$dbh,$SETTINGS{notFoundPage});
|
||||
%PAGE = _getPageInfo("",$dbh,$SETTINGS{notFoundPage},$CONFIG{scripturl});
|
||||
%session = (
|
||||
env => \%ENV, # environment variables from the web server
|
||||
config=> \%CONFIG, # variables loaded from the config file
|
||||
|
|
|
|||
|
|
@ -12,11 +12,12 @@ package WebGUI::Shortcut;
|
|||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use WebGUI::Attachment;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&formHeader &formSave &tableFormRow &helpLink);
|
||||
our @EXPORT = qw(&attachmentBox &formHeader &formSave &tableFormRow &helpLink);
|
||||
|
||||
# The subroutines found herein do nothing other than creating a
|
||||
# short way of doing much longer repetitive tasks. They simply
|
||||
|
|
@ -24,6 +25,22 @@ our @EXPORT = qw(&formHeader &formSave &tableFormRow &helpLink);
|
|||
# less cluttered code.
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub attachmentBox {
|
||||
my ($output, %fileType, $fileUrl);
|
||||
$fileUrl = $session{setting}{attachmentDirectoryWeb}.'/'.$_[1].'/';
|
||||
if ($_[2] ne "") {
|
||||
$fileUrl .= $_[2].'/';
|
||||
}
|
||||
$fileUrl .= $_[0];
|
||||
%fileType = WebGUI::Attachment::getType($_[0]);
|
||||
$output = '<p><table cellpadding=3 cellspacing=0 border=1><tr><td class="tableHeader">'.
|
||||
'<a href="'.$fileUrl.'"><img src="'.$session{setting}{lib}.'/attachment.gif" border=0 alt="'.
|
||||
$_[0].'"></a></td><td><a href="'.$fileUrl.'"><img src="'.$fileType{icon}.
|
||||
'" align="middle" width="16" height="16" border="0" alt="'.$_[0].'">'.$_[0].'</a></td></tr></table>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub formHeader {
|
||||
my ($output);
|
||||
|
|
@ -42,7 +59,8 @@ sub formSave {
|
|||
sub helpLink {
|
||||
my ($output, $namespace);
|
||||
$namespace = $_[1] || "WebGUI";
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid='.$_[0].'&namespace='.$namespace.'"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid='.$_[0].'&namespace='.$namespace.
|
||||
'" target="_blank"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,13 @@ sub getStyle {
|
|||
$header = '<!-- WebGUI '.$WebGUI::VERSION.' -->
|
||||
<html>
|
||||
<head>
|
||||
<title>'.$session{page}{title}.'</title>'
|
||||
<title>';
|
||||
if ($session{page}{pageId} == 1) {
|
||||
$header .= $session{setting}{companyName}.' - '.$session{page}{title};
|
||||
} else {
|
||||
$header .= $session{page}{title};
|
||||
}
|
||||
$header .= '</title>'
|
||||
.$style{styleSheet}
|
||||
.$session{page}{metaTags};
|
||||
if ($session{page}{defaultMetaTags}) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ sub duplicate {
|
|||
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
|
||||
WebGUI::Attachment::copy($data{image},$_[0],$newWidgetId);
|
||||
WebGUI::Attachment::copy($data{attachment},$_[0],$newWidgetId);
|
||||
WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}')");
|
||||
WebGUI::SQL->write("insert into Article values ($newWidgetId, $data{startDate}, $data{endDate}, ".quote($data{body}).", ".quote($data{image}).", ".quote($data{linkTitle}).", ".quote($data{linkURL}).", ".quote($data{attachment}).", '$data{convertCarriageReturns}', ".quote($data{alignImage}).")");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -48,7 +48,7 @@ sub widgetName {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output, %hash);
|
||||
my ($output, %hash, @array);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = helpLink(1,$namespace);
|
||||
|
|
@ -66,6 +66,14 @@ sub www_add {
|
|||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("endDate",20,30,'01/01/2037',1));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::textArea("body",'',50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::file("image"));
|
||||
%hash = (
|
||||
right => WebGUI::International::get(15,$namespace),
|
||||
left => WebGUI::International::get(16,$namespace),
|
||||
center => WebGUI::International::get(17,$namespace)
|
||||
);
|
||||
$array[0] = "right";
|
||||
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
|
||||
WebGUI::Form::selectList("alignImage",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("linkTitle",20,128));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("linkURL",20,2048));
|
||||
$output .= tableFormRow(WebGUI::International::get(9,$namespace),WebGUI::Form::file("attachment"));
|
||||
|
|
@ -86,7 +94,7 @@ sub www_addSave {
|
|||
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
|
||||
$image = WebGUI::Attachment::save("image",$widgetId);
|
||||
$attachment = WebGUI::Attachment::save("attachment",$widgetId);
|
||||
WebGUI::SQL->write("insert into Article values ($widgetId, '".setToEpoch($session{form}{startDate})."', '".setToEpoch($session{form}{endDate})."', ".quote($session{form}{body}).", ".quote($image).", ".quote($session{form}{linkTitle}).", ".quote($session{form}{linkURL}).", ".quote($attachment).", '$session{form}{convertCarriageReturns}')");
|
||||
WebGUI::SQL->write("insert into Article values ($widgetId, '".setToEpoch($session{form}{startDate})."', '".setToEpoch($session{form}{endDate})."', ".quote($session{form}{body}).", ".quote($image).", ".quote($session{form}{linkTitle}).", ".quote($session{form}{linkURL}).", ".quote($attachment).", '$session{form}{convertCarriageReturns}', ".quote($session{form}{alignImage}).")");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -150,6 +158,14 @@ sub www_edit {
|
|||
} else {
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::file("image"));
|
||||
}
|
||||
%hash = (
|
||||
right => WebGUI::International::get(15,$namespace),
|
||||
left => WebGUI::International::get(16,$namespace),
|
||||
center => WebGUI::International::get(17,$namespace)
|
||||
);
|
||||
$array[0] = $data{alignImage};
|
||||
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
|
||||
WebGUI::Form::selectList("alignImage",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::text("linkTitle",20,128,$data{linkTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::text("linkURL",20,2048,$data{linkURL}));
|
||||
if ($data{attachment} ne "") {
|
||||
|
|
@ -179,7 +195,7 @@ sub www_editSave {
|
|||
if ($attachment ne "") {
|
||||
$attachment = ', attachment='.quote($attachment);
|
||||
}
|
||||
WebGUI::SQL->write("update Article set startDate='".setToEpoch($session{form}{startDate})."', endDate='".setToEpoch($session{form}{endDate})."', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}");
|
||||
WebGUI::SQL->write("update Article set alignImage=".quote($session{form}{alignImage}).", startDate='".setToEpoch($session{form}{startDate})."', endDate='".setToEpoch($session{form}{endDate})."', convertCarriageReturns='$session{form}{convertCarriageReturns}', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -188,7 +204,7 @@ sub www_editSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @test, $output);
|
||||
my (%data, @test, $output, $image);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
if ($data{startDate}<time() && $data{endDate}>time()) {
|
||||
|
|
@ -196,7 +212,16 @@ sub www_view {
|
|||
$output = "<h1>".$data{title}."</h1>";
|
||||
}
|
||||
if ($data{image} ne "") {
|
||||
$output .= '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{image}.'" border="0" align="right">';
|
||||
$image = '<img src="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{image}.'"';
|
||||
if ($data{alignImage} ne "center") {
|
||||
$image .= ' align="'.$data{alignImage}.'"';
|
||||
}
|
||||
$image .= ' border="0">';
|
||||
if ($data{alignImage} eq "center") {
|
||||
$output .= '<div align="center">'.$image.'</div>';
|
||||
} else {
|
||||
$output .= $image;
|
||||
}
|
||||
}
|
||||
if ($data{convertCarriageReturns}) {
|
||||
$data{body} =~ s/\n/\<br\>/g;
|
||||
|
|
@ -206,7 +231,7 @@ sub www_view {
|
|||
$output .= '<p><a href="'.$data{linkURL}.'">'.$data{linkTitle}.'</a>';
|
||||
}
|
||||
if ($data{attachment} ne "") {
|
||||
$output .= '<p><a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{attachment}.'"><img src="'.$session{setting}{lib}.'/attachment.gif" border=0 alt="'.WebGUI::International::get(14,$namespace).'"></a>';
|
||||
$output .= attachmentBox($data{attachment},$_[0]);
|
||||
}
|
||||
}
|
||||
if ($data{processMacros} == 1) {
|
||||
|
|
|
|||
581
lib/WebGUI/Widget/DownloadManager.pm
Normal file
581
lib/WebGUI/Widget/DownloadManager.pm
Normal file
|
|
@ -0,0 +1,581 @@
|
|||
package WebGUI::Widget::DownloadManager;
|
||||
|
||||
our $namespace = "DownloadManager";
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Widget;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _reorderDownloads {
|
||||
my ($sth, $i, $did);
|
||||
$sth = WebGUI::SQL->read("select downloadId from DownloadManager_file where widgetId=$_[0] order by sequenceNumber");
|
||||
while (($did) = $sth->array) {
|
||||
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber='$i' where downloadId=$did");
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub duplicate {
|
||||
my (%data, $newWidgetId, $pageId, %row, $sth, $newDownloadId);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
$pageId = $_[1] || $data{pageId};
|
||||
$newWidgetId = create(
|
||||
$pageId,
|
||||
$namespace,
|
||||
$data{title},
|
||||
$data{displayTitle},
|
||||
$data{description},
|
||||
$data{processMacros},
|
||||
$data{templatePosition}
|
||||
);
|
||||
WebGUI::SQL->write("insert into DownloadManager values ($newWidgetId, $data{paginateAfter})");
|
||||
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0]");
|
||||
while (%row = $sth->hash) {
|
||||
$newDownloadId = getNextId("downloadId");
|
||||
WebGUI::Attachment::copy($row{downloadFile},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
|
||||
WebGUI::Attachment::copy($row{alternateVersion1},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
|
||||
WebGUI::Attachment::copy($row{alternateVersion2},$_[0],$newWidgetId,$row{downloadId},$newDownloadId);
|
||||
WebGUI::SQL->write("insert into DownloadManager_file values ($newDownloadId, $newWidgetId, ".
|
||||
quote($row{fileTitle}).", ".quote($row{downloadFile}).", $row{groupToView}, ".
|
||||
quote($row{briefSynopsis}).", $row{dateUploaded}, $row{sequenceNumber}, ".
|
||||
quote($row{alternateVersion1}).", ".quote($row{alternateVersion2}).")");
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub purge {
|
||||
purgeWidget($_[0],$_[1],$namespace);
|
||||
WebGUI::SQL->write("delete from DownloadManager_file where widgetId=$_[0]");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub widgetName {
|
||||
return WebGUI::International::get(1,$namespace);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output, %hash);
|
||||
tie %hash,'Tie::IxHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = helpLink(1,$namespace);
|
||||
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("widget",$namespace);
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,30,widgetName())
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle",1,1)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros",1,1)
|
||||
);
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",'',50,5,1)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(20,$namespace),
|
||||
WebGUI::Form::text("paginateAfter",20,30,50)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::checkbox("proceed",1,1)
|
||||
);
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addSave {
|
||||
my ($widgetId);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create(
|
||||
$session{page}{pageId},
|
||||
$session{form}{widget},
|
||||
$session{form}{title},
|
||||
$session{form}{displayTitle},
|
||||
$session{form}{description},
|
||||
$session{form}{processMacros},
|
||||
$session{form}{templatePosition}
|
||||
);
|
||||
WebGUI::SQL->write("insert into DownloadManager values ($widgetId, '$session{form}{paginateAfter}')");
|
||||
if ($session{form}{proceed} == 1) {
|
||||
$session{form}{wid} = $widgetId;
|
||||
return www_addDownload();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addDownload {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output .= '<h1>'.WebGUI::International::get(4,$namespace).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","addDownloadSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(6,$namespace),
|
||||
WebGUI::Form::file("downloadFile")
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(17,$namespace),
|
||||
WebGUI::Form::file("alternateVersion1")
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(18,$namespace),
|
||||
WebGUI::Form::file("alternateVersion2")
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("fileTitle",20,128,WebGUI::International::get(5,$namespace))
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(8,$namespace),
|
||||
WebGUI::Form::text("briefSynopsis",50,256)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(7,$namespace),
|
||||
WebGUI::Form::groupList("groupToView",2)
|
||||
);
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addDownloadSave {
|
||||
my ($downloadId,$file,$alt1,$alt2,$sequenceNumber);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$downloadId = getNextId("downloadId");
|
||||
$file = WebGUI::Attachment::save("downloadFile",$session{form}{wid},$downloadId);
|
||||
$alt1 = WebGUI::Attachment::save("alternateVersion1",$session{form}{wid},$downloadId);
|
||||
$alt2 = WebGUI::Attachment::save("alternateVersion2",$session{form}{wid},$downloadId);
|
||||
($sequenceNumber) = WebGUI::SQL->quickArray("select count(*)+1 from DownloadManager_file where widgetId=$session{form}{wid}");
|
||||
WebGUI::SQL->write("insert into DownloadManager_file values (".
|
||||
$downloadId.
|
||||
", ".$session{form}{wid}.
|
||||
", ".quote($session{form}{fileTitle}).
|
||||
", ".quote($file).
|
||||
", '$session{form}{groupToView}'".
|
||||
", ".quote($session{form}{briefSynopsis}).
|
||||
", ".time().
|
||||
", ".$sequenceNumber.
|
||||
", ".quote($alt1).
|
||||
", ".quote($alt2).
|
||||
")");
|
||||
return www_edit();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_copy {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
duplicate($session{form}{wid});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteFile {
|
||||
my ($delete);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
if ($session{form}{alt} == 1) {
|
||||
$delete = "alternateVersion1";
|
||||
} elsif ($session{form}{alt} == 2) {
|
||||
$delete = "alternateVersion2";
|
||||
} else {
|
||||
$delete = "downloadFile";
|
||||
}
|
||||
WebGUI::SQL->write("update DownloadManager_file set $delete='' where downloadId=$session{form}{did}");
|
||||
return www_editDownload();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteDownload {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(12,$namespace).'<p>';
|
||||
$output .= '<div align="center">'.
|
||||
'<a href="'.$session{page}{url}.
|
||||
'?func=deleteDownloadConfirm&wid='.
|
||||
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
|
||||
WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.
|
||||
'?func=edit&wid='.$session{form}{wid}.'">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteDownloadConfirm {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("delete from DownloadManager_file where downloadId=$session{form}{did}");
|
||||
_reorderDownloads($session{form}{wid});
|
||||
return www_edit();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_download {
|
||||
my (%download);
|
||||
tie %download,'Tie::CPHash';
|
||||
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId=$session{form}{did}");
|
||||
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
|
||||
$session{header}{redirect} = WebGUI::Session::httpRedirect(
|
||||
$session{setting}{attachmentDirectoryWeb}."/".
|
||||
$session{form}{wid}."/".$session{form}{did}."/".$download{downloadFile}
|
||||
);
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my ($output, %data, %hash, @array, $sth, @download);
|
||||
tie %data, 'Tie::CPHash';
|
||||
tie %hash, 'Tie::IxHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%data = getProperties($namespace,$session{form}{wid});
|
||||
$output .= helpLink(1,$namespace);
|
||||
$output .= '<h1>'.WebGUI::International::get(9,$namespace).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,30,$data{title})
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle})
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros","1",
|
||||
$data{processMacros})
|
||||
);
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$array[0] = $data{templatePosition};
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash,\@array)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",$data{description},50,5,1)
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(20,$namespace),
|
||||
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter})
|
||||
);
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addDownload&wid='.
|
||||
$session{form}{wid}.'">'.WebGUI::International::get(11,$namespace).'</a><p>';
|
||||
$output .= '<table border=1 cellpadding=3 cellspacing=0>';
|
||||
$sth = WebGUI::SQL->read("select downloadId,fileTitle from DownloadManager_file where widgetId='$session{form}{wid}' order by sequenceNumber");
|
||||
while (@download = $sth->array) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.
|
||||
'?func=editDownload&wid='.$session{form}{wid}.
|
||||
'&did='.$download[0].'"><img src="'.
|
||||
$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.
|
||||
$session{page}{url}.'?func=deleteDownload&wid='.
|
||||
$session{form}{wid}.'&did='.$download[0].'"><img src="'.
|
||||
$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.
|
||||
$session{page}{url}.'?func=moveDownloadUp&wid='.
|
||||
$session{form}{wid}.'&did='.$download[0].'"><img src="'.
|
||||
$session{setting}{lib}.'/upArrow.gif" border=0></a><a href="'.
|
||||
$session{page}{url}.'?func=moveDownloadDown&wid='.
|
||||
$session{form}{wid}.'&did='.$download[0].
|
||||
'"><img src="'.$session{setting}{lib}.
|
||||
'/downArrow.gif" border=0></a></td><td>'.$download[1].'</td><tr>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</table>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
update();
|
||||
WebGUI::SQL->write("update DownloadManager set paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editDownload {
|
||||
my ($output, %download);
|
||||
tie %download,'Tie::CPHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%download = WebGUI::SQL->quickHash("select * from DownloadManager_file where downloadId='$session{form}{did}'");
|
||||
$output .= '<h1>'.WebGUI::International::get(10,$namespace).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("did",$session{form}{did});
|
||||
$output .= WebGUI::Form::hidden("func","editDownloadSave");
|
||||
$output .= '<table>';
|
||||
if ($download{downloadFile} ne "") {
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(6,$namespace),
|
||||
'<a href="'.$session{page}{url}.'?func=deleteFile&wid='.
|
||||
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
|
||||
WebGUI::International::get(13,$namespace).'</a>
|
||||
');
|
||||
} else {
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(6,$namespace),
|
||||
WebGUI::Form::file("downloadFile")
|
||||
);
|
||||
}
|
||||
if ($download{alternateVersion1} ne "") {
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(17,$namespace),
|
||||
'<a href="'.$session{page}{url}.'?func=deleteFile&alt=1&wid='.
|
||||
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
|
||||
WebGUI::International::get(13,$namespace).'</a>
|
||||
');
|
||||
} else {
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(17,$namespace),
|
||||
WebGUI::Form::file("alternateVersion1")
|
||||
);
|
||||
}
|
||||
if ($download{alternateVersion2} ne "") {
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(18,$namespace),
|
||||
'<a href="'.$session{page}{url}.'?func=deleteFile&alt=2&wid='.
|
||||
$session{form}{wid}.'&did='.$session{form}{did}.'">'.
|
||||
WebGUI::International::get(13,$namespace).'</a>
|
||||
');
|
||||
} else {
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(18,$namespace),
|
||||
WebGUI::Form::file("alternateVersion2")
|
||||
);
|
||||
}
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("fileTitle",20,128,$download{fileTitle})
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(8,$namespace),
|
||||
WebGUI::Form::text("briefSynopsis",50,256,$download{briefSynopsis})
|
||||
);
|
||||
$output .= tableFormRow(
|
||||
WebGUI::International::get(7,$namespace),
|
||||
WebGUI::Form::groupList("groupToView",$download{groupToView})
|
||||
);
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editDownloadSave {
|
||||
my ($file, $alt1, $alt2);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$file = WebGUI::Attachment::save("downloadFile",$session{form}{wid},$session{form}{did});
|
||||
if ($file ne "") {
|
||||
$file = ', downloadFile='.quote($file);
|
||||
}
|
||||
$alt1 = WebGUI::Attachment::save("alternateVersion1",$session{form}{wid},$session{form}{did});
|
||||
if ($alt1 ne "") {
|
||||
$alt1 = ', alternateVersion1='.quote($alt1);
|
||||
}
|
||||
$alt2 = WebGUI::Attachment::save("alternateVersion2",$session{form}{wid},$session{form}{did});
|
||||
if ($alt2 ne "") {
|
||||
$alt2 = ', alternateVersion2='.quote($alt2);
|
||||
}
|
||||
WebGUI::SQL->write("update DownloadManager_file set ".
|
||||
" downloadId=".$session{form}{did}.
|
||||
", widgetId=".$session{form}{wid}.
|
||||
", fileTitle=".quote($session{form}{fileTitle}).
|
||||
$file.$alt1.$alt2.
|
||||
", groupToView='$session{form}{groupToView}'".
|
||||
", briefSynopsis=".quote($session{form}{briefSynopsis}).
|
||||
", dateUploaded=".time().
|
||||
" where downloadId=".$session{form}{did}
|
||||
);
|
||||
return www_edit();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveDownloadDown {
|
||||
my (@data, $thisSeq);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from DownloadManager_file where downloadId=$session{form}{did}");
|
||||
@data = WebGUI::SQL->quickArray("select downloadId from DownloadManager_file where widgetId=$session{form}{wid} and sequenceNumber=$thisSeq+1 group by widgetId");
|
||||
if ($data[0] ne "") {
|
||||
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber+1 where downloadId=$session{form}{did}");
|
||||
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber-1 where downloadId=$data[0]");
|
||||
}
|
||||
return www_edit();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveDownloadUp {
|
||||
my (@data, $thisSeq);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from DownloadManager_file where downloadId=$session{form}{did}");
|
||||
@data = WebGUI::SQL->quickArray("select downloadId from DownloadManager_file where widgetId=$session{form}{wid} and sequenceNumber=$thisSeq-1 group by widgetId");
|
||||
if ($data[0] ne "") {
|
||||
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber-1 where downloadId=$session{form}{did}");
|
||||
WebGUI::SQL->write("update DownloadManager_file set sequenceNumber=sequenceNumber+1 where downloadId=$data[0]");
|
||||
}
|
||||
return www_edit();
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (@row, $i, $dataRows, $prevNextBar, %data, @test, %fileType, $output, $sth, %download, $flag);
|
||||
tie %download, 'Tie::CPHash';
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
if (defined %data) {
|
||||
if ($data{displayTitle} == 1) {
|
||||
$output .= '<h1>'.$data{title}.'</h1>';
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
}
|
||||
$output .= '<table cellpadding="3" cellspacing="1" border="0" width="100%">';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(14,$namespace).
|
||||
'</td><td class="tableHeader">'.WebGUI::International::get(15,$namespace).
|
||||
'</td><td class="tableHeader">'.WebGUI::International::get(16,$namespace).'</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select * from DownloadManager_file where widgetId=$_[0] order by sequenceNumber");
|
||||
while (%download = $sth->hash) {
|
||||
if (WebGUI::Privilege::isInGroup($download{groupToView})) {
|
||||
%fileType = WebGUI::Attachment::getType($download{downloadFile});
|
||||
$row[$i] = '<tr><td class="tableData" valign="top">';
|
||||
$row[$i] .= '<a href="'.$session{page}{url}.'?func=download&wid='.$_[0].
|
||||
'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}.
|
||||
'" border=0 width=16 height=16 align="middle">'.
|
||||
$download{fileTitle}.' ('.$fileType{extension}.')</a>';
|
||||
if ($download{alternateVersion1}) {
|
||||
%fileType = WebGUI::Attachment::getType($download{alternateVersion1});
|
||||
$row[$i] .= ' · <a href="'.$session{page}{url}.'?func=download&wid='.
|
||||
$_[0].'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}.
|
||||
'" border=0 width=16 height=16 align="middle">('.
|
||||
$fileType{extension}.')</a>';
|
||||
}
|
||||
if ($download{alternateVersion2}) {
|
||||
%fileType = WebGUI::Attachment::getType($download{alternateVersion2});
|
||||
$row[$i] .= ' · <a href="'.$session{page}{url}.'?func=download&wid='.
|
||||
$_[0].'&did='.$download{downloadId}.'"><img src="'.$fileType{icon}.
|
||||
'" border=0 width=16 height=16 align="middle">('.
|
||||
$fileType{extension}.')</a>';
|
||||
}
|
||||
$row[$i] .= '</td><td class="tableData" valign="top">'.$download{briefSynopsis}.'</td>'.
|
||||
'<td class="tableData" valign="top">'.
|
||||
epochToHuman($download{dateUploaded},"%M/%D/%y").'</td>'.
|
||||
'</tr>';
|
||||
$flag = 1;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
unless ($flag) {
|
||||
$output .= '<tr><td class="tableData" colspan="3">'.
|
||||
WebGUI::International::get(19,$namespace).'</td></tr>';
|
||||
}
|
||||
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row);
|
||||
$output .= $dataRows;
|
||||
$output .= '</table>';
|
||||
$output .= $prevNextBar;
|
||||
if ($data{processMacros} == 1) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -29,8 +29,9 @@ sub duplicate {
|
|||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
$pageId = $_[1] || $data{pageId};
|
||||
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
|
||||
WebGUI::SQL->write("insert into EventsCalendar values ($newWidgetId)");
|
||||
$newWidgetId = create($pageId,$namespace,$data{title},
|
||||
$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
|
||||
WebGUI::SQL->write("insert into EventsCalendar values ($newWidgetId, '$data{calendarLayout}', '$data{paginateAfter}')");
|
||||
$sth = WebGUI::SQL->read("select * from EventsCalendar_event where widgetId=$_[0] order by recurringEventId");
|
||||
while (@row = $sth->array) {
|
||||
$newEventId = getNextId("eventId");
|
||||
|
|
@ -38,7 +39,9 @@ sub duplicate {
|
|||
$row[6] = getNextId("recurringEventId");
|
||||
$previousRecurringEventId = $row[6];
|
||||
}
|
||||
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, $newWidgetId, ".quote($row[2]).", ".quote($row[3]).", '".$row[4]."', '".$row[5]."', $row[6])");
|
||||
WebGUI::SQL->write("insert into EventsCalendar_event values ($newEventId, $newWidgetId, ".
|
||||
quote($row[2]).", ".quote($row[3]).", '".$row[4].
|
||||
"', '".$row[5]."', $row[6])");
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
|
@ -65,12 +68,20 @@ sub www_add {
|
|||
$output .= WebGUI::Form::hidden("widget",$namespace);
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'Events Calendar'));
|
||||
$output .= tableFormRow(WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,128,'Events Calendar'));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
|
||||
%hash = (list => WebGUI::International::get(17,$namespace),
|
||||
calendar => WebGUI::International::get(18,$namespace));
|
||||
$output .= tableFormRow(WebGUI::International::get(16,$namespace),
|
||||
WebGUI::Form::selectList("calendarLayout",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(19,$namespace),
|
||||
WebGUI::Form::text("paginateAfter",20,30,50));
|
||||
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::checkbox("proceed",1,1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
|
|
@ -85,8 +96,10 @@ sub www_add {
|
|||
sub www_addSave {
|
||||
my ($widgetId);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
|
||||
WebGUI::SQL->write("insert into EventsCalendar values ($widgetId)");
|
||||
$widgetId = create($session{page}{pageId},$session{form}{widget},
|
||||
$session{form}{title},$session{form}{displayTitle},$session{form}{description},
|
||||
$session{form}{processMacros},$session{form}{templatePosition});
|
||||
WebGUI::SQL->write("insert into EventsCalendar values ($widgetId, '$session{form}{calendarLayout}', '$session{form}{paginateAfter}')");
|
||||
if ($session{form}{proceed} == 1) {
|
||||
$session{form}{wid} = $widgetId;
|
||||
return www_addEvent();
|
||||
|
|
@ -114,9 +127,12 @@ sub www_addEvent {
|
|||
$output .= WebGUI::Form::hidden("func","addEventSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("name",20,128));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(176),WebGUI::Form::text("startDate",20,30,$today,1,'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"'));
|
||||
$output .= tableFormRow(WebGUI::International::get(177),WebGUI::Form::text("endDate",20,30,$today,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",'',50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
|
||||
WebGUI::Form::text("startDate",20,30,$today,1,'onBlur="this.form.endDate.value=this.form.startDate.value;this.form.until.value=this.form.startDate.value;"'));
|
||||
$output .= tableFormRow(WebGUI::International::get(15,$namespace),
|
||||
WebGUI::Form::text("endDate",20,30,$today,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(8,$namespace),WebGUI::Form::selectList("recursEvery",\%recursEvery).' '.WebGUI::International::get(9,$namespace).' '.WebGUI::Form::text("until",20,30,$today,1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
|
|
@ -220,12 +236,23 @@ sub www_edit {
|
|||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",$data{description},50,5,1));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$array[0] = $data{templatePosition};
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
%hash = (list => WebGUI::International::get(17,$namespace),
|
||||
calendar => WebGUI::International::get(18,$namespace));
|
||||
$array[0] = $data{calendarLayout};
|
||||
$output .= tableFormRow(WebGUI::International::get(16,$namespace),
|
||||
WebGUI::Form::selectList("calendarLayout",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(19,$namespace),
|
||||
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter}));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
$output .= '<p><a href="'.$session{page}{url}.'?func=addEvent&wid='.$session{form}{wid}.'">Add New Event</a><p>';
|
||||
|
|
@ -246,6 +273,7 @@ sub www_edit {
|
|||
sub www_editSave {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
update();
|
||||
WebGUI::SQL->write("update EventsCalendar set calendarLayout='$session{form}{calendarLayout}', paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -264,10 +292,14 @@ sub www_editEvent {
|
|||
$output .= WebGUI::Form::hidden("eid",$session{form}{eid});
|
||||
$output .= WebGUI::Form::hidden("func","editEventSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("name",20,128,$event{name}));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$event{description},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(176),WebGUI::Form::text("startDate",20,30,epochToSet($event{startDate}),1));
|
||||
$output .= tableFormRow(WebGUI::International::get(177),WebGUI::Form::text("endDate",20,30,epochToSet($event{endDate}),1));
|
||||
$output .= tableFormRow(WebGUI::International::get(99),
|
||||
WebGUI::Form::text("name",20,128,$event{name}));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",$event{description},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
|
||||
WebGUI::Form::text("startDate",20,30,epochToSet($event{startDate}),1));
|
||||
$output .= tableFormRow(WebGUI::International::get(15,$namespace),
|
||||
WebGUI::Form::text("endDate",20,30,epochToSet($event{endDate}),1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ sub www_editSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my (%data, @test, $output);
|
||||
my (%data, @test, $output, %fileType);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
if (defined %data) {
|
||||
|
|
@ -165,12 +165,18 @@ sub www_view {
|
|||
$output .= '<span class="itemTitle">'.$data{title}.'</span>';
|
||||
}
|
||||
if ($data{attachment} ne "") {
|
||||
$output .= ' - <a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.$data{attachment}.'"><img src="'.$session{setting}{lib}.'/smallAttachment.gif" border=0 alt="'.WebGUI::International::get(5,$namespace).'"></a>';
|
||||
%fileType = WebGUI::Attachment::getType($data{attachment});
|
||||
$output .= ' - <a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$_[0].'/'.
|
||||
$data{attachment}.'"><img src="'.$fileType{icon}.'" border=0 alt="'.
|
||||
$data{attachment}.'" width=16 height=16 border=0 align="middle"></a>';
|
||||
}
|
||||
if ($data{description} ne "") {
|
||||
$output .= ' - '.$data{description};
|
||||
}
|
||||
}
|
||||
if ($data{processMacros} == 1) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,17 +58,20 @@ sub www_add {
|
|||
$output .= WebGUI::Form::hidden("widget",$namespace);
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'Message Board'));
|
||||
$output .= tableFormRow(WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,128,'Message Board'));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = 2;
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::selectList("groupToPost",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("messagesPerPage",20,2,30));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("editTimeout",20,3,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::groupList("groupToPost",2));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
|
||||
WebGUI::Form::text("messagesPerPage",20,2,30));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("editTimeout",20,3,1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -120,9 +123,8 @@ sub www_edit {
|
|||
$array[0] = $board{templatePosition};
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$board{description},50,5,1));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = $board{groupToPost};
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::selectList("groupToPost",\%hash,\@array,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::selectList("groupToPost",$board{groupToPost}));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage}));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("editTimeout",20,2,$board{editTimeout}));
|
||||
$output .= formSave();
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ sub widgetName {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_add {
|
||||
my ($output, %hash, @array);
|
||||
tie %hash, "Tie::IxHash";
|
||||
my ($output, %hash);
|
||||
tie %hash, 'Tie::IxHash';
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = helpLink(1,$namespace);
|
||||
$output .= '<h1>'.WebGUI::International::get(2,$namespace).'</h1>';
|
||||
|
|
@ -107,15 +107,17 @@ sub www_add {
|
|||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::checkbox("active",1,1));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = 1;
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::selectList("voteGroup",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("graphWidth",20,3,150));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
|
||||
WebGUI::Form::groupList("voteGroup",1));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("graphWidth",20,3,150));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("question",50,255));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',WebGUI::Form::textArea("answers",'',50,8,0,'on'));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',
|
||||
WebGUI::Form::textArea("answers",'',50,8,0,'on'));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -162,19 +164,26 @@ sub www_edit {
|
|||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros",1,$data{processMacros}));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$array[0] = $data{templatePosition};
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::checkbox("active",1,$data{active}));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = $data{voteGroup};
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::selectList("voteGroup",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("graphWidth",20,3,$data{graphWidth}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("question",50,255,$data{question}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on'));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",$data{description},50,5,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::checkbox("active",1,$data{active}));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
|
||||
WebGUI::Form::groupList("voteGroup",$data{voteGroup}));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("graphWidth",20,3,$data{graphWidth}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
|
||||
WebGUI::Form::text("question",50,255,$data{question}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace).'<span><br>'.WebGUI::International::get(8,$namespace).'</span>',
|
||||
WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on'));
|
||||
$output .= formSave();
|
||||
$output .= tableFormRow("",'<a href="'.$session{page}{url}.'?func=resetVotes&wid='.$session{form}{wid}.'">'.WebGUI::International::get(10,$namespace).'</a>');
|
||||
$output .= '</table></form>';
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@ sub duplicate {
|
|||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
$pageId = $_[1] || $data{pageId};
|
||||
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},$data{description},$data{processMacros},$data{templatePosition});
|
||||
WebGUI::SQL->write("insert into SQLReport values($newWidgetId, ".quote($data{template}).", ".quote($data{dbQuery}).", ".quote($data{DSN}).", ".quote($data{username}).", ".quote($data{identifier}).", '$data{convertCarriageReturns}')");
|
||||
$newWidgetId = create($pageId,$namespace,$data{title},$data{displayTitle},
|
||||
$data{description},$data{processMacros},$data{templatePosition});
|
||||
WebGUI::SQL->write("insert into SQLReport values($newWidgetId, ".quote($data{template}).", ".
|
||||
quote($data{dbQuery}).", ".quote($data{DSN}).", ".quote($data{username}).", ".
|
||||
quote($data{identifier}).", '$data{convertCarriageReturns}', '$data{paginateAfter}')");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -54,18 +57,31 @@ sub www_add {
|
|||
$output .= WebGUI::Form::hidden("widget",$namespace);
|
||||
$output .= WebGUI::Form::hidden("func","addSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,'SQL Report'));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,128,widgetName()));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle",1,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros",1,1));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'','','',1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::textArea("template",'','','',1));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::textArea("dbQuery",''));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("DSN",20,255,$session{config}{dsn}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("username",20,255,$session{config}{dbuser}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::password("identifier",20,255));
|
||||
$output .= tableFormRow(WebGUI::International::get(183),WebGUI::Form::checkbox("convertCarriageReturns",1));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",'','','',1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::textArea("template",'','','',1));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
|
||||
WebGUI::Form::textArea("dbQuery",''));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("DSN",20,255,$session{config}{dsn}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
|
||||
WebGUI::Form::text("username",20,255,$session{config}{dbuser}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),
|
||||
WebGUI::Form::password("identifier",20,255));
|
||||
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
|
||||
WebGUI::Form::text("paginateAfter",20,30,50));
|
||||
$output .= tableFormRow(WebGUI::International::get(13,$namespace),
|
||||
WebGUI::Form::checkbox("convertCarriageReturns",1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -79,8 +95,15 @@ sub www_add {
|
|||
sub www_addSave {
|
||||
my ($widgetId);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$widgetId = create($session{page}{pageId},$session{form}{widget},$session{form}{title},$session{form}{displayTitle},$session{form}{description},$session{form}{processMacros},$session{form}{templatePosition});
|
||||
WebGUI::SQL->write("insert into SQLReport values($widgetId, ".quote($session{form}{template}).", ".quote($session{form}{dbQuery}).", ".quote($session{form}{DSN}).", ".quote($session{form}{username}).", ".quote($session{form}{identifier}).", '$session{form}{convertCarriageReturns}')");
|
||||
$widgetId = create($session{page}{pageId},$session{form}{widget},
|
||||
$session{form}{title},$session{form}{displayTitle},
|
||||
$session{form}{description},$session{form}{processMacros},
|
||||
$session{form}{templatePosition});
|
||||
WebGUI::SQL->write("insert into SQLReport values($widgetId, ".
|
||||
quote($session{form}{template}).", ".quote($session{form}{dbQuery}).", ".
|
||||
quote($session{form}{DSN}).", ".quote($session{form}{username}).", ".
|
||||
quote($session{form}{identifier}).
|
||||
", '$session{form}{convertCarriageReturns}', '$session{form}{paginateAfter}')");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -110,19 +133,32 @@ sub www_edit {
|
|||
$output .= WebGUI::Form::hidden("wid",$session{form}{wid});
|
||||
$output .= WebGUI::Form::hidden("func","editSave");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$data{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
|
||||
$output .= tableFormRow(WebGUI::International::get(99),
|
||||
WebGUI::Form::text("title",20,128,$data{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(174),
|
||||
WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}));
|
||||
$output .= tableFormRow(WebGUI::International::get(175),
|
||||
WebGUI::Form::checkbox("processMacros","1",$data{processMacros}));
|
||||
%hash = WebGUI::Widget::getPositions();
|
||||
$array[0] = $data{templatePosition};
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),WebGUI::Form::textArea("template",$data{template},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),WebGUI::Form::text("DSN",20,255,$data{DSN}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("username",20,255,$data{username}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),WebGUI::Form::password("identifier",20,255,$data{identifier}));
|
||||
$output .= tableFormRow(WebGUI::International::get(183),WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}));
|
||||
$output .= tableFormRow(WebGUI::International::get(363),
|
||||
WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),
|
||||
WebGUI::Form::textArea("description",$data{description},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(3,$namespace),
|
||||
WebGUI::Form::textArea("template",$data{template},50,10,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(4,$namespace),
|
||||
WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10));
|
||||
$output .= tableFormRow(WebGUI::International::get(5,$namespace),
|
||||
WebGUI::Form::text("DSN",20,255,$data{DSN}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),
|
||||
WebGUI::Form::text("username",20,255,$data{username}));
|
||||
$output .= tableFormRow(WebGUI::International::get(7,$namespace),
|
||||
WebGUI::Form::password("identifier",20,255,$data{identifier}));
|
||||
$output .= tableFormRow(WebGUI::International::get(14,$namespace),
|
||||
WebGUI::Form::text("paginateAfter",20,30,$data{paginateAfter}));
|
||||
$output .= tableFormRow(WebGUI::International::get(13,$namespace),
|
||||
WebGUI::Form::checkbox("convertCarriageReturns",1,$data{convertCarriageReturns}));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
|
|
@ -136,7 +172,12 @@ sub www_editSave {
|
|||
my ($widgetId, $displayTitle, $image, $attachment);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
update();
|
||||
WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).", dbQuery=".quote($session{form}{dbQuery}).", convertCarriageReturns='$session{form}{convertCarriageReturns}', DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier})." where widgetId=$session{form}{wid}");
|
||||
WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).
|
||||
", dbQuery=".quote($session{form}{dbQuery}).
|
||||
", convertCarriageReturns='$session{form}{convertCarriageReturns}', DSN=".
|
||||
quote($session{form}{DSN}).", username=".quote($session{form}{username}).
|
||||
", identifier=".quote($session{form}{identifier}).
|
||||
", paginateAfter='$session{form}{paginateAfter}' where widgetId=$session{form}{wid}");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -145,7 +186,8 @@ sub www_editSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my ($ouch, %data, $output, $sth, $dbh, @result, @template, $temp);
|
||||
my (@row, $i, $dataRows, $prevNextBar, $ouch, %data, $output, $sth, $dbh, @result,
|
||||
@template, $temp, $col);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = getProperties($namespace,$_[0]);
|
||||
if (defined %data) {
|
||||
|
|
@ -155,8 +197,6 @@ sub www_view {
|
|||
if ($data{description} ne "") {
|
||||
$output .= $data{description}.'<p>';
|
||||
}
|
||||
@template = split(/\^\-\;/,$data{template});
|
||||
$output .= $template[0];
|
||||
if ($data{DSN} =~ /\DBI\:\w+\:\w+/) {
|
||||
$dbh = DBI->connect($data{DSN},$data{username},$data{identifier});
|
||||
} else {
|
||||
|
|
@ -171,15 +211,39 @@ sub www_view {
|
|||
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] The SQL query is improperly formatted.");
|
||||
}
|
||||
if ($sth->rows > 0) {
|
||||
if ($data{template} ne "") {
|
||||
@template = split(/\^\-\;/,$data{template});
|
||||
} else {
|
||||
$i = 0;
|
||||
$template[0] = '<table width="100%"><tr>';
|
||||
$template[1] = '<tr>';
|
||||
foreach $col ($sth->getColumnNames) {
|
||||
$template[0] .= '<td class="tableHeader">'.$col.'</td>';
|
||||
$template[1] .= '<td class="tableData">^'.$i.';</td>';
|
||||
$i++;
|
||||
}
|
||||
$template[0] .= '</tr>';
|
||||
$template[1] .= '</tr>';
|
||||
$template[2] = '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
$output .= $template[0];
|
||||
while (@result = $sth->array) {
|
||||
$temp = $template[1];
|
||||
$temp =~ s/\^(\d)\;/$result[$1]/g;
|
||||
$temp =~ s/\^(\d*)\;/$result[$1]/g;
|
||||
if ($data{convertCarriageReturns}) {
|
||||
$temp =~ s/\n/\<br\>/g;
|
||||
}
|
||||
$output .= $temp;
|
||||
$row[$i] = $temp;
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
($dataRows, $prevNextBar) = paginate($data{paginateAfter},$session{page}{url},\@row);
|
||||
$output .= $dataRows;
|
||||
$output .= $template[2];
|
||||
if ($#row > $data{paginateAfter}) {
|
||||
$output .= $prevNextBar;
|
||||
}
|
||||
} else {
|
||||
$output .= WebGUI::International::get(11,$namespace).'<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] There was a problem with the query.");
|
||||
|
|
@ -189,7 +253,6 @@ sub www_view {
|
|||
$output .= WebGUI::International::get(12,$namespace).'<p>';
|
||||
WebGUI::ErrorHandler::warn("SQLReport [$_[0]] Could not connect to remote database.");
|
||||
}
|
||||
$output .= $template[2];
|
||||
}
|
||||
if ($data{processMacros} == 1) {
|
||||
$output = WebGUI::Macro::process($output);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ sub _traversePageTree {
|
|||
$sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]' order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
$output .= $depth.$_[4].' <a href="'.$session{env}{SCRIPT_NAME}.'/'.$data[0].'">'.$data[1].'</a>';
|
||||
$output .= $depth.$_[4].' <a href="'.$session{config}{scripturl}.
|
||||
'/'.$data[0].'">'.$data[1].'</a>';
|
||||
$output .= $lineSpacing;
|
||||
$output .= _traversePageTree($data[2],$_[1]+1,$_[2],$_[3],$_[4],$_[5]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ sub duplicate {
|
|||
$sth = WebGUI::SQL->read("select * from UserSubmission_submission where widgetId=$_[0]");
|
||||
while (@row = $sth->array) {
|
||||
$newSubmissionId = getNextId("submissionId");
|
||||
WebGUI::Attachment::copy($row[8],$_[0],$newWidgetId,$row[1],$newSubmissionId);
|
||||
WebGUI::SQL->write("insert into UserSubmission_submission values ($newWidgetId, $newSubmissionId, ".quote($row[2]).", $row[3], ".quote($row[4]).", '$row[5]', ".quote($row[6]).", ".quote($row[7]).", ".quote($row[8]).", '$row[9]', '$row[10]')");
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -71,11 +72,10 @@ sub www_add {
|
|||
%hash = WebGUI::Widget::getPositions();
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",'',50,5,1));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = 4;
|
||||
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::selectList("groupToApprove",\%hash,\@array));
|
||||
$array[0] = 2;
|
||||
$output .= tableFormRow(WebGUI::International::get(2,$namespace),WebGUI::Form::selectList("groupToContribute",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(1,$namespace),
|
||||
WebGUI::Form::groupList("groupToApprove",4));
|
||||
$output .= tableFormRow(WebGUI::International::get(2,$namespace),
|
||||
WebGUI::Form::groupList("groupToContribute",2));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("submissionsPerPage",20,2,50));
|
||||
%hash = ("Approved"=>WebGUI::International::get(7,$namespace),"Denied"=>WebGUI::International::get(8,$namespace),"Pending"=>WebGUI::International::get(9,$namespace));
|
||||
$output .= tableFormRow(WebGUI::International::get(10,$namespace),WebGUI::Form::selectList("defaultStatus",\%hash,'',1));
|
||||
|
|
@ -265,11 +265,10 @@ sub www_edit {
|
|||
$array[0] = $data{templatePosition};
|
||||
$output .= tableFormRow(WebGUI::International::get(363),WebGUI::Form::selectList("templatePosition",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$data{description}));
|
||||
$array[0] = $data{groupToApprove};
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$output .= tableFormRow(WebGUI::International::get(1,$namespace),WebGUI::Form::selectList("groupToApprove",\%hash,\@array,1));
|
||||
$array[0] = $data{groupToContribute};
|
||||
$output .= tableFormRow(WebGUI::International::get(2,$namespace),WebGUI::Form::selectList("groupToContribute",\%hash,\@array,1));
|
||||
$output .= tableFormRow(WebGUI::International::get(1,$namespace),
|
||||
WebGUI::Form::groupList("groupToApprove",$data{groupToApprove}));
|
||||
$output .= tableFormRow(WebGUI::International::get(2,$namespace),
|
||||
WebGUI::Form::groupList("groupToContribute",$data{groupToContribute}));
|
||||
$output .= tableFormRow(WebGUI::International::get(6,$namespace),WebGUI::Form::text("submissionsPerPage",20,2,$data{submissionsPerPage}));
|
||||
%hash = ("Approved"=>WebGUI::International::get(7,$namespace),"Denied"=>WebGUI::International::get(8,$namespace),"Pending"=>WebGUI::International::get(9,$namespace));
|
||||
$array[0] = $data{defaultStatus};
|
||||
|
|
@ -404,7 +403,7 @@ sub www_viewSubmission {
|
|||
#---menu
|
||||
$output .= '<a href="'.$session{page}{url}.'">'.WebGUI::International::get(28,$namespace).'</a><br>';
|
||||
if ($submission{userId} == $session{user}{userId}) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(186).'</a><br>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=deleteSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(37,$namespace).'</a><br>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?func=editSubmission&wid='.$session{form}{wid}.'&sid='.$session{form}{sid}.'">'.WebGUI::International::get(27,$namespace).'</a><br>';
|
||||
}
|
||||
if ($submission{status} eq "Pending" && (WebGUI::Privilege::isInGroup(3,$session{user}{userId}) || WebGUI::Privilege::isInGroup(4,$session{user}{userId}))) {
|
||||
|
|
@ -422,7 +421,7 @@ sub www_viewSubmission {
|
|||
}
|
||||
$output .= $submission{content}.'<p>';
|
||||
if ($submission{attachment} ne "") {
|
||||
$output .= '<p><a href="'.$session{setting}{attachmentDirectoryWeb}.'/'.$session{form}{wid}.'/'.$session{form}{sid}.'/'.$submission{attachment}.'"><img src="'.$session{setting}{lib}.'/attachment.gif" border=0 alt="Download Attachment"></a><p>';
|
||||
$output .= attachmentBox($submission{attachment},$session{form}{wid},$session{form}{sid});
|
||||
}
|
||||
$output .= '</td></tr></table>';
|
||||
return $output;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue