more admin console
This commit is contained in:
parent
aae95ff407
commit
405c7be5f3
2 changed files with 37 additions and 35 deletions
|
|
@ -12,12 +12,12 @@ package WebGUI::Operation::Template;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Tie::CPHash;
|
use Tie::CPHash;
|
||||||
|
use WebGUI::AdminConsole;
|
||||||
use WebGUI::Grouping;
|
use WebGUI::Grouping;
|
||||||
use WebGUI::HTML;
|
use WebGUI::HTML;
|
||||||
use WebGUI::HTMLForm;
|
use WebGUI::HTMLForm;
|
||||||
use WebGUI::Icon;
|
use WebGUI::Icon;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
use WebGUI::Operation::Shared;
|
|
||||||
use WebGUI::Paginator;
|
use WebGUI::Paginator;
|
||||||
use WebGUI::Privilege;
|
use WebGUI::Privilege;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
|
@ -28,22 +28,36 @@ use WebGUI::Utility;
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub _submenu {
|
sub _submenu {
|
||||||
my (%menu);
|
my $workarea = shift;
|
||||||
tie %menu, 'Tie::IxHash';
|
my $title = shift;
|
||||||
$menu{WebGUI::URL::page('op=editTemplate&tid=new&namespace='.$session{form}{namespace})} =
|
$title = WebGUI::International::get($title) if ($title);
|
||||||
WebGUI::International::get(505);
|
my $help = shift;
|
||||||
if ($session{form}{op} eq "editTemplate" && ($session{form}{tid} ne "new" || $session{form}{op} ne "deleteTemplateConfirm")) {
|
my $ac = WebGUI::AdminConsole->new;
|
||||||
$menu{WebGUI::URL::page('op=editTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace})} =
|
if ($help) {
|
||||||
WebGUI::International::get(851);
|
$ac->setHelp($help);
|
||||||
$menu{WebGUI::URL::page('op=copyTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace})} =
|
|
||||||
WebGUI::International::get(852);
|
|
||||||
$menu{WebGUI::URL::page('op=deleteTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace})} =
|
|
||||||
WebGUI::International::get(853);
|
|
||||||
$menu{WebGUI::URL::page('op=listTemplates&namespace='.$session{form}{namespace})} =
|
|
||||||
WebGUI::International::get(854);
|
|
||||||
}
|
}
|
||||||
$menu{WebGUI::URL::page('op=listTemplates')} = WebGUI::International::get(855);
|
$ac->setAdminFunction("templates");
|
||||||
return menuWrapper($_[0],\%menu);
|
$ac->addSubmenuItem(WebGUI::URL::page('op=editTemplate&tid=new&namespace='.$session{form}{namespace}), WebGUI::International::get(505));
|
||||||
|
if ($session{form}{op} eq "editTemplate" && ($session{form}{tid} ne "new" || $session{form}{op} ne "deleteTemplateConfirm")) {
|
||||||
|
$ac->addSubmenuItem(
|
||||||
|
WebGUI::URL::page('op=editTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace}),
|
||||||
|
WebGUI::International::get(851)
|
||||||
|
);
|
||||||
|
$ac->addSubmenuItem(
|
||||||
|
WebGUI::URL::page('op=copyTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace}),
|
||||||
|
WebGUI::International::get(852)
|
||||||
|
);
|
||||||
|
$ac->addSubmenuItem(
|
||||||
|
WebGUI::URL::page('op=deleteTemplate&tid='.$session{form}{tid}.'&namespace='.$session{form}{namespace}),
|
||||||
|
WebGUI::International::get(853)
|
||||||
|
);
|
||||||
|
$ac->addSubmenuItem(
|
||||||
|
WebGUI::URL::page('op=listTemplates&namespace='.$session{form}{namespace}),
|
||||||
|
WebGUI::International::get(854)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$ac->addSubmenuItem(WebGUI::URL::page('op=listTemplates'), WebGUI::International::get(855));
|
||||||
|
return $ac->render($workarea, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,10 +78,8 @@ sub www_copyTemplate {
|
||||||
sub www_deleteTemplate {
|
sub www_deleteTemplate {
|
||||||
my ($output);
|
my ($output);
|
||||||
if ($session{form}{tid} =~ /^\d+$/ && $session{form}{tid} < 1000 && $session{form}{tid} > 0) {
|
if ($session{form}{tid} =~ /^\d+$/ && $session{form}{tid} < 1000 && $session{form}{tid} > 0) {
|
||||||
return WebGUI::Privilege::vitalComponent();
|
return _submenu(WebGUI::Privilege::vitalComponent());
|
||||||
} elsif (WebGUI::Grouping::isInGroup(8)) {
|
} elsif (WebGUI::Grouping::isInGroup(8)) {
|
||||||
$output .= helpIcon("template delete");
|
|
||||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
|
||||||
$output .= WebGUI::International::get(502).'<p>';
|
$output .= WebGUI::International::get(502).'<p>';
|
||||||
$output .= '<div align="center"><a href="'.
|
$output .= '<div align="center"><a href="'.
|
||||||
WebGUI::URL::page('op=deleteTemplateConfirm&tid='.$session{form}{tid}.'&namespace='
|
WebGUI::URL::page('op=deleteTemplateConfirm&tid='.$session{form}{tid}.'&namespace='
|
||||||
|
|
@ -75,7 +87,7 @@ sub www_deleteTemplate {
|
||||||
.'">'.WebGUI::International::get(44).'</a>';
|
.'">'.WebGUI::International::get(44).'</a>';
|
||||||
$output .= ' <a href="'.WebGUI::URL::page('op=listTemplates&namespace='
|
$output .= ' <a href="'.WebGUI::URL::page('op=listTemplates&namespace='
|
||||||
.$session{form}{namespace}).'">'.WebGUI::International::get(45).'</a></div>';
|
.$session{form}{namespace}).'">'.WebGUI::International::get(45).'</a></div>';
|
||||||
return _submenu($output);
|
return _submenu($output,'42',"template delete");
|
||||||
} else {
|
} else {
|
||||||
return WebGUI::Privilege::adminOnly();
|
return WebGUI::Privilege::adminOnly();
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +97,7 @@ sub www_deleteTemplate {
|
||||||
sub www_deleteTemplateConfirm {
|
sub www_deleteTemplateConfirm {
|
||||||
my ($a, $pageId);
|
my ($a, $pageId);
|
||||||
if ($session{form}{tid} =~ /^\d+$/ && $session{form}{tid} < 1000 && $session{form}{tid} > 0) {
|
if ($session{form}{tid} =~ /^\d+$/ && $session{form}{tid} < 1000 && $session{form}{tid} > 0) {
|
||||||
return WebGUI::Privilege::vitalComponent();
|
return _submenu(WebGUI::Privilege::vitalComponent());
|
||||||
} elsif (WebGUI::Grouping::isInGroup(8)) {
|
} elsif (WebGUI::Grouping::isInGroup(8)) {
|
||||||
if ($session{form}{namespace} eq "Page") {
|
if ($session{form}{namespace} eq "Page") {
|
||||||
$a = WebGUI::SQL->read("select * from page where templateId=".quote($session{form}{tid}));
|
$a = WebGUI::SQL->read("select * from page where templateId=".quote($session{form}{tid}));
|
||||||
|
|
@ -105,7 +117,7 @@ sub www_deleteTemplateConfirm {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_editTemplate {
|
sub www_editTemplate {
|
||||||
my ($output, $namespaces, %template, $f);
|
my ($namespaces, %template, $f);
|
||||||
tie %template, 'Tie::CPHash';
|
tie %template, 'Tie::CPHash';
|
||||||
if (WebGUI::Grouping::isInGroup(8)) {
|
if (WebGUI::Grouping::isInGroup(8)) {
|
||||||
if ($session{form}{tid} eq "new" || $session{form}{tid} eq "") {
|
if ($session{form}{tid} eq "new" || $session{form}{tid} eq "") {
|
||||||
|
|
@ -119,8 +131,6 @@ sub www_editTemplate {
|
||||||
%template = WebGUI::SQL->quickHash("select * from template where templateId=".quote($session{form}{tid})." and
|
%template = WebGUI::SQL->quickHash("select * from template where templateId=".quote($session{form}{tid})." and
|
||||||
namespace=".quote($session{form}{namespace}));
|
namespace=".quote($session{form}{namespace}));
|
||||||
}
|
}
|
||||||
$output .= helpIcon("template add/edit");
|
|
||||||
$output .= '<h1>'.WebGUI::International::get(507).'</h1>';
|
|
||||||
$f = WebGUI::HTMLForm->new;
|
$f = WebGUI::HTMLForm->new;
|
||||||
$f->hidden("op","editTemplateSave");
|
$f->hidden("op","editTemplateSave");
|
||||||
$f->readOnly($session{form}{tid},WebGUI::International::get(503));
|
$f->readOnly($session{form}{tid},WebGUI::International::get(503));
|
||||||
|
|
@ -141,11 +151,10 @@ sub www_editTemplate {
|
||||||
-rows=>(5+$session{setting}{textAreaRows})
|
-rows=>(5+$session{setting}{textAreaRows})
|
||||||
);
|
);
|
||||||
$f->submit;
|
$f->submit;
|
||||||
$output .= $f->print;
|
return _submenu($f->print,'507',"template add/edit");
|
||||||
} else {
|
} else {
|
||||||
$output = WebGUI::Privilege::insufficient();
|
return WebGUI::Privilege::insufficient();
|
||||||
}
|
}
|
||||||
return _submenu($output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -175,8 +184,6 @@ sub www_listTemplates {
|
||||||
my ($output, $sth, @data, @row, $i, $p, $where);
|
my ($output, $sth, @data, @row, $i, $p, $where);
|
||||||
if (WebGUI::Grouping::isInGroup(8)) {
|
if (WebGUI::Grouping::isInGroup(8)) {
|
||||||
$where = "and namespace=".quote($session{form}{namespace}) if ($session{form}{namespace});
|
$where = "and namespace=".quote($session{form}{namespace}) if ($session{form}{namespace});
|
||||||
$output = helpIcon("templates manage");
|
|
||||||
$output .= '<h1>'.WebGUI::International::get(506).'</h1>';
|
|
||||||
$sth = WebGUI::SQL->read("select templateId,name,namespace from template where isEditable=1 $where order by namespace,name");
|
$sth = WebGUI::SQL->read("select templateId,name,namespace from template where isEditable=1 $where order by namespace,name");
|
||||||
while (@data = $sth->array) {
|
while (@data = $sth->array) {
|
||||||
$row[$i] = '<tr><td valign="top" class="tableData">'
|
$row[$i] = '<tr><td valign="top" class="tableData">'
|
||||||
|
|
@ -195,7 +202,7 @@ sub www_listTemplates {
|
||||||
$output .= $p->getPage($session{form}{pn});
|
$output .= $p->getPage($session{form}{pn});
|
||||||
$output .= '</table>';
|
$output .= '</table>';
|
||||||
$output .= $p->getBarTraditional($session{form}{pn});
|
$output .= $p->getBarTraditional($session{form}{pn});
|
||||||
return _submenu($output);
|
return _submenu($output,'506',"templates manage");
|
||||||
} else {
|
} else {
|
||||||
return WebGUI::Privilege::insufficient();
|
return WebGUI::Privilege::insufficient();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1591,11 +1591,6 @@ As with any delete operation, you are prompted to be sure you wish to proceed wi
|
||||||
lastUpdated => 1031514049
|
lastUpdated => 1031514049
|
||||||
},
|
},
|
||||||
|
|
||||||
'506' => {
|
|
||||||
message => q|Manage Templates|,
|
|
||||||
lastUpdated => 1031514049
|
|
||||||
},
|
|
||||||
|
|
||||||
'116' => {
|
'116' => {
|
||||||
message => q|Select "Yes" to change the privileges of all pages and wobjects under this page to these privileges.|,
|
message => q|Select "Yes" to change the privileges of all pages and wobjects under this page to these privileges.|,
|
||||||
lastUpdated => 1056054674
|
lastUpdated => 1056054674
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue