several bug fixes
added asset type icons to toolbar added isAdminOn, switchOnAdmin, and switchOffAdmin subs to WebGUI::Session
This commit is contained in:
parent
e5f55921ab
commit
e9d6c1b4e4
9 changed files with 80 additions and 15 deletions
|
|
@ -1500,7 +1500,7 @@ sub getToolbar {
|
|||
# .moveTopIcon('func=moveTop&wid='.${$wobject}{wobjectId})
|
||||
# .moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId})
|
||||
$toolbar .= shortcutIcon('func=createShortcut',$self->get("url")) unless ($self->get("className") =~ /Shortcut/);
|
||||
return $toolbar;
|
||||
return '<img src="'.$self->getIcon(1).'" border="0" title="'.$self->getName.'" alt="'.$self->getName.'" align="absmiddle">'.$toolbar;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ sub view {
|
|||
my %var = (
|
||||
isShortcut => 1,
|
||||
'shortcut.content' => $content,
|
||||
'shortcut.label' => WebGUI::International::get('3',"Shortcut");
|
||||
'shortcut.label' => WebGUI::International::get('3',"Shortcut"),
|
||||
originalURL => $self->getShortcut->getUrl
|
||||
);
|
||||
return $self->processTemplate(\%var,$self->getValue("templateId"));
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ sub getEditForm {
|
|||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
# $tabform->getTab("properties")->raw('<input type="hidden" name="op2" value="'.$session{form}{afterEdit}.'" />');
|
||||
if ($session{form}{func} eq "add") {
|
||||
if ($self->getValue("namespace") eq "") {
|
||||
my $namespaces = WebGUI::SQL->buildHashRef("select distinct(namespace),namespace
|
||||
from template order by namespace");
|
||||
$tabform->getTab("properties")->combo(
|
||||
|
|
@ -150,6 +150,10 @@ sub getEditForm {
|
|||
-label=>WebGUI::International::get('namespace','Template'),
|
||||
-value=>$self->getValue("namespace")
|
||||
);
|
||||
$tabform->getTab("meta")->hidden(
|
||||
-name=>"namespace",
|
||||
-value=>$self->getValue("namespace")
|
||||
);
|
||||
}
|
||||
$tabform->getTab("display")->yesNo(
|
||||
-name=>"showInForms",
|
||||
|
|
@ -312,7 +316,11 @@ sub processRaw {
|
|||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
return $self->getParent->view;
|
||||
if (WebGUI::Session::isAdminOn()) {
|
||||
return $self->getToolbar;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -324,6 +332,11 @@ sub www_edit {
|
|||
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('edit template', 'Template'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
return $self->getContainer->www_view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use WebGUI::Asset::Template;
|
|||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Operation::Shared;
|
||||
use WebGUI::Operation::Profile;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ sub process {
|
|||
my ($turnOn,$turnOff,$templateName) = WebGUI::Macro::getParams($_[0]);
|
||||
$turnOn |= WebGUI::International::get(516);
|
||||
$turnOff |= WebGUI::International::get(517);
|
||||
if ($session{var}{adminOn}) {
|
||||
if (WebGUI::Session::isAdminOn()) {
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin');
|
||||
$var{'toggle.text'} = $turnOff;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use strict;
|
|||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_adminConsole {
|
||||
|
|
@ -26,16 +25,14 @@ sub www_adminConsole {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_switchOffAdmin {
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
WebGUI::SQL->write("update userSession set adminOn=0 where sessionId='$session{var}{sessionId}'");
|
||||
WebGUI::Session::refreshSessionVars($session{var}{sessionId});
|
||||
WebGUI::Session::switchAdminOff();
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_switchOnAdmin {
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
WebGUI::SQL->write("update userSession set adminOn=1 where sessionId='$session{var}{sessionId}'");
|
||||
WebGUI::Session::refreshSessionVars($session{var}{sessionId});
|
||||
WebGUI::Session::switchAdminOn();
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,6 +122,18 @@ sub www_editSettings {
|
|||
-label=>$i18n->get(465),
|
||||
-value=>$session{setting}{textBoxSize}
|
||||
);
|
||||
$tabform->getTab("ui")->template(
|
||||
-name=>"userFunctionStyleId",
|
||||
-label=>"User Function Style",
|
||||
-namespace=>"style",
|
||||
-value=>$session{setting}{userFunctionStyleId}
|
||||
);
|
||||
$tabform->getTab("ui")->template(
|
||||
-name=>"AdminConsoleTemplate",
|
||||
-label=>"Admin Console Template",
|
||||
-namespace=>"AdminConsole",
|
||||
-value=>$session{setting}{AdminConsoleTemplate}
|
||||
);
|
||||
# messaging settings
|
||||
$tabform->getTab("messaging")->text(
|
||||
-name=>"smtpServer",
|
||||
|
|
@ -210,11 +222,6 @@ sub www_editSettings {
|
|||
-value=>$session{setting}{passiveProfilingEnabled},
|
||||
-extras=>' onChange="alert(\''.$i18n->get("Illegal Warning","Asset").'\')" '
|
||||
);
|
||||
$tabform->getTab("user")->yesNo(
|
||||
-name=>"userFunctionStyleId",
|
||||
-label=>"User Function Style",
|
||||
-value=>$session{setting}{userFunctionStyleId}
|
||||
);
|
||||
# auth settings
|
||||
WebGUI::Style::setScript($session{config}{extrasURL}."/swapLayers.js",{language=>"Javascript"});
|
||||
$tabform->getTab("auth")->raw('<script language="JavaScript" > var active="'.$session{setting}{authMethod}.'"; </script>');
|
||||
|
|
|
|||
|
|
@ -275,6 +275,18 @@ sub getScratch {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isAdminOn ( )
|
||||
|
||||
Returns a boolean indicating whether admin mode is on or not.
|
||||
|
||||
=cut
|
||||
|
||||
sub isAdminOn {
|
||||
return $session{var}{adminOn};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 open ( webguiRoot, configFile [ , fastcgi ] )
|
||||
|
||||
Opens a closed ( or new ) WebGUI session.
|
||||
|
|
@ -490,4 +502,30 @@ sub start {
|
|||
return $sessionId;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 switchAdminOff ( )
|
||||
|
||||
Disables admin mode.
|
||||
|
||||
=cut
|
||||
|
||||
sub switchAdminOff {
|
||||
WebGUI::SQL->write("update userSession set adminOn=0 where sessionId='$session{var}{sessionId}'");
|
||||
refreshSessionVars($session{var}{sessionId});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 switchAdminOn ( )
|
||||
|
||||
Enables admin mode.
|
||||
|
||||
=cut
|
||||
|
||||
sub switchAdminOn {
|
||||
WebGUI::SQL->write("update userSession set adminOn=1 where sessionId='$session{var}{sessionId}'");
|
||||
refreshSessionVars($session{var}{sessionId});
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue