added an empty style template and the ability to hide templates from forms and editing

This commit is contained in:
JT Smith 2004-02-22 18:10:14 +00:00
parent 016c33171e
commit 044b024011
5 changed files with 16 additions and 5 deletions

View file

@ -523,3 +523,12 @@ INSERT INTO template VALUES (2,'Events List','<tmpl_if displayTitle>\r\n <h1>
INSERT INTO template VALUES (3,'Calendar Month (Small)','<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <tmpl_var description><p />\r\n</tmpl_if>\r\n\r\n<tmpl_if session.var.adminOn>\r\n <a href=\"<tmpl_var addevent.url>\"><tmpl_var addevent.label></a>\r\n <p />\r\n</tmpl_if>\r\n\r\n\n\n\n<tmpl_loop month_loop>\n <table border=\"1\" width=\"100%\">\n <tr><td colspan=7 class=\"tableHeader\"><h2 align=\"center\"><tmpl_var month> <tmpl_var year></h2></td></tr>\n <tr>\n <tmpl_if session.user.firstDayOfWeek>\n <th class=\"tableData\"><tmpl_var monday.label.short></th>\n <th class=\"tableData\"><tmpl_var tuesday.label.short></th>\n <th class=\"tableData\"><tmpl_var wednesday.label.short></th>\n <th class=\"tableData\"><tmpl_var thursday.label.short></th>\n <th class=\"tableData\"><tmpl_var friday.label.short></th>\n <th class=\"tableData\"><tmpl_var saturday.label.short></th>\n <th class=\"tableData\"><tmpl_var sunday.label.short></th>\n <tmpl_else>\n <th class=\"tableData\"><tmpl_var sunday.label.short></th>\n <th class=\"tableData\"><tmpl_var monday.label.short></th>\n <th class=\"tableData\"><tmpl_var tuesday.label.short></th>\n <th class=\"tableData\"><tmpl_var wednesday.label.short></th>\n <th class=\"tableData\"><tmpl_var thursday.label.short></th>\n <th class=\"tableData\"><tmpl_var friday.label.short></th>\n <th class=\"tableData\"><tmpl_var saturday.label.short></th>\n </tmpl_if>\n </tr><tr>\n <tmpl_loop prepad_loop>\n <td>&nbsp;</td>\n </tmpl_loop>\n <tmpl_loop day_loop>\n <tmpl_if isStartOfWeek>\n <tr>\n </tmpl_if>\n <td class=\"table<tmpl_if isToday>Header<tmpl_else>Data</tmpl_if>\" width=\"28\" valign=\"top\" align=\"left\"><p><b>\n <tmpl_if url>\n <a href=\"<tmpl_var url>\"><tmpl_var day></a>\n <tmpl_else>\n <tmpl_var day>\n </tmpl_if>\n </b></p></td> \n <tmpl_if isEndOfWeek>\n </tr>\n </tmpl_if>\n </tmpl_loop>\n <tmpl_loop postpad_loop>\n <td>&nbsp;</td>\n </tmpl_loop>\n </tr>\n </table>\n</tmpl_loop>\n\n\n<tmpl_if pagination.pageCount.isMultiple>\n <div class=\"pagination\">\n <tmpl_var pagination.previousPage> &middot; <tmpl_var pagination.pageList.upTo20> &middot; <tmpl_var pagination.nextPage>\n </div>\n</tmpl_if>\n','EventsCalendar');
INSERT INTO template VALUES (1,'Calendar Month (Big)','<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <tmpl_var description><p />\r\n</tmpl_if>\r\n\r\n<tmpl_if session.var.adminOn>\r\n <a href=\"<tmpl_var addevent.url>\"><tmpl_var addevent.label></a>\r\n <p />\r\n</tmpl_if>\r\n\r\n<tmpl_loop month_loop>\n <table border=\"1\" width=\"100%\">\n <tr><td colspan=7 class=\"tableHeader\"><h2 align=\"center\"><tmpl_var month> <tmpl_var year></h2></td></tr>\n <tr>\n <tmpl_if session.user.firstDayOfWeek>\n <th class=\"tableData\"><tmpl_var monday.label></th>\n <th class=\"tableData\"><tmpl_var tuesday.label></th>\n <th class=\"tableData\"><tmpl_var wednesday.label></th>\n <th class=\"tableData\"><tmpl_var thursday.label></th>\n <th class=\"tableData\"><tmpl_var friday.label></th>\n <th class=\"tableData\"><tmpl_var saturday.label></th>\n <th class=\"tableData\"><tmpl_var sunday.label></th>\n <tmpl_else>\n <th class=\"tableData\"><tmpl_var sunday.label></th>\n <th class=\"tableData\"><tmpl_var monday.label></th>\n <th class=\"tableData\"><tmpl_var tuesday.label></th>\n <th class=\"tableData\"><tmpl_var wednesday.label></th>\n <th class=\"tableData\"><tmpl_var thursday.label></th>\n <th class=\"tableData\"><tmpl_var friday.label></th>\n <th class=\"tableData\"><tmpl_var saturday.label></th>\n </tmpl_if>\n </tr><tr>\n <tmpl_loop prepad_loop>\n <td>&nbsp;</td>\n </tmpl_loop>\n <tmpl_loop day_loop>\n <tmpl_if isStartOfWeek>\n <tr>\n </tmpl_if>\n <td class=\"table<tmpl_if isToday>Header<tmpl_else>Data</tmpl_if>\" width=\"14%\" valign=\"top\" align=\"left\"><p><b><tmpl_var day></b></p>\n <tmpl_loop event_loop>\n <tmpl_if name>\n &middot;<a href=\"<tmpl_var url>\"><tmpl_var name></a><br />\n </tmpl_if>\n </tmpl_loop>\n </td>\n <tmpl_if isEndOfWeek>\n </tr>\n </tmpl_if>\n </tmpl_loop>\n <tmpl_loop postpad_loop>\n <td>&nbsp;</td>\n </tmpl_loop>\n </tr>\n </table>\n</tmpl_loop>\n\n\n<tmpl_if pagination.pageCount.isMultiple>\n <div class=\"pagination\">\n <tmpl_var pagination.previousPage> &middot; <tmpl_var pagination.pageList.upTo20> &middot; <tmpl_var pagination.nextPage>\n </div>\n</tmpl_if>\n','EventsCalendar');
alter table template add column isEditable int not null default 1;
alter table template add column showInForms int not null default 1;
update template set showInForms=0 where namespace='style' and templateId=10;
update template set isEditable=0, showInForms=0 where namespace='style' and templateId in (1,2,4,5);
insert into template (templateId, name, template, namespace, isEditable, showInForms) values (6,'Empty','<tmpl_var body.content>','style',0,0);

View file

@ -187,10 +187,10 @@ sub www_editTemplateSave {
sub www_listTemplates {
my ($output, $sth, @data, @row, $i, $p, $where);
if (WebGUI::Privilege::isInGroup(8)) {
$where = "where namespace=".quote($session{form}{namespace}) if ($session{form}{namespace});
$where = "and namespace=".quote($session{form}{namespace}) if ($session{form}{namespace});
$output = helpIcon(33);
$output .= '<h1>'.WebGUI::International::get(506).'</h1>';
$sth = WebGUI::SQL->read("select templateId,name,namespace from template $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) {
$row[$i] = '<tr><td valign="top" class="tableData">'
.deleteIcon('op=deleteTemplate&tid='.$data[0].'&namespace='.$data[2])

View file

@ -19,7 +19,7 @@ our @EXPORT = qw(&www_theWg &www_genesis);
#-------------------------------------------------------------------
sub www_genesis {
$session{page}{styleId} = 2;
$session{page}{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">
@ -37,7 +37,7 @@ sub www_genesis {
#-------------------------------------------------------------------
sub www_theWg {
$session{page}{styleId} = 2;
$session{page}{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

View file

@ -95,6 +95,8 @@ sub process {
$templateId = $session{setting}{adminStyleId};
} elsif ($session{scratch}{personalStyleId} ne "") {
$templateId = $session{scratch}{personalStyleId};
} elsif ($session{page}{useEmptyStyle}) {
$templateId = 6;
}
my $type = lc($session{setting}{siteicon});
$type =~ s/.*\.(.*?)$/$1/;

View file

@ -93,7 +93,7 @@ Defaults to "Page". Specify the namespace to build the list for.
sub getList {
my $namespace = $_[0] || "Page";
return WebGUI::SQL->buildHashRef("select templateId,name from template where namespace=".quote($namespace)." order by name");
return WebGUI::SQL->buildHashRef("select templateId,name from template where namespace=".quote($namespace)." and showInForms=1 order by name");
}