WebGUI 1.0.0 release
This commit is contained in:
parent
597b9ff2b0
commit
655ba6d283
40 changed files with 606 additions and 267 deletions
|
|
@ -119,7 +119,11 @@ sub www_displayAccount {
|
|||
$output .= '</form> ';
|
||||
$output .= '<div class="accountOptions"><ul>';
|
||||
if (WebGUI::Privilege::isInGroup(3) || WebGUI::Privilege::isInGroup(4)) {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">Turn admin on.</a>';
|
||||
if ($session{var}{adminOn}) {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOffAdmin">Turn admin off.</a>';
|
||||
} else {
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=switchOnAdmin">Turn admin on.</a>';
|
||||
}
|
||||
}
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=logout">Logout.</a><li><a href="'.$session{page}{url}.'?op=deactivateAccount">Please deactivate my account permanently.</a></ul></div>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -115,33 +115,37 @@ sub www_editGroupSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listGroups {
|
||||
my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage);
|
||||
my ($output, $pn, $sth, @data, @row, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from groups where groupName<>'Reserved'",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=10"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Groups</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addGroup">Add a new group.</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td valign="top">'.$data[1].'</td>';
|
||||
$output .= '<td valign="top">'.$data[2].'</td></tr>';
|
||||
$row[$i] = '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[1].'</td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[2].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$output .= $row[$i];
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listGroups">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listGroups">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ sub www_editSettings {
|
|||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit("save").'</td></tr>';
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<hr size=1>Build Version: '.$session{wg}{version}.'<br>Release Date: '.$session{wg}{date};
|
||||
$output .= '<hr size=1>Build Version: '.$WebGUI::VERSION;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::insufficient();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,32 +112,36 @@ sub www_editStyleSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listStyles {
|
||||
my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage);
|
||||
my ($output, $pn, $sth, @data, @row, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from style where name<>'Reserved'",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=9"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Styles</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addStyle">Add a new style.</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td valign="top">'.$data[1].'</td>';
|
||||
$row[$i] = '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[1].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$output .= $row[$i];
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listStyles">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listGroups&pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listStyles">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
|
|
|
|||
71
lib/WebGUI/Operation/Trash.pm
Normal file
71
lib/WebGUI/Operation/Trash.pm
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package WebGUI::Operation::Trash;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 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 qw(vars subs);
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _purgeWidgets {
|
||||
my ($b, $widgetId, $widgetType, $func);
|
||||
$b = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=$_[0]",$session{dbh});
|
||||
while (($widgetId,$widgetType) = $b->array) {
|
||||
$func = "WebGUI::Widget::".$widgetType."::purge";
|
||||
&$func($widgetId,$session{dbh});
|
||||
}
|
||||
$b->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _recursePageTree {
|
||||
my ($a, $pageId);
|
||||
$a = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh});
|
||||
while (($pageId) = $a->array) {
|
||||
_recursePageTree($pageId);
|
||||
_purgeWidgets($pageId);
|
||||
WebGUI::SQL->write("delete from page where pageId=$pageId",$session{dbh});
|
||||
}
|
||||
$a->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_purgeTrash {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<h1>Please Confirm</h1>';
|
||||
$output .= 'Are you certain that you wish to purge all the pages and widgets in the trash?<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=purgeTrashConfirm">Yes, I\'m sure.</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">No, I made a mistake.</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_purgeTrashConfirm {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
_recursePageTree(3);
|
||||
_purgeWidgets(3);
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -138,38 +138,42 @@ sub www_editUserSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listUsers {
|
||||
my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage);
|
||||
my ($output, $sth, @data, @row, $pn, $i, $itemsPerPage);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$itemsPerPage = 50;
|
||||
if ($session{form}{pageNumber} < 1) {
|
||||
$currentPage = 1;
|
||||
} else {
|
||||
$currentPage = $session{form}{pageNumber};
|
||||
}
|
||||
($totalItems) = WebGUI::SQL->quickArray("select count(*) from user where username<>'Reserved'",$session{dbh});
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=8"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>Users</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addUser">Add a new user.</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from user where username<>'Reserved' order by username limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from user where username<>'Reserved' order by username",$session{dbh});
|
||||
while (@data = $sth->array) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
#$output .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
$output .= '<td>'.$data[1].'</td>';
|
||||
$output .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
|
||||
$row[$i] = '<tr><td><a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
#$row[$i] .= '<td><a href="'.$session{page}{url}.'?op=viewUserProfile&uid='.$data[0].'">'.$data[1].'</a></td>';
|
||||
$row[$i] .= '<td>'.$data[1].'</td>';
|
||||
$row[$i] .= '<td><a href="mailto:'.$data[2].'">'.$data[2].'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$output .= '</table><div class="pagination">';
|
||||
if ($currentPage > 1) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listUsers&pageNumber='.($currentPage-1).'">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($currentPage < round($totalItems/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=listUsers&pageNumber='.($currentPage+1).'">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
if ($session{form}{pn} < 1) {
|
||||
$pn = 0;
|
||||
} else {
|
||||
$pn = $session{form}{pn};
|
||||
}
|
||||
for ($i=($itemsPerPage*$pn); $i<($itemsPerPage*($pn+1));$i++) {
|
||||
$output .= $row[$i];
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= '<div class="pagination">';
|
||||
if ($pn > 0) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn-1).'&op=listUsers">«Previous Page</a>';
|
||||
} else {
|
||||
$output .= '«Previous Page';
|
||||
}
|
||||
$output .= ' · ';
|
||||
if ($pn < round($#row/$itemsPerPage)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?pn='.($pn+1).'&op=listUsers">Next Page»</a>';
|
||||
} else {
|
||||
$output .= 'Next Page»';
|
||||
}
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue