package WebGUI::Operation::Group; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2002 Plain Black LLC. #------------------------------------------------------------------- # 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 Tie::CPHash; use WebGUI::DateTime; use WebGUI::HTMLForm; use WebGUI::Icon; use WebGUI::International; use WebGUI::Paginator; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; use WebGUI::URL; use WebGUI::Utility; our @ISA = qw(Exporter); our @EXPORT = qw(&www_deleteGroup &www_deleteGroupConfirm &www_editGroup &www_editGroupSave &www_listGroups); #------------------------------------------------------------------- sub www_deleteGroup { my ($output); if ($session{form}{gid} < 26) { return WebGUI::Privilege::vitalComponent(); } elsif (WebGUI::Privilege::isInGroup(3)) { $output .= helpIcon(15); $output .= '
'; $output .= '
'; return $output; } else { return WebGUI::Privilege::adminOnly(); } } #------------------------------------------------------------------- sub www_deleteGroupConfirm { if ($session{form}{gid} < 26) { return WebGUI::Privilege::vitalComponent(); } elsif (WebGUI::Privilege::isInGroup(3)) { WebGUI::SQL->write("delete from groups where groupId=$session{form}{gid}"); WebGUI::SQL->write("delete from groupings where groupId=$session{form}{gid}"); return www_listGroups(); } else { return WebGUI::Privilege::adminOnly(); } } #------------------------------------------------------------------- sub www_editGroup { my ($output, $sth, %group, %hash, $f); tie %group, 'Tie::CPHash'; tie %hash, 'Tie::CPHash'; if (WebGUI::Privilege::isInGroup(3)) { if ($session{form}{gid} eq "new") { $group{expireAfter} = 314496000; $group{karmaThreshold} = 1000000000; } else { %group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}"); } $output .= helpIcon(17); $output .= '| '.WebGUI::International::get(50).' | '.WebGUI::International::get(369).' | |
| ' .deleteIcon('op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}) .editIcon('op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}) .' | '; $output .= '' .$hash{username}.' | '; $output .= ''.epochToHuman($hash{expireDate},"%z").' |
| ' .deleteIcon('op=deleteGroup&gid='.$data[0]) .editIcon('op=editGroup&gid='.$data[0]) .' | '; $row[$i] .= ''.$data[1].' | '; $row[$i] .= ''.$data[2].' |