WebGUI 3.1.0 release
This commit is contained in:
parent
d1c1445ea1
commit
71cd27d3bc
56 changed files with 2025 additions and 238 deletions
|
|
@ -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>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue