more session changes
This commit is contained in:
parent
657ae8baf7
commit
f429daa942
27 changed files with 857 additions and 666 deletions
|
|
@ -606,6 +606,14 @@ Fix $session{asset}
|
|||
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!\$session{asset}!\$self->session->asset!g' {} \;
|
||||
|
||||
Fix $session{scratch}
|
||||
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteAllScratch!\$self->session->scratch->deleteAll!g' {} \;
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteScratch!\$self->session->scratch->delete!g' {} \;
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!WebGUI\:\:Session\:\:setScratch!\$self->session->scratch->set!g' {} \;
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!WebGUI\:\:Session\:\:getScratch!\$self->session->scratch->get!g' {} \;
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!\$session{scratch}{(\w+)}!\$self->session->scratch->get("$1")!g' {} \;
|
||||
|
||||
|
||||
5.23.1 WebGUI::SQL API Refactored
|
||||
|
||||
|
|
@ -648,6 +656,12 @@ find . -name '*.pm' -exec perl -pi.bak -e 's!\$session{page}{useEmptyStyle} = (\
|
|||
find . -name '*.pm' -exec perl -pi.bak -e 's!\$session{page}{makePrintable} = (\d+);!\$self->session->style->makePrintable("$1")!g' {} \;
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!WebGUI\:\:Style\:\:!\$self->session->style->!g' {} \;
|
||||
|
||||
5.23.5 WebGUI::URL API Refactored
|
||||
|
||||
As of 6.9 WebGUI::URL is now accessed through session like $session->url
|
||||
|
||||
find . -name '*.pm' -exec perl -pi.bak -e 's!WebGUI\:\:URL\:\:!\$self->session->url->!g' {} \;
|
||||
|
||||
|
||||
5.23.5 Lots of APIs Refactored
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ The name of the operation to execute.
|
|||
=cut
|
||||
|
||||
sub execute {
|
||||
my $session = shift;
|
||||
my $op = shift;
|
||||
my ($output, $cmd);
|
||||
my $operation = getOperations();
|
||||
|
|
@ -56,13 +57,13 @@ sub execute {
|
|||
# Load the module
|
||||
$cmd = 'use '.$operation->{$op};
|
||||
eval ($cmd);
|
||||
WebGUI::ErrorHandler::error("Couldn't compile operation: ".$operation->{$op}.". Root cause: ".$@) if ($@);
|
||||
$session->error("Couldn't compile operation: ".$operation->{$op}.". Root cause: ".$@) if ($@);
|
||||
# Call the method
|
||||
$cmd = $operation->{$op} . '::www_'.$op;
|
||||
$output = eval($cmd);
|
||||
WebGUI::ErrorHandler::error("Couldn't execute operation : ".$cmd.". Root cause: ".$@) if ($@);
|
||||
$output = eval{&$cmd($session)};
|
||||
$session->error("Couldn't execute operation : ".$cmd.". Root cause: ".$@) if ($@);
|
||||
} else {
|
||||
WebGUI::ErrorHandler::security("execute an invalid operation: ".$op);
|
||||
$session->security("execute an invalid operation: ".$op);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,14 +37,15 @@ Operation handler for displaying and killing active sessions.
|
|||
|
||||
This method can be called directly, but is usually called
|
||||
from www_viewActiveSessions. It ends the active session in
|
||||
$session{form}{sid}. Afterwards, it calls www_viewActiveSessions.
|
||||
$session->form->process("sid"). Afterwards, it calls www_viewActiveSessions.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_killSession {
|
||||
return www_viewActiveSessions() if $session{form}{sid} eq $session{var}{sessionId};
|
||||
my $session = shift;
|
||||
return www_viewActiveSessions() if $session->form->process("sid") eq $session->var->get("sessionId");
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::Session::end($session{form}{sid});
|
||||
WebGUI::Session::end($session->form->process("sid"));
|
||||
return www_viewActiveSessions();
|
||||
}
|
||||
|
||||
|
|
@ -58,10 +59,11 @@ delete (kill) each one via www_killSession
|
|||
=cut
|
||||
|
||||
sub www_viewActiveSessions {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$sth = WebGUI::SQL->read("select users.username,users.userId,userSession.sessionId,userSession.expires,
|
||||
$sth = $session->db->read("select users.username,users.userId,userSession.sessionId,userSession.expires,
|
||||
userSession.lastPageView,userSession.lastIP from users,userSession where users.userId=userSession.userId
|
||||
and users.userId<>1 order by users.username,userSession.lastPageView desc");
|
||||
while (%data = $sth->hash) {
|
||||
|
|
@ -74,7 +76,7 @@ sub www_viewActiveSessions {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewActiveSessions'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=viewActiveSessions'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
||||
|
|
@ -83,9 +85,9 @@ sub www_viewActiveSessions {
|
|||
$output .= '<td>'.WebGUI::International::get(430).'</td>';
|
||||
$output .= '<td>'.WebGUI::International::get(431).'</td>';
|
||||
$output .= '<td>'.WebGUI::International::get(436).'</td></tr>';
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= $p->getPage($session->form->process("pn"));
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
return WebGUI::AdminConsole->new("activeSessions")->render($output);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ If the current user is in the Turn On Admin Group, then return an Admin Console.
|
|||
=cut
|
||||
|
||||
sub www_adminConsole {
|
||||
my $session = shift;
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
my $ac = WebGUI::AdminConsole->new;
|
||||
return $ac->render;
|
||||
|
|
@ -50,6 +51,7 @@ via WebGUI::Session::switchAdminOff()
|
|||
=cut
|
||||
|
||||
sub www_switchOffAdmin {
|
||||
my $session = shift;
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
WebGUI::Session::switchAdminOff();
|
||||
return "";
|
||||
|
|
@ -65,6 +67,7 @@ via WebGUI::Session::switchAdminOn()
|
|||
=cut
|
||||
|
||||
sub www_switchOnAdmin {
|
||||
my $session = shift;
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
WebGUI::Session::switchAdminOn();
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -32,19 +32,20 @@ Get the instance of this object or create a new instance if none exists
|
|||
|
||||
=cut
|
||||
|
||||
sub getInstance {
|
||||
sub getInstance {
|
||||
my $session = shift;
|
||||
#Get Auth Settings
|
||||
my $authMethod = $session{user}{authMethod} || $session{setting}{authMethod};
|
||||
$authMethod = $session{setting}{authMethod} if($session{user}{userId} eq '1');
|
||||
$authMethod = $_[0] if($_[0] && isIn($_[0], @{$session{config}{authMethods}}));
|
||||
my $authMethod = $session->user->profileField("authMethod") || $session->setting->get("authMethod");
|
||||
$authMethod = $session->setting->get("authMethod") if($session->user->profileField("userId") eq '1');
|
||||
$authMethod = $_[0] if($_[0] && isIn($_[0], @{$session->config->get("authMethods")}));
|
||||
my $userId = $_[1];
|
||||
#Create Auth Object
|
||||
my $cmd = "WebGUI::Auth::".$authMethod;
|
||||
my $load = "use ".$cmd;
|
||||
eval($load);
|
||||
WebGUI::ErrorHandler::fatal("Authentication module failed to compile: $cmd.".$@) if($@);
|
||||
$session->errorHandler->fatal("Authentication module failed to compile: $cmd.".$@) if($@);
|
||||
my $auth = eval{$cmd->new($authMethod,$userId)};
|
||||
WebGUI::ErrorHandler::fatal("Couldn't instantiate authentication module: $authMethod. Root cause: ".$@) if($@);
|
||||
$session->errorHandler->fatal("Couldn't instantiate authentication module: $authMethod. Root cause: ".$@) if($@);
|
||||
return $auth;
|
||||
}
|
||||
|
||||
|
|
@ -60,12 +61,13 @@ is returned.
|
|||
=cut
|
||||
|
||||
sub www_auth {
|
||||
my $session = shift;
|
||||
my $auth;
|
||||
($auth) = WebGUI::SQL->quickArray("select authMethod from users where username=".quote($session{form}{username})) if($session{form}{username});
|
||||
($auth) = $session->db->quickArray("select authMethod from users where username=".$session->db->quote($session->form->process("username"))) if($session->form->process("username"));
|
||||
my $authMethod = getInstance($auth);
|
||||
my $methodCall = shift || $session{form}{method} || "init";
|
||||
my $methodCall = shift || $session->form->process("method") || "init";
|
||||
if(!$authMethod->isCallable($methodCall)){
|
||||
WebGUI::ErrorHandler::security("access uncallable auth method on page '".$session{page}{title}."' [".$session{page}{pageId}."].");
|
||||
$session->errorHandler->security("access uncallable auth method on page '".$session{page}{title}."' [".$session{page}{pageId}."].");
|
||||
return WebGUI::International::get(1077);
|
||||
}
|
||||
return WebGUI::Operation::Shared::userStyle($authMethod->$methodCall);
|
||||
|
|
|
|||
|
|
@ -47,12 +47,13 @@ is looked up in the i18n table in the WebGUI namespace.
|
|||
=cut
|
||||
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title) if ($title);
|
||||
my $ac = WebGUI::AdminConsole->new("cache");
|
||||
if ($session{setting}{trackPageStatistics}) {
|
||||
$ac->addSubmenuItem( WebGUI::URL::page('op=manageCache'), WebGUI::International::get('manage cache'));
|
||||
if ($session->setting->get("trackPageStatistics")) {
|
||||
$ac->addSubmenuItem( $session->url->page('op=manageCache'), WebGUI::International::get('manage cache'));
|
||||
}
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
|
@ -74,6 +75,7 @@ Text description of how long the subscription lasts.
|
|||
=cut
|
||||
|
||||
sub www_flushCache {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $cache = WebGUI::Cache->new();
|
||||
$cache->flush;
|
||||
|
|
@ -90,10 +92,11 @@ provides an option to clear the cache.
|
|||
=cut
|
||||
|
||||
sub www_manageCache {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $data);
|
||||
my $cache = WebGUI::Cache->new();
|
||||
my $flushURL = WebGUI::URL::page('op=flushCache');
|
||||
my $flushURL = $session->url->page('op=flushCache');
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get('cache type').':</td><td class="tableData">'.ref($cache).'</td></tr>';
|
||||
$output .= '<tr><td align="right" valign="top" class="tableHeader">'.WebGUI::International::get('cache statistics').':</td><td class="tableData"><pre>'.$cache->stats.'</pre></td></tr>';
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use WebGUI::Icon;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $i18n = WebGUI::International->new("Commerce");
|
||||
|
||||
my $workarea = shift;
|
||||
|
|
@ -37,30 +38,34 @@ sub _submenu {
|
|||
if ($help) {
|
||||
$ac->setHelp($help, 'Commerce');
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editCommerceSettings'), $i18n->get('manage commerce settings'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listTransactions'), $i18n->get('list transactions'));
|
||||
$ac->addSubmenuItem($session->url->page('op=editCommerceSettings'), $i18n->get('manage commerce settings'));
|
||||
$ac->addSubmenuItem($session->url->page('op=listTransactions'), $i18n->get('list transactions'));
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _clearCheckoutScratch {
|
||||
my $session = shift;
|
||||
_clearShippingScratch();
|
||||
_clearPaymentScratch();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _clearPaymentScratch {
|
||||
my $session = shift;
|
||||
WebGUI::Session::setScratch('paymentGateway', '-delete-');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _clearShippingScratch {
|
||||
my $session = shift;
|
||||
WebGUI::Session::setScratch('shippingMethod', '-delete-');
|
||||
WebGUI::Session::setScratch('shippingOptions', '-delete-');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _paymentSelected {
|
||||
my $session = shift;
|
||||
return 0 unless (WebGUI::Session::getScratch('paymentGateway'));
|
||||
my $plugin = WebGUI::Commerce::Payment->load(WebGUI::Session::getScratch('paymentGateway'));
|
||||
return 1 if ($plugin && $plugin->enabled);
|
||||
|
|
@ -69,6 +74,7 @@ sub _paymentSelected {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _shippingSelected {
|
||||
my $session = shift;
|
||||
return 0 unless (WebGUI::Session::getScratch('shippingMethod'));
|
||||
|
||||
my $plugin = WebGUI::Commerce::Shipping->load(WebGUI::Session::getScratch('shippingMethod'));
|
||||
|
|
@ -82,28 +88,31 @@ sub _shippingSelected {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addToCart {
|
||||
WebGUI::Commerce::ShoppingCart->new->add($session{form}{itemId}, $session{form}{itemType}, $session{form}{quantity});
|
||||
my $session = shift;
|
||||
WebGUI::Commerce::ShoppingCart->new->add($session->form->process("itemId"), $session->form->process("itemType"), $session->form->process("quantity"));
|
||||
|
||||
return WebGUI::Operation::execute('viewCart');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_cancelTransaction {
|
||||
my $session = shift;
|
||||
my ($transaction, %var);
|
||||
|
||||
$transaction = WebGUI::Commerce::Transaction->new($session{form}{tid});
|
||||
$transaction = WebGUI::Commerce::Transaction->new($session->form->process("tid"));
|
||||
unless ($transaction->status eq 'Completed') {
|
||||
$transaction->cancelTransaction;
|
||||
}
|
||||
|
||||
$var{message} = WebGUI::International::get('checkout canceled message', 'Commerce');
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session{setting}{commerceCheckoutCanceledTemplateId})->process(\%var));
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session->setting->get("commerceCheckoutCanceledTemplateId"))->process(\%var));
|
||||
}
|
||||
|
||||
# This operation is here for easier future extensions to the commerce system.
|
||||
#-------------------------------------------------------------------
|
||||
sub www_checkout {
|
||||
my $session = shift;
|
||||
return WebGUI::Operation::execute('selectShippingMethod') unless (_shippingSelected);
|
||||
|
||||
return WebGUI::Operation::execute('selectPaymentGateway') unless (_paymentSelected);
|
||||
|
|
@ -113,14 +122,15 @@ sub www_checkout {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_checkoutConfirm {
|
||||
my $session = shift;
|
||||
my ($plugin, $f, %var, $errors, $i18n, $shoppingCart, $normal, $recurring, $shipping, $total);
|
||||
$errors = shift;
|
||||
|
||||
$i18n = WebGUI::International->new('Commerce');
|
||||
|
||||
# If the user isn't logged in yet, let him do so or have him create an account
|
||||
if ($session{user}{userId} == 1) {
|
||||
WebGUI::Session::setScratch('redirectAfterLogin', WebGUI::URL::page('op=checkout'));
|
||||
if ($session->user->profileField("userId") == 1) {
|
||||
WebGUI::Session::setScratch('redirectAfterLogin', $session->url->page('op=checkout'));
|
||||
return WebGUI::Operation::execute('auth');
|
||||
}
|
||||
|
||||
|
|
@ -180,18 +190,19 @@ sub www_checkoutConfirm {
|
|||
$var{form} = $f->print;
|
||||
$var{title} = $i18n->get('checkout confirm title');
|
||||
|
||||
$var{'changePayment.url'} = WebGUI::URL::page('op=selectPaymentGateway');
|
||||
$var{'changePayment.url'} = $session->url->page('op=selectPaymentGateway');
|
||||
$var{'changePayment.label'} = $i18n->get('change payment gateway');
|
||||
$var{'changeShipping.url'} = WebGUI::URL::page('op=selectShippingMethod');
|
||||
$var{'changeShipping.url'} = $session->url->page('op=selectShippingMethod');
|
||||
$var{'changeShipping.label'} = $i18n->get('change shipping method');
|
||||
$var{'viewShoppingCart.url'} = WebGUI::URL::page('op=viewCart');
|
||||
$var{'viewShoppingCart.url'} = $session->url->page('op=viewCart');
|
||||
$var{'viewShoppingCart.label'} = $i18n->get('view shopping cart');
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session{setting}{commerceConfirmCheckoutTemplateId})->process(\%var));
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session->setting->get("commerceConfirmCheckoutTemplateId"))->process(\%var));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_checkoutSubmit {
|
||||
my $session = shift;
|
||||
my ($plugin, $shoppingCart, $transaction, $var, $amount, @cartItems, $i18n, @transactions,
|
||||
@normal, $currentPurchase, $checkoutError, @resultLoop, %param, $normal, $recurring,
|
||||
$formError, $shipping, $shippingCost, $shippingDescription);
|
||||
|
|
@ -199,8 +210,8 @@ sub www_checkoutSubmit {
|
|||
$i18n = WebGUI::International->new('Commerce');
|
||||
|
||||
# check if user has already logged in
|
||||
if ($session{user}{userId} == 1) {
|
||||
WebGUI::Session::setScratch('redirectAfterLogin', WebGUI::URL::page('op=checkout'));
|
||||
if ($session->user->profileField("userId") == 1) {
|
||||
WebGUI::Session::setScratch('redirectAfterLogin', $session->url->page('op=checkout'));
|
||||
return WebGUI::Operation::execute('displayLogin');
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +229,7 @@ sub www_checkoutSubmit {
|
|||
|
||||
# Check if shoppingcart contains any items. If not the user probably clicked reload, so we redirect to the current page.
|
||||
unless (@$normal || @$recurring) {
|
||||
WebGUI::HTTP::setRedirect(WebGUI::URL::page);
|
||||
WebGUI::HTTP::setRedirect($session->url->page);
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -316,23 +327,25 @@ sub www_checkoutSubmit {
|
|||
return WebGUI::Operation::execute('viewPurchaseHistory') unless ($checkoutError);
|
||||
|
||||
# If an error has occurred show the template errorlog
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session{setting}{commerceTransactionErrorTemplateId})->process(\%param));
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session->setting->get("commerceTransactionErrorTemplateId"))->process(\%param));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_completePendingTransaction {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::Commerce::Transaction->new($session{form}{tid})->completeTransaction;
|
||||
WebGUI::Commerce::Transaction->new($session->form->process("tid"))->completeTransaction;
|
||||
|
||||
return WebGUI::Operation::execute('listPendingTransactions');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_confirmRecurringTransaction {
|
||||
my $session = shift;
|
||||
my($plugin, %var);
|
||||
|
||||
$plugin = WebGUI::Commerce::Payment->load($session{form}{gateway});
|
||||
$plugin = WebGUI::Commerce::Payment->load($session->form->process("gateway"));
|
||||
if ($plugin) {
|
||||
$plugin->confirmRecurringTransaction;
|
||||
}
|
||||
|
|
@ -340,8 +353,9 @@ sub www_confirmRecurringTransaction {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_confirmTransaction {
|
||||
my $session = shift;
|
||||
my($plugin, %var);
|
||||
$plugin = WebGUI::Commerce::Payment->load($session{form}{pg});
|
||||
$plugin = WebGUI::Commerce::Payment->load($session->form->process("pg"));
|
||||
|
||||
if ($plugin->confirmTransaction) {
|
||||
WebGUI::Commerce::Transaction->new($plugin->getTransactionId)->completeTransaction;
|
||||
|
|
@ -350,13 +364,15 @@ sub www_confirmTransaction {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCartItem {
|
||||
WebGUI::Commerce::ShoppingCart->new->delete($session{form}{itemId}, $session{form}{itemType});
|
||||
my $session = shift;
|
||||
WebGUI::Commerce::ShoppingCart->new->delete($session->form->process("itemId"), $session->form->process("itemType"));
|
||||
|
||||
return WebGUI::Operation::execute('viewCart');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCommerceSettings {
|
||||
my $session = shift;
|
||||
my (%tabs, $tabform, $currentPlugin, $ac, $jscript, $i18n,
|
||||
$paymentPlugin, @paymentPlugins, %paymentPlugins, @failedPaymentPlugins, $plugin,
|
||||
$shippingPlugin, @shippingPlugins, %shippingPlugins, @failedShippingPlugins);
|
||||
|
|
@ -371,8 +387,8 @@ sub www_editCommerceSettings {
|
|||
shipping=>{label=>$i18n->get('shipping tab')},
|
||||
);
|
||||
|
||||
$paymentPlugin = $session{config}{paymentPlugins}->[0];
|
||||
$shippingPlugin = $session{config}{shippingPlugins}->[0];
|
||||
$paymentPlugin = $session->config->get("paymentPlugins")->[0];
|
||||
$shippingPlugin = $session->config->get("shippingPlugins")->[0];
|
||||
|
||||
$tabform = WebGUI::TabForm->new(\%tabs);
|
||||
$tabform->hidden({name => 'op', value => 'editCommerceSettingsSave'});
|
||||
|
|
@ -381,48 +397,48 @@ sub www_editCommerceSettings {
|
|||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceConfirmCheckoutTemplateId',
|
||||
-label => $i18n->get('confirm checkout template'),
|
||||
-value => $session{setting}{commerceConfirmCheckoutTemplateId},
|
||||
-value => $session->setting->get("commerceConfirmCheckoutTemplateId"),
|
||||
-namespace => 'Commerce/ConfirmCheckout'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceTransactionErrorTemplateId',
|
||||
-label => $i18n->get('transaction error template'),
|
||||
-value => $session{setting}{commerceTransactionPendingTemplateId},
|
||||
-value => $session->setting->get("commerceTransactionPendingTemplateId"),
|
||||
-namespace => 'Commerce/TransactionError'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceCheckoutCanceledTemplateId',
|
||||
-label => $i18n->get('checkout canceled template'),
|
||||
-value => $session{setting}{commerceCheckoutCanceledTemplateId},
|
||||
-value => $session->setting->get("commerceCheckoutCanceledTemplateId"),
|
||||
-namespace => 'Commerce/CheckoutCanceled'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceSelectPaymentGatewayTemplateId',
|
||||
-label => $i18n->get('checkout select payment template'),
|
||||
-value => $session{setting}{commerceSelectPaymentGatewayTemplateId},
|
||||
-value => $session->setting->get("commerceSelectPaymentGatewayTemplateId"),
|
||||
-namespace => 'Commerce/SelectPaymentGateway'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceSelectShippingMethodTemplateId',
|
||||
-label => $i18n->get('checkout select shipping template'),
|
||||
-value => $session{setting}{commerceSelectShippingMethodTemplateId},
|
||||
-value => $session->setting->get("commerceSelectShippingMethodTemplateId"),
|
||||
-namespace => 'Commerce/SelectShippingMethod'
|
||||
);
|
||||
$tabform->getTab('general')->template(
|
||||
-name => 'commerceViewShoppingCartTemplateId',
|
||||
-label => $i18n->get('view shopping cart template'),
|
||||
-value => $session{setting}{commerceViewShoppingCartTemplateId},
|
||||
-value => $session->setting->get("commerceViewShoppingCartTemplateId"),
|
||||
-namespace => 'Commerce/ViewShoppingCart'
|
||||
);
|
||||
|
||||
$tabform->getTab('general')->email(
|
||||
-name => 'commerceSendDailyReportTo',
|
||||
-label => $i18n->get('daily report email'),
|
||||
-value => $session{setting}{commerceSendDailyReportTo}
|
||||
-value => $session->setting->get("commerceSendDailyReportTo")
|
||||
);
|
||||
|
||||
# Check which payment plugins will compile, and load them.
|
||||
foreach (@{$session{config}{paymentPlugins}}) {
|
||||
foreach (@{$session->config->get("paymentPlugins")}) {
|
||||
$plugin = WebGUI::Commerce::Payment->load($_);
|
||||
if ($plugin) {
|
||||
push(@paymentPlugins, $plugin);
|
||||
|
|
@ -434,7 +450,7 @@ sub www_editCommerceSettings {
|
|||
|
||||
# payment plugin
|
||||
if (%paymentPlugins) {
|
||||
WebGUI::Style::setRawHeadTags('<script type="text/javascript">var activePayment="'.$paymentPlugin.'";</script>');
|
||||
$session->style->setRawHeadTags('<script type="text/javascript">var activePayment="'.$paymentPlugin.'";</script>');
|
||||
$tabform->getTab("payment")->selectBox(
|
||||
-name => 'commercePaymentPlugin',
|
||||
-options => \%paymentPlugins,
|
||||
|
|
@ -460,7 +476,7 @@ sub www_editCommerceSettings {
|
|||
|
||||
# Shipping plugins...
|
||||
# Check which payment plugins will compile, and load them.
|
||||
foreach (@{$session{config}{shippingPlugins}}) {
|
||||
foreach (@{$session->config->get("shippingPlugins")}) {
|
||||
$plugin = WebGUI::Commerce::Shipping->load($_);
|
||||
if ($plugin) {
|
||||
push(@shippingPlugins, $plugin);
|
||||
|
|
@ -472,7 +488,7 @@ sub www_editCommerceSettings {
|
|||
|
||||
# shipping plugin
|
||||
if (%shippingPlugins) {
|
||||
WebGUI::Style::setRawHeadTags('<script type="text/javascript">var activeShipping="'.$shippingPlugin.'";</script>');
|
||||
$session->style->setRawHeadTags('<script type="text/javascript">var activeShipping="'.$shippingPlugin.'";</script>');
|
||||
$tabform->getTab('shipping')->selectBox(
|
||||
-name => 'commerceShippingPlugin',
|
||||
-options=> \%shippingPlugins,
|
||||
|
|
@ -493,13 +509,14 @@ sub www_editCommerceSettings {
|
|||
|
||||
$tabform->submit;
|
||||
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}.'/swapLayers.js',{type=>"text/javascript"});
|
||||
$session->style->setScript($session->config->get("extrasURL").'/swapLayers.js',{type=>"text/javascript"});
|
||||
|
||||
return _submenu($tabform->print, 'edit commerce settings title', 'commerce manage');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCommerceSettingsSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
foreach (keys(%{$session{form}})) {
|
||||
|
|
@ -522,17 +539,18 @@ sub www_editCommerceSettingsSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listPendingTransactions {
|
||||
my $session = shift;
|
||||
my ($p, $transactions, $output, $properties, $i18n);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
$i18n = WebGUI::International->new("Commerce");
|
||||
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listPendingTransactions'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listPendingTransactions'));
|
||||
$p->setDataByArrayRef(WebGUI::Commerce::Transaction->pendingTransactions);
|
||||
|
||||
$transactions = $p->getPageData;
|
||||
|
||||
$output = $p->getBarTraditional($session{form}{pn});
|
||||
$output = $p->getBarTraditional($session->form->process("pn"));
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr><th>'.$i18n->get('transactionId').'</th><th>'.$i18n->get('gateway').'</th>'.
|
||||
'<th>'.$i18n->get('gatewayId').'</th><th>'.$i18n->get('init date').'</th></tr>';
|
||||
|
|
@ -543,17 +561,18 @@ sub www_listPendingTransactions {
|
|||
$output .= '<td>'.$properties->{gatewayId}.'</td>';
|
||||
$output .= '<td>'.$properties->{gateway}.'</td>';
|
||||
$output .= '<td>'.WebGUI::DateTime::epochToHuman($properties->{initDate}).'</td>';
|
||||
$output .= '<td><a href="'.WebGUI::URL::page('op=completePendingTransaction;tid='.$properties->{transactionId}).'">'.$i18n->get('complete pending transaction').'</a></td>';
|
||||
$output .= '<td><a href="'.$session->url->page('op=completePendingTransaction;tid='.$properties->{transactionId}).'">'.$i18n->get('complete pending transaction').'</a></td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
|
||||
_submenu($output, 'list pending transactions', 'list pending transactions');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listTransactions {
|
||||
my $session = shift;
|
||||
my ($output, %criteria, $transaction, @transactions);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
|
@ -573,32 +592,32 @@ sub www_listTransactions {
|
|||
'Delivered' => $i18n->get('delivered'),
|
||||
};
|
||||
|
||||
my $initStart = WebGUI::FormProcessor::date('initStart');
|
||||
my $initStop = WebGUI::DateTime::addToTime(WebGUI::FormProcessor::date('initStop'),23,59);
|
||||
my $completionStart = WebGUI::FormProcessor::date('completionStart');
|
||||
my $completionStop = WebGUI::DateTime::addToTime(WebGUI::FormProcessor::date('completionStop'),23,59);
|
||||
my $initStart = $session->form->date('initStart');
|
||||
my $initStop = WebGUI::DateTime::addToTime($session->form->date('initStop'),23,59);
|
||||
my $completionStart = $session->form->date('completionStart');
|
||||
my $completionStop = WebGUI::DateTime::addToTime($session->form->date('completionStop'),23,59);
|
||||
|
||||
$output .= $i18n->get('selection message');
|
||||
|
||||
$output .= WebGUI::Form::formHeader;
|
||||
$output .= WebGUI::Form::hidden({name=>'op', value=>'listTransactions'});
|
||||
$output .= '<table>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'init', checked=>($session{form}{selection} eq 'init')}).'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'init', checked=>($session->form->process("selection") eq 'init')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('init date').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::date({name=>'initStart', value=>$initStart}).' '.$i18n->get('and').' '.WebGUI::Form::date({name=>'initStop', value=>$initStop}).'</td>';
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'completion', checked=>($session{form}{selection} eq 'completion')}).'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'completion', checked=>($session->form->process("selection") eq 'completion')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('completion date').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::date({name=>'completionStart', value=>$completionStart}).' '.$i18n->get('and').' '.WebGUI::Form::date({name=>'completionStop', value=>$completionStop}).'</td>';
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td></td>';
|
||||
$output .= '<td align="left">'.$i18n->get('transaction status').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::selectBox({name => 'tStatus', value => [$session{form}{tStatus}], options => $transactionOptions});
|
||||
$output .= '<td>'.WebGUI::Form::selectBox({name => 'tStatus', value => [$session->form->process("tStatus")], options => $transactionOptions});
|
||||
$output .= '</tr><tr>';
|
||||
|
||||
$output .= '<td></td>';
|
||||
$output .= '<td align="left">'.$i18n->get('shipping status').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::selectBox({name => 'sStatus', value => [$session{form}{sStatus}], options => $shippingOptions});
|
||||
$output .= '<td>'.WebGUI::Form::selectBox({name => 'sStatus', value => [$session->form->process("sStatus")], options => $shippingOptions});
|
||||
$output .= '</tr><tr>';
|
||||
|
||||
$output .= '<td></td>';
|
||||
|
|
@ -607,12 +626,12 @@ sub www_listTransactions {
|
|||
$output .= '</table>';
|
||||
$output .= WebGUI::Form::formFooter;
|
||||
|
||||
$criteria{initStart} = WebGUI::FormProcessor::date('initStart') if ($session{form}{initStart} && ($session{form}{selection} eq 'init'));
|
||||
$criteria{initStop} = WebGUI::FormProcessor::date('initStop') if ($session{form}{initStop} && ($session{form}{selection} eq 'init'));
|
||||
$criteria{completionStart} = WebGUI::FormProcessor::date('completionStart') if ($session{form}{completionStart} && ($session{form}{selection} eq 'completion'));
|
||||
$criteria{completionStop} = WebGUI::FormProcessor::date('completionStop') if ($session{form}{completionStop} && ($session{form}{selection} eq 'completion'));
|
||||
$criteria{shippingStatus} = $session{form}{sStatus} if ($session{form}{sStatus});
|
||||
$criteria{paymentStatus} = $session{form}{tStatus} if ($session{form}{tStatus});
|
||||
$criteria{initStart} = $session->form->date('initStart') if ($session->form->process("initStart") && ($session->form->process("selection") eq 'init'));
|
||||
$criteria{initStop} = $session->form->date('initStop') if ($session->form->process("initStop") && ($session->form->process("selection") eq 'init'));
|
||||
$criteria{completionStart} = $session->form->date('completionStart') if ($session->form->process("completionStart") && ($session->form->process("selection") eq 'completion'));
|
||||
$criteria{completionStop} = $session->form->date('completionStop') if ($session->form->process("completionStop") && ($session->form->process("selection") eq 'completion'));
|
||||
$criteria{shippingStatus} = $session->form->process("sStatus") if ($session->form->process("sStatus"));
|
||||
$criteria{paymentStatus} = $session->form->process("tStatus") if ($session->form->process("tStatus"));
|
||||
|
||||
@transactions = WebGUI::Commerce::Transaction->getTransactions(\%criteria);
|
||||
|
||||
|
|
@ -649,6 +668,7 @@ sub www_listTransactions {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_selectPaymentGateway {
|
||||
my $session = shift;
|
||||
my ($plugins, $f, $i18n, @pluginLoop, %var);
|
||||
|
||||
_clearPaymentScratch;
|
||||
|
|
@ -664,7 +684,7 @@ sub www_selectPaymentGateway {
|
|||
});
|
||||
}
|
||||
} elsif (scalar(@$plugins) == 1) {
|
||||
$session{form}{paymentGateway} = $plugins->[0]->namespace;
|
||||
$session->form->process("paymentGateway") = $plugins->[0]->namespace;
|
||||
return WebGUI::Operation::execute('selectPaymentGatewaySave');
|
||||
}
|
||||
|
||||
|
|
@ -676,13 +696,14 @@ sub www_selectPaymentGateway {
|
|||
$var{formSubmit} = WebGUI::Form::submit({value=>$i18n->get('payment gateway select')});
|
||||
$var{formFooter} = WebGUI::Form::formFooter;
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session{setting}{commerceSelectPaymentGatewayTemplateId})->process(\%var));
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session->setting->get("commerceSelectPaymentGatewayTemplateId"))->process(\%var));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_selectPaymentGatewaySave {
|
||||
if (WebGUI::Commerce::Payment->load($session{form}{paymentGateway})->enabled) {
|
||||
WebGUI::Session::setScratch('paymentGateway', $session{form}{paymentGateway});
|
||||
my $session = shift;
|
||||
if (WebGUI::Commerce::Payment->load($session->form->process("paymentGateway"))->enabled) {
|
||||
WebGUI::Session::setScratch('paymentGateway', $session->form->process("paymentGateway"));
|
||||
} else {
|
||||
WebGUI::Session::setScratch('paymentGateway', '-delete-');
|
||||
}
|
||||
|
|
@ -692,6 +713,7 @@ sub www_selectPaymentGatewaySave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_selectShippingMethod {
|
||||
my $session = shift;
|
||||
my ($plugins, $f, $i18n, @pluginLoop, %var);
|
||||
|
||||
_clearShippingScratch;
|
||||
|
|
@ -708,7 +730,7 @@ sub www_selectShippingMethod {
|
|||
});
|
||||
}
|
||||
} elsif (scalar(@$plugins) == 1) {
|
||||
$session{form}{shippingMethod} = $plugins->[0]->namespace;
|
||||
$session->form->process("shippingMethod") = $plugins->[0]->namespace;
|
||||
return WebGUI::Operation::execute("selectShippingMethodSave");
|
||||
}
|
||||
|
||||
|
|
@ -720,12 +742,13 @@ sub www_selectShippingMethod {
|
|||
$var{formSubmit} = WebGUI::Form::submit({value=>$i18n->get('shipping select button')});
|
||||
$var{formFooter} = WebGUI::Form::formFooter;
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session{setting}{commerceSelectShippingMethodTemplateId})->process(\%var));
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session->setting->get("commerceSelectShippingMethodTemplateId"))->process(\%var));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_selectShippingMethodSave {
|
||||
my $shipping = WebGUI::Commerce::Shipping->load($session{form}{shippingMethod});
|
||||
my $session = shift;
|
||||
my $shipping = WebGUI::Commerce::Shipping->load($session->form->process("shippingMethod"));
|
||||
|
||||
$shipping->processOptionsForm;
|
||||
return WebGUI::Operation::execute('selectShipping') unless ($shipping->optionsOk);
|
||||
|
|
@ -742,11 +765,13 @@ sub www_selectShippingMethodSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_transactionComplete {
|
||||
my $session = shift;
|
||||
return WebGUI::Operation::execute('viewPurchaseHistory');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_updateCart {
|
||||
my $session = shift;
|
||||
my $shoppingCart = WebGUI::Commerce::ShoppingCart->new;
|
||||
|
||||
foreach my $formElement (keys(%{$session{form}})) {
|
||||
|
|
@ -760,6 +785,7 @@ my $shoppingCart = WebGUI::Commerce::ShoppingCart->new;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewCart {
|
||||
my $session = shift;
|
||||
my ($shoppingCart, $normal, $recurring, %var, $total, $i18n);
|
||||
|
||||
$i18n = WebGUI::International->new('Commerce');
|
||||
|
|
@ -806,7 +832,7 @@ sub www_viewCart {
|
|||
|
||||
$var{total} = sprintf('%.2f', $total);
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session{setting}{commerceViewShoppingCartTemplateId})->process(\%var));
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new($session->setting->get("commerceViewShoppingCartTemplateId"))->process(\%var));
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use WebGUI::URL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title) if ($title);
|
||||
|
|
@ -34,56 +35,60 @@ sub _submenu {
|
|||
if ($help) {
|
||||
$ac->setHelp($help);
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editDatabaseLink;dlid=new'), WebGUI::International::get(982));
|
||||
if (($session{form}{op} eq "editDatabaseLink" && $session{form}{dlid} ne "new") || $session{form}{op} eq "deleteDatabaseLink") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editDatabaseLink;dlid='.$session{form}{dlid}), WebGUI::International::get(983));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=copyDatabaseLink;dlid='.$session{form}{dlid}), WebGUI::International::get(984));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteDatabaseLink;dlid='.$session{form}{dlid}), WebGUI::International::get(985));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listDatabaseLinks'), WebGUI::International::get(986));
|
||||
$ac->addSubmenuItem($session->url->page('op=editDatabaseLink;dlid=new'), WebGUI::International::get(982));
|
||||
if (($session->form->process("op") eq "editDatabaseLink" && $session->form->process("dlid") ne "new") || $session->form->process("op") eq "deleteDatabaseLink") {
|
||||
$ac->addSubmenuItem($session->url->page('op=editDatabaseLink;dlid='.$session->form->process("dlid")), WebGUI::International::get(983));
|
||||
$ac->addSubmenuItem($session->url->page('op=copyDatabaseLink;dlid='.$session->form->process("dlid")), WebGUI::International::get(984));
|
||||
$ac->addSubmenuItem($session->url->page('op=deleteDatabaseLink;dlid='.$session->form->process("dlid")), WebGUI::International::get(985));
|
||||
$ac->addSubmenuItem($session->url->page('op=listDatabaseLinks'), WebGUI::International::get(986));
|
||||
}
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_copyDatabaseLink {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my (%db);
|
||||
tie %db, 'Tie::CPHash';
|
||||
%db = WebGUI::SQL->quickHash("select * from databaseLink where databaseLinkId=".quote($session{form}{dlid}));
|
||||
WebGUI::SQL->write("insert into databaseLink (databaseLinkId,title,DSN,username,identifier) values (".quote(WebGUI::Id::generate()).",
|
||||
".quote($db{title}." (copy)").", ".quote($db{DSN}).", ".quote($db{username}).", ".quote($db{identifier}).")");
|
||||
%db = $session->db->quickHash("select * from databaseLink where databaseLinkId=".$session->db->quote($session->form->process("dlid")));
|
||||
$session->db->write("insert into databaseLink (databaseLinkId,title,DSN,username,identifier) values (".$session->db->quote(WebGUI::Id::generate()).",
|
||||
".$session->db->quote($db{title}." (copy)").", ".$session->db->quote($db{DSN}).", ".$session->db->quote($db{username}).", ".$session->db->quote($db{identifier}).")");
|
||||
return www_listDatabaseLinks();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteDatabaseLink {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output);
|
||||
$output .= WebGUI::International::get(988).'<p>';
|
||||
$output .= '<p><div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteDatabaseLinkConfirm;dlid='.$session{form}{dlid})
|
||||
$session->url->page('op=deleteDatabaseLinkConfirm;dlid='.$session->form->process("dlid"))
|
||||
.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=listDatabaseLinks').
|
||||
$output .= ' <a href="'.$session->url->page('op=listDatabaseLinks').
|
||||
'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return _submenu($output,"987","database link delete");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteDatabaseLinkConfirm {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::SQL->write("delete from databaseLink where databaseLinkId=".quote($session{form}{dlid}));
|
||||
$session->db->write("delete from databaseLink where databaseLinkId=".$session->db->quote($session->form->process("dlid")));
|
||||
return www_listDatabaseLinks();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editDatabaseLink {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, %db, $f);
|
||||
tie %db, 'Tie::CPHash';
|
||||
if ($session{form}{dlid} eq "new") {
|
||||
if ($session->form->process("dlid") eq "new") {
|
||||
|
||||
} else {
|
||||
%db = WebGUI::SQL->quickHash("select * from databaseLink where databaseLinkId=".quote($session{form}{dlid}));
|
||||
%db = $session->db->quickHash("select * from databaseLink where databaseLinkId=".$session->db->quote($session->form->process("dlid")));
|
||||
}
|
||||
$f = WebGUI::HTMLForm->new(
|
||||
-extras=>'autocomplete="off"'
|
||||
|
|
@ -94,10 +99,10 @@ sub www_editDatabaseLink {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "dlid",
|
||||
-value => $session{form}{dlid},
|
||||
-value => $session->form->process("dlid"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-value => $session{form}{dlid},
|
||||
-value => $session->form->process("dlid"),
|
||||
-label => WebGUI::International::get(991),
|
||||
-hoverHelp => WebGUI::International::get('991 description'),
|
||||
);
|
||||
|
|
@ -132,21 +137,23 @@ sub www_editDatabaseLink {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editDatabaseLinkSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
if ($session{form}{dlid} eq "new") {
|
||||
$session{form}{dlid} = WebGUI::Id::generate();
|
||||
WebGUI::SQL->write("insert into databaseLink (databaseLinkId) values (".quote($session{form}{dlid}).")");
|
||||
if ($session->form->process("dlid") eq "new") {
|
||||
$session->form->process("dlid") = WebGUI::Id::generate();
|
||||
$session->db->write("insert into databaseLink (databaseLinkId) values (".$session->db->quote($session->form->process("dlid")).")");
|
||||
}
|
||||
WebGUI::SQL->write("update databaseLink set title=".quote($session{form}{title}).", DSN=".quote($session{form}{DSN}).",
|
||||
username=".quote($session{form}{dbusername}).", identifier=".quote($session{form}{dbidentifier})." where databaseLinkId=".quote($session{form}{dlid}));
|
||||
$session->db->write("update databaseLink set title=".$session->db->quote($session->form->process("title")).", DSN=".$session->db->quote($session->form->process("DSN")).",
|
||||
username=".$session->db->quote($session->form->process("dbusername")).", identifier=".$session->db->quote($session->form->process("dbidentifier"))." where databaseLinkId=".$session->db->quote($session->form->process("dlid")));
|
||||
return www_listDatabaseLinks();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listDatabaseLinks {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless(WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $p, $sth, %data, @row, $i);
|
||||
$sth = WebGUI::SQL->read("select * from databaseLink order by title");
|
||||
$sth = $session->db->read("select * from databaseLink order by title");
|
||||
$row[$i] = '<tr><td valign="top" class="tableData"></td><td valign="top" class="tableData">'.WebGUI::International::get(1076).'</td></tr>';
|
||||
$i++;
|
||||
while (%data = $sth->hash) {
|
||||
|
|
@ -159,7 +166,7 @@ sub www_listDatabaseLinks {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listDatabaseLinks'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listDatabaseLinks'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="3" cellspacing="0" align="center">';
|
||||
$output .= $p->getPage;
|
||||
|
|
|
|||
|
|
@ -18,28 +18,29 @@ use WebGUI::Style;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_formAssetTree {
|
||||
my $session = shift;
|
||||
my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot;
|
||||
my @crumb;
|
||||
my $ancestors = $base->getLineage(["self","ancestors"],{returnObjects=>1});
|
||||
foreach my $ancestor (@{$ancestors}) {
|
||||
push(@crumb,'<a href="'.$ancestor->getUrl("op=formAssetTree;classLimiter=".$session{form}{classLimiter}.";formId="
|
||||
.$session{form}{formId}).'">'.$ancestor->get("menuTitle").'</a>');
|
||||
push(@crumb,'<a href="'.$ancestor->getUrl("op=formAssetTree;classLimiter=".$session->form->process("classLimiter").";formId="
|
||||
.$session->form->process("formId")).'">'.$ancestor->get("menuTitle").'</a>');
|
||||
}
|
||||
my $output = '<p>'.join(" > ", @crumb)."</p>\n";
|
||||
my $children = $base->getLineage(["children"],{returnObjects=>1});
|
||||
foreach my $child (@{$children}) {
|
||||
next unless $child->canView;
|
||||
if ($child->get("className") =~ /^$session{form}{classLimiter}/) {
|
||||
$output .= '<a href="#" onclick="window.opener.document.getElementById(\''.$session{form}{formId}
|
||||
if ($child->get("className") =~ /^$session->form->process("classLimiter")/) {
|
||||
$output .= '<a href="#" onclick="window.opener.document.getElementById(\''.$session->form->process("formId")
|
||||
.'\').value=\''.$child->getId.'\';window.opener.document.getElementById(\''.
|
||||
$session{form}{formId}.'_display\').value=\''.$child->get("title").'\';window.close();">(•)</a> ';
|
||||
$session->form->process("formId").'_display\').value=\''.$child->get("title").'\';window.close();">(•)</a> ';
|
||||
} else {
|
||||
$output .= "(•) ";
|
||||
}
|
||||
$output .= '<a href="'.$child->getUrl("op=formAssetTree;classLimiter=".$session{form}{classLimiter}.";formId="
|
||||
.$session{form}{formId}).'">'.$child->get("menuTitle").'</a>'."<br />\n";
|
||||
$output .= '<a href="'.$child->getUrl("op=formAssetTree;classLimiter=".$session->form->process("classLimiter").";formId="
|
||||
.$session->form->process("formId")).'">'.$child->get("menuTitle").'</a>'."<br />\n";
|
||||
}
|
||||
$session{page}{useEmptyStyle} = 1;
|
||||
$session->style->useEmptyStyle("1")
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ sub www_formAssetTree {
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
sub www_richEditPageTree {
|
||||
my $session = shift;
|
||||
my $f = WebGUI::HTMLForm->new(-action=>"#",-extras=>'name"linkchooser"');
|
||||
$f->text(
|
||||
-name=>"url",
|
||||
|
|
@ -64,7 +66,7 @@ sub www_richEditPageTree {
|
|||
-value=>WebGUI::International::get('done'),
|
||||
-extras=>'onclick="createLink()"'
|
||||
);
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/tinymce/jscripts/tiny_mce/tiny_mce_popup.js",{type=>"text/javascript"});
|
||||
$session->style->setScript($session->config->get("extrasURL")."/tinymce/jscripts/tiny_mce/tiny_mce_popup.js",{type=>"text/javascript"});
|
||||
my $output = '<fieldset><legend>Insert A Link</legend>
|
||||
<fieldset><legend>Link Settings</legend>'.$f->print.'</fieldset>
|
||||
<script type="text/javascript">
|
||||
|
|
@ -91,7 +93,7 @@ window.opener.tinyMCE.insertLink("^" + "/" + ";" + document.getElementById("url_
|
|||
next unless $child->canView;
|
||||
$output .= '<a href="#" onclick="document.getElementById(\'url_formId\').value=\''.$child->get("url").'\'">(•)</a> <a href="'.$child->getUrl("op=richEditPageTree").'">'.$child->get("menuTitle").'</a>'."<br />\n";
|
||||
}
|
||||
$session{page}{useEmptyStyle} = 1;
|
||||
$session->style->useEmptyStyle("1")
|
||||
return $output.'</fieldset></fieldset>';
|
||||
}
|
||||
|
||||
|
|
@ -99,6 +101,7 @@ window.opener.tinyMCE.insertLink("^" + "/" + ";" + document.getElementById("url_
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_richEditImageTree {
|
||||
my $session = shift;
|
||||
my $base = WebGUI::Asset->newByUrl || WebGUI::Asset->getRoot;
|
||||
my @crumb;
|
||||
my $ancestors = $base->getLineage(["self","ancestors"],{returnObjects=>1});
|
||||
|
|
@ -116,15 +119,16 @@ sub www_richEditImageTree {
|
|||
}
|
||||
$output .= '<a href="'.$child->getUrl("op=richEditImageTree").'">'.$child->get("menuTitle").'</a>'."<br />\n";
|
||||
}
|
||||
$session{page}{useEmptyStyle} = 1;
|
||||
$session->style->useEmptyStyle("1")
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_richEditViewThumbnail {
|
||||
my $session = shift;
|
||||
my $image = WebGUI::Asset->newByUrl;
|
||||
$session{page}{useEmptyStyle} = 1;
|
||||
$session->style->useEmptyStyle("1")
|
||||
if ($image->get("className") =~ /WebGUI::Asset::File::Image/) {
|
||||
my $output = '<div align="center">';
|
||||
$output .= '<img src="'.$image->getThumbnailUrl.'" border="0" alt="Preview">';
|
||||
|
|
@ -141,7 +145,7 @@ sub www_richEditViewThumbnail {
|
|||
</script>\n";
|
||||
return $output;
|
||||
}
|
||||
return '<div align="center"><img src="'.$session{config}{extrasURL}.'/tinymce/images/icon.gif" border="0" alt="Image Manager"></div>';
|
||||
return '<div align="center"><img src="'.$session->config->get("extrasURL").'/tinymce/images/icon.gif" border="0" alt="Image Manager"></div>';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,15 @@ use WebGUI::Utility;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _hasSecondaryPrivilege {
|
||||
my $session = shift;
|
||||
return 0 unless (WebGUI::Grouping::isInGroup(11));
|
||||
return WebGUI::Grouping::userGroupAdmin($session{user}{userId},$_[0]);
|
||||
return WebGUI::Grouping::userGroupAdmin($session->user->profileField("userId"),$_[0]);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title) if ($title);
|
||||
|
|
@ -49,19 +51,19 @@ sub _submenu {
|
|||
$ac->setHelp($help);
|
||||
}
|
||||
if (WebGUI::Grouping::isInGroup(3)) {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editGroup;gid=new'), WebGUI::International::get(90));
|
||||
$ac->addSubmenuItem($session->url->page('op=editGroup;gid=new'), WebGUI::International::get(90));
|
||||
}
|
||||
if (WebGUI::Grouping::isInGroup(11)) {
|
||||
unless ($session{form}{op} eq "listGroups"
|
||||
|| $session{form}{gid} eq "new"
|
||||
|| $session{form}{op} eq "deleteGroupConfirm") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editGroup;gid=".$session{form}{gid}), WebGUI::International::get(753));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=manageUsersInGroup;gid=".$session{form}{gid}), WebGUI::International::get(754));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=manageGroupsInGroup;gid=".$session{form}{gid}), WebGUI::International::get(807));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=emailGroup;gid=".$session{form}{gid}), WebGUI::International::get(808));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=deleteGroup;gid=".$session{form}{gid}), WebGUI::International::get(806));
|
||||
unless ($session->form->process("op") eq "listGroups"
|
||||
|| $session->form->process("gid") eq "new"
|
||||
|| $session->form->process("op") eq "deleteGroupConfirm") {
|
||||
$ac->addSubmenuItem($session->url->page("op=editGroup;gid=".$session->form->process("gid")), WebGUI::International::get(753));
|
||||
$ac->addSubmenuItem($session->url->page("op=manageUsersInGroup;gid=".$session->form->process("gid")), WebGUI::International::get(754));
|
||||
$ac->addSubmenuItem($session->url->page("op=manageGroupsInGroup;gid=".$session->form->process("gid")), WebGUI::International::get(807));
|
||||
$ac->addSubmenuItem($session->url->page("op=emailGroup;gid=".$session->form->process("gid")), WebGUI::International::get(808));
|
||||
$ac->addSubmenuItem($session->url->page("op=deleteGroup;gid=".$session->form->process("gid")), WebGUI::International::get(806));
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=listGroups"), WebGUI::International::get(756));
|
||||
$ac->addSubmenuItem($session->url->page("op=listGroups"), WebGUI::International::get(756));
|
||||
}
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
|
@ -69,6 +71,7 @@ sub _submenu {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub doGroupSearch {
|
||||
my $session = shift;
|
||||
my $op = shift;
|
||||
my $returnPaginator = shift;
|
||||
my $groupFilter = shift;
|
||||
|
|
@ -81,15 +84,15 @@ sub doGroupSearch {
|
|||
} else {
|
||||
$keyword = "%".$keyword;
|
||||
}
|
||||
$keyword = quote($keyword);
|
||||
$keyword = $session->db->quote($keyword);
|
||||
my $sql = "select groupId,groupName,description from groups where isEditable=1 and (groupName like $keyword or description like $keyword)
|
||||
and groupId not in (".quoteAndJoin($groupFilter).") order by groupName";
|
||||
and groupId not in (".$session->db->quoteAndJoin($groupFilter).") order by groupName";
|
||||
if ($returnPaginator) {
|
||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page($op));
|
||||
my $p = WebGUI::Paginator->new($session->url->page($op));
|
||||
$p->setDataByQuery($sql);
|
||||
return $p;
|
||||
} else {
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
my $sth = $session->db->read($sql);
|
||||
return $sth;
|
||||
}
|
||||
}
|
||||
|
|
@ -97,10 +100,11 @@ sub doGroupSearch {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub getGroupSearchForm {
|
||||
my $session = shift;
|
||||
my $op = shift;
|
||||
my $params = shift;
|
||||
WebGUI::Session::setScratch("groupSearchKeyword",$session{form}{keyword});
|
||||
WebGUI::Session::setScratch("groupSearchModifier",$session{form}{modifier});
|
||||
WebGUI::Session::setScratch("groupSearchKeyword",$session->form->process("keyword"));
|
||||
WebGUI::Session::setScratch("groupSearchModifier",$session->form->process("modifier"));
|
||||
my $output = '<div align="center">';
|
||||
my $f = WebGUI::HTMLForm->new(1);
|
||||
foreach my $key (keys %{$params}) {
|
||||
|
|
@ -140,10 +144,11 @@ sub getGroupSearchForm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub walkGroups {
|
||||
my $session = shift;
|
||||
my $parentId = shift;
|
||||
my $indent = shift;
|
||||
my $output;
|
||||
my $sth = WebGUI::SQL->read("select groups.groupId, groups.groupName from groupGroupings left join groups on groups.groupId=groupGroupings.groupId where groupGroupings.inGroup=".quote($parentId));
|
||||
my $sth = $session->db->read("select groups.groupId, groups.groupName from groupGroupings left join groups on groups.groupId=groupGroupings.groupId where groupGroupings.inGroup=".$session->db->quote($parentId));
|
||||
while (my ($id, $name) = $sth->array) {
|
||||
$output .= $indent
|
||||
.deleteIcon('op=deleteGroupGrouping;gid='.$parentId.';delete='.$id)
|
||||
|
|
@ -157,66 +162,73 @@ sub walkGroups {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addGroupsToGroupSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my @groups = WebGUI::FormProcessor::group('groups');
|
||||
WebGUI::Grouping::addGroupsToGroups(\@groups,[$session{form}{gid}]);
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my @groups = $session->form->group('groups');
|
||||
WebGUI::Grouping::addGroupsToGroups(\@groups,[$session->form->process("gid")]);
|
||||
return www_manageGroupsInGroup();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addUsersToGroupSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my @users = WebGUI::FormProcessor::selectList('users');
|
||||
WebGUI::Grouping::addUsersToGroups(\@users,[$session{form}{gid}]);
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my @users = $session->form->selectList('users');
|
||||
WebGUI::Grouping::addUsersToGroups(\@users,[$session->form->process("gid")]);
|
||||
return www_manageUsersInGroup();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_autoAddToGroup {
|
||||
return WebGUI::AdminConsole->new("groups")->render(WebGUI::Privilege::insufficient()) unless ($session{user}{userId} ne 1);
|
||||
my $group = WebGUI::Group->new($session{form}{groupId});
|
||||
my $session = shift;
|
||||
return WebGUI::AdminConsole->new("groups")->render(WebGUI::Privilege::insufficient()) unless ($session->user->profileField("userId") ne 1);
|
||||
my $group = WebGUI::Group->new($session->form->process("groupId"));
|
||||
if ($group->autoAdd) {
|
||||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$session{form}{groupId}]);
|
||||
WebGUI::Grouping::addUsersToGroups([$session->user->profileField("userId")],[$session->form->process("groupId")]);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_autoDeleteFromGroup {
|
||||
return WebGUI::AdminConsole->new("groups")->render(WebGUI::Privilege::insufficient()) unless ($session{user}{userId} ne 1);
|
||||
my $group = WebGUI::Group->new($session{form}{groupId});
|
||||
my $session = shift;
|
||||
return WebGUI::AdminConsole->new("groups")->render(WebGUI::Privilege::insufficient()) unless ($session->user->profileField("userId") ne 1);
|
||||
my $group = WebGUI::Group->new($session->form->process("groupId"));
|
||||
if ($group->autoDelete) {
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session{user}{userId}],[$session{form}{groupId}]);
|
||||
WebGUI::Grouping::deleteUsersFromGroups([$session->user->profileField("userId")],[$session->form->process("groupId")]);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteGroup {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
return WebGUI::Privilege::vitalComponent() if (isIn($session{form}{gid}, qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
return WebGUI::Privilege::vitalComponent() if (isIn($session->form->process("gid"), qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)));
|
||||
my ($output);
|
||||
$output .= WebGUI::International::get(86).'<p>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deleteGroupConfirm;gid='.$session{form}{gid}).
|
||||
$output .= '<div align="center"><a href="'.$session->url->page('op=deleteGroupConfirm;gid='.$session->form->process("gid")).
|
||||
'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=listGroups').'">'
|
||||
$output .= ' <a href="'.$session->url->page('op=listGroups').'">'
|
||||
.WebGUI::International::get(45).'</a></div>';
|
||||
return _submenu($output, '42',"group delete");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteGroupConfirm {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
return WebGUI::Privilege::vitalComponent() if (isIn($session{form}{gid}, qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)));
|
||||
my $g = WebGUI::Group->new($session{form}{gid});
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
return WebGUI::Privilege::vitalComponent() if (isIn($session->form->process("gid"), qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)));
|
||||
my $g = WebGUI::Group->new($session->form->process("gid"));
|
||||
$g->delete;
|
||||
return www_listGroups();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteGroupGrouping {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup('3') || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
WebGUI::Grouping::deleteGroupsFromGroups([$session{form}{delete}],[$session{form}{gid}]);
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup('3') || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
WebGUI::Grouping::deleteGroupsFromGroups([$session->form->process("delete")],[$session->form->process("gid")]);
|
||||
return www_manageGroupsInGroup();
|
||||
}
|
||||
|
||||
|
|
@ -232,12 +244,13 @@ perform this operation, and the
|
|||
=cut
|
||||
|
||||
sub www_deleteGrouping {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
if (($session{user}{userId} eq $session{form}{uid} || $session{form}{uid} eq '3') && $session{form}{gid} eq '3') {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
if (($session->user->profileField("userId") eq $session->form->process("uid") || $session->form->process("uid") eq '3') && $session->form->process("gid") eq '3') {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
}
|
||||
my @users = WebGUI::FormProcessor::selectList('uid');
|
||||
my @groups = WebGUI::FormProcessor::group("gid");
|
||||
my @users = $session->form->selectList('uid');
|
||||
my @groups = $session->form->group("gid");
|
||||
foreach my $user (@users) {
|
||||
my $u = WebGUI::User->new($user);
|
||||
$u->deleteFromGroups(\@groups);
|
||||
|
|
@ -248,12 +261,13 @@ sub www_deleteGrouping {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroup {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my ($output, $f, $g);
|
||||
if ($session{form}{gid} eq "new") {
|
||||
if ($session->form->process("gid") eq "new") {
|
||||
$g = WebGUI::Group->new("");
|
||||
} else {
|
||||
$g = WebGUI::Group->new($session{form}{gid});
|
||||
$g = WebGUI::Group->new($session->form->process("gid"));
|
||||
}
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
|
|
@ -262,7 +276,7 @@ sub www_editGroup {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "gid",
|
||||
-value => $session{form}{gid}
|
||||
-value => $session->form->process("gid")
|
||||
);
|
||||
$f->readOnly(
|
||||
-label => WebGUI::International::get(379),
|
||||
|
|
@ -310,7 +324,7 @@ sub www_editGroup {
|
|||
-label=>WebGUI::International::get(863),
|
||||
-hoverHelp=>WebGUI::International::get('863 description'),
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
if ($session->setting->get("useKarma")) {
|
||||
$f->integer(
|
||||
-name=>"karmaThreshold",
|
||||
-label=>WebGUI::International::get(538),
|
||||
|
|
@ -330,7 +344,7 @@ sub www_editGroup {
|
|||
-label=>WebGUI::International::get(945),
|
||||
-hoverHelp=>WebGUI::International::get('945 description'),
|
||||
);
|
||||
if ($session{form}{gid} eq "3") {
|
||||
if ($session->form->process("gid") eq "3") {
|
||||
$f->hidden(
|
||||
-name=>"autoAdd",
|
||||
-value=>0
|
||||
|
|
@ -394,32 +408,34 @@ sub www_editGroup {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroupSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $g = WebGUI::Group->new($session{form}{gid});
|
||||
$g->description($session{form}{description});
|
||||
$g->name($session{form}{groupName});
|
||||
$g->expireOffset(WebGUI::FormProcessor::interval("expireOffset"));
|
||||
$g->karmaThreshold($session{form}{karmaThreshold});
|
||||
$g->ipFilter($session{form}{ipFilter});
|
||||
$g->scratchFilter($session{form}{scratchFilter});
|
||||
$g->expireNotify(WebGUI::FormProcessor::yesNo("expireNotify"));
|
||||
$g->expireNotifyOffset($session{form}{expireNotifyOffset});
|
||||
$g->expireNotifyMessage($session{form}{expireNotifyMessage});
|
||||
$g->deleteOffset($session{form}{deleteOffset});
|
||||
$g->autoAdd(WebGUI::FormProcessor::yesNo("autoAdd"));
|
||||
$g->autoDelete(WebGUI::FormProcessor::yesNo("autoDelete"));
|
||||
$g->databaseLinkId($session{form}{databaseLinkId});
|
||||
$g->dbQuery($session{form}{dbQuery});
|
||||
$g->dbCacheTimeout(WebGUI::FormProcessor::interval("dbCacheTimeout"));
|
||||
$g->ldapGroup(WebGUI::FormProcessor::text("ldapGroup"));
|
||||
$g->ldapGroupProperty(WebGUI::FormProcessor::text("ldapGroupProperty"));
|
||||
$g->ldapRecursiveProperty(WebGUI::FormProcessor::text("ldapRecursiveProperty"));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my $g = WebGUI::Group->new($session->form->process("gid"));
|
||||
$g->description($session->form->process("description"));
|
||||
$g->name($session->form->process("groupName"));
|
||||
$g->expireOffset($session->form->interval("expireOffset"));
|
||||
$g->karmaThreshold($session->form->process("karmaThreshold"));
|
||||
$g->ipFilter($session->form->process("ipFilter"));
|
||||
$g->scratchFilter($session->form->process("scratchFilter"));
|
||||
$g->expireNotify($session->form->yesNo("expireNotify"));
|
||||
$g->expireNotifyOffset($session->form->process("expireNotifyOffset"));
|
||||
$g->expireNotifyMessage($session->form->process("expireNotifyMessage"));
|
||||
$g->deleteOffset($session->form->process("deleteOffset"));
|
||||
$g->autoAdd($session->form->yesNo("autoAdd"));
|
||||
$g->autoDelete($session->form->yesNo("autoDelete"));
|
||||
$g->databaseLinkId($session->form->process("databaseLinkId"));
|
||||
$g->dbQuery($session->form->process("dbQuery"));
|
||||
$g->dbCacheTimeout($session->form->interval("dbCacheTimeout"));
|
||||
$g->ldapGroup($session->form->text("ldapGroup"));
|
||||
$g->ldapGroupProperty($session->form->text("ldapGroupProperty"));
|
||||
$g->ldapRecursiveProperty($session->form->text("ldapRecursiveProperty"));
|
||||
return www_listGroups();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGrouping {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
-name => "op",
|
||||
|
|
@ -427,14 +443,14 @@ sub www_editGrouping {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "uid",
|
||||
-value => $session{form}{uid}
|
||||
-value => $session->form->process("uid")
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "gid",
|
||||
-value => $session{form}{gid}
|
||||
-value => $session->form->process("gid")
|
||||
);
|
||||
my $u = WebGUI::User->new($session{form}{uid});
|
||||
my $g = WebGUI::Group->new($session{form}{gid});
|
||||
my $u = WebGUI::User->new($session->form->process("uid"));
|
||||
my $g = WebGUI::Group->new($session->form->process("gid"));
|
||||
$f->readOnly(
|
||||
-value => $u->username,
|
||||
-label => WebGUI::International::get(50),
|
||||
|
|
@ -449,13 +465,13 @@ sub www_editGrouping {
|
|||
-name => "expireDate",
|
||||
-label => WebGUI::International::get(369),
|
||||
-hoverHelp => WebGUI::International::get('369 description'),
|
||||
-value => WebGUI::Grouping::userGroupExpireDate($session{form}{uid},$session{form}{gid}),
|
||||
-value => WebGUI::Grouping::userGroupExpireDate($session->form->process("uid"),$session->form->process("gid")),
|
||||
);
|
||||
$f->yesNo(
|
||||
-name=>"groupAdmin",
|
||||
-label=>WebGUI::International::get(977),
|
||||
-hoverHelp=>WebGUI::International::get('977 description'),
|
||||
-value=>WebGUI::Grouping::userGroupAdmin($session{form}{uid},$session{form}{gid})
|
||||
-value=>WebGUI::Grouping::userGroupAdmin($session->form->process("uid"),$session->form->process("gid"))
|
||||
);
|
||||
$f->submit;
|
||||
return _submenu($f->print,'370','grouping edit');
|
||||
|
|
@ -463,15 +479,17 @@ sub www_editGrouping {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroupingSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
WebGUI::Grouping::userGroupExpireDate($session{form}{uid},$session{form}{gid},setToEpoch($session{form}{expireDate}));
|
||||
WebGUI::Grouping::userGroupAdmin($session{form}{uid},$session{form}{gid},$session{form}{groupAdmin});
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
WebGUI::Grouping::userGroupExpireDate($session->form->process("uid"),$session->form->process("gid"),setToEpoch($session->form->process("expireDate")));
|
||||
WebGUI::Grouping::userGroupAdmin($session->form->process("uid"),$session->form->process("gid"),$session->form->process("groupAdmin"));
|
||||
return www_manageUsersInGroup();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_emailGroup {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my ($output,$f);
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
|
|
@ -480,11 +498,11 @@ sub www_emailGroup {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "gid",
|
||||
-value => $session{form}{gid}
|
||||
-value => $session->form->process("gid")
|
||||
);
|
||||
$f->email(
|
||||
-name=>"from",
|
||||
-value=>$session{setting}{companyEmail},
|
||||
-value=>$session->setting->get("companyEmail"),
|
||||
-label=>WebGUI::International::get(811),
|
||||
-hoverHelp=>WebGUI::International::get('811 description'),
|
||||
);
|
||||
|
|
@ -497,7 +515,7 @@ sub www_emailGroup {
|
|||
-name=>"message",
|
||||
-label=>WebGUI::International::get(230),
|
||||
-hoverHelp=>WebGUI::International::get('230 description'),
|
||||
-rows=>(5+$session{setting}{textAreaRows}),
|
||||
-rows=>(5+$session->setting->get("textAreaRows")),
|
||||
);
|
||||
$f->submit(WebGUI::International::get(810));
|
||||
$output = $f->print;
|
||||
|
|
@ -506,13 +524,14 @@ sub www_emailGroup {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_emailGroupSend {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my ($sth, $email);
|
||||
$sth = WebGUI::SQL->read("select b.fieldData from groupings a left join userProfileData b
|
||||
on a.userId=b.userId and b.fieldName='email' where a.groupId=".quote($session{form}{gid}));
|
||||
$sth = $session->db->read("select b.fieldData from groupings a left join userProfileData b
|
||||
on a.userId=b.userId and b.fieldName='email' where a.groupId=".$session->db->quote($session->form->process("gid")));
|
||||
while (($email) = $sth->array) {
|
||||
if ($email ne "") {
|
||||
WebGUI::Mail::send($email,$session{form}{subject},$session{form}{message},'',$session{form}{from});
|
||||
WebGUI::Mail::send($email,$session->form->process("subject"),$session->form->process("message"),'',$session->form->process("from"));
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -521,20 +540,21 @@ sub www_emailGroupSend {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listGroups {
|
||||
my $session = shift;
|
||||
if (WebGUI::Grouping::isInGroup(3)) {
|
||||
my $output = getGroupSearchForm("listGroups");
|
||||
my ($groupCount) = WebGUI::SQL->quickArray("select count(*) from groups where isEditable=1");
|
||||
return _submenu($output) unless ($session{form}{doit} || $groupCount<250 || $session{form}{pn} > 1);
|
||||
my ($groupCount) = $session->db->quickArray("select count(*) from groups where isEditable=1");
|
||||
return _submenu($output) unless ($session->form->process("doit") || $groupCount<250 || $session->form->process("pn") > 1);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
|
||||
.WebGUI::International::get(85).'</td><td class="tableHeader">'
|
||||
.WebGUI::International::get(748).'</td></tr>';
|
||||
my $p = doGroupSearch("op=listGroups",1);
|
||||
foreach my $row (@{$p->getPageData}) {
|
||||
my ($userCount) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=".quote($row->{groupId}));
|
||||
my ($userCount) = $session->db->quickArray("select count(*) from groupings where groupId=".$session->db->quote($row->{groupId}));
|
||||
$output .= '
|
||||
<tr>
|
||||
<td valign="top" class="tableData"><a href="'.WebGUI::URL::page("op=editGroup;gid=".$row->{groupId}).'">'.$row->{groupName}.'</a></td>
|
||||
<td valign="top" class="tableData"><a href="'.$session->url->page("op=editGroup;gid=".$row->{groupId}).'">'.$row->{groupName}.'</a></td>
|
||||
<td valign="top" class="tableData">'.$row->{description}.'</td>
|
||||
<td valign="top" class="tableData">'.$userCount.'</td>
|
||||
</tr>
|
||||
|
|
@ -545,30 +565,30 @@ sub www_listGroups {
|
|||
return _submenu($output,'',"groups manage");
|
||||
} elsif (WebGUI::Grouping::isInGroup(11)) {
|
||||
my ($output, $p, $sth, @data, @row, $i, $userCount);
|
||||
my @editableGroups = WebGUI::SQL->buildArray("select groupId from groupings where userId=".quote($session{user}{userId})." and groupAdmin=1");
|
||||
my @editableGroups = $session->db->buildArray("select groupId from groupings where userId=".$session->db->quote($session->user->profileField("userId"))." and groupAdmin=1");
|
||||
push (@editableGroups,0);
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups
|
||||
where groupId in (".quoteAndJoin(\@editableGroups).") order by groupName");
|
||||
$sth = $session->db->read("select groupId,groupName,description from groups
|
||||
where groupId in (".$session->db->quoteAndJoin(\@editableGroups).") order by groupName");
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr>';
|
||||
$row[$i] .= '<td valign="top" class="tableData"><a href="'
|
||||
.WebGUI::URL::page('op=manageUsersInGroup;gid='.$data[0]).'">'.$data[1].'</td>';
|
||||
.$session->url->page('op=manageUsersInGroup;gid='.$data[0]).'">'.$data[1].'</td>';
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$data[2].'</td>';
|
||||
($userCount) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=".quote($data[0]));
|
||||
($userCount) = $session->db->quickArray("select count(*) from groupings where groupId=".$session->db->quote($data[0]));
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$userCount.'</td></tr>';
|
||||
$row[$i] .= '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listGroups'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listGroups'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'
|
||||
.WebGUI::International::get(85).'</td><td class="tableHeader">'
|
||||
.WebGUI::International::get(748).'</td></tr>';
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= $p->getPage($session->form->process("pn"));
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
return _submenu($output,'89');
|
||||
}
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -577,7 +597,8 @@ sub www_listGroups {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_manageGroupsInGroup {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
-name => "op",
|
||||
|
|
@ -585,12 +606,12 @@ sub www_manageGroupsInGroup {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "gid",
|
||||
-value => $session{form}{gid}
|
||||
-value => $session->form->process("gid")
|
||||
);
|
||||
my @groups;
|
||||
my $groupsIn = WebGUI::Grouping::getGroupsInGroup($session{form}{gid},1);
|
||||
my $groupsFor = WebGUI::Grouping::getGroupsForGroup($session{form}{gid});
|
||||
push(@groups, @$groupsIn,@$groupsFor,$session{form}{gid});
|
||||
my $groupsIn = WebGUI::Grouping::getGroupsInGroup($session->form->process("gid"),1);
|
||||
my $groupsFor = WebGUI::Grouping::getGroupsForGroup($session->form->process("gid"));
|
||||
push(@groups, @$groupsIn,@$groupsFor,$session->form->process("gid"));
|
||||
$f->group(
|
||||
-name=>"groups",
|
||||
-excludeGroups=>\@groups,
|
||||
|
|
@ -601,17 +622,18 @@ sub www_manageGroupsInGroup {
|
|||
$f->submit;
|
||||
my $output = $f->print;
|
||||
$output .= '<p />';
|
||||
$output .= walkGroups($session{form}{gid});
|
||||
$output .= walkGroups($session->form->process("gid"));
|
||||
return _submenu($output,'813');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_manageUsersInGroup {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session->form->process("gid")));
|
||||
my $output = WebGUI::Form::formHeader()
|
||||
.WebGUI::Form::hidden({
|
||||
name=>"gid",
|
||||
value=>$session{form}{gid}
|
||||
value=>$session->form->process("gid")
|
||||
})
|
||||
.WebGUI::Form::hidden({
|
||||
name=>"op",
|
||||
|
|
@ -621,9 +643,9 @@ sub www_manageUsersInGroup {
|
|||
.WebGUI::Icon::_getBaseURL().'delete.gif" border="0"></td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(50).'</td>
|
||||
<td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page("op=manageUsersInGroup;gid=".$session{form}{gid}));
|
||||
my $p = WebGUI::Paginator->new($session->url->page("op=manageUsersInGroup;gid=".$session->form->process("gid")));
|
||||
$p->setDataByQuery("select users.username,users.userId,groupings.expireDate
|
||||
from groupings,users where groupings.groupId=".quote($session{form}{gid})." and groupings.userId=users.userId
|
||||
from groupings,users where groupings.groupId=".$session->db->quote($session->form->process("gid"))." and groupings.userId=users.userId
|
||||
order by users.username");
|
||||
foreach my $row (@{$p->getPageData}) {
|
||||
$output .= '<tr><td>'
|
||||
|
|
@ -631,32 +653,32 @@ sub www_manageUsersInGroup {
|
|||
name=>"uid",
|
||||
value=>$row->{userId}
|
||||
})
|
||||
.deleteIcon('op=deleteGrouping;uid='.$row->{userId}.';gid='.$session{form}{gid})
|
||||
.editIcon('op=editGrouping;uid='.$row->{userId}.';gid='.$session{form}{gid})
|
||||
.deleteIcon('op=deleteGrouping;uid='.$row->{userId}.';gid='.$session->form->process("gid"))
|
||||
.editIcon('op=editGrouping;uid='.$row->{userId}.';gid='.$session->form->process("gid"))
|
||||
.'</td>';
|
||||
$output .= '<td class="tableData"><a href="'.WebGUI::URL::page('op=editUser;uid='.$row->{userId}).'">'.$row->{username}.'</a></td>';
|
||||
$output .= '<td class="tableData"><a href="'.$session->url->page('op=editUser;uid='.$row->{userId}).'">'.$row->{username}.'</a></td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($row->{expireDate},"%z").'</td></tr>';
|
||||
}
|
||||
$output .= '</table>'.WebGUI::Form::formFooter();
|
||||
$output .= $p->getBarTraditional;
|
||||
$output .= '<p><h1>'.WebGUI::International::get(976).'</h1>';
|
||||
$output .= WebGUI::Operation::User::getUserSearchForm("manageUsersInGroup",{gid=>$session{form}{gid}});
|
||||
my ($userCount) = WebGUI::SQL->quickArray("select count(*) from users");
|
||||
return _submenu($output) unless ($session{form}{doit} || $userCount < 250 || $session{form}{pn} > 1);
|
||||
$output .= WebGUI::Operation::User::getUserSearchForm("manageUsersInGroup",{gid=>$session->form->process("gid")});
|
||||
my ($userCount) = $session->db->quickArray("select count(*) from users");
|
||||
return _submenu($output) unless ($session->form->process("doit") || $userCount < 250 || $session->form->process("pn") > 1);
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
-name => "gid",
|
||||
-value => $session{form}{gid}
|
||||
-value => $session->form->process("gid")
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "op",
|
||||
-value => "addUsersToGroupSave"
|
||||
);
|
||||
my $existingUsers = WebGUI::Grouping::getUsersInGroup($session{form}{gid});
|
||||
my $existingUsers = WebGUI::Grouping::getUsersInGroup($session->form->process("gid"));
|
||||
push(@{$existingUsers},"1");
|
||||
my %users;
|
||||
tie %users, "Tie::IxHash";
|
||||
my $sth = WebGUI::Operation::User::doUserSearch("op=manageUsersInGroup;gid=".$session{form}{gid},0,$existingUsers);
|
||||
my $sth = WebGUI::Operation::User::doUserSearch("op=manageUsersInGroup;gid=".$session->form->process("gid"),0,$existingUsers);
|
||||
while (my $data = $sth->hashRef) {
|
||||
$users{$data->{userId}} = $data->{username};
|
||||
$users{$data->{userId}} .= " (".$data->{email}.")" if ($data->{email});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use WebGUI::Utility;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _load {
|
||||
my $session = shift;
|
||||
my $namespace = shift;
|
||||
$namespace =~ s/[^\w\d\s]//g;
|
||||
my $cmd = "WebGUI::Help::".$namespace;
|
||||
|
|
@ -31,13 +32,14 @@ sub _load {
|
|||
return $hash
|
||||
}
|
||||
else {
|
||||
WebGUI::ErrorHandler::error("Help failed to compile: $namespace. ".$@);
|
||||
$session->errorHandler->error("Help failed to compile: $namespace. ".$@);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _get {
|
||||
my $session = shift;
|
||||
my $id = shift;
|
||||
my $namespace = shift;
|
||||
my $help = _load($namespace);
|
||||
|
|
@ -51,18 +53,21 @@ sub _get {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _link {
|
||||
return WebGUI::URL::page('op=viewHelp;hid='.WebGUI::URL::escape($_[0]).';namespace='.$_[1]);
|
||||
my $session = shift;
|
||||
return $session->url->page('op=viewHelp;hid='.$session->url->escape($_[0]).';namespace='.$_[1]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _linkTOC {
|
||||
return WebGUI::URL::page('op=viewHelpChapter;namespace='.$_[0]);
|
||||
my $session = shift;
|
||||
return $session->url->page('op=viewHelpChapter;namespace='.$_[0]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getHelpFilesList {
|
||||
my $dir = join '/', $session{config}{webguiRoot},"lib","WebGUI","Help";
|
||||
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatal("Can't open Help directory!");
|
||||
my $session = shift;
|
||||
my $dir = join '/', $session->config->getWebguiRoot,"lib","WebGUI","Help";
|
||||
opendir (DIR,$dir) or $session->errorHandler->fatal("Can't open Help directory!");
|
||||
my @files;
|
||||
foreach my $file (readdir DIR) {
|
||||
next unless $file =~ /.pm$/;
|
||||
|
|
@ -76,6 +81,7 @@ sub _getHelpFilesList {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getHelpName {
|
||||
my $session = shift;
|
||||
my $file = shift;
|
||||
my $helpName;
|
||||
if ($file =~ /^Asset_/) {
|
||||
|
|
@ -92,11 +98,12 @@ sub _getHelpName {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelp {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(7));
|
||||
my $ac = WebGUI::AdminConsole->new("help");
|
||||
my $namespace = $session{form}{namespace} || "WebGUI";
|
||||
my $namespace = $session->form->process("namespace") || "WebGUI";
|
||||
my $i18n = WebGUI::International->new($namespace);
|
||||
my $help = _get($session{form}{hid},$namespace);
|
||||
my $help = _get($session->form->process("hid"),$namespace);
|
||||
foreach my $row (@{$help->{related}}) {
|
||||
my $relatedHelp = _get($row->{tag},$row->{namespace});
|
||||
$ac->addSubmenuItem(_link($row->{tag},$row->{namespace}),WebGUI::International::get($relatedHelp->{title},$row->{namespace}));
|
||||
|
|
@ -109,8 +116,8 @@ sub www_viewHelp {
|
|||
'description' => WebGUI::International::get($row->{description},$row->{namespace}), }
|
||||
}
|
||||
my $body = WebGUI::Asset::Template->new("PBtmplHelp000000000001")->process(\%vars);
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=viewHelpIndex'),WebGUI::International::get(95));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=viewHelpTOC'),WebGUI::International::get('help contents'));
|
||||
$ac->addSubmenuItem($session->url->page('op=viewHelpIndex'),WebGUI::International::get(95));
|
||||
$ac->addSubmenuItem($session->url->page('op=viewHelpTOC'),WebGUI::International::get('help contents'));
|
||||
WebGUI::Macro::process(\$body);
|
||||
return $ac->render(
|
||||
$body,
|
||||
|
|
@ -120,6 +127,7 @@ sub www_viewHelp {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpIndex {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(7));
|
||||
my @helpIndex;
|
||||
my $i;
|
||||
|
|
@ -147,12 +155,13 @@ sub www_viewHelpIndex {
|
|||
}
|
||||
$output .= '</td></tr></table>';
|
||||
my $ac = WebGUI::AdminConsole->new("help");
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=viewHelpTOC'),WebGUI::International::get('help contents'));
|
||||
$ac->addSubmenuItem($session->url->page('op=viewHelpTOC'),WebGUI::International::get('help contents'));
|
||||
return $ac->render($output, join ': ',WebGUI::International::get(93), WebGUI::International::get('help index'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpTOC {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(7));
|
||||
my @helpIndex;
|
||||
my $i;
|
||||
|
|
@ -176,14 +185,15 @@ sub www_viewHelpTOC {
|
|||
}
|
||||
$output .= '</td></tr></table>';
|
||||
my $ac = WebGUI::AdminConsole->new("help");
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=viewHelpIndex'),WebGUI::International::get(95));
|
||||
$ac->addSubmenuItem($session->url->page('op=viewHelpIndex'),WebGUI::International::get(95));
|
||||
return $ac->render($output, join ': ',WebGUI::International::get(93), WebGUI::International::get('help toc'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpChapter {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(7));
|
||||
my $namespace = $session{form}{namespace};
|
||||
my $namespace = $session->form->process("namespace");
|
||||
my $help = _load($namespace);
|
||||
my @entries = sort keys %{ $help };
|
||||
my $output = '';
|
||||
|
|
@ -191,8 +201,8 @@ sub www_viewHelpChapter {
|
|||
$output .= '<p><a href="'._link($id,$namespace).'">'.WebGUI::International::get($help->{$id}{title},$namespace).'</a></p>';
|
||||
}
|
||||
my $ac = WebGUI::AdminConsole->new("help");
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=viewHelpIndex'),WebGUI::International::get(95));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=viewHelpTOC'),WebGUI::International::get('help contents'));
|
||||
$ac->addSubmenuItem($session->url->page('op=viewHelpIndex'),WebGUI::International::get(95));
|
||||
$ac->addSubmenuItem($session->url->page('op=viewHelpTOC'),WebGUI::International::get('help contents'));
|
||||
return $ac->render($output, join ': ',WebGUI::International::get(93), _getHelpName($namespace));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use WebGUI::URL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title,"AuthLDAP") if ($title);
|
||||
|
|
@ -35,47 +36,50 @@ sub _submenu {
|
|||
$ac->setHelp($help,"AuthLDAP");
|
||||
}
|
||||
my $returnUrl = "";
|
||||
if($session{form}{returnUrl}) {
|
||||
$returnUrl = ";returnUrl=".WebGUI::URL::escape($session{form}{returnUrl});
|
||||
if($session->form->process("returnUrl")) {
|
||||
$returnUrl = ";returnUrl=".$session->url->escape($session->form->process("returnUrl"));
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editLDAPLink;llid=new'.$returnUrl), WebGUI::International::get("LDAPLink_982","AuthLDAP"));
|
||||
if ($session{form}{op} eq "editLDAPLink" && $session{form}{llid} ne "new") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editLDAPLink;llid='.$session{form}{llid}.$returnUrl), WebGUI::International::get("LDAPLink_983","AuthLDAP"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=copyLDAPLink;llid='.$session{form}{llid}.$returnUrl), WebGUI::International::get("LDAPLink_984","AuthLDAP"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteLDAPLink;llid='.$session{form}{llid}), WebGUI::International::get("LDAPLink_985","AuthLDAP"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listLDAPLinks'.$returnUrl), WebGUI::International::get("LDAPLink_986","AuthLDAP"));
|
||||
$ac->addSubmenuItem($session->url->page('op=editLDAPLink;llid=new'.$returnUrl), WebGUI::International::get("LDAPLink_982","AuthLDAP"));
|
||||
if ($session->form->process("op") eq "editLDAPLink" && $session->form->process("llid") ne "new") {
|
||||
$ac->addSubmenuItem($session->url->page('op=editLDAPLink;llid='.$session->form->process("llid").$returnUrl), WebGUI::International::get("LDAPLink_983","AuthLDAP"));
|
||||
$ac->addSubmenuItem($session->url->page('op=copyLDAPLink;llid='.$session->form->process("llid").$returnUrl), WebGUI::International::get("LDAPLink_984","AuthLDAP"));
|
||||
$ac->addSubmenuItem($session->url->page('op=deleteLDAPLink;llid='.$session->form->process("llid")), WebGUI::International::get("LDAPLink_985","AuthLDAP"));
|
||||
$ac->addSubmenuItem($session->url->page('op=listLDAPLinks'.$returnUrl), WebGUI::International::get("LDAPLink_986","AuthLDAP"));
|
||||
}
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_copyLDAPLink {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my (%db);
|
||||
tie %db, 'Tie::CPHash';
|
||||
%db = WebGUI::SQL->quickHash("select * from ldapLink where ldapLinkId=".quote($session{form}{llid}));
|
||||
%db = $session->db->quickHash("select * from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid")));
|
||||
$db{ldapLinkId} = "new";
|
||||
$db{ldapLinkName} = "Copy of ".$db{ldapLinkName};
|
||||
WebGUI::SQL->setRow("ldapLink","ldapLinkId",\%db);
|
||||
#WebGUI::SQL->write("insert into databaseLink (databaseLinkId,title,DSN,username,identifier) values (".quote(WebGUI::Id::generate()).", ".quote($db{title}." (copy)").", ".quote($db{DSN}).", ".quote($db{username}).", ".quote($db{identifier}).")");
|
||||
$session{form}{op} = "listLDAPLinks";
|
||||
$session->db->setRow("ldapLink","ldapLinkId",\%db);
|
||||
#$session->db->write("insert into databaseLink (databaseLinkId,title,DSN,username,identifier) values (".$session->db->quote(WebGUI::Id::generate()).", ".$session->db->quote($db{title}." (copy)").", ".$session->db->quote($db{DSN}).", ".$session->db->quote($db{username}).", ".$session->db->quote($db{identifier}).")");
|
||||
$session->form->process("op") = "listLDAPLinks";
|
||||
return www_listLDAPLinks();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteLDAPLink {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::SQL->write("delete from ldapLink where ldapLinkId=".quote($session{form}{llid}));
|
||||
$session{form}{op} = "listLDAPLinks";
|
||||
$session->db->write("delete from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid")));
|
||||
$session->form->process("op") = "listLDAPLinks";
|
||||
return www_listLDAPLinks();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editLDAPLink {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, %db, $f);
|
||||
tie %db, 'Tie::CPHash';
|
||||
%db = WebGUI::SQL->quickHash("select * from ldapLink where ldapLinkId=".quote($session{form}{llid}));
|
||||
%db = $session->db->quickHash("select * from ldapLink where ldapLinkId=".$session->db->quote($session->form->process("llid")));
|
||||
|
||||
$f = WebGUI::HTMLForm->new( -extras=>'autocomplete="off"' );
|
||||
$f->hidden(
|
||||
|
|
@ -84,15 +88,15 @@ sub www_editLDAPLink {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "llid",
|
||||
-value => $session{form}{llid},
|
||||
-value => $session->form->process("llid"),
|
||||
);
|
||||
$f->hidden(
|
||||
-name => "returnUrl",
|
||||
-value => $session{form}{returnUrl},
|
||||
-value => $session->form->process("returnUrl"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-label => WebGUI::International::get("LDAPLink_991","AuthLDAP"),
|
||||
-value => $session{form}{llid},
|
||||
-value => $session->form->process("llid"),
|
||||
);
|
||||
$f->text(
|
||||
-name => "ldapLinkName",
|
||||
|
|
@ -183,43 +187,45 @@ sub www_editLDAPLink {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editLDAPLinkSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $properties = {};
|
||||
$properties->{ldapLinkId} = $session{form}{llid};
|
||||
$properties->{ldapLinkName} = $session{form}{ldapLinkName};
|
||||
$properties->{ldapUrl} = $session{form}{ldapUrl};
|
||||
$properties->{connectDn} = $session{form}{connectDn};
|
||||
$properties->{identifier} = $session{form}{ldapIdentifier};
|
||||
$properties->{ldapUserRDN} = $session{form}{ldapUserRDN};
|
||||
$properties->{ldapIdentity} = $session{form}{ldapIdentity};
|
||||
$properties->{ldapIdentityName} = $session{form}{ldapIdentityName};
|
||||
$properties->{ldapPasswordName} = $session{form}{ldapPasswordName};
|
||||
$properties->{ldapSendWelcomeMessage} = WebGUI::FormProcessor::yesNo("ldapSendWelcomeMessage");
|
||||
$properties->{ldapWelcomeMessage} = WebGUI::FormProcessor::textarea("ldapWelcomeMessage");
|
||||
$properties->{ldapAccountTemplate} = WebGUI::FormProcessor::template("ldapAccountTemplate");
|
||||
$properties->{ldapCreateAccountTemplate} = WebGUI::FormProcessor::template("ldapCreateAccountTemplate");
|
||||
$properties->{ldapLoginTemplate} = WebGUI::FormProcessor::template("ldapLoginTemplate");
|
||||
WebGUI::SQL->setRow("ldapLink","ldapLinkId",$properties);
|
||||
if($session{form}{returnUrl}) {
|
||||
WebGUI::HTTP::setRedirect($session{form}{returnUrl});
|
||||
$properties->{ldapLinkId} = $session->form->process("llid");
|
||||
$properties->{ldapLinkName} = $session->form->process("ldapLinkName");
|
||||
$properties->{ldapUrl} = $session->form->process("ldapUrl");
|
||||
$properties->{connectDn} = $session->form->process("connectDn");
|
||||
$properties->{identifier} = $session->form->process("ldapIdentifier");
|
||||
$properties->{ldapUserRDN} = $session->form->process("ldapUserRDN");
|
||||
$properties->{ldapIdentity} = $session->form->process("ldapIdentity");
|
||||
$properties->{ldapIdentityName} = $session->form->process("ldapIdentityName");
|
||||
$properties->{ldapPasswordName} = $session->form->process("ldapPasswordName");
|
||||
$properties->{ldapSendWelcomeMessage} = $session->form->yesNo("ldapSendWelcomeMessage");
|
||||
$properties->{ldapWelcomeMessage} = $session->form->textarea("ldapWelcomeMessage");
|
||||
$properties->{ldapAccountTemplate} = $session->form->template("ldapAccountTemplate");
|
||||
$properties->{ldapCreateAccountTemplate} = $session->form->template("ldapCreateAccountTemplate");
|
||||
$properties->{ldapLoginTemplate} = $session->form->template("ldapLoginTemplate");
|
||||
$session->db->setRow("ldapLink","ldapLinkId",$properties);
|
||||
if($session->form->process("returnUrl")) {
|
||||
WebGUI::HTTP::setRedirect($session->form->process("returnUrl"));
|
||||
}
|
||||
return www_listLDAPLinks();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listLDAPLinks {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless(WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $p, $sth, $data, @row, $i);
|
||||
my $returnUrl = "";
|
||||
if($session{form}{returnUrl}) {
|
||||
$returnUrl = ";returnUrl=".WebGUI::URL::escape($session{form}{returnUrl});
|
||||
if($session->form->process("returnUrl")) {
|
||||
$returnUrl = ";returnUrl=".$session->url->escape($session->form->process("returnUrl"));
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select * from ldapLink order by ldapLinkName");
|
||||
$sth = $session->db->read("select * from ldapLink order by ldapLinkName");
|
||||
$row[$i] = '<tr><td valign="top" class="tableData"> </td><td valign="top" class="tableData">'.WebGUI::International::get("LDAPLink_1076","AuthLDAP").'</td><td>'.WebGUI::International::get("LDAPLink_1077","AuthLDAP").'</td></tr>';
|
||||
$i++;
|
||||
while ($data = $sth->hashRef) {
|
||||
$row[$i] = '<tr><td valign="top" class="tableData">'
|
||||
.deleteIcon('op=deleteLDAPLink;llid='.$data->{ldapLinkId},WebGUI::URL::page(),WebGUI::International::get("LDAPLink_988","AuthLDAP"))
|
||||
.deleteIcon('op=deleteLDAPLink;llid='.$data->{ldapLinkId},$session->url->page(),WebGUI::International::get("LDAPLink_988","AuthLDAP"))
|
||||
.editIcon('op=editLDAPLink;llid='.$data->{ldapLinkId}.$returnUrl)
|
||||
.copyIcon('op=copyLDAPLink;llid='.$data->{ldapLinkId}.$returnUrl)
|
||||
.'</td>';
|
||||
|
|
@ -230,7 +236,7 @@ sub www_listLDAPLinks {
|
|||
if($ldapLink->bind) {
|
||||
$status = WebGUI::International::get("LDAPLink_1079","AuthLDAP");
|
||||
}else{
|
||||
WebGUI::ErrorHandler::warn($ldapLink->getErrorMessage());
|
||||
$session->errorHandler->warn($ldapLink->getErrorMessage());
|
||||
}
|
||||
$ldapLink->unbind;
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$status.'</td>';
|
||||
|
|
@ -238,7 +244,7 @@ sub www_listLDAPLinks {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listLDAPLinks'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listLDAPLinks'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="3" cellspacing="0" align="center">';
|
||||
$output .= $p->getPage;
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ they used.
|
|||
=cut
|
||||
|
||||
sub www_viewLoginHistory {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$sth = WebGUI::SQL->read("select * from users,userLoginLog where users.userId=userLoginLog.userId order by userLoginLog.timeStamp desc");
|
||||
$sth = $session->db->read("select * from users,userLoginLog where users.userId=userLoginLog.userId order by userLoginLog.timeStamp desc");
|
||||
while (%data = $sth->hash) {
|
||||
$data{username} = WebGUI::International::get('unknown user') if ($data{userId} eq "0");
|
||||
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
|
||||
|
|
@ -52,7 +53,7 @@ sub www_viewLoginHistory {
|
|||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewLoginHistory'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=viewLoginHistory'));
|
||||
$p->setDataByArrayRef(\@row);
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr class="tableHeader"><td>'.WebGUI::International::get(428).'</td>';
|
||||
|
|
@ -60,9 +61,9 @@ sub www_viewLoginHistory {
|
|||
$output .= '<td>'.WebGUI::International::get(429).'</td>';
|
||||
$output .= '<td>'.WebGUI::International::get(431).'</td>';
|
||||
$output .= '<td>'.WebGUI::International::get(433).'</td></tr>';
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= $p->getPage($session->form->process("pn"));
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBar($session{form}{pn});
|
||||
$output .= $p->getBar($session->form->process("pn"));
|
||||
return WebGUI::AdminConsole->new("loginHistory")->render($output);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ returns a hashref with internationalized values for message status.
|
|||
=cut
|
||||
|
||||
sub _status {
|
||||
my $session = shift;
|
||||
return {"notice"=>WebGUI::International::get(551),"pending"=>WebGUI::International::get(552),"completed"=>WebGUI::International::get(350)};
|
||||
}
|
||||
|
||||
|
|
@ -56,11 +57,12 @@ Templated display all messages for the current user.
|
|||
=cut
|
||||
|
||||
sub www_viewMessageLog {
|
||||
my $session = shift;
|
||||
my (@msg, $vars);
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(2,$session{user}{userId}));
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(2,$session->user->profileField("userId")));
|
||||
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(159).'</h1>';
|
||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page('op=viewMessageLog'));
|
||||
my $query = "select messageLogId,subject,url,dateOfEntry,status from messageLog where userId=".quote($session{user}{userId})." order by dateOfEntry desc";
|
||||
my $p = WebGUI::Paginator->new($session->url->page('op=viewMessageLog'));
|
||||
my $query = "select messageLogId,subject,url,dateOfEntry,status from messageLog where userId=".$session->db->quote($session->user->profileField("userId"))." order by dateOfEntry desc";
|
||||
$p->setDataByQuery($query);
|
||||
|
||||
$vars->{'message.subject.label'} = WebGUI::International::get(351);
|
||||
|
|
@ -70,9 +72,9 @@ sub www_viewMessageLog {
|
|||
my $messages = $p->getPageData;
|
||||
foreach my $message (@$messages) {
|
||||
my $hash;
|
||||
$hash->{'message.subject'} = '<a href="'.WebGUI::URL::page('op=viewMessageLogMessage;mlog='.$message->{messageLogId}).'">'.$message->{subject}.'</a>';
|
||||
$hash->{'message.subject'} = '<a href="'.$session->url->page('op=viewMessageLogMessage;mlog='.$message->{messageLogId}).'">'.$message->{subject}.'</a>';
|
||||
my $status = _status->{$message->{status}};
|
||||
$status = '<a href="'.WebGUI::URL::append($message->{url},'mlog='.$message->{messageLogId}).'">'.$status.'</a>' if ($message->{url} ne "");
|
||||
$status = '<a href="'.$session->url->append($message->{url},'mlog='.$message->{messageLogId}).'">'.$status.'</a>' if ($message->{url} ne "");
|
||||
$hash->{'message.status'} = $status;
|
||||
$hash->{'message.dateOfEntry'} = epochToHuman($message->{dateOfEntry});
|
||||
push(@msg,$hash);
|
||||
|
|
@ -100,19 +102,20 @@ Templated display of a single message for the user.
|
|||
=cut
|
||||
|
||||
sub www_viewMessageLogMessage {
|
||||
my $session = shift;
|
||||
my ($data, $vars);
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(2,$session{user}{userId}));
|
||||
return WebGUI::Privilege::insufficient() unless (WebGUI::Grouping::isInGroup(2,$session->user->profileField("userId")));
|
||||
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(159).'</h1>';
|
||||
|
||||
$data = WebGUI::SQL->quickHashRef("select * from messageLog where messageLogId=".quote($session{form}{mlog})." and userId=".quote($session{user}{userId}));
|
||||
$data = $session->db->quickHashRef("select * from messageLog where messageLogId=".$session->db->quote($session->form->process("mlog"))." and userId=".$session->db->quote($session->user->profileField("userId")));
|
||||
|
||||
$vars->{'message.subject'} = $data->{subject};
|
||||
$vars->{'message.dateOfEntry'} = epochToHuman($data->{dateOfEntry});
|
||||
|
||||
my $status = _status->{$data->{status}};
|
||||
if ($data->{url} ne "" && $data->{status} eq 'pending'){
|
||||
$status = '<a href="'.WebGUI::URL::append($data->{url},'mlog='.$data->{messageLogId}).'">'.$status.'</a>';
|
||||
$vars->{'message.takeAction'} = '<a href="'.WebGUI::URL::append($data->{url},'mlog='.$data->{messageLogId}).'">'.WebGUI::International::get(554).'</a>'
|
||||
$status = '<a href="'.$session->url->append($data->{url},'mlog='.$data->{messageLogId}).'">'.$status.'</a>';
|
||||
$vars->{'message.takeAction'} = '<a href="'.$session->url->append($data->{url},'mlog='.$data->{messageLogId}).'">'.WebGUI::International::get(554).'</a>'
|
||||
}
|
||||
$vars->{'message.status'} = $status;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use WebGUI::Grouping;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $i18n = WebGUI::International->new("ProductManager");
|
||||
|
||||
my $workarea = shift;
|
||||
|
|
@ -29,19 +30,20 @@ sub _submenu {
|
|||
$ac->setHelp($help, 'ProductManager');
|
||||
}
|
||||
|
||||
my $productId = $session{form}{productId} || WebGUI::Session::getScratch('managingProduct');
|
||||
my $productId = $session->form->process("productId") || WebGUI::Session::getScratch('managingProduct');
|
||||
undef $productId if ($productId eq 'new');
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editProduct;productId=new'), $i18n->get('add product'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listProducts'), $i18n->get('list products'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=manageProduct;productId='.$productId), $i18n->get('manage product')) if ($productId);
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listProductVariants;productId='.$productId), $i18n->get('list variants')) if ($productId);
|
||||
$ac->addSubmenuItem($session->url->page('op=editProduct;productId=new'), $i18n->get('add product'));
|
||||
$ac->addSubmenuItem($session->url->page('op=listProducts'), $i18n->get('list products'));
|
||||
$ac->addSubmenuItem($session->url->page('op=manageProduct;productId='.$productId), $i18n->get('manage product')) if ($productId);
|
||||
$ac->addSubmenuItem($session->url->page('op=listProductVariants;productId='.$productId), $i18n->get('list variants')) if ($productId);
|
||||
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProductParameterOption {
|
||||
my $optionId = $session{form}{optionId};
|
||||
my $session = shift;
|
||||
my $optionId = $session->form->process("optionId");
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
|
|
@ -52,7 +54,8 @@ sub www_deleteProductParameterOption {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProductParameter {
|
||||
my $parameterId = $session{form}{parameterId};
|
||||
my $session = shift;
|
||||
my $parameterId = $session->form->process("parameterId");
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
|
|
@ -63,7 +66,8 @@ sub www_deleteProductParameter {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProduct {
|
||||
my $productId = $session{form}{productId};
|
||||
my $session = shift;
|
||||
my $productId = $session->form->process("productId");
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
|
|
@ -74,12 +78,13 @@ sub www_deleteProduct {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProduct {
|
||||
my $session = shift;
|
||||
my ($productId, $product, $f, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new('ProductManager');
|
||||
$productId = $session{form}{productId};
|
||||
$productId = $session->form->process("productId");
|
||||
|
||||
unless ($productId eq 'new') {
|
||||
$product = WebGUI::Product->new($productId)->get;
|
||||
|
|
@ -98,48 +103,48 @@ sub www_editProduct {
|
|||
-name => 'title',
|
||||
-label => $i18n->get('title'),
|
||||
-hoverHelp => $i18n->get('title description'),
|
||||
-value => $session{form}{title} || $product->{title},
|
||||
-value => $session->form->process("title") || $product->{title},
|
||||
-maxlength => 255,
|
||||
);
|
||||
$f->textarea(
|
||||
-name => 'description',
|
||||
-label => $i18n->get('description'),
|
||||
-hoverHelp => $i18n->get('description description'),
|
||||
-value => $session{form}{decsription} || $product->{description},
|
||||
-value => $session->form->process("decsription") || $product->{description},
|
||||
);
|
||||
$f->float(
|
||||
-name => 'price',
|
||||
-label => $i18n->get('price'),
|
||||
-hoverHelp => $i18n->get('price description'),
|
||||
-value => $session{form}{price} || $product->{price},
|
||||
-value => $session->form->process("price") || $product->{price},
|
||||
-maxlength => 13,
|
||||
);
|
||||
$f->float(
|
||||
-name => 'weight',
|
||||
-label => $i18n->get('weight'),
|
||||
-hoverHelp => $i18n->get('weight description'),
|
||||
-value => $session{form}{weight} || $product->{weight},
|
||||
-value => $session->form->process("weight") || $product->{weight},
|
||||
-maxlength => 9,
|
||||
);
|
||||
$f->text(
|
||||
-name => 'sku',
|
||||
-label => $i18n->get('sku'),
|
||||
-hoverHelp => $i18n->get('sku description'),
|
||||
-value => $session{form}{sku} || $product->{SKU},
|
||||
-value => $session->form->process("sku") || $product->{SKU},
|
||||
-maxlength => 64,
|
||||
);
|
||||
$f->template(
|
||||
-name => 'templateId',
|
||||
-label => $i18n->get('template'),
|
||||
-hoverHelp => $i18n->get('template description'),
|
||||
-value => $session{form}{templateId} || $product->{templateId},
|
||||
-value => $session->form->process("templateId") || $product->{templateId},
|
||||
-namespace => 'Commerce/Product',
|
||||
);
|
||||
$f->text(
|
||||
-name => 'skuTemplate',
|
||||
-label => $i18n->get('sku template'),
|
||||
-hoverHelp => $i18n->get('sku template description'),
|
||||
-value => $session{form}{skuTemplate} || $product->{skuTemplate},
|
||||
-value => $session->form->process("skuTemplate") || $product->{skuTemplate},
|
||||
-maxlength => 255,
|
||||
);
|
||||
$f->submit;
|
||||
|
|
@ -149,45 +154,47 @@ sub www_editProduct {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductSave {
|
||||
my $session = shift;
|
||||
my ($self, @error, $productId, $product, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new('ProductManager');
|
||||
|
||||
push(@error, $i18n->get('edit product title error')) unless $session{form}{title};
|
||||
push(@error, $i18n->get('edit product price error')) unless ($session{form}{price} && $session{form}{price} =~ /^\d+(\.\d+)?$/);
|
||||
push(@error, $i18n->get('edit product weight error')) unless (defined $session{form}{weight} && $session{form}{price} =~ /^\d+(\.\d+)?$/);
|
||||
push(@error, $i18n->get('edit product sku error')) unless ($session{form}{sku});
|
||||
push(@error, $i18n->get('edit product title error')) unless $session->form->process("title");
|
||||
push(@error, $i18n->get('edit product price error')) unless ($session->form->process("price") && $session->form->process("price") =~ /^\d+(\.\d+)?$/);
|
||||
push(@error, $i18n->get('edit product weight error')) unless (defined $session->form->process("weight") && $session->form->process("price") =~ /^\d+(\.\d+)?$/);
|
||||
push(@error, $i18n->get('edit product sku error')) unless ($session->form->process("sku"));
|
||||
|
||||
return '<ul><li>'.join('</li><li>', @error).'</li></ul><br />'.WebGUI::Operation::execute('editProduct') if (@error);
|
||||
|
||||
$productId = $session{form}{productId};
|
||||
$productId = $session->form->process("productId");
|
||||
$product = WebGUI::Product->new($productId);
|
||||
$product->set({
|
||||
title => $session{form}{title},
|
||||
description => $session{form}{description},
|
||||
price => $session{form}{price},
|
||||
weight => $session{form}{weight},
|
||||
sku => $session{form}{sku},
|
||||
templateId => $session{form}{templateId},
|
||||
skuTemplate => $session{form}{skuTemplate},
|
||||
title => $session->form->process("title"),
|
||||
description => $session->form->process("description"),
|
||||
price => $session->form->process("price"),
|
||||
weight => $session->form->process("weight"),
|
||||
sku => $session->form->process("sku"),
|
||||
templateId => $session->form->process("templateId"),
|
||||
skuTemplate => $session->form->process("skuTemplate"),
|
||||
});
|
||||
|
||||
$session{form}{productId} = $product->get('productId');
|
||||
$session->form->process("productId") = $product->get('productId');
|
||||
return WebGUI::Operation::execute('manageProduct');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductParameter {
|
||||
my $session = shift;
|
||||
my ($parameterId, $product, $productId, $parameter, $f, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new('ProductManager');
|
||||
|
||||
$parameterId = $session{form}{parameterId};
|
||||
$productId = $session{form}{productId};
|
||||
$parameterId = $session->form->process("parameterId");
|
||||
$productId = $session->form->process("productId");
|
||||
|
||||
unless ($parameterId eq 'new') {
|
||||
$product = WebGUI::Product->getByParameterId($parameterId);
|
||||
|
|
@ -216,7 +223,7 @@ sub www_editProductParameter {
|
|||
-name => 'name',
|
||||
-label => $i18n->get('edit parameter name'),
|
||||
-hoverHelp => $i18n->get('edit parameter name description'),
|
||||
-value => $session{form}{name} || $parameter->{name},
|
||||
-value => $session->form->process("name") || $parameter->{name},
|
||||
-maxlength => 64,
|
||||
);
|
||||
$f->submit;
|
||||
|
|
@ -226,27 +233,28 @@ sub www_editProductParameter {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductParameterSave {
|
||||
my $session = shift;
|
||||
my (@error, $parameterId, $product, $i18n, $skuTemplate, $oldName, $newName);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new('ProductManager');
|
||||
|
||||
$parameterId = $session{form}{parameterId};
|
||||
$parameterId = $session->form->process("parameterId");
|
||||
|
||||
push (@error, $i18n->get('edit parameter name error')) unless $session{form}{name};
|
||||
push (@error, $i18n->get('edit parameter productId error')) unless $session{form}{productId};
|
||||
push (@error, $i18n->get('edit parameter name error')) unless $session->form->process("name");
|
||||
push (@error, $i18n->get('edit parameter productId error')) unless $session->form->process("productId");
|
||||
|
||||
return "<ul><li>".join('</li><li>', @error)."</li></ul>".WebGUI::Operation::execute('editProductParameter') if (@error);
|
||||
|
||||
$product = WebGUI::Product->new($session{form}{productId});
|
||||
$product = WebGUI::Product->new($session->form->process("productId"));
|
||||
$skuTemplate = $product->get('skuTemplate');
|
||||
|
||||
if ($parameterId eq 'new') {
|
||||
$parameterId = $product->addParameter;
|
||||
} else {
|
||||
($oldName = $product->getParameter($parameterId)->{name}) =~ s/[ ><]/\./g;
|
||||
($newName = $session{form}{name}) =~ s/[ ><]/\./g;
|
||||
($newName = $session->form->process("name")) =~ s/[ ><]/\./g;
|
||||
$skuTemplate = $product->get('skuTemplate');
|
||||
$skuTemplate =~ s/< *?tmpl_var *?param\.$oldName *?>/<tmpl_var param.$newName>/i;
|
||||
$product->set({
|
||||
|
|
@ -255,22 +263,23 @@ sub www_editProductParameterSave {
|
|||
}
|
||||
|
||||
$product->setParameter($parameterId, {
|
||||
name => $session{form}{name}
|
||||
name => $session->form->process("name")
|
||||
});
|
||||
|
||||
return WebGUI::Operation::execute('editSkuTemplate') if ($session{form}{parameterId} eq 'new');
|
||||
return WebGUI::Operation::execute('editSkuTemplate') if ($session->form->process("parameterId") eq 'new');
|
||||
return WebGUI::Operation::execute('manageProduct');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductParameterOption {
|
||||
my $session = shift;
|
||||
my ($self, $optionId, $option, $f, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new('ProductManager');
|
||||
|
||||
$optionId = $session{form}{optionId};
|
||||
$optionId = $session->form->process("optionId");
|
||||
unless ($optionId eq 'new') {
|
||||
$option = WebGUI::Product->getByOptionId($optionId)->getOption($optionId);
|
||||
}
|
||||
|
|
@ -286,7 +295,7 @@ sub www_editProductParameterOption {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => 'parameterId',
|
||||
-value => $session{form}{parameterId},
|
||||
-value => $session->form->process("parameterId"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-label => $i18n->get('option ID'),
|
||||
|
|
@ -296,28 +305,28 @@ sub www_editProductParameterOption {
|
|||
-name => 'value',
|
||||
-label => $i18n->get('edit option value'),
|
||||
-hoverHelp => $i18n->get('edit option value description'),
|
||||
-value => $session{form}{value} || $option->{value},
|
||||
-value => $session->form->process("value") || $option->{value},
|
||||
-maxlength => 64,
|
||||
);
|
||||
$f->float(
|
||||
-name => 'priceModifier',
|
||||
-label => $i18n->get('edit option price modifier'),
|
||||
-hoverHelp => $i18n->get('edit option price modifier description'),
|
||||
-value => $session{form}{priceModifier} || $option->{priceModifier},
|
||||
-value => $session->form->process("priceModifier") || $option->{priceModifier},
|
||||
-maxlength => 11,
|
||||
);
|
||||
$f->float(
|
||||
-name => 'weightModifier',
|
||||
-label => $i18n->get('edit option weight modifier'),
|
||||
-hoverHelp => $i18n->get('edit option weight modifier description'),
|
||||
-value => $session{form}{weightModifier} || $option->{weightModifier},
|
||||
-value => $session->form->process("weightModifier") || $option->{weightModifier},
|
||||
-maxlength => 7,
|
||||
);
|
||||
$f->text(
|
||||
-name => 'skuModifier',
|
||||
-label => $i18n->get('edit option sku modifier'),
|
||||
-hoverHelp => $i18n->get('edit option sku modifier description'),
|
||||
-value => $session{form}{skuModifier} || $option->{skuModifier},
|
||||
-value => $session->form->process("skuModifier") || $option->{skuModifier},
|
||||
-maxlength => 64,
|
||||
);
|
||||
$f->submit;
|
||||
|
|
@ -327,25 +336,26 @@ sub www_editProductParameterOption {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductParameterOptionSave {
|
||||
my $session = shift;
|
||||
my ($self, @error, $optionId, $product, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new('ProductManager');
|
||||
|
||||
push (@error, $i18n->get('edit option value error')) unless ($session{form}{value});
|
||||
push (@error, $i18n->get('edit option parameterId error')) unless ($session{form}{parameterId});
|
||||
push (@error, $i18n->get('edit option value error')) unless ($session->form->process("value"));
|
||||
push (@error, $i18n->get('edit option parameterId error')) unless ($session->form->process("parameterId"));
|
||||
|
||||
return '<ul><li>'.join('</li><li>', @error).'</li></ul><br />'.WebGUI::Operation::execute('editProduct') if (@error);
|
||||
|
||||
$product = WebGUI::Product->getByParameterId($session{form}{parameterId});
|
||||
$optionId = $session{form}{optionId};
|
||||
$optionId = $product->addOptionToParameter($session{form}{parameterId}) if ($optionId eq 'new');
|
||||
$product = WebGUI::Product->getByParameterId($session->form->process("parameterId"));
|
||||
$optionId = $session->form->process("optionId");
|
||||
$optionId = $product->addOptionToParameter($session->form->process("parameterId")) if ($optionId eq 'new');
|
||||
$product->setOption($optionId, {
|
||||
value => $session{form}{value},
|
||||
priceModifier => $session{form}{priceModifier},
|
||||
weightModifier => $session{form}{weightModifier},
|
||||
skuModifier => $session{form}{skuModifier}
|
||||
value => $session->form->process("value"),
|
||||
priceModifier => $session->form->process("priceModifier"),
|
||||
weightModifier => $session->form->process("weightModifier"),
|
||||
skuModifier => $session->form->process("skuModifier")
|
||||
});
|
||||
|
||||
return WebGUI::Operation::execute('manageProduct');
|
||||
|
|
@ -353,13 +363,14 @@ sub www_editProductParameterOptionSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductVariant {
|
||||
my $session = shift;
|
||||
my ($variantId, $variant, $f, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new("ProductManager");
|
||||
|
||||
$variantId = $session{form}{variantId};
|
||||
$variantId = $session->form->process("variantId");
|
||||
$variant = WebGUI::Product->getByVariantId($variantId)->getVariant($variantId);
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
|
|
@ -406,7 +417,8 @@ sub www_editProductVariant {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProductVariantSave {
|
||||
my $variantId = $session{form}{variantId};
|
||||
my $session = shift;
|
||||
my $variantId = $session->form->process("variantId");
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
|
|
@ -417,13 +429,14 @@ my $variantId = $session{form}{variantId};
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSkuTemplate {
|
||||
my $session = shift;
|
||||
my ($product, $productId, $output, $f, $name, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new("ProductManager");
|
||||
|
||||
$productId = $session{form}{productId};
|
||||
$productId = $session->form->process("productId");
|
||||
$product = WebGUI::Product->new($productId);
|
||||
|
||||
$output .= "Available are: <br />\n";
|
||||
|
|
@ -456,12 +469,13 @@ sub www_editSkuTemplate {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSkuTemplateSave {
|
||||
my ($productId) = $session{form}{productId};
|
||||
my $session = shift;
|
||||
my ($productId) = $session->form->process("productId");
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
WebGUI::Product->new($productId)->set({
|
||||
skuTemplate => $session{form}{skuTemplate},
|
||||
skuTemplate => $session->form->process("skuTemplate"),
|
||||
});
|
||||
|
||||
return WebGUI::Operation::execute('manageProduct');
|
||||
|
|
@ -469,6 +483,7 @@ sub www_editSkuTemplateSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listProducts {
|
||||
my $session = shift;
|
||||
my ($self, $sth, $output, $row, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
|
@ -477,7 +492,7 @@ sub www_listProducts {
|
|||
|
||||
WebGUI::Session::setScratch('managingProduct', '-delete-');
|
||||
|
||||
$sth = WebGUI::SQL->read('select * from products order by title');
|
||||
$sth = $session->db->read('select * from products order by title');
|
||||
|
||||
$output .= '<table>';
|
||||
while ($row = $sth->hashRef) {
|
||||
|
|
@ -496,13 +511,14 @@ sub www_listProducts {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listProductVariants {
|
||||
my $session = shift;
|
||||
my ($productId, $product, @variants, %parameters, %options, $output, %composition, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new("ProductManager");
|
||||
|
||||
$productId = $session{form}{productId} || WebGUI::Session::getScratch('managingProduct');
|
||||
$productId = $session->form->process("productId") || WebGUI::Session::getScratch('managingProduct');
|
||||
|
||||
return WebGUI::Operation::execute('listProducts') if ($productId eq 'new' || !$productId);
|
||||
|
||||
|
|
@ -558,12 +574,13 @@ sub www_listProductVariants {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listProductVariantsSave {
|
||||
my $session = shift;
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
my %availableVariants = map {$_ => 1} WebGUI::FormProcessor::selectList('available');
|
||||
my %availableVariants = map {$_ => 1} $session->form->selectList('available');
|
||||
|
||||
my $product = WebGUI::Product->new($session{form}{productId});
|
||||
my $product = WebGUI::Product->new($session->form->process("productId"));
|
||||
my @variants = @{$product->getVariant};
|
||||
|
||||
foreach (@variants) {
|
||||
|
|
@ -576,13 +593,14 @@ sub www_listProductVariantsSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_manageProduct {
|
||||
my $session = shift;
|
||||
my ($productId, $product, $output, $parameter, $option, $optionId, $i18n);
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||
|
||||
$i18n = WebGUI::International->new("ProductManager");
|
||||
|
||||
$productId = $session{form}{productId} || WebGUI::Session::getScratch('managingProduct');
|
||||
$productId = $session->form->process("productId") || WebGUI::Session::getScratch('managingProduct');
|
||||
return WebGUI::Operation::execute('listProducts') if ($productId eq 'new' || !$productId);
|
||||
WebGUI::Session::setScratch('managingProduct', $productId);
|
||||
|
||||
|
|
@ -599,14 +617,14 @@ sub www_manageProduct {
|
|||
$output .= "</table>";
|
||||
|
||||
$output .= "<h2>Parameters</h2>";
|
||||
$output .= '<a href="'.WebGUI::URL::page('op=editProductParameter;parameterId=new;productId='.$product->get('productId')).'">'.
|
||||
$output .= '<a href="'.$session->url->page('op=editProductParameter;parameterId=new;productId='.$product->get('productId')).'">'.
|
||||
$i18n->get('add parameter').'</a><br />';
|
||||
foreach $parameter (@{$product->getParameter}) {
|
||||
$output .= deleteIcon('op=deleteProductParameter;parameterId='.$parameter->{parameterId}).
|
||||
editIcon('op=editProductParameter;parameterId='.$parameter->{parameterId});
|
||||
$output .= '<span style="margin-left: 10px"><b>'.$parameter->{name}.'</b></span><br />';
|
||||
$output .= '<a style="margin-left: 20px" href="'.
|
||||
WebGUI::URL::page('op=editProductParameterOption;optionId=new;parameterId='.$parameter->{parameterId}).'">'.
|
||||
$session->url->page('op=editProductParameterOption;optionId=new;parameterId='.$parameter->{parameterId}).'">'.
|
||||
$i18n->get('add option').'</a><br />';
|
||||
foreach $optionId (@{$parameter->{options}}) {
|
||||
$option = $product->getOption($optionId);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ use WebGUI::Operation::Shared;
|
|||
#-------------------------------------------------------------------
|
||||
# Builds Extra form requirements for anonymous registration.
|
||||
sub getRequiredProfileFields {
|
||||
my $session = shift;
|
||||
my @array;
|
||||
foreach my $field (@{WebGUI::ProfileField->getRequiredFields}) {
|
||||
push(@array, {
|
||||
|
|
@ -55,13 +56,15 @@ sub getRequiredProfileFields {
|
|||
=cut
|
||||
|
||||
sub isDuplicateEmail {
|
||||
my $session = shift;
|
||||
my $email = shift;
|
||||
my ($otherEmail) = WebGUI::SQL->quickArray("select count(*) from userProfileData where fieldName='email' and fieldData = ".quote($email)." and userId <> ".quote($session{user}{userId}));
|
||||
my ($otherEmail) = $session->db->quickArray("select count(*) from userProfileData where fieldName='email' and fieldData = ".$session->db->quote($email)." and userId <> ".$session->db->quote($session->user->profileField("userId")));
|
||||
return ($otherEmail > 0);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub saveProfileFields {
|
||||
my $session = shift;
|
||||
my $u = shift;
|
||||
my $profile = shift;
|
||||
|
||||
|
|
@ -72,6 +75,7 @@ sub saveProfileFields {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub validateProfileData {
|
||||
my $session = shift;
|
||||
my %data = ();
|
||||
my $error = "";
|
||||
my $warning = "";
|
||||
|
|
@ -93,7 +97,8 @@ sub validateProfileData {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfile {
|
||||
return WebGUI::Operation::Auth::www_auth("init") if($session{user}{userId} eq '1');
|
||||
my $session = shift;
|
||||
return WebGUI::Operation::Auth::www_auth("init") if($session->user->profileField("userId") eq '1');
|
||||
my $vars = {};
|
||||
$vars->{displayTitle} .= '<h1>'.WebGUI::International::get(338).'</h1>';
|
||||
$vars->{'profile.message'} = $_[0] if($_[0]);
|
||||
|
|
@ -101,7 +106,7 @@ sub www_editProfile {
|
|||
$vars->{'profile.form.footer'} = WebGUI::Form::formFooter();
|
||||
|
||||
$vars->{'profile.form.hidden'} = WebGUI::Form::hidden({"name"=>"op","value"=>"editProfileSave"});
|
||||
$vars->{'profile.form.hidden'} .= WebGUI::Form::hidden({"name"=>"uid","value"=>$session{user}{userId}});
|
||||
$vars->{'profile.form.hidden'} .= WebGUI::Form::hidden({"name"=>"uid","value"=>$session->user->profileField("userId")});
|
||||
my @array = ();
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
next unless $category->isEditable;
|
||||
|
|
@ -128,15 +133,16 @@ sub www_editProfile {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSave {
|
||||
my $session = shift;
|
||||
my ($profile, $fieldName, $error, $u, $warning);
|
||||
return WebGUI::Operation::Auth::www_auth("init") if ($session{user}{userId} eq '1');
|
||||
return WebGUI::Operation::Auth::www_auth("init") if ($session->user->profileField("userId") eq '1');
|
||||
|
||||
($profile, $error, $warning) = validateProfileData();
|
||||
$error .= $warning;
|
||||
|
||||
return www_editProfile('<ul>'.$error.'</ul>') if($error ne "");
|
||||
|
||||
$u = WebGUI::User->new($session{user}{userId});
|
||||
$u = WebGUI::User->new($session->user->profileField("userId"));
|
||||
foreach $fieldName (keys %{$profile}) {
|
||||
$u->profileField($fieldName,$profile->{$fieldName});
|
||||
}
|
||||
|
|
@ -146,13 +152,14 @@ sub www_editProfileSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewProfile {
|
||||
my $u = WebGUI::User->new($session{form}{uid});
|
||||
my $session = shift;
|
||||
my $u = WebGUI::User->new($session->form->process("uid"));
|
||||
my $vars = {};
|
||||
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(347).' '.$u->username.'</h1>';
|
||||
|
||||
return WebGUI::Privilege::notMember() if($u->username eq "");
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle($vars->{displayTitle}.WebGUI::International::get(862)) if($u->profileField("publicProfile") < 1 && ($session{user}{userId} ne $session{form}{uid} || WebGUI::Grouping::isInGroup(3)));
|
||||
return WebGUI::Operation::Shared::userStyle($vars->{displayTitle}.WebGUI::International::get(862)) if($u->profileField("publicProfile") < 1 && ($session->user->profileField("userId") ne $session->form->process("uid") || WebGUI::Grouping::isInGroup(3)));
|
||||
return WebGUI::Privilege::insufficient() if(!WebGUI::Grouping::isInGroup(2));
|
||||
|
||||
my @array = ();
|
||||
|
|
@ -169,7 +176,7 @@ sub www_viewProfile {
|
|||
}
|
||||
}
|
||||
$vars->{'profile.elements'} = \@array;
|
||||
if ($session{user}{userId} eq $session{form}{uid}) {
|
||||
if ($session->user->profileField("userId") eq $session->form->process("uid")) {
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions();
|
||||
}
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new("PBtmpl0000000000000052")->process($vars));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use WebGUI::ProfileCategory;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
my $help = shift;
|
||||
|
|
@ -34,24 +35,25 @@ sub _submenu {
|
|||
if ($help) {
|
||||
$ac->setHelp($help,"WebGUIProfile");
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editProfileCategory;cid=new"), WebGUI::International::get(490,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editProfileField;fid=new"), WebGUI::International::get(491,"WebGUIProfile"));
|
||||
if ((($session{form}{op} eq "editProfileField" && $session{form}{fid} ne "new") || $session{form}{op} eq "deleteProfileField") && $session{form}{cid} eq "") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editProfileField;fid='.$session{form}{fid}), WebGUI::International::get(787,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteProfileField;fid='.$session{form}{fid}), WebGUI::International::get(788,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem($session->url->page("op=editProfileCategory;cid=new"), WebGUI::International::get(490,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem($session->url->page("op=editProfileField;fid=new"), WebGUI::International::get(491,"WebGUIProfile"));
|
||||
if ((($session->form->process("op") eq "editProfileField" && $session->form->process("fid") ne "new") || $session->form->process("op") eq "deleteProfileField") && $session->form->process("cid") eq "") {
|
||||
$ac->addSubmenuItem($session->url->page('op=editProfileField;fid='.$session->form->process("fid")), WebGUI::International::get(787,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem($session->url->page('op=deleteProfileField;fid='.$session->form->process("fid")), WebGUI::International::get(788,"WebGUIProfile"));
|
||||
}
|
||||
if ((($session{form}{op} eq "editProfileCategory" && $session{form}{cid} ne "new") || $session{form}{op} eq "deleteProfileCategory") && $session{form}{fid} eq "") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editProfileCategory;cid='.$session{form}{cid}), WebGUI::International::get(789,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteProfileCategory;cid='.$session{form}{cid}), WebGUI::International::get(790,"WebGUIProfile"));
|
||||
if ((($session->form->process("op") eq "editProfileCategory" && $session->form->process("cid") ne "new") || $session->form->process("op") eq "deleteProfileCategory") && $session->form->process("fid") eq "") {
|
||||
$ac->addSubmenuItem($session->url->page('op=editProfileCategory;cid='.$session->form->process("cid")), WebGUI::International::get(789,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem($session->url->page('op=deleteProfileCategory;cid='.$session->form->process("cid")), WebGUI::International::get(790,"WebGUIProfile"));
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editProfileSettings"), WebGUI::International::get(492,"WebGUIProfile"));
|
||||
$ac->addSubmenuItem($session->url->page("op=editProfileSettings"), WebGUI::International::get(492,"WebGUIProfile"));
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileCategoryConfirm {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $category = WebGUI::ProfileCategory->new($session{form}{cid});
|
||||
my $category = WebGUI::ProfileCategory->new($session->form->process("cid"));
|
||||
return WebGUI::AdminConsole->new("userProfiling")->render(WebGUI::Privilege::vitalComponent()) if ($category->isProtected);
|
||||
$category->delete;
|
||||
return www_editProfileSettings();
|
||||
|
|
@ -59,8 +61,9 @@ sub www_deleteProfileCategoryConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteProfileFieldConfirm {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $field = WebGUI::ProfileField->new($session{form}{fid});
|
||||
my $field = WebGUI::ProfileField->new($session->form->process("fid"));
|
||||
return WebGUI::AdminConsole->new("userProfiling")->render(WebGUI::Privilege::vitalComponent()) if ($field->isProtected);
|
||||
$field->delete;
|
||||
return www_editProfileSettings();
|
||||
|
|
@ -68,6 +71,7 @@ sub www_deleteProfileFieldConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileCategory {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $data = {};
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
|
|
@ -75,16 +79,16 @@ sub www_editProfileCategory {
|
|||
-name => "op",
|
||||
-value => "editProfileCategorySave",
|
||||
);
|
||||
if ($session{form}{cid}) {
|
||||
if ($session->form->process("cid")) {
|
||||
$f->hidden(
|
||||
-name => "cid",
|
||||
-value => $session{form}{cid},
|
||||
-value => $session->form->process("cid"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-name => $session{form}{cid},
|
||||
-name => $session->form->process("cid"),
|
||||
-label => WebGUI::International::get(469,"WebGUIProfile"),
|
||||
);
|
||||
$data = WebGUI::ProfileCategory->new($session{form}{cid})->get;
|
||||
$data = WebGUI::ProfileCategory->new($session->form->process("cid"))->get;
|
||||
} else {
|
||||
$f->hidden(
|
||||
-name => "cid",
|
||||
|
|
@ -115,23 +119,25 @@ sub www_editProfileCategory {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileCategorySave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my %data = (
|
||||
label=>WebGUI::FormProcessor::text("label"),
|
||||
visible=>WebGUI::FormProcessor::yesNo("visible"),
|
||||
editable=>WebGUI::FormProcessor::yesNo("editable"),
|
||||
label=>$session->form->text("label"),
|
||||
visible=>$session->form->yesNo("visible"),
|
||||
editable=>$session->form->yesNo("editable"),
|
||||
);
|
||||
if ($session{form}{cid} eq "new") {
|
||||
if ($session->form->process("cid") eq "new") {
|
||||
my $category = WebGUI::ProfileCategory->create(\%data);
|
||||
$session{form}{cid} = $category->getId;
|
||||
$session->form->process("cid") = $category->getId;
|
||||
} else {
|
||||
WebGUI::ProfileCategory->new($session{form}{cid})->set(\%data);
|
||||
WebGUI::ProfileCategory->new($session->form->process("cid"))->set(\%data);
|
||||
}
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileField {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
|
|
@ -139,17 +145,17 @@ sub www_editProfileField {
|
|||
-value => "editProfileFieldSave",
|
||||
);
|
||||
my $data = {};
|
||||
if ($session{form}{fid} ne 'new') {
|
||||
if ($session->form->process("fid") ne 'new') {
|
||||
$f->hidden(
|
||||
-name => "fid",
|
||||
-value => $session{form}{fid},
|
||||
-value => $session->form->process("fid"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-value => $session{form}{fid},
|
||||
-value => $session->form->process("fid"),
|
||||
-label => WebGUI::International::get(475,"WebGUIProfile"),
|
||||
-hoverHelp => WebGUI::International::get('475 description',"WebGUIProfile"),
|
||||
);
|
||||
$data = WebGUI::ProfileField->new($session{form}{fid})->get;
|
||||
$data = WebGUI::ProfileField->new($session->form->process("fid"))->get;
|
||||
} else {
|
||||
$f->hidden(
|
||||
-name => "new",
|
||||
|
|
@ -232,22 +238,23 @@ sub www_editProfileField {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileFieldSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my %data = (
|
||||
label=>WebGUI::FormProcessor::text("label"),
|
||||
editable=>WebGUI::FormProcessor::yesNo("editable"),
|
||||
visible=>WebGUI::FormProcessor::yesNo("visible"),
|
||||
required=>WebGUI::FormProcessor::yesNo("required"),
|
||||
possibleValues=>WebGUI::FormProcessor::textarea("possibleValues"),
|
||||
dataDefault=>WebGUI::FormProcessor::textarea("dataDefault"),
|
||||
fieldType=>WebGUI::FormProcessor::fieldType("fieldType"),
|
||||
label=>$session->form->text("label"),
|
||||
editable=>$session->form->yesNo("editable"),
|
||||
visible=>$session->form->yesNo("visible"),
|
||||
required=>$session->form->yesNo("required"),
|
||||
possibleValues=>$session->form->textarea("possibleValues"),
|
||||
dataDefault=>$session->form->textarea("dataDefault"),
|
||||
fieldType=>$session->form->fieldType("fieldType"),
|
||||
);
|
||||
my $categoryId = WebGUI::FormProcessor::selectBox("profileCategoryId");
|
||||
if ($session{form}{new}) {
|
||||
my $field = WebGUI::ProfileField->create(WebGUI::FormProcessor::text("fid"), \%data, $categoryId);
|
||||
$session{form}{fid} = $field->getId;
|
||||
my $categoryId = $session->form->selectBox("profileCategoryId");
|
||||
if ($session->form->process("new")) {
|
||||
my $field = WebGUI::ProfileField->create($session->form->text("fid"), \%data, $categoryId);
|
||||
$session->form->process("fid") = $field->getId;
|
||||
} else {
|
||||
my $field = WebGUI::ProfileField->new($session{form}{fid});
|
||||
my $field = WebGUI::ProfileField->new($session->form->process("fid"));
|
||||
$field->set(\%data);
|
||||
$field->setCategory($categoryId);
|
||||
}
|
||||
|
|
@ -256,6 +263,7 @@ sub www_editProfileFieldSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSettings {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $output = "";
|
||||
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
|
||||
|
|
@ -279,29 +287,33 @@ sub www_editProfileSettings {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileCategoryDown {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileCategory->new($session{form}{cid})->moveDown;
|
||||
WebGUI::ProfileCategory->new($session->form->process("cid"))->moveDown;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileCategoryUp {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileCategory->new($session{form}{cid})->moveUp;
|
||||
WebGUI::ProfileCategory->new($session->form->process("cid"))->moveUp;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileFieldDown {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileField->new($session{form}{fid})->moveDown;
|
||||
WebGUI::ProfileField->new($session->form->process("fid"))->moveDown;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_moveProfileFieldUp {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::ProfileField->new($session{form}{fid})->moveUp;
|
||||
WebGUI::ProfileField->new($session->form->process("fid"))->moveUp;
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use WebGUI::SQL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title) if ($title);
|
||||
|
|
@ -30,23 +31,25 @@ sub _submenu {
|
|||
if ($help) {
|
||||
$ac->setHelp($help);
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editReplacement;replacementId=new"), WebGUI::International::get(1047));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=listReplacements"), WebGUI::International::get("content filters"));
|
||||
$ac->addSubmenuItem($session->url->page("op=editReplacement;replacementId=new"), WebGUI::International::get(1047));
|
||||
$ac->addSubmenuItem($session->url->page("op=listReplacements"), WebGUI::International::get("content filters"));
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteReplacement {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::SQL->write("delete from replacements where replacementId=".quote($session{form}{replacementId}));
|
||||
$session->db->write("delete from replacements where replacementId=".$session->db->quote($session->form->process("replacementId")));
|
||||
return www_listReplacements();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editReplacement {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $data = WebGUI::SQL->getRow("replacements","replacementId",$session{form}{replacementId});
|
||||
my $data = $session->db->getRow("replacements","replacementId",$session->form->process("replacementId"));
|
||||
my $f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
-name=>"op",
|
||||
|
|
@ -54,11 +57,11 @@ sub www_editReplacement {
|
|||
);
|
||||
$f->hidden(
|
||||
-name=>"replacementId",
|
||||
-value=>$session{form}{replacementId}
|
||||
-value=>$session->form->process("replacementId")
|
||||
);
|
||||
$f->readOnly(
|
||||
-label=>WebGUI::International::get(1049),
|
||||
-value=>$session{form}{replacementId}
|
||||
-value=>$session->form->process("replacementId")
|
||||
);
|
||||
$f->text(
|
||||
-name=>"searchFor",
|
||||
|
|
@ -78,21 +81,23 @@ sub www_editReplacement {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editReplacementSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
WebGUI::SQL->setRow("replacements","replacementId",{
|
||||
replacementId=>$session{form}{replacementId},
|
||||
searchFor=>$session{form}{searchFor},
|
||||
replaceWith=>$session{form}{replaceWith}
|
||||
$session->db->setRow("replacements","replacementId",{
|
||||
replacementId=>$session->form->process("replacementId"),
|
||||
searchFor=>$session->form->process("searchFor"),
|
||||
replaceWith=>$session->form->process("replaceWith")
|
||||
});
|
||||
return www_listReplacements();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listReplacements {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $output = '<table>';
|
||||
$output .= '<tr><td></td><td class="tableHeader">'.WebGUI::International::get(1050).'</td><td class="tableHeader">'.WebGUI::International::get(1051).'</td></tr>';
|
||||
my $sth = WebGUI::SQL->read("select replacementId,searchFor,replaceWith from replacements order by searchFor");
|
||||
my $sth = $session->db->read("select replacementId,searchFor,replaceWith from replacements order by searchFor");
|
||||
while (my $data = $sth->hashRef) {
|
||||
$output .= '<tr><td>'.deleteIcon("op=deleteReplacement;replacementId=".$data->{replacementId})
|
||||
.editIcon("op=editReplacement;replacementId=".$data->{replacementId}).'</td>';
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ variable, scratchName.
|
|||
=cut
|
||||
|
||||
sub www_deleteScratch {
|
||||
WebGUI::Session::deleteScratch("www_".$session{form}{scratchName});
|
||||
my $session = shift;
|
||||
WebGUI::Session::deleteScratch("www_".$session->form->process("scratchName"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +50,8 @@ the value the variable should take.
|
|||
=cut
|
||||
|
||||
sub www_setScratch {
|
||||
WebGUI::Session::setScratch("www_".$session{form}{scratchName},$session{form}{scratchValue});
|
||||
my $session = shift;
|
||||
WebGUI::Session::setScratch("www_".$session->form->process("scratchName"),$session->form->process("scratchValue"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use WebGUI::URL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSettings {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $i18n = WebGUI::International->new("WebGUI");
|
||||
my %tabs;
|
||||
|
|
@ -49,19 +50,19 @@ sub www_editSettings {
|
|||
-name=>"companyName",
|
||||
-label=>$i18n->get(125),
|
||||
-hoverHelp=>$i18n->get('125 description'),
|
||||
-value=>$session{setting}{companyName}
|
||||
-value=>$session->setting->get("companyName")
|
||||
);
|
||||
$tabform->getTab("company")->text(
|
||||
-name=>"companyEmail",
|
||||
-label=>$i18n->get(126),
|
||||
-hoverHelp=>$i18n->get('126 description'),
|
||||
-value=>$session{setting}{companyEmail}
|
||||
-value=>$session->setting->get("companyEmail")
|
||||
);
|
||||
$tabform->getTab("company")->url(
|
||||
-name=>"companyURL",
|
||||
-label=>$i18n->get(127),
|
||||
-hoverHelp=>$i18n->get('127 description'),
|
||||
-value=>$session{setting}{companyURL}
|
||||
-value=>$session->setting->get("companyURL")
|
||||
);
|
||||
# content settings
|
||||
my %htmlFilter = (
|
||||
|
|
@ -74,17 +75,17 @@ sub www_editSettings {
|
|||
-name=>"defaultPage",
|
||||
-label=>$i18n->get(527),
|
||||
-hoverHelp=>$i18n->get('527 description'),
|
||||
-value=>$session{setting}{defaultPage}
|
||||
-value=>$session->setting->get("defaultPage")
|
||||
);
|
||||
$tabform->getTab("content")->asset(
|
||||
-name=>"notFoundPage",
|
||||
-label=>$i18n->get(141),
|
||||
-hoverHelp=>$i18n->get('141 description'),
|
||||
-value=>$session{setting}{notFoundPage}
|
||||
-value=>$session->setting->get("notFoundPage")
|
||||
);
|
||||
$tabform->getTab("content")->text(
|
||||
-name=>"urlExtension",
|
||||
-value=>$session{setting}{urlExtension},
|
||||
-value=>$session->setting->get("urlExtension"),
|
||||
-label=>$i18n->get("url extension"),
|
||||
-hoverHelp=>$i18n->get("url extension description"),
|
||||
);
|
||||
|
|
@ -92,124 +93,124 @@ sub www_editSettings {
|
|||
-name=>"maxAttachmentSize",
|
||||
-label=>$i18n->get(130),
|
||||
-hoverHelp=>$i18n->get('130 description'),
|
||||
-value=>$session{setting}{maxAttachmentSize}
|
||||
-value=>$session->setting->get("maxAttachmentSize")
|
||||
);
|
||||
$tabform->getTab("content")->integer(
|
||||
-name=>"maxImageSize",
|
||||
-label=>$i18n->get(583),
|
||||
-hoverHelp=>$i18n->get('583 description'),
|
||||
-value=>$session{setting}{maxImageSize}
|
||||
-value=>$session->setting->get("maxImageSize")
|
||||
);
|
||||
$tabform->getTab("content")->integer(
|
||||
-name=>"thumbnailSize",
|
||||
-label=>$i18n->get(406),
|
||||
-hoverHelp=>$i18n->get('406 description'),
|
||||
-value=>$session{setting}{thumbnailSize}
|
||||
-value=>$session->setting->get("thumbnailSize")
|
||||
);
|
||||
$tabform->getTab("content")->yesNo(
|
||||
-name=>"autoCommit",
|
||||
-label=>WebGUI::International::get("enable autocommit of asset versioning","Asset"),
|
||||
-value=>$session{setting}{autoCommit}
|
||||
-value=>$session->setting->get("autoCommit")
|
||||
);
|
||||
$tabform->getTab("content")->yesNo(
|
||||
-name=>"metaDataEnabled",
|
||||
-label=>$i18n->get("Enable Metadata"),
|
||||
-hoverHelp=>$i18n->get("Enable Metadata description"),
|
||||
-value=>$session{setting}{metaDataEnabled}
|
||||
-value=>$session->setting->get("metaDataEnabled")
|
||||
);
|
||||
# user interface settings
|
||||
$tabform->getTab("ui")->selectBox(
|
||||
-name=>"richEditor",
|
||||
-label=>$i18n->get("default rich editor"),
|
||||
-hoverHelp=>$i18n->get("default rich editor description"),
|
||||
-value=>[$session{setting}{richEditor}],
|
||||
-options=>WebGUI::SQL->buildHashRef("select assetData.assetId,assetData.title from asset left join assetData on asset.assetId=assetData.assetId where asset.className='WebGUI::Asset::RichEdit' order by assetData.title"),
|
||||
-value=>[$session->setting->get("richEditor")],
|
||||
-options=>$session->db->buildHashRef("select assetData.assetId,assetData.title from asset left join assetData on asset.assetId=assetData.assetId where asset.className='WebGUI::Asset::RichEdit' order by assetData.title"),
|
||||
-defaultValue=>["PBrichedit000000000001"]
|
||||
);
|
||||
$tabform->getTab("ui")->integer(
|
||||
-name=>"textAreaRows",
|
||||
-label=>$i18n->get(463),
|
||||
-hoverHelp=>$i18n->get('463 description'),
|
||||
-value=>$session{setting}{textAreaRows}
|
||||
-value=>$session->setting->get("textAreaRows")
|
||||
);
|
||||
$tabform->getTab("ui")->integer(
|
||||
-name=>"textAreaCols",
|
||||
-label=>$i18n->get(464),
|
||||
-hoverHelp=>$i18n->get('464 description'),
|
||||
-value=>$session{setting}{textAreaCols}
|
||||
-value=>$session->setting->get("textAreaCols")
|
||||
);
|
||||
$tabform->getTab("ui")->integer(
|
||||
-name=>"textBoxSize",
|
||||
-label=>$i18n->get(465),
|
||||
-hoverHelp=>$i18n->get('465 description'),
|
||||
-value=>$session{setting}{textBoxSize}
|
||||
-value=>$session->setting->get("textBoxSize")
|
||||
);
|
||||
$tabform->getTab("ui")->template(
|
||||
-name=>"userFunctionStyleId",
|
||||
-label=>$i18n->get('user function style'),
|
||||
-hoverHelp=>$i18n->get('user function style description'),
|
||||
-namespace=>"style",
|
||||
-value=>$session{setting}{userFunctionStyleId}
|
||||
-value=>$session->setting->get("userFunctionStyleId")
|
||||
);
|
||||
$tabform->getTab("ui")->template(
|
||||
-name=>"AdminConsoleTemplate",
|
||||
-label=>$i18n->get('admin console template'),
|
||||
-hoverHelp=>$i18n->get('admin console template description'),
|
||||
-namespace=>"AdminConsole",
|
||||
-value=>$session{setting}{AdminConsoleTemplate}
|
||||
-value=>$session->setting->get("AdminConsoleTemplate")
|
||||
);
|
||||
# messaging settings
|
||||
$tabform->getTab("messaging")->text(
|
||||
-name=>"smtpServer",
|
||||
-label=>$i18n->get(135),
|
||||
-hoverHelp=>$i18n->get('135 description'),
|
||||
-value=>$session{setting}{smtpServer}
|
||||
-value=>$session->setting->get("smtpServer")
|
||||
);
|
||||
$tabform->getTab("messaging")->textarea(
|
||||
-name=>"mailFooter",
|
||||
-label=>$i18n->get(824),
|
||||
-hoverHelp=>$i18n->get('824 description'),
|
||||
-value=>$session{setting}{mailFooter}
|
||||
-value=>$session->setting->get("mailFooter")
|
||||
);
|
||||
$tabform->getTab("messaging")->yesNo(
|
||||
-name=>"alertOnNewUser",
|
||||
-label=>$i18n->get(534),
|
||||
-hoverHelp=>$i18n->get('534 description'),
|
||||
-value=>$session{setting}{alertOnNewUser}
|
||||
-value=>$session->setting->get("alertOnNewUser")
|
||||
);
|
||||
$tabform->getTab("messaging")->group(
|
||||
-name=>"onNewUserAlertGroup",
|
||||
-label=>$i18n->get(535),
|
||||
-hoverHelp=>$i18n->get('535 description'),
|
||||
-value=>[$session{setting}{onNewUserAlertGroup}]
|
||||
-value=>[$session->setting->get("onNewUserAlertGroup")]
|
||||
);
|
||||
$tabform->getTab("misc")->yesNo(
|
||||
-name=>"preventProxyCache",
|
||||
-label=>$i18n->get(400),
|
||||
-hoverHelp=>$i18n->get('400 description'),
|
||||
-value=>$session{setting}{preventProxyCache}
|
||||
-value=>$session->setting->get("preventProxyCache")
|
||||
);
|
||||
$tabform->getTab("misc")->text(
|
||||
-name=>"debugIp",
|
||||
-label=>$i18n->get("debug ip"),
|
||||
-hoverHelp=>$i18n->get("debug ip description"),
|
||||
-value=>$session{setting}{debugIp}
|
||||
-value=>$session->setting->get("debugIp")
|
||||
);
|
||||
$tabform->getTab("misc")->yesNo(
|
||||
-name=>"showDebug",
|
||||
-label=>$i18n->get(707),
|
||||
-hoverHelp=>$i18n->get('707 description'),
|
||||
-value=>$session{setting}{showDebug}
|
||||
-value=>$session->setting->get("showDebug")
|
||||
);
|
||||
$tabform->getTab("misc")->yesNo(
|
||||
-name=>"showPerformanceIndicators",
|
||||
-label=>$i18n->get('show performance indicators'),
|
||||
-hoverHelp=>$i18n->get('show performance indicators description'),
|
||||
-value=>$session{setting}{showPerformanceIndicators}
|
||||
-value=>$session->setting->get("showPerformanceIndicators")
|
||||
);
|
||||
$tabform->getTab("misc")->selectBox(
|
||||
-name=>"hostToUse",
|
||||
-value=>[$session{setting}{hostToUse}],
|
||||
-value=>[$session->setting->get("hostToUse")],
|
||||
-options=>{
|
||||
sitename=>$i18n->get(1070),
|
||||
HTTP_HOST=>$i18n->get(1071)
|
||||
|
|
@ -222,56 +223,56 @@ sub www_editSettings {
|
|||
-name=>"anonymousRegistration",
|
||||
-label=>$i18n->get(118),
|
||||
-hoverHelp=>$i18n->get('118 description'),
|
||||
-value=>$session{setting}{anonymousRegistration}
|
||||
-value=>$session->setting->get("anonymousRegistration")
|
||||
);
|
||||
$tabform->getTab("user")->text(
|
||||
-name=>"runOnRegistration",
|
||||
-label=>$i18n->get(559),
|
||||
-hoverHelp=>$i18n->get('559 description'),
|
||||
-value=>$session{setting}{runOnRegistration}
|
||||
-value=>$session->setting->get("runOnRegistration")
|
||||
);
|
||||
$tabform->getTab("user")->yesNo(
|
||||
-name=>"useKarma",
|
||||
-label=>$i18n->get(539),
|
||||
-hoverHelp=>$i18n->get('539 description'),
|
||||
-value=>$session{setting}{useKarma}
|
||||
-value=>$session->setting->get("useKarma")
|
||||
);
|
||||
$tabform->getTab("user")->integer(
|
||||
-name=>"karmaPerLogin",
|
||||
-label=>$i18n->get(540),
|
||||
-hoverHelp=>$i18n->get('540 description'),
|
||||
-value=>$session{setting}{karmaPerLogin}
|
||||
-value=>$session->setting->get("karmaPerLogin")
|
||||
);
|
||||
$tabform->getTab("user")->interval(
|
||||
-name=>"sessionTimeout",
|
||||
-label=>$i18n->get(142),
|
||||
-hoverHelp=>$i18n->get('142 description'),
|
||||
-value=>$session{setting}{sessionTimeout}
|
||||
-value=>$session->setting->get("sessionTimeout")
|
||||
);
|
||||
$tabform->getTab("user")->yesNo(
|
||||
-name=>"selfDeactivation",
|
||||
-label=>$i18n->get(885),
|
||||
-hoverHelp=>$i18n->get('885 description'),
|
||||
-value=>$session{setting}{selfDeactivation}
|
||||
-value=>$session->setting->get("selfDeactivation")
|
||||
);
|
||||
$tabform->getTab("user")->yesNo(
|
||||
-name=>"encryptLogin",
|
||||
-label=>$i18n->get(1006),
|
||||
-hoverHelp=>$i18n->get('1006 description'),
|
||||
-value=>$session{setting}{encryptLogin}
|
||||
-value=>$session->setting->get("encryptLogin")
|
||||
);
|
||||
$tabform->getTab("user")->yesNo(
|
||||
-name=>"passiveProfilingEnabled",
|
||||
-label=>$i18n->get("Enable passive profiling"),
|
||||
-hoverHelp=>$i18n->get("Enable passive profiling description"),
|
||||
-value=>$session{setting}{passiveProfilingEnabled},
|
||||
-value=>$session->setting->get("passiveProfilingEnabled"),
|
||||
-extras=>' onChange="alert(\''.$i18n->get("Illegal Warning").'\')" '
|
||||
);
|
||||
# auth settings
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/swapLayers.js",{type=>"text/javascript"});
|
||||
WebGUI::Style::setRawHeadTags('<script type="text/javascript" >var active="'.$session{setting}{authMethod}.'";</script>');
|
||||
$session->style->setScript($session->config->get("extrasURL")."/swapLayers.js",{type=>"text/javascript"});
|
||||
$session->style->setRawHeadTags('<script type="text/javascript" >var active="'.$session->setting->get("authMethod").'";</script>');
|
||||
my $options;
|
||||
foreach (@{$session{config}{authMethods}}) {
|
||||
foreach (@{$session->config->get("authMethods")}) {
|
||||
$options->{$_} = $_;
|
||||
}
|
||||
$tabform->getTab("auth")->selectBox(
|
||||
|
|
@ -279,12 +280,12 @@ sub www_editSettings {
|
|||
-options=>$options,
|
||||
-label=>$i18n->get(164),
|
||||
-hoverHelp=>$i18n->get('164 description'),
|
||||
-value=>[$session{setting}{authMethod}],
|
||||
-value=>[$session->setting->get("authMethod")],
|
||||
-extras=>"onChange=\"active=operateHidden(this.options[this.selectedIndex].value,active)\""
|
||||
);
|
||||
foreach (@{$session{config}{authMethods}}) {
|
||||
foreach (@{$session->config->get("authMethods")}) {
|
||||
my $authInstance = WebGUI::Operation::Auth::getInstance($_,1);
|
||||
my $style = '" style="display: none;' unless ($_ eq $session{setting}{authMethod});
|
||||
my $style = '" style="display: none;' unless ($_ eq $session->setting->get("authMethod"));
|
||||
$tabform->getTab("auth")->raw('<tr id="'.$_.$style.'"><td colspan="2" width="100%"><table border="0" cellspacing="0" cellpadding="0" width="100%">'.$authInstance->editUserSettingsForm.'<tr><td width="304"> </td><td width="496"> </td></tr></table></td></tr>');
|
||||
}
|
||||
$tabform->submit();
|
||||
|
|
@ -295,12 +296,13 @@ sub www_editSettings {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_saveSettings {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($key, $value);
|
||||
foreach $key (keys %{$session{form}}) {
|
||||
$value = $session{form}{$key};
|
||||
if ($key =~ m/(.*)_interval/) {
|
||||
$value = WebGUI::FormProcessor::interval($1);
|
||||
$value = $session->form->interval($1);
|
||||
$key = $1;
|
||||
} elsif ($key =~ m/_units/) {
|
||||
next;
|
||||
|
|
|
|||
|
|
@ -25,46 +25,47 @@ our @EXPORT = qw(&menuWrapper);
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub accountOptions {
|
||||
my $session = shift;
|
||||
my @array;
|
||||
if (WebGUI::Grouping::isInGroup(12)) {
|
||||
my %hash;
|
||||
if ($session{var}{adminOn}) {
|
||||
$hash{'options.display'} .= '<a href="'.WebGUI::URL::page('op=switchOffAdmin').'">'.WebGUI::International::get(12).'</a>';
|
||||
if ($session->var->get("adminOn")) {
|
||||
$hash{'options.display'} .= '<a href="'.$session->url->page('op=switchOffAdmin').'">'.WebGUI::International::get(12).'</a>';
|
||||
} else {
|
||||
$hash{'options.display'} .= '<a href="'.WebGUI::URL::page('op=switchOnAdmin').'">'.WebGUI::International::get(63).'</a>';
|
||||
$hash{'options.display'} .= '<a href="'.$session->url->page('op=switchOnAdmin').'">'.WebGUI::International::get(63).'</a>';
|
||||
}
|
||||
push(@array,\%hash);
|
||||
}
|
||||
unless ($session{form}{op} eq "displayAccount"){
|
||||
unless ($session->form->process("op") eq "displayAccount"){
|
||||
my %hash;
|
||||
$hash{'options.display'} = '<a href="'.WebGUI::URL::page('op=auth;method=init').'">'.WebGUI::International::get(342).'</a>';
|
||||
$hash{'options.display'} = '<a href="'.$session->url->page('op=auth;method=init').'">'.WebGUI::International::get(342).'</a>';
|
||||
push(@array,\%hash);
|
||||
}
|
||||
unless ($session{form}{op} eq "editProfile"){
|
||||
unless ($session->form->process("op") eq "editProfile"){
|
||||
my %hash;
|
||||
$hash{'options.display'} = '<a href="'.WebGUI::URL::page('op=editProfile').'">'.WebGUI::International::get(341).'</a>';
|
||||
$hash{'options.display'} = '<a href="'.$session->url->page('op=editProfile').'">'.WebGUI::International::get(341).'</a>';
|
||||
push(@array,\%hash);
|
||||
}
|
||||
unless ($session{form}{op} eq "viewProfile"){
|
||||
unless ($session->form->process("op") eq "viewProfile"){
|
||||
my %hash;
|
||||
$hash{'options.display'} = '<a href="'.WebGUI::URL::page('op=viewProfile;uid='.$session{user}{userId}).'">'.WebGUI::International::get(343).'</a>';
|
||||
$hash{'options.display'} = '<a href="'.$session->url->page('op=viewProfile;uid='.$session->user->profileField("userId")).'">'.WebGUI::International::get(343).'</a>';
|
||||
push(@array,\%hash);
|
||||
}
|
||||
unless ($session{form}{op} eq "viewMessageLog"){
|
||||
unless ($session->form->process("op") eq "viewMessageLog"){
|
||||
my %hash;
|
||||
$hash{'options.display'} = '<a href="'.WebGUI::URL::page('op=viewMessageLog').'">'.WebGUI::International::get(354).'</a>';
|
||||
$hash{'options.display'} = '<a href="'.$session->url->page('op=viewMessageLog').'">'.WebGUI::International::get(354).'</a>';
|
||||
push(@array,\%hash);
|
||||
}
|
||||
unless ($session{form}{op} eq "redeemSubscriptionCode") {
|
||||
push(@array, {'options.display' => '<a href="'.WebGUI::URL::page('op=redeemSubscriptionCode').'">'.WebGUI::International::get('redeem code', 'Subscription').'</a>'});
|
||||
unless ($session->form->process("op") eq "redeemSubscriptionCode") {
|
||||
push(@array, {'options.display' => '<a href="'.$session->url->page('op=redeemSubscriptionCode').'">'.WebGUI::International::get('redeem code', 'Subscription').'</a>'});
|
||||
}
|
||||
|
||||
my %logout;
|
||||
$logout{'options.display'} = '<a href="'.WebGUI::URL::page('op=auth;method=logout').'">'.WebGUI::International::get(64).'</a>';
|
||||
$logout{'options.display'} = '<a href="'.$session->url->page('op=auth;method=logout').'">'.WebGUI::International::get(64).'</a>';
|
||||
push(@array,\%logout);
|
||||
if ($session{setting}{selfDeactivation} && !WebGUI::Grouping::isInGroup(3)){
|
||||
if ($session->setting->get("selfDeactivation") && !WebGUI::Grouping::isInGroup(3)){
|
||||
my %hash;
|
||||
$hash{'options.display'} = '<a href="'.WebGUI::URL::page('op=auth;method=deactivateAccount').'">'.WebGUI::International::get(65).'</a>';
|
||||
$hash{'options.display'} = '<a href="'.$session->url->page('op=auth;method=deactivateAccount').'">'.WebGUI::International::get(65).'</a>';
|
||||
push(@array,\%hash);
|
||||
}
|
||||
return \@array;
|
||||
|
|
@ -72,6 +73,7 @@ our @EXPORT = qw(&menuWrapper);
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub menuWrapper {
|
||||
my $session = shift;
|
||||
my ($output, $key);
|
||||
$session{page}{useAdminStyle} = 1;
|
||||
$output = '<table width="100%" border="0" cellpadding="5" cellspacing="0">
|
||||
|
|
@ -81,16 +83,17 @@ sub menuWrapper {
|
|||
foreach $key (keys %{$_[1]}) {
|
||||
$output .= '<li><a href="'.$key.'">'.$_[1]->{$key}.'</a></li>';
|
||||
}
|
||||
$output .= '<li><a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(493).'</a></li>';
|
||||
$output .= '<li><a href="'.$session->url->page().'">'.WebGUI::International::get(493).'</a></li>';
|
||||
$output .= '</td></tr></table>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub userStyle {
|
||||
my $session = shift;
|
||||
my $output = shift;
|
||||
if ($output) {
|
||||
return WebGUI::Style::process($output,$session{setting}{userFunctionStyleId});
|
||||
return $session->style->process($output,$session->setting->get("userFunctionStyleId"));
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
|
|
@ -99,6 +102,7 @@ sub userStyle {
|
|||
#-------------------------------------------------------------------
|
||||
# This function is here to replace the dangerous eval calls in the User Profile System.
|
||||
sub secureEval {
|
||||
my $session = shift;
|
||||
my $code = shift;
|
||||
|
||||
# Handle WebGUI function calls
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@ use WebGUI::SQL;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title) if ($title);
|
||||
my $ac = WebGUI::AdminConsole->new("statistics");
|
||||
if ($session{setting}{trackPageStatistics}) {
|
||||
$ac->addSubmenuItem( WebGUI::URL::page('op=viewStatistics'), WebGUI::International::get(144));
|
||||
if ($session->setting->get("trackPageStatistics")) {
|
||||
$ac->addSubmenuItem( $session->url->page('op=viewStatistics'), WebGUI::International::get(144));
|
||||
}
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
|
@ -34,6 +35,7 @@ sub _submenu {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewStatistics {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $data);
|
||||
my $url = "http://www.plainblack.com/downloads/latest-version.txt";
|
||||
|
|
@ -51,17 +53,17 @@ sub www_viewStatistics {
|
|||
$version = '<a href="http://files.plainblack.com/downloads/'.$rev[0].'.x.x/webgui-'.$version.'.tar.gz">'.$version.'</a>';
|
||||
}
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(349).':</td><td class="tableData">'.$version.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from asset where state='published'");
|
||||
($data) = $session->db->quickArray("select count(*) from asset where state='published'");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(147).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(distinct assetId) from assetData where isPackage=1");
|
||||
($data) = $session->db->quickArray("select count(distinct assetId) from assetData where isPackage=1");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(794).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from template");
|
||||
($data) = $session->db->quickArray("select count(*) from template");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(792).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from userSession");
|
||||
($data) = $session->db->quickArray("select count(*) from userSession");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(146).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from users");
|
||||
($data) = $session->db->quickArray("select count(*) from users");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(149).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from groups");
|
||||
($data) = $session->db->quickArray("select count(*) from groups");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(89).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
$output .= '</table>';
|
||||
return _submenu($output);
|
||||
|
|
|
|||
|
|
@ -31,16 +31,17 @@ Operation for overriding styles in Assets.
|
|||
|
||||
=head2 www_makePrintable ( )
|
||||
|
||||
Copy $session{form}{styleId} to printableStyleId and set the makePrintable flag so that
|
||||
Copy $session->form->process("styleId") to printableStyleId and set the makePrintable flag so that
|
||||
the printableStyleId is used instead of the normal styleId for the page.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_makePrintable {
|
||||
if ($session{form}{styleId} ne "") {
|
||||
$session{page}{printableStyleId} = $session{form}{styleId};
|
||||
my $session = shift;
|
||||
if ($session->form->process("styleId") ne "") {
|
||||
$session{page}{printableStyleId} = $session->form->process("styleId");
|
||||
}
|
||||
$session{page}{makePrintable} = 1;
|
||||
$session->style->makePrintable("1")
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +56,8 @@ overriding the style without setting a printable style and on a per user basis.
|
|||
=cut
|
||||
|
||||
sub www_setPersonalStyle {
|
||||
WebGUI::Session::setScratch("personalStyleId",$session{form}{styleId});
|
||||
my $session = shift;
|
||||
WebGUI::Session::setScratch("personalStyleId",$session->form->process("styleId"));
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +70,7 @@ Clears the personalStyleId from the scratch area of the session variable.
|
|||
=cut
|
||||
|
||||
sub www_unsetPersonalStyle {
|
||||
my $session = shift;
|
||||
WebGUI::Session::deleteScratch("personalStyleId");
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use WebGUI::International;
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _generateCode {
|
||||
my $session = shift;
|
||||
my ($codeLength, @codeElements, $code, $i);
|
||||
$codeLength = shift || 64;
|
||||
@codeElements = ('A'..'Z', 'a'..'z', 0..9, '-');
|
||||
|
|
@ -32,6 +33,7 @@ sub _generateCode {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
my $workarea = shift;
|
||||
|
|
@ -42,16 +44,17 @@ sub _submenu {
|
|||
if ($help) {
|
||||
$ac->setHelp($help, 'Subscription');
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=editSubscription;sid=new'), $i18n->get('add subscription'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=createSubscriptionCodeBatch'), $i18n->get('generate batch'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listSubscriptionCodes'), $i18n->get('manage codes'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listSubscriptionCodeBatches'), $i18n->get('manage batches'));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=listSubscriptions'), 'Manage Subscriptions');
|
||||
$ac->addSubmenuItem($session->url->page('op=editSubscription;sid=new'), $i18n->get('add subscription'));
|
||||
$ac->addSubmenuItem($session->url->page('op=createSubscriptionCodeBatch'), $i18n->get('generate batch'));
|
||||
$ac->addSubmenuItem($session->url->page('op=listSubscriptionCodes'), $i18n->get('manage codes'));
|
||||
$ac->addSubmenuItem($session->url->page('op=listSubscriptionCodeBatches'), $i18n->get('manage batches'));
|
||||
$ac->addSubmenuItem($session->url->page('op=listSubscriptions'), 'Manage Subscriptions');
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_createSubscriptionCodeBatch {
|
||||
my $session = shift;
|
||||
my (%subscriptions, $f, $error, $errorMessage);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
|
|
@ -61,7 +64,7 @@ sub www_createSubscriptionCodeBatch {
|
|||
$errorMessage = $i18n->get('create batch error').'<ul><li>'.join('</li><li>', @{$error}).'</li></ul>' if ($error);
|
||||
|
||||
tie %subscriptions, "Tie::IxHash";
|
||||
%subscriptions = WebGUI::SQL->buildHash("select subscriptionId, name from subscription where deleted != 1 order by name");
|
||||
%subscriptions = $session->db->buildHash("select subscriptionId, name from subscription where deleted != 1 order by name");
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
|
|
@ -72,21 +75,21 @@ sub www_createSubscriptionCodeBatch {
|
|||
-name => 'noc',
|
||||
-label => $i18n->get('noc'),
|
||||
-hoverHelp => $i18n->get('noc description'),
|
||||
-value => $session{form}{noc} || 1
|
||||
-value => $session->form->process("noc") || 1
|
||||
);
|
||||
$f->integer(
|
||||
-name => 'codeLength',
|
||||
-label => $i18n->get('code length'),
|
||||
-hoverHelp => $i18n->get('code length description'),
|
||||
-value => $session{form}{codeLength} || 64
|
||||
-value => $session->form->process("codeLength") || 64
|
||||
);
|
||||
$f->interval(
|
||||
-name => 'expires',
|
||||
-label => $i18n->get('codes expire'),
|
||||
-hoverHelp => $i18n->get('codes expire description'),
|
||||
-value => $session{form}{expires} || WebGUI::DateTime::intervalToSeconds(1, 'months')
|
||||
-value => $session->form->process("expires") || WebGUI::DateTime::intervalToSeconds(1, 'months')
|
||||
);
|
||||
my @sub = WebGUI::FormProcessor::selectList("subscriptionId");
|
||||
my @sub = $session->form->selectList("subscriptionId");
|
||||
$f->selectList(
|
||||
-name => 'subscriptionId',
|
||||
-label => $i18n->get('association'),
|
||||
|
|
@ -100,7 +103,7 @@ sub www_createSubscriptionCodeBatch {
|
|||
-name => 'description',
|
||||
-label => $i18n->get('batch description'),
|
||||
-hoverHelp => $i18n->get('batch description description'),
|
||||
-value => $session{form}{description}
|
||||
-value => $session->form->process("description")
|
||||
);
|
||||
$f->submit;
|
||||
|
||||
|
|
@ -109,38 +112,39 @@ sub www_createSubscriptionCodeBatch {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_createSubscriptionCodeBatchSave {
|
||||
my $session = shift;
|
||||
my ($numberOfCodes, $description, $expires, $batchId, @codeElements, $currentCode, $code, $i, @subscriptions,
|
||||
@error, $creationEpoch);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$numberOfCodes = $session{form}{noc};
|
||||
$description = $session{form}{description};
|
||||
$expires = WebGUI::FormProcessor::interval('expires');
|
||||
$numberOfCodes = $session->form->process("noc");
|
||||
$description = $session->form->process("description");
|
||||
$expires = $session->form->interval('expires');
|
||||
$batchId = WebGUI::Id::generate;
|
||||
|
||||
push(@error, $i18n->get('no description error')) unless ($description);
|
||||
push(@error, $i18n->get('no association error')) unless ($session{form}{subscriptionId});
|
||||
push(@error, $i18n->get('code length error')) unless ($session{form}{codeLength} >= 10 && $session{form}{codeLength} <= 64 && $session{form}{codeLength} =~ m/^\d\d$/);
|
||||
push(@error, $i18n->get('no association error')) unless ($session->form->process("subscriptionId"));
|
||||
push(@error, $i18n->get('code length error')) unless ($session->form->process("codeLength") >= 10 && $session->form->process("codeLength") <= 64 && $session->form->process("codeLength") =~ m/^\d\d$/);
|
||||
|
||||
return www_createSubscriptionCodeBatch(\@error) if (@error);
|
||||
|
||||
$creationEpoch = time();
|
||||
|
||||
WebGUI::SQL->write("insert into subscriptionCodeBatch (batchId, description) values (".
|
||||
quote($batchId).", ".quote($description).")");
|
||||
$session->db->write("insert into subscriptionCodeBatch (batchId, description) values (".
|
||||
$session->db->quote($batchId).", ".$session->db->quote($description).")");
|
||||
|
||||
for ($currentCode=0; $currentCode < $numberOfCodes; $currentCode++) {
|
||||
$code = _generateCode($session{form}{codeLength});
|
||||
$code = _generateCode($session{form}{codeLength}) while (WebGUI::SQL->quickArray("select code from subscriptionCode where code=".quote($code)));
|
||||
$code = _generateCode($session->form->process("codeLength"));
|
||||
$code = _generateCode($session->form->process("codeLength")) while ($session->db->quickArray("select code from subscriptionCode where code=".$session->db->quote($code)));
|
||||
|
||||
WebGUI::SQL->write("insert into subscriptionCode (batchId, code, status, dateCreated, dateUsed, expires, usedBy)".
|
||||
" values (".quote($batchId).",".quote($code).", 'Unused', ".quote($creationEpoch).", 0, ".quote($expires).", 0)");
|
||||
@subscriptions = WebGUI::FormProcessor::selectList('subscriptionId');
|
||||
$session->db->write("insert into subscriptionCode (batchId, code, status, dateCreated, dateUsed, expires, usedBy)".
|
||||
" values (".$session->db->quote($batchId).",".$session->db->quote($code).", 'Unused', ".$session->db->quote($creationEpoch).", 0, ".$session->db->quote($expires).", 0)");
|
||||
@subscriptions = $session->form->selectList('subscriptionId');
|
||||
foreach (@subscriptions) {
|
||||
WebGUI::SQL->write("insert into subscriptionCodeSubscriptions (code, subscriptionId) values (".
|
||||
quote($code).", ".quote($_).")");
|
||||
$session->db->write("insert into subscriptionCodeSubscriptions (code, subscriptionId) values (".
|
||||
$session->db->quote($code).", ".$session->db->quote($_).")");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,32 +153,35 @@ sub www_createSubscriptionCodeBatchSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubscription {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::Subscription->new($session{form}{sid})->delete;
|
||||
WebGUI::Subscription->new($session->form->process("sid"))->delete;
|
||||
return www_listSubscriptions();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubscriptionCodeBatch {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::SQL->write("delete from subscriptionCodeBatch where batchId=".quote($session{form}{bid}));
|
||||
WebGUI::SQL->write("delete from subscriptionCode where batchId=".quote($session{form}{bid}));
|
||||
$session->db->write("delete from subscriptionCodeBatch where batchId=".$session->db->quote($session->form->process("bid")));
|
||||
$session->db->write("delete from subscriptionCode where batchId=".$session->db->quote($session->form->process("bid")));
|
||||
|
||||
return www_listSubscriptionCodeBatches();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteSubscriptionCodes {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
if ($session{form}{selection} eq 'dc') {
|
||||
WebGUI::SQL->write("delete from subscriptionCode where dateCreated >= ".quote($session{form}{dcStart}).
|
||||
' and dateCreated <= '.quote($session{form}{dcStop}));
|
||||
} elsif ($session{form}{selection} eq 'du') {
|
||||
WebGUI::SQL->write("delete from subscriptionCode where dateUsed >= ".quote($session{form}{duStart}).
|
||||
' and dateUsed <= '.quote($session{form}{duStop}));
|
||||
if ($session->form->process("selection") eq 'dc') {
|
||||
$session->db->write("delete from subscriptionCode where dateCreated >= ".$session->db->quote($session->form->process("dcStart")).
|
||||
' and dateCreated <= '.$session->db->quote($session->form->process("dcStop")));
|
||||
} elsif ($session->form->process("selection") eq 'du') {
|
||||
$session->db->write("delete from subscriptionCode where dateUsed >= ".$session->db->quote($session->form->process("duStart")).
|
||||
' and dateUsed <= '.$session->db->quote($session->form->process("duStop")));
|
||||
}
|
||||
|
||||
return www_listSubscriptionCodes();
|
||||
|
|
@ -182,16 +189,17 @@ sub www_deleteSubscriptionCodes {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubscription {
|
||||
my $session = shift;
|
||||
my ($properties, $subscriptionId, $durationInterval, $durationUnits, $f);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
unless ($session{form}{sid} eq 'new') {
|
||||
$properties = WebGUI::Subscription->new($session{form}{sid})->get;
|
||||
unless ($session->form->process("sid") eq 'new') {
|
||||
$properties = WebGUI::Subscription->new($session->form->process("sid"))->get;
|
||||
}
|
||||
|
||||
$subscriptionId = $session{form}{sid} || 'new';
|
||||
$subscriptionId = $session->form->process("sid") || 'new';
|
||||
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden(
|
||||
|
|
@ -243,7 +251,7 @@ sub www_editSubscription {
|
|||
-hoverHelp => $i18n->get('execute on subscription description'),
|
||||
-value => $properties->{executeOnSubscription}
|
||||
);
|
||||
if ($session{setting}{useKarma}) {
|
||||
if ($session->setting->get("useKarma")) {
|
||||
$f->integer(
|
||||
-name => 'karma',
|
||||
-label => $i18n->get('subscription karma'),
|
||||
|
|
@ -258,38 +266,40 @@ sub www_editSubscription {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editSubscriptionSave {
|
||||
my $session = shift;
|
||||
my (@relevantFields);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
@relevantFields = qw(subscriptionId name price description subscriptionGroup duration executeOnSubscription karma);
|
||||
WebGUI::Subscription->new($session{form}{sid})->set({map {$_ => $session{form}{$_}} @relevantFields});
|
||||
WebGUI::Subscription->new($session->form->process("sid"))->set({map {$_ => $session{form}{$_}} @relevantFields});
|
||||
|
||||
return www_listSubscriptions();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listSubscriptionCodeBatches {
|
||||
my $session = shift;
|
||||
my ($p, $batches, $output);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listSubscriptionCodeBatches'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listSubscriptionCodeBatches'));
|
||||
$p->setDataByQuery("select * from subscriptionCodeBatch");
|
||||
|
||||
$batches = $p->getPageData;
|
||||
|
||||
$output = $p->getBarTraditional($session{form}{pn});
|
||||
$output = $p->getBarTraditional($session->form->process("pn"));
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
foreach (@{$batches}) {
|
||||
$output .= '<tr><td>';
|
||||
$output .= deleteIcon('op=deleteSubscriptionCodeBatch;bid='.$_->{batchId}, undef, $i18n->get('delete batch confirm'));
|
||||
$output .= '<td>'.$_->{description}.'</td>';
|
||||
$output .= '<td><a href="'.WebGUI::URL::page('op=listSubscriptionCodes;selection=b;bid='.$_->{batchId}).'">'.$i18n->get('list codes in batch').'</a></td>';
|
||||
$output .= '<td><a href="'.$session->url->page('op=listSubscriptionCodes;selection=b;bid='.$_->{batchId}).'">'.$i18n->get('list codes in batch').'</a></td>';
|
||||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
|
||||
$output = $i18n->get('no subscription code batches') unless (@{$batches});
|
||||
|
||||
|
|
@ -298,33 +308,34 @@ sub www_listSubscriptionCodeBatches {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listSubscriptionCodes {
|
||||
my $session = shift;
|
||||
my ($p, $codes, $output, $where, $ops, $delete);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
my $dcStart = WebGUI::FormProcessor::date('dcStart');
|
||||
my $dcStop = WebGUI::DateTime::addToTime(WebGUI::FormProcessor::date('dcStop'),23,59);
|
||||
my $duStart = WebGUI::FormProcessor::date('duStart');
|
||||
my $duStop = WebGUI::DateTime::addToTime(WebGUI::FormProcessor::date('duStop'),23,59);
|
||||
my $batches = WebGUI::SQL->buildHashRef("select batchId, description from subscriptionCodeBatch");
|
||||
my $dcStart = $session->form->date('dcStart');
|
||||
my $dcStop = WebGUI::DateTime::addToTime($session->form->date('dcStop'),23,59);
|
||||
my $duStart = $session->form->date('duStart');
|
||||
my $duStop = WebGUI::DateTime::addToTime($session->form->date('duStop'),23,59);
|
||||
my $batches = $session->db->buildHashRef("select batchId, description from subscriptionCodeBatch");
|
||||
|
||||
$output .= $i18n->get('selection message');
|
||||
|
||||
$output .= WebGUI::Form::formHeader;
|
||||
$output .= WebGUI::Form::hidden({name=>'op', value=>'listSubscriptionCodes'});
|
||||
$output .= '<table>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'du', checked=>($session{form}{selection} eq 'du')}).'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'du', checked=>($session->form->process("selection") eq 'du')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('selection used').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::date({name=>'duStart', value=>$duStart}).' '.$i18n->get('and').' '.WebGUI::Form::date({name=>'duStop', value=>$duStop}).'</td>';
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'dc', checked=>($session{form}{selection} eq 'dc')}).'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'dc', checked=>($session->form->process("selection") eq 'dc')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('selection created').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::date({name=>'dcStart', value=>$dcStart}).' '.$i18n->get('and').' '.WebGUI::Form::date({name=>'dcStop', value=>$dcStop}).'</td>';
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'b', checked=>($session{form}{selection} eq 'b')}).'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::radio({name=>'selection', value => 'b', checked=>($session->form->process("selection") eq 'b')}).'</td>';
|
||||
$output .= '<td align="left">'.$i18n->get('selection batch id').'</td>';
|
||||
$output .= '<td>'.WebGUI::Form::selectList({name => 'bid', value => [$session{form}{bid}], options => $batches});
|
||||
$output .= '<td>'.WebGUI::Form::selectList({name => 'bid', value => [$session->form->process("bid")], options => $batches});
|
||||
$output .= '</tr><tr>';
|
||||
$output .= '<td></td>';
|
||||
$output .= '<td>'.WebGUI::Form::submit({value=>$i18n->get('select')}).'</td>';
|
||||
|
|
@ -332,29 +343,29 @@ sub www_listSubscriptionCodes {
|
|||
$output .= '</table>';
|
||||
$output .= WebGUI::Form::formFooter;
|
||||
|
||||
if ($session{form}{selection} eq 'du') {
|
||||
$where = " and dateUsed >= ".quote($duStart)." and dateUsed <= ".quote($duStop);
|
||||
if ($session->form->process("selection") eq 'du') {
|
||||
$where = " and dateUsed >= ".$session->db->quote($duStart)." and dateUsed <= ".$session->db->quote($duStop);
|
||||
$ops = ';duStart='.$duStart.';duStop='.$duStop.';selection=du';
|
||||
$delete = '<a href="'.WebGUI::URL::page('op=deleteSubscriptionCodes'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} elsif ($session{form}{selection} eq 'dc') {
|
||||
$where = " and dateCreated >= ".quote($dcStart)." and dateCreated <= ".quote($dcStop);
|
||||
$delete = '<a href="'.$session->url->page('op=deleteSubscriptionCodes'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} elsif ($session->form->process("selection") eq 'dc') {
|
||||
$where = " and dateCreated >= ".$session->db->quote($dcStart)." and dateCreated <= ".$session->db->quote($dcStop);
|
||||
$ops = ';dcStart='.$dcStart.';dcStop='.$dcStop.';selection=dc';
|
||||
$delete = '<a href="'.WebGUI::URL::page('op=deleteSubscriptionCodes'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} elsif ($session{form}{selection} eq 'b') {
|
||||
$where = " and t1.batchId=".quote($session{form}{bid});
|
||||
$ops = ';bid='.$session{form}{bid}.';selection=b';
|
||||
$delete = '<a href="'.WebGUI::URL::page('op=deleteSubscriptionCodeBatch'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
$delete = '<a href="'.$session->url->page('op=deleteSubscriptionCodes'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} elsif ($session->form->process("selection") eq 'b') {
|
||||
$where = " and t1.batchId=".$session->db->quote($session->form->process("bid"));
|
||||
$ops = ';bid='.$session->form->process("bid").';selection=b';
|
||||
$delete = '<a href="'.$session->url->page('op=deleteSubscriptionCodeBatch'.$ops).'">'.$i18n->get('delete codes').'</a>';
|
||||
} else {
|
||||
return _submenu($output, 'listSubscriptionCodes title', 'subscription codes manage');
|
||||
}
|
||||
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listSubscriptionCodes'.$ops));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listSubscriptionCodes'.$ops));
|
||||
$p->setDataByQuery("select t1.*, t2.* from subscriptionCode as t1, subscriptionCodeBatch as t2 where t1.batchId=t2.batchId ".$where);
|
||||
|
||||
$codes = $p->getPageData;
|
||||
|
||||
$output .= '<br />'.$delete.'<br />' if ($delete);
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
$output .= '<br />';
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
$output .= '<tr>';
|
||||
|
|
@ -372,23 +383,24 @@ sub www_listSubscriptionCodes {
|
|||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
|
||||
return _submenu($output, 'listSubscriptionCodes title', 'subscription codes manage');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listSubscriptions {
|
||||
my $session = shift;
|
||||
my ($p, $subscriptions, $output);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listSubscriptions'));
|
||||
$p = WebGUI::Paginator->new($session->url->page('op=listSubscriptions'));
|
||||
$p->setDataByQuery('select subscriptionId, name from subscription where deleted != 1');
|
||||
$subscriptions = $p->getPageData;
|
||||
|
||||
$output = $p->getBarTraditional($session{form}{pn});
|
||||
$output = $p->getBarTraditional($session->form->process("pn"));
|
||||
$output .= '<table border="1" cellpadding="5" cellspacing="0" align="center">';
|
||||
foreach (@{$subscriptions}) {
|
||||
$output .= '<tr>';
|
||||
|
|
@ -398,7 +410,7 @@ sub www_listSubscriptions {
|
|||
$output .= '</tr>';
|
||||
}
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session->form->process("pn"));
|
||||
|
||||
$output = $i18n->get('no subscriptions') unless (@{$subscriptions});
|
||||
|
||||
|
|
@ -407,29 +419,31 @@ sub www_listSubscriptions {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_purchaseSubscription {
|
||||
WebGUI::Commerce::ShoppingCart->new->add($session{form}{sid}, 'Subscription');
|
||||
my $session = shift;
|
||||
WebGUI::Commerce::ShoppingCart->new->add($session->form->process("sid"), 'Subscription');
|
||||
|
||||
return WebGUI::HTTP::setRedirect(WebGUI::URL::page('op=checkout'));
|
||||
return WebGUI::HTTP::setRedirect($session->url->page('op=checkout'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_redeemSubscriptionCode {
|
||||
my $session = shift;
|
||||
my (%codeProperties, @subscriptions, %var, $f);
|
||||
my $i18n = WebGUI::International->new("Subscription");
|
||||
|
||||
if ($session{form}{code}) {
|
||||
%codeProperties = WebGUI::SQL->quickHash("select * from subscriptionCode as t1, subscriptionCodeBatch as t2 where ".
|
||||
"t1.batchId = t2.batchId and t1.code=".quote($session{form}{code})." and (t1.dateCreated + t1.expires) > ".quote(time));
|
||||
if ($session->form->process("code")) {
|
||||
%codeProperties = $session->db->quickHash("select * from subscriptionCode as t1, subscriptionCodeBatch as t2 where ".
|
||||
"t1.batchId = t2.batchId and t1.code=".$session->db->quote($session->form->process("code"))." and (t1.dateCreated + t1.expires) > ".$session->db->quote(time));
|
||||
|
||||
if ($codeProperties{status} eq 'Unused') {
|
||||
# Code is ok
|
||||
@subscriptions = WebGUI::SQL->buildArray("select subscriptionId from subscriptionCodeSubscriptions where code=".quote($session{form}{code}));
|
||||
@subscriptions = $session->db->buildArray("select subscriptionId from subscriptionCodeSubscriptions where code=".$session->db->quote($session->form->process("code")));
|
||||
foreach (@subscriptions) {
|
||||
WebGUI::Subscription->new($_)->apply;
|
||||
}
|
||||
|
||||
# Set code to Used
|
||||
WebGUI::SQL->write("update subscriptionCode set status='Used', dateUsed=".quote(time)." where code=".quote($session{form}{code}));
|
||||
$session->db->write("update subscriptionCode set status='Used', dateUsed=".$session->db->quote(time)." where code=".$session->db->quote($session->form->process("code")));
|
||||
|
||||
$var{batchDescription} = $codeProperties{description};
|
||||
$var{message} = $i18n->get('redeem code success');
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@ This error message will be added to the template variables.
|
|||
=cut
|
||||
|
||||
sub www_viewPurchaseHistory {
|
||||
my $session = shift;
|
||||
my (@history, @historyLoop, %var, %properties);
|
||||
|
||||
$var{errorMessage} = shift;
|
||||
|
||||
@history = @{WebGUI::Commerce::Transaction->transactionsByUser($session{user}{userId})};
|
||||
@history = @{WebGUI::Commerce::Transaction->transactionsByUser($session->user->profileField("userId"))};
|
||||
foreach (@history) {
|
||||
%properties = %{$_->get};
|
||||
$properties{initDate} = WebGUI::DateTime::epochToHuman($properties{initDate});
|
||||
|
|
@ -45,7 +46,7 @@ sub www_viewPurchaseHistory {
|
|||
push(@historyLoop, {
|
||||
(%properties),
|
||||
itemLoop => $_->getItems,
|
||||
cancelUrl => WebGUI::URL::page('op=cancelRecurringTransaction;tid='.$properties{transactionId}),
|
||||
cancelUrl => $session->url->page('op=cancelRecurringTransaction;tid='.$properties{transactionId}),
|
||||
canCancel => ($properties{recurring} && ($properties{status} eq 'Completed')),
|
||||
});
|
||||
}
|
||||
|
|
@ -61,16 +62,17 @@ sub www_viewPurchaseHistory {
|
|||
|
||||
Cancels a transaction if it is recurring. If not, an error message is returned.
|
||||
The transaction to cancel is passed in via a form field entry in the session variable,
|
||||
$session{form}{tid}.
|
||||
$session->form->process("tid").
|
||||
|
||||
=cut
|
||||
|
||||
sub www_cancelRecurringTransaction {
|
||||
my $session = shift;
|
||||
my ($transaction, $error, $message);
|
||||
|
||||
my $i18n = WebGUI::International->new("TransactionLog");
|
||||
|
||||
$transaction = WebGUI::Commerce::Transaction->new($session{form}{tid});
|
||||
$transaction = WebGUI::Commerce::Transaction->new($session->form->process("tid"));
|
||||
if ($transaction->isRecurring) {
|
||||
$error = $transaction->cancelTransaction;
|
||||
$message = $i18n->get('cancel error').$error if ($error);
|
||||
|
|
@ -85,17 +87,18 @@ sub www_cancelRecurringTransaction {
|
|||
|
||||
=head2 www_deleteTransaction ( )
|
||||
|
||||
Deletes a transaction, as specified by $session{form}{tid}.
|
||||
Deletes a transaction, as specified by $session->form->process("tid").
|
||||
Afterward, it calls www_listTransactions
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteTransaction {
|
||||
my $session = shift;
|
||||
my $transactionId;
|
||||
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
$transactionId = $session{form}{tid};
|
||||
$transactionId = $session->form->process("tid");
|
||||
|
||||
WebGUI::Commerce::Transaction->new($transactionId)->delete;
|
||||
|
||||
|
|
@ -104,9 +107,10 @@ sub www_deleteTransaction {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteTransactionItem {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
||||
WebGUI::Commerce::Transaction->new($session{form}{tid})->deleteItem($session{form}{iid}, $session{form}{itype});
|
||||
WebGUI::Commerce::Transaction->new($session->form->process("tid"))->deleteItem($session->form->process("iid"), $session->form->process("itype"));
|
||||
|
||||
return WebGUI::Operation::execute('listTransactions');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ Help topic. If set, then a Help icon will be displayed as a link to that topic.
|
|||
=cut
|
||||
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
$title = WebGUI::International::get($title) if ($title);
|
||||
|
|
@ -73,19 +74,19 @@ sub _submenu {
|
|||
$ac->setHelp($help);
|
||||
}
|
||||
if (WebGUI::Grouping::isInGroup(11)) {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editUser;uid=new"), WebGUI::International::get(169));
|
||||
$ac->addSubmenuItem($session->url->page("op=editUser;uid=new"), WebGUI::International::get(169));
|
||||
}
|
||||
if (WebGUI::Grouping::isInGroup(3)) {
|
||||
unless ($session{form}{op} eq "listUsers"
|
||||
|| $session{form}{op} eq "deleteUserConfirm") {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editUser;uid=".$session{form}{uid}), WebGUI::International::get(457));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=becomeUser;uid='.$session{form}{uid}), WebGUI::International::get(751));
|
||||
$ac->addSubmenuItem(WebGUI::URL::page('op=deleteUser;uid='.$session{form}{uid}), WebGUI::International::get(750));
|
||||
if ($session{setting}{useKarma}) {
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=editUserKarma;uid=".$session{form}{uid}), WebGUI::International::get(555));
|
||||
unless ($session->form->process("op") eq "listUsers"
|
||||
|| $session->form->process("op") eq "deleteUserConfirm") {
|
||||
$ac->addSubmenuItem($session->url->page("op=editUser;uid=".$session->form->process("uid")), WebGUI::International::get(457));
|
||||
$ac->addSubmenuItem($session->url->page('op=becomeUser;uid='.$session->form->process("uid")), WebGUI::International::get(751));
|
||||
$ac->addSubmenuItem($session->url->page('op=deleteUser;uid='.$session->form->process("uid")), WebGUI::International::get(750));
|
||||
if ($session->setting->get("useKarma")) {
|
||||
$ac->addSubmenuItem($session->url->page("op=editUserKarma;uid=".$session->form->process("uid")), WebGUI::International::get(555));
|
||||
}
|
||||
}
|
||||
$ac->addSubmenuItem(WebGUI::URL::page("op=listUsers"), WebGUI::International::get(456));
|
||||
$ac->addSubmenuItem($session->url->page("op=listUsers"), WebGUI::International::get(456));
|
||||
}
|
||||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
|
@ -111,6 +112,7 @@ Array reference, used to screen out user names via a SQL "not in ()" clause.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub doUserSearch {
|
||||
my $session = shift;
|
||||
my $op = shift;
|
||||
my $returnPaginator = shift;
|
||||
my $userFilter = shift;
|
||||
|
|
@ -129,19 +131,19 @@ sub doUserSearch {
|
|||
} else {
|
||||
$keyword = "%".$keyword;
|
||||
}
|
||||
$keyword = quote($keyword);
|
||||
$keyword = $session->db->quote($keyword);
|
||||
my $sql = "select users.userId, users.username, users.status, users.dateCreated, users.lastUpdated,
|
||||
email.fieldData as email from users
|
||||
left join userProfileData email on users.userId=email.userId and email.fieldName='email'
|
||||
left join userProfileData useralias on users.userId=useralias.userId and useralias.fieldName='alias'
|
||||
where $selectedStatus and (users.username like ".$keyword." or useralias.fieldData like ".$keyword." or email.fieldData like ".$keyword.")
|
||||
and users.userId not in (".quoteAndJoin($userFilter).") order by users.username";
|
||||
and users.userId not in (".$session->db->quoteAndJoin($userFilter).") order by users.username";
|
||||
if ($returnPaginator) {
|
||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page("op=".$op));
|
||||
my $p = WebGUI::Paginator->new($session->url->page("op=".$op));
|
||||
$p->setDataByQuery($sql);
|
||||
return $p;
|
||||
} else {
|
||||
my $sth = WebGUI::SQL->read($sql);
|
||||
my $sth = $session->db->read($sql);
|
||||
return $sth;
|
||||
}
|
||||
}
|
||||
|
|
@ -162,11 +164,12 @@ Hashref. A set of key,value pairs that will be hidden in the user search form.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub getUserSearchForm {
|
||||
my $session = shift;
|
||||
my $op = shift;
|
||||
my $params = shift;
|
||||
WebGUI::Session::setScratch("userSearchKeyword",$session{form}{keyword});
|
||||
WebGUI::Session::setScratch("userSearchStatus",$session{form}{status});
|
||||
WebGUI::Session::setScratch("userSearchModifier",$session{form}{modifier});
|
||||
WebGUI::Session::setScratch("userSearchKeyword",$session->form->process("keyword"));
|
||||
WebGUI::Session::setScratch("userSearchStatus",$session->form->process("status"));
|
||||
WebGUI::Session::setScratch("userSearchModifier",$session->form->process("modifier"));
|
||||
my $output = '<div align="center">'
|
||||
.WebGUI::Form::formHeader()
|
||||
.WebGUI::Form::hidden(
|
||||
|
|
@ -223,8 +226,9 @@ Allows an administrator to assume another user.
|
|||
=cut
|
||||
|
||||
sub www_becomeUser {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
$session->user({userId=>$session{form}{uid}});
|
||||
$session->user({userId=>$session->form->process("uid")});
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
@ -240,15 +244,16 @@ of the user to delete is expected in a URL param names 'uid'.
|
|||
=cut
|
||||
|
||||
sub www_deleteUser {
|
||||
my $session = shift;
|
||||
my ($output);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
if ($session{form}{uid} eq '1' || $session{form}{uid} eq '3') {
|
||||
if ($session->form->process("uid") eq '1' || $session->form->process("uid") eq '3') {
|
||||
return _submenu(WebGUI::Privilege::vitalComponent());
|
||||
} else {
|
||||
$output .= WebGUI::International::get(167).'<p>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=deleteUserConfirm;uid='.$session{form}{uid}).
|
||||
$output .= '<div align="center"><a href="'.$session->url->page('op=deleteUserConfirm;uid='.$session->form->process("uid")).
|
||||
'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=listUsers').'">'.
|
||||
$output .= ' <a href="'.$session->url->page('op=listUsers').'">'.
|
||||
WebGUI::International::get(45).'</a></div>';
|
||||
return _submenu($output,'42',"user delete");
|
||||
}
|
||||
|
|
@ -265,12 +270,13 @@ after this.
|
|||
=cut
|
||||
|
||||
sub www_deleteUserConfirm {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($u);
|
||||
if ($session{form}{uid} eq '1' || $session{form}{uid} eq '3') {
|
||||
if ($session->form->process("uid") eq '1' || $session->form->process("uid") eq '3') {
|
||||
return WebGUI::AdminConsole->new("users")->render(WebGUI::Privilege::vitalComponent());
|
||||
} else {
|
||||
$u = WebGUI::User->new($session{form}{uid});
|
||||
$u = WebGUI::User->new($session->form->process("uid"));
|
||||
$u->delete;
|
||||
return www_listUsers();
|
||||
}
|
||||
|
|
@ -278,6 +284,7 @@ sub www_deleteUserConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUser {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(11));
|
||||
my $error = shift;
|
||||
my $i18n = WebGUI::International->new("WebGUI");
|
||||
|
|
@ -289,20 +296,20 @@ sub www_editUser {
|
|||
"groups"=> { label=>$i18n->get('89')},
|
||||
);
|
||||
my $tabform = WebGUI::TabForm->new(\%tabs);
|
||||
my $u = WebGUI::User->new(($session{form}{uid} eq 'new') ? '' : $session{form}{uid});
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/swapLayers.js", {type=>"text/javascript"});
|
||||
WebGUI::Style::setRawHeadTags('<script type="text/javascript">var active="'.$u->authMethod.'";</script>');
|
||||
my $u = WebGUI::User->new(($session->form->process("uid") eq 'new') ? '' : $session->form->process("uid"));
|
||||
$session->style->setScript($session->config->get("extrasURL")."/swapLayers.js", {type=>"text/javascript"});
|
||||
$session->style->setRawHeadTags('<script type="text/javascript">var active="'.$u->authMethod.'";</script>');
|
||||
$tabform->hidden({name=>"op",value=>"editUserSave"});
|
||||
$tabform->hidden({name=>"uid",value=>$session{form}{uid}});
|
||||
$tabform->hidden({name=>"uid",value=>$session->form->process("uid")});
|
||||
$tabform->getTab("account")->raw('<tr><td width="170"> </td><td> </td></tr>');
|
||||
$tabform->getTab("account")->readOnly(value=>$session{form}{uid},label=>$i18n->get(378));
|
||||
$tabform->getTab("account")->readOnly(value=>$u->karma,label=>$i18n->get(537)) if ($session{setting}{useKarma});
|
||||
$tabform->getTab("account")->readOnly(value=>$session->form->process("uid"),label=>$i18n->get(378));
|
||||
$tabform->getTab("account")->readOnly(value=>$u->karma,label=>$i18n->get(537)) if ($session->setting->get("useKarma"));
|
||||
$tabform->getTab("account")->readOnly(value=>epochToHuman($u->dateCreated,"%z"),label=>$i18n->get(453));
|
||||
$tabform->getTab("account")->readOnly(value=>epochToHuman($u->lastUpdated,"%z"),label=>$i18n->get(454));
|
||||
$tabform->getTab("account")->text(
|
||||
-name=>"username",
|
||||
-label=>$i18n->get(50),
|
||||
-value=>$session{form}{username}|| $u->username
|
||||
-value=>$session->form->process("username")|| $u->username
|
||||
);
|
||||
my %status;
|
||||
tie %status, 'Tie::IxHash';
|
||||
|
|
@ -311,7 +318,7 @@ sub www_editUser {
|
|||
Deactivated =>$i18n->get(818),
|
||||
Selfdestructed =>$i18n->get(819)
|
||||
);
|
||||
if ($u->userId eq $session{user}{userId}) {
|
||||
if ($u->userId eq $session->user->profileField("userId")) {
|
||||
$tabform->getTab("account")->hidden(
|
||||
-name => "status",
|
||||
-value => $u->status
|
||||
|
|
@ -325,7 +332,7 @@ sub www_editUser {
|
|||
);
|
||||
}
|
||||
my $options;
|
||||
foreach (@{$session{config}{authMethods}}) {
|
||||
foreach (@{$session->config->get("authMethods")}) {
|
||||
$options->{$_} = $_;
|
||||
}
|
||||
$tabform->getTab("account")->selectBox(
|
||||
|
|
@ -335,7 +342,7 @@ sub www_editUser {
|
|||
-value=>$u->authMethod,
|
||||
-extras=>"onChange=\"active=operateHidden(this.options[this.selectedIndex].value,active)\""
|
||||
);
|
||||
foreach (@{$session{config}{authMethods}}) {
|
||||
foreach (@{$session->config->get("authMethods")}) {
|
||||
my $authInstance = WebGUI::Operation::Auth::getInstance($_,$u->userId);
|
||||
my $style = '" style="display: none;' unless ($_ eq $u->authMethod);
|
||||
$tabform->getTab("account")->raw('<tr id="'.$_.$style.'"><td colspan="2" align="center"><table>'.$authInstance->editUserForm.'<tr><td width="170"> </td><td> </td></tr></table></td></tr>');
|
||||
|
|
@ -348,8 +355,8 @@ sub www_editUser {
|
|||
$tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u));
|
||||
}
|
||||
}
|
||||
my @groupsToAdd = WebGUI::FormProcessor::group("groupsToAdd");
|
||||
my @exclude = WebGUI::SQL->buildArray("select groupId from groupings where userId=".quote($u->userId));
|
||||
my @groupsToAdd = $session->form->group("groupsToAdd");
|
||||
my @exclude = $session->db->buildArray("select groupId from groupings where userId=".$session->db->quote($u->userId));
|
||||
@exclude = (@exclude,"1","2","7");
|
||||
$tabform->getTab("groups")->group(
|
||||
-name=>"groupsToAdd",
|
||||
|
|
@ -363,18 +370,18 @@ sub www_editUser {
|
|||
foreach my $group (@exclude) {
|
||||
unless (
|
||||
$group eq "1" || $group eq "2" || $group eq "7" # can't remove user from magic groups
|
||||
|| ($session{user}{userId} eq $u->userId && $group eq 3) # cannot remove self from admin
|
||||
|| ($session->user->profileField("userId") eq $u->userId && $group eq 3) # cannot remove self from admin
|
||||
|| ($u->userId eq "3" && $group eq "3") # admin user cannot be remove from admin
|
||||
) {
|
||||
push(@include,$group);
|
||||
}
|
||||
}
|
||||
push (@include, "0");
|
||||
my @groupsToDelete = WebGUI::FormProcessor::group("groupsToDelete");
|
||||
my @groupsToDelete = $session->form->group("groupsToDelete");
|
||||
$tabform->getTab("groups")->selectList(
|
||||
-name=>"groupsToDelete",
|
||||
-options=>WebGUI::SQL->buildHashRef("select groupId, groupName from groups
|
||||
where groupId in (".quoteAndJoin(\@include).") and showInForms=1 order by groupName"),
|
||||
-options=>$session->db->buildHashRef("select groupId, groupName from groups
|
||||
where groupId in (".$session->db->quoteAndJoin(\@include).") and showInForms=1 order by groupName"),
|
||||
-label=>$i18n->get("groups to delete"),
|
||||
-multiple=>1,
|
||||
-size=>15,
|
||||
|
|
@ -384,22 +391,23 @@ sub www_editUser {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserSave {
|
||||
sub www_editUserSave {
|
||||
my $session = shift;
|
||||
my $isAdmin = WebGUI::Grouping::isInGroup(3);
|
||||
my $isSecondary;
|
||||
unless ($isAdmin) {
|
||||
$isSecondary = (WebGUI::Grouping::isInGroup(11) && $session{form}{uid} eq "new");
|
||||
$isSecondary = (WebGUI::Grouping::isInGroup(11) && $session->form->process("uid") eq "new");
|
||||
}
|
||||
return WebGUI::Privilege::adminOnly() unless ($isAdmin || $isSecondary);
|
||||
my ($uid) = WebGUI::SQL->quickArray("select userId from users where username=".quote($session{form}{username}));
|
||||
my ($uid) = $session->db->quickArray("select userId from users where username=".$session->db->quote($session->form->process("username")));
|
||||
my $error;
|
||||
if (($uid eq $session{form}{uid} || $uid eq "") && $session{form}{username} ne '') {
|
||||
my $u = WebGUI::User->new($session{form}{uid});
|
||||
$session{form}{uid} = $u->userId unless ($isSecondary);
|
||||
$u->username($session{form}{username});
|
||||
$u->authMethod($session{form}{authMethod});
|
||||
$u->status($session{form}{status});
|
||||
foreach (@{$session{config}{authMethods}}) {
|
||||
if (($uid eq $session->form->process("uid") || $uid eq "") && $session->form->process("username") ne '') {
|
||||
my $u = WebGUI::User->new($session->form->process("uid"));
|
||||
$session->form->process("uid") = $u->userId unless ($isSecondary);
|
||||
$u->username($session->form->process("username"));
|
||||
$u->authMethod($session->form->process("authMethod"));
|
||||
$u->status($session->form->process("status"));
|
||||
foreach (@{$session->config->get("authMethods")}) {
|
||||
my $authInstance = WebGUI::Operation::Auth::getInstance($_,$u->userId);
|
||||
$authInstance->editUserFormSave;
|
||||
}
|
||||
|
|
@ -407,12 +415,12 @@ sub www_editUserSave {
|
|||
next if $field->getId =~ /contentPositions/;
|
||||
$u->profileField($field->getId,$field->formProcess);
|
||||
}
|
||||
my @groups = WebGUI::FormProcessor::group("groupsToAdd");
|
||||
my @groups = $session->form->group("groupsToAdd");
|
||||
$u->addToGroups(\@groups);
|
||||
@groups = WebGUI::FormProcessor::group("groupsToDelete");
|
||||
@groups = $session->form->group("groupsToDelete");
|
||||
$u->deleteFromGroups(\@groups);
|
||||
} else {
|
||||
$error = '<ul><li>'.WebGUI::International::get(77).' '.$session{form}{username}.'Too or '.$session{form}{username}.'02</li></ul>';
|
||||
$error = '<ul><li>'.WebGUI::International::get(77).' '.$session->form->process("username").'Too or '.$session->form->process("username").'02</li></ul>';
|
||||
}
|
||||
if ($isSecondary) {
|
||||
return _submenu(WebGUI::International::get(978));
|
||||
|
|
@ -423,6 +431,7 @@ sub www_editUserSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserKarma {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $f, $a, %user, %data, $method, $values, $category, $label, $default, $previousCategory);
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
|
|
@ -432,7 +441,7 @@ sub www_editUserKarma {
|
|||
);
|
||||
$f->hidden(
|
||||
-name => "uid",
|
||||
-value => $session{form}{uid},
|
||||
-value => $session->form->process("uid"),
|
||||
);
|
||||
$f->integer(
|
||||
-name => "amount",
|
||||
|
|
@ -451,26 +460,28 @@ sub www_editUserKarma {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserKarmaSave {
|
||||
my $session = shift;
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($u);
|
||||
$u = WebGUI::User->new($session{form}{uid});
|
||||
$u->karma($session{form}{amount},$session{user}{username}." (".$session{user}{userId}.")",$session{form}{description});
|
||||
$u = WebGUI::User->new($session->form->process("uid"));
|
||||
$u->karma($session->form->process("amount"),$session->user->profileField("username")." (".$session->user->profileField("userId").")",$session->form->process("description"));
|
||||
return www_editUser();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listUsers {
|
||||
my $session = shift;
|
||||
unless (WebGUI::Grouping::isInGroup(3)) {
|
||||
if (WebGUI::Grouping::isInGroup(11)) {
|
||||
$session{form}{uid} = "new";
|
||||
$session->form->process("uid") = "new";
|
||||
return www_editUser();
|
||||
}
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
my %status;
|
||||
my $output = getUserSearchForm("listUsers");
|
||||
my ($userCount) = WebGUI::SQL->quickArray("select count(*) from users");
|
||||
return _submenu($output) unless ($session{form}{doit} || $userCount<250 || $session{form}{pn} > 1);
|
||||
my ($userCount) = $session->db->quickArray("select count(*) from users");
|
||||
return _submenu($output) unless ($session->form->process("doit") || $userCount<250 || $session->form->process("pn") > 1);
|
||||
tie %status, 'Tie::IxHash';
|
||||
%status = (
|
||||
Active => WebGUI::International::get(817),
|
||||
|
|
@ -491,13 +502,13 @@ sub www_listUsers {
|
|||
foreach my $data (@{$p->getPageData}) {
|
||||
$output .= '<tr class="tableData">';
|
||||
$output .= '<td>'.$status{$data->{status}}.'</td>';
|
||||
$output .= '<td><a href="'.WebGUI::URL::page('op=editUser;uid='.$data->{userId})
|
||||
$output .= '<td><a href="'.$session->url->page('op=editUser;uid='.$data->{userId})
|
||||
.'">'.$data->{username}.'</a></td>';
|
||||
$output .= '<td class="tableData">'.$data->{email}.'</td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($data->{dateCreated},"%z").'</td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($data->{lastUpdated},"%z").'</td>';
|
||||
my ($lastLoginStatus, $lastLogin) = WebGUI::SQL->quickArray("select status,timeStamp from userLoginLog where
|
||||
userId=".quote($data->{userId})." order by timeStamp DESC");
|
||||
my ($lastLoginStatus, $lastLogin) = $session->db->quickArray("select status,timeStamp from userLoginLog where
|
||||
userId=".$session->db->quote($data->{userId})." order by timeStamp DESC");
|
||||
if ($lastLogin) {
|
||||
$output .= '<td class="tableData">'.epochToHuman($lastLogin).'</td>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ The beginning of WebGUI.
|
|||
=cut
|
||||
|
||||
sub www_genesis {
|
||||
$session{page}{useEmptyStyle} = 1;
|
||||
my $session = shift;
|
||||
$session->style->useEmptyStyle("1")
|
||||
my $output = '<html><head><title>About WebGUI</title>
|
||||
<style>.big {font-size: 23px;}</style>
|
||||
</head><body bgcolor="#ef4200" text="black" link="white" vlink="white">
|
||||
|
|
@ -56,7 +57,8 @@ password and email address, as well as some other WebGUI settings.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_setup {
|
||||
return "" unless ($session{setting}{specialState} eq "init");
|
||||
my $session = shift;
|
||||
return "" unless ($session->setting->get("specialState") eq "init");
|
||||
my $i18n = WebGUI::International->new("WebGUI");
|
||||
my $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
|
@ -69,13 +71,13 @@ sub www_setup {
|
|||
</style>
|
||||
</head>
|
||||
<body><div style="font-family: georgia, helvetica, arial, sans-serif; color: white; z-index: 10; width: 550px; height: 400px; top: 20%; left: 20%; position: absolute;"><h1>WebGUI Initial Configuration</h1><fieldset>';
|
||||
if ($session{form}{step} eq "2") {
|
||||
if ($session->form->process("step") eq "2") {
|
||||
$output .= '<legend align="left">Company Information</legend>';
|
||||
my $u = WebGUI::User->new("3");
|
||||
$u->username(WebGUI::FormProcessor::process("username","text","Admin"));
|
||||
$u->profileField("email",WebGUI::FormProcessor::email("email"));
|
||||
$u->identifier(Digest::MD5::md5_base64(WebGUI::FormProcessor::process("identifier","password","123qwe")));
|
||||
my $f = WebGUI::HTMLForm->new(action=>WebGUI::URL::gateway());
|
||||
$u->username($session->form->process("username","text","Admin"));
|
||||
$u->profileField("email",$session->form->email("email"));
|
||||
$u->identifier(Digest::MD5::md5_base64($session->form->process("identifier","password","123qwe")));
|
||||
my $f = WebGUI::HTMLForm->new(action=>$session->url->gateway());
|
||||
$f->hidden(
|
||||
-name=>"op",
|
||||
-value=>"setup"
|
||||
|
|
@ -86,35 +88,35 @@ sub www_setup {
|
|||
);
|
||||
$f->text(
|
||||
-name=>"companyName",
|
||||
-value=>$session{setting}{companyName},
|
||||
-value=>$session->setting->get("companyName"),
|
||||
-label=>$i18n->get(125),
|
||||
-hoverHelp=>$i18n->get('125 description'),
|
||||
);
|
||||
$f->email(
|
||||
-name=>"companyEmail",
|
||||
-value=>$session{setting}{companyEmail},
|
||||
-value=>$session->setting->get("companyEmail"),
|
||||
-label=>$i18n->get(126),
|
||||
-hoverHelp=>$i18n->get('126 description'),
|
||||
);
|
||||
$f->url(
|
||||
-name=>"companyURL",
|
||||
-value=>$session{setting}{companyURL},
|
||||
-value=>$session->setting->get("companyURL"),
|
||||
-label=>$i18n->get(127),
|
||||
-hoverHelp=>$i18n->get('127 description'),
|
||||
);
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} elsif ($session{form}{step} eq "3") {
|
||||
} elsif ($session->form->process("step") eq "3") {
|
||||
WebGUI::Setting::remove('specialState');
|
||||
WebGUI::Setting::set('companyName',WebGUI::FormProcessor::text("companyName"));
|
||||
WebGUI::Setting::set('companyURL',WebGUI::FormProcessor::url("companyURL"));
|
||||
WebGUI::Setting::set('companyEmail',WebGUI::FormProcessor::email("companyEmail"));
|
||||
WebGUI::HTTP::setRedirect(WebGUI::URL::gateway());
|
||||
WebGUI::Setting::set('companyName',$session->form->text("companyName"));
|
||||
WebGUI::Setting::set('companyURL',$session->form->url("companyURL"));
|
||||
WebGUI::Setting::set('companyEmail',$session->form->email("companyEmail"));
|
||||
WebGUI::HTTP::setRedirect($session->url->gateway());
|
||||
return "";
|
||||
} else {
|
||||
$output .= '<legend align="left">Admin Account</legend>';
|
||||
my $u = WebGUI::User->new('3');
|
||||
my $f = WebGUI::HTMLForm->new(action=>WebGUI::URL::gateway());
|
||||
my $f = WebGUI::HTMLForm->new(action=>$session->url->gateway());
|
||||
$f->hidden(
|
||||
-name=>"op",
|
||||
-value=>"setup"
|
||||
|
|
@ -146,7 +148,7 @@ sub www_setup {
|
|||
$output .= $f->print;
|
||||
}
|
||||
$output .= '</fieldset></div>
|
||||
<img src="'.$session{config}{extrasURL}.'/background.jpg" border="0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5;" />
|
||||
<img src="'.$session->config->get("extrasURL").'/background.jpg" border="0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5;" />
|
||||
</body>
|
||||
</html>';
|
||||
return $output;
|
||||
|
|
@ -163,7 +165,8 @@ to work, even superseding the session variable.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_theWg {
|
||||
$session{page}{useEmptyStyle} = 1;
|
||||
my $session = shift;
|
||||
$session->style->useEmptyStyle("1")
|
||||
my $output = '<html><head><title>WebGUI</title></head><body BGCOLOR="black"><center>
|
||||
<nobr><font SIZE="1" FACE="Courier New, Courier"><font COLOR="white"></font><font COLOR="#1A1108">p</font><font COLOR="#24130C">a</font><font COLOR="#5C2605">c</font><font COLOR="#642206">kageW</font><font COLOR="#5C1F04">e</font><font COLOR="#642206">bGUI;ou</font><font COLOR="#5C2605">r</font><font COLOR="#642206">$VERSION="5.5.0</font><font COLOR="#5C2605">"</font><font COLOR="#642206">;usestr</font><font COLOR="#5C1F04">i</font><font COLOR="#642206">ctqw(v</font><font COLOR="#68290C">a</font><font COLOR="#5C1F04">r</font><font COLOR="#5C2605">s</font><font COLOR="#642206">s</font><font COLOR="#541604">u</font><font COLOR="#481404">b</font><font COLOR="#380B04">s</font><font COLOR="#0B0204">);useTie::CPHash;useW
|
||||
|
||||
|
|
@ -175,7 +178,7 @@ sub www_theWg {
|
|||
|
||||
<br>s</font><font COLOR="#180204">e</font><font COLOR="#843619">W</font><font COLOR="#C45327">e</font><font COLOR="#E4460A">b</font><font COLOR="#F44304">G</font><font COLOR="#EC4404">U</font><font COLOR="#D44C14">I</font><font COLOR="#FCD4A6">:</font><font COLOR="#FCF5ED">:</font><font COLOR="#FCFDFA">URL;</font><font COLOR="#FCF5ED">u</font><font COLOR="#FCFDFA">seW</font><font COLOR="#FCF5ED">e</font><font COLOR="#FCFDFA">bGUI:</font><font COLOR="#FCF5ED">:</font><font COLOR="#FCFDFA">Utility;sub</font><font COLOR="#FCF5ED">_</font><font COLOR="#FCFDFA">gen</font><font COLOR="#FCF5ED">e</font><font COLOR="#FCFDFA">rateDe</font><font COLOR="#FCF5ED">bu</font><font COLOR="#FCFDFA">g{if(</font><font COLOR="#FCF5E2">$s</font><font COLOR="#FCD9CC">e</font><font COLOR="#DC9D83">s</font><font COLOR="#E49C7E">s</font><font COLOR="#C15B32">i</font><font COLOR="#CC4D14">o</font><font COLOR="#E14A0C">n</font><font COLOR="#EC4404">{s</font><font COLOR="#EC3E04">e</font><font COLOR="#E4460A">t</font><font COLOR="#D44309">t</font><font COLOR="#C04D1F">i</font><font COLOR="#771504">n</font><font COLOR="#380304">g</font><font COLOR="#280204">}</font><font COLOR="#180204">{</font><font COLOR="#0B0204">sho
|
||||
|
||||
<br>w</font><font COLOR="#180204">D</font><font COLOR="#542110">e</font><font COLOR="#B45833">b</font><font COLOR="#DC4A14">u</font><font COLOR="#F44304">g</font><font COLOR="#EC4404">}</font><font COLOR="#DC4A14">|</font><font COLOR="#FCBEA2">|</font><font COLOR="#FCF5E2">(</font><font COLOR="#FCFDFA">$session{form}{debug}==1&&WebGUI::Privilege::isIn</font><font COLOR="#FCE5D9">G</font><font COLOR="#DA957C">r</font><font COLOR="#E49274">o</font><font COLOR="#CC5D30">u</font><font COLOR="#D44C14">p</font><font COLOR="#DC460A">(</font><font COLOR="#EC4404">3))</font><font COLOR="#E4460A">)</font><font COLOR="#B42604">{</font><font COLOR="#A72A04">r</font><font COLOR="#480204">e</font><font COLOR="#180204">t</font><font COLOR="#0B0204">ur
|
||||
<br>w</font><font COLOR="#180204">D</font><font COLOR="#542110">e</font><font COLOR="#B45833">b</font><font COLOR="#DC4A14">u</font><font COLOR="#F44304">g</font><font COLOR="#EC4404">}</font><font COLOR="#DC4A14">|</font><font COLOR="#FCBEA2">|</font><font COLOR="#FCF5E2">(</font><font COLOR="#FCFDFA">$session->form->process("debug")==1&&WebGUI::Privilege::isIn</font><font COLOR="#FCE5D9">G</font><font COLOR="#DA957C">r</font><font COLOR="#E49274">o</font><font COLOR="#CC5D30">u</font><font COLOR="#D44C14">p</font><font COLOR="#DC460A">(</font><font COLOR="#EC4404">3))</font><font COLOR="#E4460A">)</font><font COLOR="#B42604">{</font><font COLOR="#A72A04">r</font><font COLOR="#480204">e</font><font COLOR="#180204">t</font><font COLOR="#0B0204">ur
|
||||
|
||||
<br>nW</font><font COLOR="#290E07">e</font><font COLOR="#A45E43">b</font><font COLOR="#D44C14">G</font><font COLOR="#F44304">UI</font><font COLOR="#E4460A">:</font><font COLOR="#FC9367">:</font><font COLOR="#FCECD6">E</font><font COLOR="#FCF5ED">r</font><font COLOR="#FCFDFA">r</font><font COLOR="#FCF5ED">o</font><font COLOR="#FAECE6">r</font><font COLOR="#D4764F">H</font><font COLOR="#FC9C75">a</font><font COLOR="#F49E7C">n</font><font COLOR="#FCF5E2">d</font><font COLOR="#FCFDFA">ler</font><font COLOR="#FCF5ED">::</font><font COLOR="#A49A9C">s</font><font COLOR="#FCF5ED">ho</font><font COLOR="#FCFDFA">wDebug</font><font COLOR="#C98367">(</font><font COLOR="#FCE4B7">)</font><font COLOR="#FAECE6">;</font><font COLOR="#FCFDFA">}ret</font><font COLOR="#F4F3F4">u</font><font COLOR="#FAECE6">r</font><font COLOR="#DCB6AC">n</font><font COLOR="#DA957C">"</font><font COLOR="#EF9574">"</font><font COLOR="#D46D41">;}</font><font COLOR="#D46434">s</font><font COLOR="#D45D2C">ub_</font><font COLOR="#D46434">g</font><font COLOR="#F07D4F">e</font><font COLOR="#E47A51">n</font><font COLOR="#F4A68A">e</font><font COLOR="#FCD4B9">r</font><font COLOR="#F4DAD3">a</font><font COLOR="#FCFDFA">tePag</font><font COLOR="#FCF5ED">e{</font><font COLOR="#FCECD6">my</font><font COLOR="#DA8663">(</font><font COLOR="#DC4A14">$</font><font COLOR="#F44304">c</font><font COLOR="#EC4404">anE</font><font COLOR="#DC4A14">d</font><font COLOR="#CC440E">i</font><font COLOR="#AC4C28">t</font><font COLOR="#481404">,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue