Adding some missing files.
This commit is contained in:
parent
84c305bcd2
commit
290d858c25
2 changed files with 206 additions and 0 deletions
56
docs/upgrades/upgrade_3.8.0-3.9.0.sql
Normal file
56
docs/upgrades/upgrade_3.8.0-3.9.0.sql
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
insert into webguiVersion values ('3.9.0','upgrade',unix_timestamp());
|
||||
alter table style add column body text;
|
||||
update style set body=concat('^AdminBar;\n\n',header,'\n\n^-;\n\n',footer);
|
||||
alter table style drop column header;
|
||||
alter table style drop column footer;
|
||||
delete from international where internationalId=152 and namespace='WebGUI';
|
||||
delete from international where internationalId=153 and namespace='WebGUI';
|
||||
INSERT INTO international VALUES (501,'WebGUI','English','Body');
|
||||
alter table style change name name varchar(255);
|
||||
create table template (
|
||||
templateId int not null primary key,
|
||||
name varchar(255),
|
||||
template text
|
||||
);
|
||||
INSERT INTO international VALUES (502,'WebGUI','English','Are you certain you wish to delete this template and set all pages using this template to the default template?');
|
||||
INSERT INTO international VALUES (503,'WebGUI','English','Template ID');
|
||||
INSERT INTO international VALUES (504,'WebGUI','English','Template');
|
||||
INSERT INTO international VALUES (505,'WebGUI','English','Add a new template.');
|
||||
INSERT INTO groups VALUES (8,'Template Managers','Users that have privileges to edit templates for this site.',314496000);
|
||||
INSERT INTO international VALUES (506,'WebGUI','English','Manage Templates');
|
||||
INSERT INTO international VALUES (507,'WebGUI','English','Edit Template');
|
||||
INSERT INTO international VALUES (508,'WebGUI','English','Manage templates.');
|
||||
INSERT INTO incrementer VALUES ('templateId',1000);
|
||||
INSERT INTO template VALUES (1,'Default','<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\">^0;</td>\r\n</tr>\r\n</table>');
|
||||
INSERT INTO template VALUES (2,'News','<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\" colspan=\"2\" width=\"100%\">^0;</td></tr>\r\n<tr>\r\n <td valign=\"top\" class=\"content\" width=\"50%\">^1;</td>\r\n <td valign=\"top\" class=\"content\" width=\"50%\">^2;</td>\r\n</tr>\r\n<tr>\r\n <td valign=\"top\" class=\"content\" colspan=\"2\" width=\"100%\">^3;</td>\r\n</tr>\r\n</table>\r\n');
|
||||
INSERT INTO template VALUES (3,'One Over Three','<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\" colspan=\"3\">^0;</td>\r\n</tr>\r\n<tr>\r\n <td valign=\"top\" class=\"content\" width=\"33%\">^1;</td>\r\n <td valign=\"top\" class=\"content\" width=\"34%\">^2;</td>\r\n <td valign=\"top\" class=\"content\" width=\"33%\">^3;</td>\r\n</tr>\r\n</table>');
|
||||
INSERT INTO template VALUES (4,'Three Over One','<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\" width=\"33%\">^0;</td>\r\n <td valign=\"top\" class=\"content\" width=\"34%\">^1;</td>\r\n <td valign=\"top\" class=\"content\" width=\"33%\">^2;</td>\r\n</tr>\r\n<tr>\r\n <td valign=\"top\" class=\"content\" colspan=\"3\">^3;</td>\r\n</tr>\r\n</table>');
|
||||
INSERT INTO template VALUES (5,'Left Column','<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\" width=\"34%\">^0;</td>\r\n <td valign=\"top\" class=\"content\" width=\"66%\">^1;</td>\r\n</tr>\r\n</table>');
|
||||
INSERT INTO template VALUES (6,'Right Column','<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\" width=\"66%\">^0;</td>\r\n <td valign=\"top\" class=\"content\" width=\"34%\">^1;</td>\r\n</tr>\r\n</table>\r\n');
|
||||
INSERT INTO template VALUES (7,'Side By Side','<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n<tr>\r\n <td valign=\"top\" class=\"content\" width=\"50%\">^0;</td>\r\n <td valign=\"top\" class=\"content\" width=\"50%\">^1;</td>\r\n</tr>\r\n</table>\r\n');
|
||||
alter table page add column templateId int not null default 1;
|
||||
update page set templateId=1 where template='Default';
|
||||
update page set templateId=1 where template='A';
|
||||
update page set templateId=2 where template='News';
|
||||
update page set templateId=3 where template='OneOverThree';
|
||||
update page set templateId=3 where template='One Over Three';
|
||||
update page set templateId=4 where template='ThreeOverOne';
|
||||
update page set templateId=4 where template='Three Over One';
|
||||
update page set templateId=5 where template='LeftColumn';
|
||||
update page set templateId=5 where template='Left Column';
|
||||
update page set templateId=6 where template='RightColumn';
|
||||
update page set templateId=6 where template='Right Column';
|
||||
update page set templateId=7 where template='SideBySide';
|
||||
update page set templateId=7 where template='Side By Side';
|
||||
alter table page drop column template;
|
||||
update wobject set templatePosition=0 where templatePosition='A';
|
||||
update wobject set templatePosition=1 where templatePosition='B';
|
||||
update wobject set templatePosition=2 where templatePosition='C';
|
||||
update wobject set templatePosition=3 where templatePosition='D';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
150
lib/WebGUI/Operation/Template.pm
Normal file
150
lib/WebGUI/Operation/Template.pm
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
package WebGUI::Operation::Template;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Paginator;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_copyTemplate &www_deleteTemplate &www_deleteTemplateConfirm &www_editTemplate &www_editTemplateSave &www_listTemplates);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_copyTemplate {
|
||||
my (%template);
|
||||
if (WebGUI::Privilege::isInGroup(8)) {
|
||||
%template = WebGUI::SQL->quickHash("select * from template where templateId=$session{form}{tid}");
|
||||
WebGUI::SQL->write("insert into template (templateId,name,template) values (".getNextId("templateId").",
|
||||
".quote('Copy of '.$template{name}).", ".quote($template{template}).")");
|
||||
return www_listTemplates();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteTemplate {
|
||||
my ($output);
|
||||
if ($session{form}{tid} < 1000 && $session{form}{tid} > 1000) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(8)) {
|
||||
$output .= helpIcon(4);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(502).'<p>';
|
||||
$output .= '<div align="center"><a href="'.
|
||||
WebGUI::URL::page('op=deleteTemplateConfirm&tid='.$session{form}{tid})
|
||||
.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.WebGUI::URL::page('op=listTemplates').
|
||||
'">'.WebGUI::International::get(45).'</a></div>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteTemplateConfirm {
|
||||
if ($session{form}{tid} < 1000 && $session{form}{tid} > 1000) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(8)) {
|
||||
WebGUI::SQL->write("delete from template where templateId=".$session{form}{tid});
|
||||
WebGUI::SQL->write("update page set templateId=2 where templateId=".$session{form}{tid});
|
||||
return www_listTemplates();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editTemplate {
|
||||
my ($output, %template, $f);
|
||||
tie %template, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(8)) {
|
||||
if ($session{form}{tid} eq "new") {
|
||||
$template{template} = "<table>\n <tr>\n <td>\n\n^0;\n\n </td>\n </tr>\n</table>\n";
|
||||
} else {
|
||||
%template = WebGUI::SQL->quickHash("select * from template where templateId=$session{form}{tid}");
|
||||
}
|
||||
$output .= helpIcon(16);
|
||||
$output .= '<h1>'.WebGUI::International::get(507).'</h1>';
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->hidden("op","editTemplateSave");
|
||||
$f->hidden("tid",$session{form}{tid});
|
||||
$f->readOnly($session{form}{tid},WebGUI::International::get(503));
|
||||
$f->text("name",WebGUI::International::get(151),$template{name});
|
||||
$f->HTMLArea("template",WebGUI::International::get(504),$template{template},'','','',(5+$session{setting}{textAreaRows}));
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editTemplateSave {
|
||||
if (WebGUI::Privilege::isInGroup(8)) {
|
||||
if ($session{form}{tid} eq "new") {
|
||||
$session{form}{tid} = getNextId("templateId");
|
||||
WebGUI::SQL->write("insert into template (templateId) values ($session{form}{tid})");
|
||||
}
|
||||
$session{form}{template} = "<table>\n <tr>\n <td>\n\n^0;\n\n </td>\n </tr>\n</table>\n" if ($session{form}{template} eq "");
|
||||
WebGUI::SQL->write("update template set name=".quote($session{form}{name}).", template=".quote($session{form}{template})."
|
||||
where templateId=".$session{form}{tid});
|
||||
return www_listTemplates();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listTemplates {
|
||||
my ($output, $sth, @data, @row, $i, $p);
|
||||
if (WebGUI::Privilege::isInGroup(8)) {
|
||||
$output = helpIcon(9);
|
||||
$output .= '<h1>'.WebGUI::International::get(506).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.WebGUI::URL::page('op=editTemplate&tid=new').
|
||||
'">'.WebGUI::International::get(505).'</a><p/></div>';
|
||||
$sth = WebGUI::SQL->read("select templateId,name from template order by name");
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr><td valign="top" class="tableData">'
|
||||
.deleteIcon('op=deleteTemplate&tid='.$data[0])
|
||||
.editIcon('op=editTemplate&tid='.$data[0])
|
||||
.copyIcon('op=copyTemplate&tid='.$data[0])
|
||||
.'</td>';
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listTemplates'),\@row);
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue