first run on new asset system

This commit is contained in:
JT Smith 2004-12-17 05:41:22 +00:00
parent f7dd3b0577
commit 382ced9ffe
27 changed files with 785 additions and 374 deletions

View file

@ -1,9 +1,16 @@
6.3.0 6.3.0
- Migrated all wobjects to assets.
- Migrated pages to the layout and redirect assets.
- Converted site maps to navigation macros.
- Converted file managers to layout assets with file and image assets
attached.
- Converted page templates to use CSS-based layouts instead of tables.
- Added a "Position" property to the DataForm Edit Field interface. This makes it easier to move a field to a certain position. (Len Kranendonk). - Added a "Position" property to the DataForm Edit Field interface. This makes it easier to move a field to a certain position. (Len Kranendonk).
- Added the variables "record.edit.icon", "record.delete.url" and "record.delete.icon" to the DataForm DataList template. (Len Kranendonk). - Added the variables "record.edit.icon", "record.delete.url" and "record.delete.icon" to the DataForm DataList template. (Len Kranendonk).
- Converted all confirmation pages to client-side confirmation dialogs. Saves - Converted all confirmation pages to client-side confirmation dialogs. Saves
a pageload. (Len Kranendonk). a pageload. (Len Kranendonk).
- Added a new, more user-friendly administrative console. - Added a new, more user-friendly administrative console complete with over
40 new icons developed specifically for WebGUI.
- SQL Report now supports multiple queries. (Thanks to Brunswick New - SQL Report now supports multiple queries. (Thanks to Brunswick New
Technologies for funding this development.) Technologies for funding this development.)
- Removed the old rich editors and replaced them with Tiny MCE. - Removed the old rich editors and replaced them with Tiny MCE.

View file

@ -38,6 +38,12 @@ save you many hours of grief.
operates, or else the scheduler plugin ProcessRecurringPayments operates, or else the scheduler plugin ProcessRecurringPayments
will fail with a cert error. will fail with a cert error.
* If you have any custom page templates, they'll need to be updated
to work with the new Layout system. The templates have been
changed significantly enough that automatic migration of them is
not possible.
6.2.8 6.2.8
-------------------------------------------------------------------- --------------------------------------------------------------------
* Due to a bug in the theme system, if you created any themes in any * Due to a bug in the theme system, if you created any themes in any

View file

@ -50,10 +50,24 @@ $sth->finish;
WebGUI::SQL->write("delete from settings where name in ('siteicon','favicon')"); WebGUI::SQL->write("delete from settings where name in ('siteicon','favicon')");
print "\tMigrating wobject templates to asset templates.\n" unless ($quiet);
my $sth = WebGUI::SQL->read("select templateId, template, namespace from template where namespace in ('Article',
'USS', 'SyndicatedContent', 'MessageBoard', 'DataForm', 'EventsCalendar', 'HttpProxy', 'Poll', 'WobjectProxy',
'IndexedSearch', 'SQLReport', 'Survey', 'WSClient')");
while (my $t = $sth->hashRef) {
$t->{template} = '<a name="<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>
'.$t->{template};
WebGUI::SQL->write("update template set template=".quote($t->{template})." where templateId=".quote($t->{templateId})." and namespace=".quote($t->{namespace}));
}
$sth->finish;
# <this is here because we don't want to actually migrate stuff yet # <this is here because we don't want to actually migrate stuff yet
WebGUI::Session::close(); #WebGUI::Session::close();
exit; #exit;
# >this is here because we don't want to actually migrate stuff yet # >this is here because we don't want to actually migrate stuff yet
@ -64,6 +78,8 @@ print "\t\tMaking first round of table structure changes\n" unless ($quiet);
WebGUI::SQL->write("alter table wobject add column assetId varchar(22) not null"); WebGUI::SQL->write("alter table wobject add column assetId varchar(22) not null");
WebGUI::SQL->write("alter table wobject add styleTemplateId varchar(22) not null"); WebGUI::SQL->write("alter table wobject add styleTemplateId varchar(22) not null");
WebGUI::SQL->write("alter table wobject add printableStyleTemplateId varchar(22) not null"); WebGUI::SQL->write("alter table wobject add printableStyleTemplateId varchar(22) not null");
WebGUI::SQL->write("alter table wobject add cacheTimeout int not null default 60");
WebGUI::SQL->write("alter table wobject add cacheTimeoutVisitor int not null default 3600");
WebGUI::SQL->write("alter table wobject drop primary key"); WebGUI::SQL->write("alter table wobject drop primary key");
my $sth = WebGUI::SQL->read("select distinct(namespace) from wobject"); my $sth = WebGUI::SQL->read("select distinct(namespace) from wobject");
while (my ($namespace) = $sth->array) { while (my ($namespace) = $sth->array) {
@ -130,24 +146,33 @@ sub walkTree {
while (my $page = $a->hashRef) { while (my $page = $a->hashRef) {
print "\t\tConverting page ".$page->{pageId}."\n" unless ($quiet); print "\t\tConverting page ".$page->{pageId}."\n" unless ($quiet);
my $pageId = WebGUI::Id::generate(); my $pageId = WebGUI::Id::generate();
if ($page->{pageId} eq $session{setting}{defaultPage}) {
WebGUI::SQL->write("update settings set value=".quote($pageId)." where name='defaultPage'");
}
if ($page->{pageId} eq $session{setting}{notFoundPage}) {
WebGUI::SQL->write("update settings set value=".quote($pageId)." where name='notFoundPage'");
}
my $pageLineage = $parentLineage.sprintf("%06d",$myRank); my $pageLineage = $parentLineage.sprintf("%06d",$myRank);
my $pageUrl = fixUrl($pageId,$page->{urlizedTitle}); my $pageUrl = fixUrl($pageId,$page->{urlizedTitle});
my $className = 'WebGUI::Asset::Layout'; my $className = 'WebGUI::Asset::Wobject::Layout';
if ($page->{redirectURL} ne "") { if ($page->{redirectURL} ne "") {
$className = 'WebGUI::Asset::Redirect'; $className = 'WebGUI::Asset::Redirect';
} }
WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, className, state, title, menuTitle, url, startDate, WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, className, state, title, menuTitle, url, startDate,
endDate, synopsis, newWindow, isHidden, ownerUserId, groupIdView, groupIdEdit, encryptPage ) values (".quote($pageId).", endDate, synopsis, newWindow, isHidden, ownerUserId, groupIdView, groupIdEdit, encryptPage, assetSize ) values (".quote($pageId).",
".quote($newParentId).", ".quote($pageLineage).", ".quote($className).",'published',".quote($page->{title}).", ".quote($newParentId).", ".quote($pageLineage).", ".quote($className).",'published',".quote($page->{title}).",
".quote($page->{menuTitle}).", ".quote($pageUrl).", ".quote($page->{startDate}).", ".quote($page->{endDate}).", ".quote($page->{menuTitle}).", ".quote($pageUrl).", ".quote($page->{startDate}).", ".quote($page->{endDate}).",
".quote($page->{synopsis}).", ".quote($page->{newWindow}).", ".quote($page->{hideFromNavigation}).", ".quote($page->{ownerId}).", ".quote($page->{synopsis}).", ".quote($page->{newWindow}).", ".quote($page->{hideFromNavigation}).", ".quote($page->{ownerId}).",
".quote($page->{groupIdView}).", ".quote($page->{groupIdEdit}).", ".quote($page->{encryptPage}).")"); ".quote($page->{groupIdView}).", ".quote($page->{groupIdEdit}).", ".quote($page->{encryptPage}).",
".length($page->{title}.$page->{menuTitle}.$page->{synopsis}.$page->{urlizedTitle}).")");
if ($page->{redirectURL} ne "") { if ($page->{redirectURL} ne "") {
WebGUI::SQL->write("insert into redirect (assetId, redirectUrl) values (".quote($pageId).",".quote($page->{redirectURL}).")"); WebGUI::SQL->write("insert into redirect (assetId, redirectUrl) values (".quote($pageId).",".quote($page->{redirectURL}).")");
} else { } else {
WebGUI::SQL->write("insert into wobject (assetId, styleTemplateId, templateId, printableStyleTemplateId) values ( WebGUI::SQL->write("insert into wobject (assetId, styleTemplateId, templateId, printableStyleTemplateId,
cacheTimeout, cacheTimeoutVisitor, displayTitle) values (
".quote($pageId).", ".quote($page->{styleId}).", ".quote($page->{templateId}).", ".quote($pageId).", ".quote($page->{styleId}).", ".quote($page->{templateId}).",
".quote($page->{printableStyleId}).")"); ".quote($page->{printableStyleId}).", ".quote($page->{cacheTimeout}).",".quote($page->{cacheTimeoutVisitor}).",
0)");
WebGUI::SQL->write("insert into layout (assetId) values (".quote($pageId).")"); WebGUI::SQL->write("insert into layout (assetId) values (".quote($pageId).")");
} }
my $rank = 1; my $rank = 1;
@ -169,12 +194,14 @@ sub walkTree {
} }
$className = 'WebGUI::Asset::Wobject::'.$wobject->{namespace}; $className = 'WebGUI::Asset::Wobject::'.$wobject->{namespace};
WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, className, state, title, menuTitle, url, startDate, WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, className, state, title, menuTitle, url, startDate,
endDate, isHidden, ownerUserId, groupIdView, groupIdEdit, encryptPage) values (".quote($wobjectId).", endDate, isHidden, ownerUserId, groupIdView, groupIdEdit, encryptPage, assetSize) values (".quote($wobjectId).",
".quote($pageId).", ".quote($wobjectLineage).", ".quote($className).",'published',".quote($page->{title}).", ".quote($pageId).", ".quote($wobjectLineage).", ".quote($className).",'published',".quote($wobject->{title}).",
".quote($page->{title}).", ".quote($wobjectUrl).", ".quote($wobject->{startDate}).", ".quote($wobject->{endDate}).", ".quote($wobject->{title}).", ".quote($wobjectUrl).", ".quote($wobject->{startDate}).", ".quote($wobject->{endDate}).",
1, ".quote($ownerId).", ".quote($groupIdView).", ".quote($groupIdEdit).", ".quote($page->{encryptPage}).")"); 1, ".quote($ownerId).", ".quote($groupIdView).", ".quote($groupIdEdit).", ".quote($page->{encryptPage}).",
".length($wobject->{title}.$wobject->{description}).")");
WebGUI::SQL->write("update wobject set assetId=".quote($wobjectId).", styleTemplateId=".quote($page->{styleId}).", WebGUI::SQL->write("update wobject set assetId=".quote($wobjectId).", styleTemplateId=".quote($page->{styleId}).",
printableStyleTemplateId=".quote($page->{printableStyleId})." where wobjectId=".quote($wobject->{wobjectId})); printableStyleTemplateId=".quote($page->{printableStyleId}).", cacheTimeout=".quote($page->{cacheTimeout})
.", cacheTimeoutVisitor=".quote($page->{cacheTimeoutVisitor})." where wobjectId=".quote($wobject->{wobjectId}));
WebGUI::SQL->write("update ".$wobject->{namespace}." set assetId=".quote($wobjectId)." where wobjectId=" WebGUI::SQL->write("update ".$wobject->{namespace}." set assetId=".quote($wobjectId)." where wobjectId="
.quote($wobject->{wobjectId})); .quote($wobject->{wobjectId}));
if ($wobject->{namespace} eq "Article") { if ($wobject->{namespace} eq "Article") {
@ -244,6 +271,25 @@ sub walkTree {
$rank++; $rank++;
} }
$b->finish; $b->finish;
if ($className eq "WebGUI::Asset::Wobject::Layout") { # Let's position some content
my $positions;
my $last = 1;
my @assets;
my @positions;
my $b = WebGUI::SQL->read("select assetId, templatePosition from wobject where pageId=".quote($page->{pageId})."
order by templatePosition, sequenceNumber");
while (my ($assetId, $position) = $b->array) {
if ($position ne $last) {
push(@positions,join(",",@assets));
@assets = ();
}
$last = $position;
push(@assets,$assetId);
}
$b->finish;
my $contentPositions = join("\.",@positions);
WebGUI::SQL->write("update layout set contentPositions=".quote($contentPositions)." where assetId=".quote($pageId));
}
walkTree($page->{pageId},$pageId,$pageLineage,$rank); walkTree($page->{pageId},$pageId,$pageLineage,$rank);
$myRank++; $myRank++;
} }

View file

@ -11,7 +11,6 @@ update userProfileData set fieldData='tinyMCE' where fieldName='richEditor';
UPDATE template set template = '<html>\r\n\r\n<script language=\"javascript\" src=\"<tmpl_var session.config.extrasURL>/tinymce/jscripts/tiny_mce/tiny_mce_popup.js\"></script>\r\n\r\n<script language=\"javascript\">\r\n\r\nfunction setLink(page) {\r\n document.getElementById(\"url\").value=\"^/;\" + page;\r\n}\r\n\r\nfunction createLink() {\r\n if (window.opener) { \r\n if (document.getElementById(\"url\").value == \"\") {\r\n alert(\"You must enter a link url\");\r\n document.getElementById(\"url\").focus();\r\n }\r\n\r\ntinyMCE.insertLink(document.getElementById(\"url\").value,document.getElementById(\"target\").value);\r\n window.close();\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<body>\r\n\r\n<fieldset>\r\n<legend>Insert/Edit Link</legend>\r\n\r\n <fieldset>\r\n <legend>Link Settings</legend>\r\n <form name=\"linkchooser\">\r\n <table border=\"0\">\r\n <tr>\r\n <td>Link URL:</td>\r\n <td><input id=\"url\" name=\"url\" type=\"text value=\"\" style=\"width: 200px\"></td>\r\n </tr>\r\n <tr>\r\n <td>Link Target:</td>\r\n <td><select id=\"target\" name=\"target\" style=\"width: 200px\">\r\n <option value=\"_self\">Open link in same window</option>\r\n <option value=\"_blank\">Open link in new window</option>\r\n </select>\r\n </td>\r\n </tr>\r\n <tr><td colspan=\"2\">&nbsp;</td></tr>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\"><input type=\"button\" value=\"Cancel\" onClick=\"window.close()\"><input type=\"button\" value=\"Create Link\" onClick=\"createLink()\"></td>\r\n </tr>\r\n </table>\r\n </form>\r\n \r\n\r\n </fieldset> \r\n<br>\r\n\r\n\r\n <fieldset>\r\n <legend>Available Page Tree</legend>\r\n<div id=\"pagetree\" style=\"overflow: auto; height: 280; width: 441\">\r\n<tmpl_loop page_loop>\r\n <tmpl_var indent><a href=\"#\" onClick=\"setLink(\'<tmpl_var url>\')\"><tmpl_var title></a><br />\r\n</tmpl_loop>\r\n</div>\r\n </fieldset>\r\n \r\n</fieldset>\r\n</body>\r\n</html>' where namespace='richEditor/pagetree' && templateId = '1'; UPDATE template set template = '<html>\r\n\r\n<script language=\"javascript\" src=\"<tmpl_var session.config.extrasURL>/tinymce/jscripts/tiny_mce/tiny_mce_popup.js\"></script>\r\n\r\n<script language=\"javascript\">\r\n\r\nfunction setLink(page) {\r\n document.getElementById(\"url\").value=\"^/;\" + page;\r\n}\r\n\r\nfunction createLink() {\r\n if (window.opener) { \r\n if (document.getElementById(\"url\").value == \"\") {\r\n alert(\"You must enter a link url\");\r\n document.getElementById(\"url\").focus();\r\n }\r\n\r\ntinyMCE.insertLink(document.getElementById(\"url\").value,document.getElementById(\"target\").value);\r\n window.close();\r\n }\r\n}\r\n\r\n</script>\r\n\r\n<body>\r\n\r\n<fieldset>\r\n<legend>Insert/Edit Link</legend>\r\n\r\n <fieldset>\r\n <legend>Link Settings</legend>\r\n <form name=\"linkchooser\">\r\n <table border=\"0\">\r\n <tr>\r\n <td>Link URL:</td>\r\n <td><input id=\"url\" name=\"url\" type=\"text value=\"\" style=\"width: 200px\"></td>\r\n </tr>\r\n <tr>\r\n <td>Link Target:</td>\r\n <td><select id=\"target\" name=\"target\" style=\"width: 200px\">\r\n <option value=\"_self\">Open link in same window</option>\r\n <option value=\"_blank\">Open link in new window</option>\r\n </select>\r\n </td>\r\n </tr>\r\n <tr><td colspan=\"2\">&nbsp;</td></tr>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\"><input type=\"button\" value=\"Cancel\" onClick=\"window.close()\"><input type=\"button\" value=\"Create Link\" onClick=\"createLink()\"></td>\r\n </tr>\r\n </table>\r\n </form>\r\n \r\n\r\n </fieldset> \r\n<br>\r\n\r\n\r\n <fieldset>\r\n <legend>Available Page Tree</legend>\r\n<div id=\"pagetree\" style=\"overflow: auto; height: 280; width: 441\">\r\n<tmpl_loop page_loop>\r\n <tmpl_var indent><a href=\"#\" onClick=\"setLink(\'<tmpl_var url>\')\"><tmpl_var title></a><br />\r\n</tmpl_loop>\r\n</div>\r\n </fieldset>\r\n \r\n</fieldset>\r\n</body>\r\n</html>' where namespace='richEditor/pagetree' && templateId = '1';
INSERT INTO template VALUES ('adminConsole','Admin Console','<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\r\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <title>WebGUI <tmpl_var session.webgui.version>-<tmpl_var session.webgui.status> Admin Console</title>\r\n <tmpl_var head.tags> \r\n</head>\r\n<body>\r\n<tmpl_var body.content>\r\n</body>\r\n</html>\r\n','style',1,0); INSERT INTO template VALUES ('adminConsole','Admin Console','<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\r\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <title>WebGUI <tmpl_var session.webgui.version>-<tmpl_var session.webgui.status> Admin Console</title>\r\n <tmpl_var head.tags> \r\n</head>\r\n<body>\r\n<tmpl_var body.content>\r\n</body>\r\n</html>\r\n','style',1,0);
INSERT INTO template VALUES ('1','Admin Console','^StyleSheet(^Extras;/adminConsole/adminConsole.css);\r\n^JavaScript(^Extras;/adminConsole/adminConsole.js);\r\n\r\n<div id=\"application_help\">\r\n <tmpl_if help.url>\r\n <a href=\"<tmpl_var help.url>\" target=\"_blank\"><img src=\"^Extras;/adminConsole/help-small.gif\" alt=\"?\" border=\"0\" /></a>\r\n </tmpl_if>\r\n</div>\r\n<div id=\"application_icon\">\r\n <img src=\"<tmpl_var application.icon>\" border=\"0\" title=\"<tmpl_var application.title>\" alt=\"<tmpl_var application.title>\" />\r\n</div>\r\n<div id=\"console_icon\">\r\n <img src=\"<tmpl_var console.icon>\" border=\"0\" title=\"<tmpl_var console.title>\" alt=\"<tmpl_var console.title>\" />\r\n</div>\r\n<div id=\"application_title\">\r\n <tmpl_var application.title>\r\n</div>\r\n<div id=\"console_title\">\r\n <tmpl_var console.title>\r\n</div>\r\n<div id=\"application_workarea\">\r\n <tmpl_var application.workArea>\r\n</div>\r\n<div id=\"console_workarea\">\r\n <div class=\"adminConsoleSpacer\">\r\n &nbsp;\r\n </div>\r\n <tmpl_loop application_loop>\r\n <tmpl_if canUse>\r\n <div class=\"adminConsoleApplication\">\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon>\" border=\"0\" title=\"<tmpl_var title>\" alt=\"<tmpl_var title>\" /></a><br />\r\n <a href=\"<tmpl_var url>\"><tmpl_var title></a>\r\n </div>\r\n </tmpl_if>\r\n </tmpl_loop>\r\n <div class=\"adminConsoleSpacer\">\r\n &nbsp;\r\n </div>\r\n</div>\r\n<div class=\"adminConsoleMenu\">\r\n <div id=\"adminConsoleMainMenu\" class=\"adminConsoleMainMenu\">\r\n <div id=\"console_toggle_on\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.on.label></a><br />\r\n </div>\r\n <div id=\"console_toggle_off\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.off.label></a><br />\r\n </div>\r\n </div>\r\n <div id=\"adminConsoleApplicationSubmenu\" class=\"adminConsoleApplicationSubmenu\">\r\n <tmpl_loop submenu_loop>\r\n <a href=\"<tmpl_var url>\"><tmpl_var label></a><br />\r\n </tmpl_loop>\r\n </div>\r\n <div id=\"adminConsoleUtilityMenu\" class=\"adminConsoleUtilityMenu\">\r\n <a href=\"^\;\"><tmpl_var backtosite.label></a><br />\r\n ^AdminToggle;<br />\r\n ^LoginToggle;<br />\r\n </div>\r\n</div>\r\n<script lang=\"JavaScript\">\r\n initAdminConsole(<tmpl_if application.title>true<tmpl_else>false</tmpl_if>,<tmpl_if submenu_loop>true<tmpl_else>false</tmpl_if>);\r\n</script>\r\n','AdminConsole',1,1);
delete from settings where name='adminStyleId'; delete from settings where name='adminStyleId';
delete from settings where name='useAdminStyle'; delete from settings where name='useAdminStyle';
@ -63,6 +62,8 @@ create table asset (
isHidden int not null default 0, isHidden int not null default 0,
isSystem int not null default 0, isSystem int not null default 0,
encryptPage int not null default 0, encryptPage int not null default 0,
lastUpdated bigint not null default 0,
assetSize int not null default 0,
unique index (lineage asc), unique index (lineage asc),
unique index (url), unique index (url),
index (parentId) index (parentId)
@ -83,14 +84,14 @@ create table redirect (
); );
create table layout ( create table layout (
assetId varchar(22) not null primary key assetId varchar(22) not null primary key,
contentPositions text
); );
create table FileAsset ( create table FileAsset (
assetId varchar(22) not null primary key, assetId varchar(22) not null primary key,
storageId varchar(22) not null, storageId varchar(22) not null,
filename varchar(255) not null, filename varchar(255) not null,
fileSize int not null,
olderVersions text olderVersions text
); );
@ -181,3 +182,19 @@ create table ImageAsset (
thumbnailSize int not null default 50 thumbnailSize int not null default 50
); );
INSERT INTO template VALUES ('1','Admin Console','^StyleSheet(^Extras;/adminConsole/adminConsole.css);\r\n^JavaScript(^Extras;/adminConsole/adminConsole.js);\r\n\r\n<div id=\"application_help\">\r\n <tmpl_if help.url>\r\n <a href=\"<tmpl_var help.url>\" target=\"_blank\"><img src=\"^Extras;/adminConsole/small/help.gif\" alt=\"?\" border=\"0\" /></a>\r\n </tmpl_if>\r\n</div>\r\n<div id=\"application_icon\">\r\n <img src=\"<tmpl_var application.icon>\" border=\"0\" title=\"<tmpl_var application.title>\" alt=\"<tmpl_var application.title>\" />\r\n</div>\r\n<div class=\"adminConsoleTitleIconMedalian\">\r\n<img src=\"^Extras;/adminConsole/medalian.gif\" border=\"0\" alt=\"*\" />\r\n</div>\r\n<div id=\"console_icon\">\r\n <img src=\"<tmpl_var console.icon>\" border=\"0\" title=\"<tmpl_var console.title>\" alt=\"<tmpl_var console.title>\" />\r\n</div>\r\n<div id=\"application_title\">\r\n <tmpl_var application.title>\r\n</div>\r\n<div id=\"console_title\">\r\n <tmpl_var console.title>\r\n</div>\r\n<div id=\"application_workarea\">\r\n <tmpl_var application.workArea>\r\n</div>\r\n<div id=\"console_workarea\">\r\n <div class=\"adminConsoleSpacer\">\r\n &nbsp;\r\n </div>\r\n <tmpl_loop application_loop>\r\n <tmpl_if canUse>\r\n <div class=\"adminConsoleApplication\">\r\n <a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon>\" border=\"0\" title=\"<tmpl_var title>\" alt=\"<tmpl_var title>\" /></a><br />\r\n <a href=\"<tmpl_var url>\"><tmpl_var title></a>\r\n </div>\r\n </tmpl_if>\r\n </tmpl_loop>\r\n <div class=\"adminConsoleSpacer\">\r\n &nbsp;\r\n </div>\r\n</div>\r\n<div class=\"adminConsoleMenu\">\r\n <div id=\"adminConsoleMainMenu\" class=\"adminConsoleMainMenu\">\r\n <div id=\"console_toggle_on\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.on.label></a><br />\r\n </div>\r\n <div id=\"console_toggle_off\">\r\n <a href=\"#\" onClick=\"toggleAdminConsole()\"><tmpl_var toggle.off.label></a><br />\r\n </div>\r\n </div>\r\n <div id=\"adminConsoleApplicationSubmenu\" class=\"adminConsoleApplicationSubmenu\">\r\n <tmpl_loop submenu_loop>\r\n <a href=\"<tmpl_var url>\"><tmpl_var label></a><br />\r\n </tmpl_loop>\r\n </div>\r\n <div id=\"adminConsoleUtilityMenu\" class=\"adminConsoleUtilityMenu\">\r\n <a href=\"^;\"><tmpl_var backtosite.label></a><br />\r\n ^AdminToggle;<br />\r\n ^LoginToggle;<br />\r\n </div>\r\n</div>\r\n<script lang=\"JavaScript\">\r\n initAdminConsole(<tmpl_if application.title>true<tmpl_else>false</tmpl_if>,<tmpl_if submenu_loop>true<tmpl_else>false</tmpl_if>);\r\n</script>\r\n','AdminConsole',1,1);
insert into settings (name,value) values ('AdminConsoleTemplate',1);
delete from template where namespace='Macro/AdminBar' and templateId in ('1','2');
INSERT INTO template VALUES ('1','Default Admin Bar','<script language=\"JavaScript\" type=\"text/javascript\"> <!--\r\n function goContent(){\r\n location = document.content.contentSelect.options[document.content.contentSelect.selectedIndex].value\r\n }\r\n function goAdmin(){\r\n location = document.admin.adminSelect.options[document.admin.adminSelect.selectedIndex].value\r\n }\r\n //--> </script>\r\n \r\n<div class=\"adminBar\">\r\n<table class=\"adminBar\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\">\r\n <tr>\r\n <form name=\"content\"> <td>\r\n<select name=\"contentSelect\" onChange=\"goContent()\">\r\n<option value=\"\"><tmpl_var addcontent.label></option>\r\n\r\n<tmpl_if clipboard_loop>\r\n<optgroup label=\"<tmpl_var clipboard.label>\"> \r\n<tmpl_loop clipboard_loop>\r\n<option value=\"<tmpl_var clipboard.url>\"><tmpl_var clipboard.label></option>\r\n</tmpl_loop>\r\n</optgroup>\r\n</tmpl_if>\r\n\r\n<tmpl_if contentTypes_loop>\r\n<optgroup label=\"<tmpl_var contentTypes.label>\"> \r\n<tmpl_loop contentTypes_loop>\r\n<option value=\"<tmpl_var contentType.url>\"><tmpl_var contentType.label></option>\r\n</tmpl_loop>\r\n</optgroup>\r\n</tmpl_if>\r\n\r\n<tmpl_if package_loop>\r\n<optgroup label=\"<tmpl_var packages.label>\"> \r\n<tmpl_loop package_loop>\r\n<option value=\"<tmpl_var package.url>\"><tmpl_var package.label></option>\r\n</tmpl_loop>\r\n</optgroup>\r\n</tmpl_if>\r\n\r\n</select>\r\n </td> </form>\r\n\r\n <form name=\"admin\"> <td align=\"center\">\r\n <select name=\"adminSelect\" onChange=\"goAdmin()\">\r\n <option value=\"\"><tmpl_var admin.label></option>\r\n <tmpl_loop admin_loop>\r\n <option value=\"<tmpl_var admin.url>\"><tmpl_var admin.label></option>\r\n </tmpl_loop>\r\n </select>\r\n </td> </form>\r\n </tr>\r\n</table>\r\n</div>\r\n','Macro/AdminBar',1,1);
INSERT INTO template VALUES ('2','DHTML Admin Bar','^JavaScript(\"<tmpl_var session.config.extrasURL>/coolmenus/coolmenus4.js\");\r\n<style type=\"text/css\">\r\n \r\n.adminBarTop,.adminBarTopOver,.adminBarSub,.adminBarSubOver{position:absolute; overflow:hidden; cursor:pointer; cursor:hand}\r\n.adminBarTop,.adminBarTopOver{padding:4px; font-size:12px; font-weight:bold}\r\n.adminBarTop{color:white; border: 1px solid #aaaaaa; }\r\n.adminBarTopOver,.adminBarSubOver{color:#EC4300;}\r\n.adminBarSub,.adminBarSubOver{padding:2px; font-size:11px; font-weight:bold}\r\n.adminBarSub{color: white; background-color: #666666; layer-background-color: #666666;}\r\n.adminBarSubOver,.adminBarSubOver,.adminBarBorder,.adminBarBkg{layer-background-color: black; background-color: black;}\r\n.adminBarBorder{position:absolute; visibility:hidden; z-index:300}\r\n.adminBarBkg{position:absolute; width:10; height:10; visibility:hidden; }\r\n</style>\r\n\r\n<script language=\"JavaScript1.2\">\r\n/*****************************************************************************\r\nCopyright (c) 2001 Thomas Brattli (webmaster@dhtmlcentral.com)\r\n \r\nDHTML coolMenus - Get it at coolmenus.dhtmlcentral.com\r\nVersion 4.0_beta\r\nThis script can be used freely as long as all copyright messages are\r\nintact.\r\n \r\nExtra info - Coolmenus reference/help - Extra links to help files ****\r\nCSS help: http://192.168.1.31/projects/coolmenus/reference.asp?m=37\r\nGeneral: http://coolmenus.dhtmlcentral.com/reference.asp?m=35\r\nMenu properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=47\r\nLevel properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=48\r\nBackground bar properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=49\r\nItem properties: http://coolmenus.dhtmlcentral.com/properties.asp?m=50\r\n******************************************************************************/\r\nadminBar=new makeCM(\"adminBar\"); \r\n\r\n//menu properties\r\nadminBar.resizeCheck=1; \r\nadminBar.rows=1; \r\nadminBar.onlineRoot=\"\"; \r\nadminBar.pxBetween =0;\r\nadminBar.fillImg=\"\"; \r\nadminBar.fromTop=0; \r\nadminBar.fromLeft=30; \r\nadminBar.wait=600; \r\nadminBar.zIndex=10000;\r\nadminBar.menuPlacement=\"left\";\r\n\r\n//background bar properties\r\nadminBar.useBar=1; \r\nadminBar.barWidth=\"\"; \r\nadminBar.barHeight=\"menu\"; \r\nadminBar.barX=0;\r\nadminBar.barY=\"menu\"; \r\nadminBar.barClass=\"adminBarBkg\";\r\nadminBar.barBorderX=0; \r\nadminBar.barBorderY=0;\r\n\r\nadminBar.level[0]=new cm_makeLevel(160,20,\"adminBarTop\",\"adminBarTopOver\",1,1,\"adminBarBorder\",0,\"bottom\",0,0,0,0,0);\r\nadminBar.level[1]=new cm_makeLevel(160,18,\"adminBarSub\",\"adminBarSubOver\",1,1,\"adminBarBorder\",0,\"right\",0,5,\"menu_arrow.gif\",10,10);\r\n\r\n\r\nadminBar.makeMenu(\'addcontent\',\'\',\'<tmpl_var addcontent.label>\',\'\');\r\n\r\n<tmpl_if clipboard_loop>\r\nadminBar.makeMenu(\'clipboard\',\'addcontent\',\'<tmpl_var clipboard.label> &raquo;\',\'\');\r\n<tmpl_loop clipboard_loop> \r\n adminBar.makeMenu(\'clipboard<tmpl_var __counter__>\',\'clipboard\',\'<tmpl_var clipboard.label>\',\'<tmpl_var clipboard.url>\');\r\n</tmpl_loop>\r\n</tmpl_if>\r\n\r\n<tmpl_if contentTypes_loop>\r\nadminBar.makeMenu(\'contentTypes\',\'addcontent\',\'<tmpl_var contentTypes.label> &raquo;\',\'\');\r\n<tmpl_loop contentTypes_loop> \r\n adminBar.makeMenu(\'contentTypes<tmpl_var __counter__>\',\'contentTypes\',\'<tmpl_var contentType.label>\',\'<tmpl_var contentType.url>\');\r\n</tmpl_loop>\r\n</tmpl_if>\r\n\r\n<tmpl_if package_loop>\r\n<tmpl_if packages.canAdd>\r\nadminBar.makeMenu(\'packages\',\'addcontent\',\'<tmpl_var packages.label> &raquo;\',\'\');\r\n<tmpl_loop package_loop> \r\n adminBar.makeMenu(\'package<tmpl_var __counter__>\',\'packages\',\'<tmpl_var package.label>\',\'<tmpl_var package.url>\');\r\n</tmpl_loop>\r\n</tmpl_if>\r\n</tmpl_if>\r\n\r\n\r\nadminBar.makeMenu(\'admin\',\'\',\'<tmpl_var admin.label>\',\'\');\r\n<tmpl_loop admin_loop> \r\n adminBar.makeMenu(\'admin<tmpl_var admin.count>\',\'admin\',\'<tmpl_var admin.label>\',\'<tmpl_var admin.url>\');\r\n</tmpl_loop>\r\n \r\nadminBar.construct()\r\n</script>\r\n','Macro/AdminBar',1,1);
delete from template where namespace='page' and templateId in ('1','2','3','4','5','6','7');
INSERT INTO template VALUES ('5','Left Column','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 1 -->\r\n<div style=\"width: 34%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n<!-- begin position 2 -->\r\n<div style=\"width: 66%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('4','Three Over One','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 1 -->\r\n<div style=\"width: 33%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n\r\n<!-- begin position 2 -->\r\n<div style=\"width: 34%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n\r\n<!-- begin position 3 -->\r\n<div style=\"width: 33%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position3\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position3_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 3 -->\r\n\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<!-- begin position 4 -->\r\n<div>\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position4\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position4_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 4 -->\r\n\r\n\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('3','One Over Three','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<!-- begin position 1 -->\r\n<div>\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 2 -->\r\n<div style=\"width: 33%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n\r\n<!-- begin position 3 -->\r\n<div style=\"width: 34%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position3\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position3_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 3 -->\r\n\r\n\r\n<!-- begin position 4 -->\r\n<div style=\"width: 33%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position4\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position4_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 4 -->\r\n\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('2','News','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<!-- begin position 1 -->\r\n<div>\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 2 -->\r\n<div style=\"width: 50%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n\r\n<!-- begin position 3 -->\r\n<div style=\"width: 50%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position3\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position3_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 3 -->\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n\r\n<!-- begin position 4 -->\r\n<div>\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position4\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position4_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 4 -->\r\n\r\n\r\n\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('7','Side By Side','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 1 -->\r\n<div style=\"width: 50%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n<!-- begin position 2 -->\r\n<div style=\"width: 50%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('6','Right Column','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n<div>\r\n<!-- begin position 1 -->\r\n<div style=\"width: 66%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 1 -->\r\n\r\n<!-- begin position 2 -->\r\n<div style=\"width: 34%; float: left;\">\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position2\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position2_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n</div>\r\n<!-- end position 2 -->\r\n</div>\r\n\r\n<div style=\"clear: both;\">&nbsp;</div>\r\n\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);
INSERT INTO template VALUES ('1','Default Page','<a href=\"<tmpl_var assetId>\"></a>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin>\r\n <table border=\"0\" id=\"position1\" class=\"content\"><tbody>\r\n</tmpl_if>\r\n\r\n<tmpl_loop position1_loop>\r\n <tmpl_if showAdmin>\r\n <tr id=\"td<tmpl_var id>\">\r\n <td><div id=\"td<tmpl_var id>_div\" class=\"dragable\"> \r\n </tmpl_if>\r\n\r\n <div class=\"content\"><tmpl_var dragger.icon><tmpl_var content></div>\r\n\r\n <tmpl_if showAdmin>\r\n </div></td>\r\n </tr>\r\n </tmpl_if>\r\n</tmpl_loop>\r\n\r\n<tmpl_if showAdmin> \r\n </tbody></table>\r\n</tmpl_if>\r\n\r\n<tmpl_if showAdmin> \r\n <table><tr id=\"blank\" class=\"hidden\"><td><div><div class=\"empty\">&nbsp;</div></div></td></tr></table>\r\n <tmpl_var dragger.init>\r\n</tmpl_if>\r\n ','page',1,1);

View file

@ -15,6 +15,7 @@ our $STATUS = "gamma";
use strict qw(vars subs); use strict qw(vars subs);
use Tie::CPHash; use Tie::CPHash;
use WebGUI::Affiliate; use WebGUI::Affiliate;
use WebGUI::Asset;
use WebGUI::Cache; use WebGUI::Cache;
use WebGUI::ErrorHandler; use WebGUI::ErrorHandler;
use WebGUI::Grouping; use WebGUI::Grouping;
@ -29,55 +30,6 @@ use WebGUI::URL;
use WebGUI::PassiveProfiling; use WebGUI::PassiveProfiling;
#-------------------------------------------------------------------
sub _generatePage {
my $content = shift;
if ($session{form}{op} eq "" && $session{setting}{trackPageStatistics} && $session{form}{wid} ne "new") {
WebGUI::SQL->write("insert into pageStatistics (dateStamp, userId, username, ipAddress, userAgent, referer,
pageId, pageTitle, wobjectId, wobjectFunction) values (".time().",".quote($session{user}{userId})
.",".quote($session{user}{username}).",
".quote($session{env}{REMOTE_ADDR}).", ".quote($session{env}{HTTP_USER_AGENT}).",
".quote($session{env}{HTTP_REFERER}).", ".quote($session{page}{pageId}).",
".quote($session{page}{title}).", ".quote($session{form}{wid}).", ".quote($session{form}{func}).")");
}
my $output = WebGUI::Style::process($content);
if ($session{setting}{showDebug} || ($session{form}{debug}==1 && WebGUI::Grouping::isInGroup(3))) {
$output .= WebGUI::ErrorHandler::showDebug();
}
return $output;
}
#-------------------------------------------------------------------
sub _getPageInfo {
my $sql = "select * from page where ";
my $url = shift || $ENV{PATH_INFO};
$url = lc($url);
$url =~ s/\/$//;
$url =~ s/^\///;
$url =~ s/\'//;
$url =~ s/\"//;
my $pageData;
if ($url ne "") {
$pageData = WebGUI::SQL->quickHashRef($sql."urlizedTitle=".quote($url));
if ($pageData->{subroutine} eq "") {
if($ENV{"MOD_PERL"}) {
my $r = Apache->request;
if(defined($r)) {
$r->custom_response(404, $url);
$r->status(404);
}
} else {
$session{http}{status} = '404';
}
$pageData = WebGUI::SQL->quickHashRef($sql."pageId=".quote($session{setting}{notFoundPage}));
}
} else {
$pageData = WebGUI::SQL->quickHashRef($sql."pageId=".quote($session{setting}{defaultPage}));
}
$session{page} = $pageData;
return $pageData;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _processOperations { sub _processOperations {
my ($cmd, $output); my ($cmd, $output);
@ -105,56 +57,32 @@ sub _processOperations {
sub page { sub page {
my $webguiRoot = shift; my $webguiRoot = shift;
my $configFile = shift; my $configFile = shift;
my $useExistingSession = shift; # used for static page generation functions where you may generate more than one page at a time. my $useExistingSession = shift; # used for static page generation functions where you may generate more than one asset at a time.
my $pageUrl = shift; my $assetUrl = shift;
my $fastcgi = shift; my $fastcgi = shift;
WebGUI::Session::open($webguiRoot,$configFile,$fastcgi) unless ($useExistingSession); WebGUI::Session::open($webguiRoot,$configFile,$fastcgi) unless ($useExistingSession);
my $page = _getPageInfo($pageUrl);
my $output = _processOperations(); my $output = _processOperations();
if ($output ne "") { if ($output eq "") {
$output = _generatePage($output); my $asset = WebGUI::Asset->newByUrl($assetUrl);
} else { my $method = "view";
my $useCache = ( if (exists $session{form}{func}) {
$session{form}{op} eq "" && $method = $session{form}{func};
$session{form}{func} eq "" &&
(
( $session{page}{cacheTimeout} > 10 && $session{user}{userId} !=1) ||
( $session{page}{cacheTimeoutVisitor} > 10 && $session{user}{userId} == 1)
) &&
not $session{var}{adminOn}
);
my $cache;
if ($useCache) {
$cache = WebGUI::Cache->new("page_".$session{page}{pageId}."_".$session{user}{userId});
$output = $cache->get;
} }
unless ($output) { $method = "www_".$method;
my $cmd = "use ".$page->{subroutinePackage}; $output = $asset->$method();
eval ($cmd); if ($output eq "" && $method ne "view") {
WebGUI::ErrorHandler::fatalError("Couldn't compile page package: ".$page->{subroutinePackage}.". Root cause: ".$@) if ($@); $output = $asset->www_view;
my $params = eval $page->{subroutineParams};
WebGUI::ErrorHandler::fatalError("Couldn't interpret page params: ".$page->{subroutineParams}.". Root cause: ".$@) if ($@);
$cmd = $page->{subroutinePackage}."::".$page->{subroutine};
$output = eval{&$cmd($params)};
WebGUI::ErrorHandler::fatalError("Couldn't execute page command: ".$page->{subroutine}.". Root cause: ".$@) if ($@);
if (WebGUI::HTTP::getMimeType() eq "text/html") {
$output = _generatePage($output);
}
my $ttl;
if ($session{user}{userId} == 1) {
$ttl = $session{page}{cacheTimeoutVisitor};
} else {
$ttl = $session{page}{cacheTimeout};
}
$cache->set($output, $ttl) if ($useCache && !WebGUI::HTTP::isRedirect());
WebGUI::PassiveProfiling::addPage(); # add wobjects on page to passive profile log
} }
WebGUI::ErrorHandler::fatalError("Couldn't call method ".$method." on asset for ".$asset->get("url")." (".$asset->getId."). Root cause: ".$!) if ($!);
} }
WebGUI::Affiliate::grabReferral(); # process affilliate tracking request WebGUI::Affiliate::grabReferral(); # process affilliate tracking request
if (WebGUI::HTTP::isRedirect() && !$useExistingSession) { if (WebGUI::HTTP::isRedirect() && !$useExistingSession) {
$output = WebGUI::HTTP::getHeader(); $output = WebGUI::HTTP::getHeader();
} else { } else {
$output = WebGUI::HTTP::getHeader().$output; $output = WebGUI::HTTP::getHeader().$output;
if ($session{setting}{showDebug} || ($session{form}{debug}==1 && WebGUI::Grouping::isInGroup(3))) {
$output .= WebGUI::ErrorHandler::showDebug();
}
} }
# This allows an operation or wobject to write directly to the browser. # This allows an operation or wobject to write directly to the browser.
$output = undef if ($session{page}{empty}); $output = undef if ($session{page}{empty});

View file

@ -4,16 +4,23 @@ use strict;
use WebGUI::Grouping; use WebGUI::Grouping;
use WebGUI::International; use WebGUI::International;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Style;
use WebGUI::Template; use WebGUI::Template;
use WebGUI::URL; use WebGUI::URL;
sub _formatFunction { sub _formatFunction {
my $self = shift; my $self = shift;
my $function = shift; my $function = shift;
my $url;
if (exists $function->{func}) {
$url = WebGUI::URL::page("func=".$function->{func});
} else {
$url = WebGUI::URL::page("op=".$function->{op});
}
return { return {
title=>WebGUI::International::get($function->{title}{id}, $function->{title}{namespace}), title=>WebGUI::International::get($function->{title}{id}, $function->{title}{namespace}),
icon=>$session{config}{extrasURL}."/adminConsole/".$function->{icon}, icon=>$session{config}{extrasURL}."/adminConsole/".$function->{icon},
url=>WebGUI::URL::page("op=".$function->{op}), url=>$url,
canUse=>WebGUI::Grouping::isInGroup($function->{group}) canUse=>WebGUI::Grouping::isInGroup($function->{group})
}; };
} }
@ -46,7 +53,7 @@ sub getAdminFunction {
namespace=>"Asset" namespace=>"Asset"
}, },
icon=>"assets.gif", icon=>"assets.gif",
op=>"manageAssets", func=>"manageAssets",
group=>"12" group=>"12"
}, },
"users"=>{ "users"=>{
@ -267,8 +274,7 @@ sub render {
$var{"console.icon"} = $acParams->{icon}; $var{"console.icon"} = $acParams->{icon};
$var{"help.url"} = $self->{_helpUrl}; $var{"help.url"} = $self->{_helpUrl};
$var{"application_loop"} = $self->getAdminFunction; $var{"application_loop"} = $self->getAdminFunction;
$session{page}{useAdminStyle} = 1; return WebGUI::Style::process(WebGUI::Template::process($session{setting}{AdminConsoleTemplate}, "AdminConsole", \%var),"adminConsole");
return WebGUI::Template::process($session{setting}{AdminConsoleTemplate}, "AdminConsole", \%var);
} }
sub setHelp { sub setHelp {
@ -278,5 +284,13 @@ sub setHelp {
$self->{_helpUrl} = WebGUI::URL::page('op=viewHelp&hid='.$id.'&namespace='.$namespace) if ($id); $self->{_helpUrl} = WebGUI::URL::page('op=viewHelp&hid='.$id.'&namespace='.$namespace) if ($id);
} }
sub setIcon {
my $self = shift;
my $icon = shift;
if ($icon) {
$self->{_function}{icon} = $icon;
}
}
1; 1;

View file

@ -3,8 +3,14 @@ package WebGUI::Asset;
#needs documentation #needs documentation
use strict; use strict;
use Tie::IxHash;
use WebGUI::Clipboard;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::ErrorHandler;
use WebGUI::Form;
use WebGUI::Grouping; use WebGUI::Grouping;
use WebGUI::HTTP;
use WebGUI::Icon;
use WebGUI::Id; use WebGUI::Id;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
@ -22,14 +28,13 @@ sub addChild {
values (".quote($id).",".quote($self->getId).", ".quote($lineage).", values (".quote($id).",".quote($self->getId).", ".quote($lineage).",
'published', ".quote($properties->{className}).", ".quote($id).", 'published', ".quote($properties->{className}).", ".quote($id).",
997995720, 9223372036854775807)"); 997995720, 9223372036854775807)");
foreach my $definition (@{$self->{definition}}) { foreach my $definition (@{$self->definition}) {
unless ($definition->{tableName} eq "asset") { unless ($definition->{tableName} eq "asset") {
WebGUI::SQL->write("insert into ".$definition->{tableName}." (assetId) values (".quote($id).")"); WebGUI::SQL->write("insert into ".$definition->{tableName}." (assetId) values (".quote($id).")");
} }
} }
WebGUI::SQL->commit; WebGUI::SQL->commit;
my $className = $properties->{className}; my $newAsset = WebGUI::Asset->newByDynamicClass($id, $properties->{className});
my $newAsset = $className->new($id);
$newAsset->update($properties); $newAsset->update($properties);
return $newAsset; return $newAsset;
} }
@ -46,9 +51,10 @@ sub canEdit {
sub canView { sub canView {
my $self = shift; my $self = shift;
my $userId = shift || $session{user}{userId}; my $userId = shift || $session{user}{userId};
return 0 unless ($self->get("state") eq "published");
if ($userId eq $self->get("ownerUserId")) { if ($userId eq $self->get("ownerUserId")) {
return 1; return 1;
} elsif ($self->get("startDate") < time() && } elsif ( $self->get("startDate") < time() &&
$self->get("endDate") > time() && $self->get("endDate") > time() &&
WebGUI::Grouping::isInGroup($self->get("groupIdView"),$userId)) { WebGUI::Grouping::isInGroup($self->get("groupIdView"),$userId)) {
return 1; return 1;
@ -75,8 +81,9 @@ sub cut {
sub definition { sub definition {
my $class = shift; my $class = shift;
my $definition = shift; my $definition = shift || [];
push(@{$definition}, { my @newDef = @{$definition};
push(@newDef, {
tableName=>'asset', tableName=>'asset',
className=>'WebGUI::Asset', className=>'WebGUI::Asset',
properties=>{ properties=>{
@ -117,18 +124,13 @@ sub definition {
fieldType=>'dateTime', fieldType=>'dateTime',
defaultValue=>undef defaultValue=>undef
}, },
assetSize=>{
fieldType=>'hidden',
defaultValue=>0
}
} }
}); });
return $definition; return \@newDef;
}
sub delete {
my $self = shift;
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set state='limbo' where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='trash' where assetId=".quote($self->getId));
WebGUI::SQL->commit;
$self->{_properties}{state} = "trash";
} }
sub demote { sub demote {
@ -148,6 +150,7 @@ sub duplicate {
return $newAsset; return $newAsset;
} }
sub fixUrl { sub fixUrl {
my $self = shift; my $self = shift;
my $url = WebGUI::URL::urlize(shift); my $url = WebGUI::URL::urlize(shift);
@ -197,9 +200,33 @@ sub getAdminConsole {
unless (exists $self->{_adminConsole}) { unless (exists $self->{_adminConsole}) {
$self->{_adminConsole} = WebGUI::AdminConsole->new("assets"); $self->{_adminConsole} = WebGUI::AdminConsole->new("assets");
} }
$self->{_adminConsole}->setIcon($self->getIcon);
return $self->{_adminConsole}; return $self->{_adminConsole};
} }
sub getAssetAdderLinks {
my $self = shift;
my @links;
foreach my $class (@{$session{config}{assets}}) {
my $load = "use ".$class;
eval ($load);
if ($@) {
WebGUI::ErrorHandler::warn("Couldn't compile ".$class." because ".$@);
} else {
my $label = eval{$class->getName()};
if ($@) {
WebGUI::ErrorHandler::warn("Couldn't get the name of ".$class." because ".$@);
} else {
push(@links, {
label=>$label,
url=>$self->getUrl("func=add&class=".$class)
});
}
}
}
return \@links;
}
sub getEditForm { sub getEditForm {
my $self = shift; my $self = shift;
my $tabform = WebGUI::TabForm->new(); my $tabform = WebGUI::TabForm->new();
@ -213,7 +240,13 @@ sub getEditForm {
value=>"1" value=>"1"
}); });
} }
$tabform->add("properties",WebGUI::International::get("properties","Asset")); if ($session{form}{afterEdit}) {
$tabform->hidden({
name=>"afterEdit",
value=>$session{form}{afterEdit}
});
}
$tabform->addTab("properties",WebGUI::International::get("properties","Asset"));
$tabform->getTab("properties")->readOnly( $tabform->getTab("properties")->readOnly(
-label=>WebGUI::International::get("asset id","Asset"), -label=>WebGUI::International::get("asset id","Asset"),
-value=>$self->get("assetId") -value=>$self->get("assetId")
@ -259,7 +292,7 @@ sub getEditForm {
-value=>$self->get("synopsis"), -value=>$self->get("synopsis"),
-uiLevel=>3 -uiLevel=>3
); );
$tabform->add("privileges",WebGUI::International::get(107),6); $tabform->addTab("privileges",WebGUI::International::get(107),6);
$tabform->getTab("privileges")->dateTime( $tabform->getTab("privileges")->dateTime(
-name=>"startDate", -name=>"startDate",
-label=>WebGUI::International::get(497), -label=>WebGUI::International::get(497),
@ -287,7 +320,7 @@ sub getEditForm {
$clause = "userId=".quote($self->get("ownerUserId")); $clause = "userId=".quote($self->get("ownerUserId"));
} }
my $users = WebGUI::SQL->buildHashRef("select userId,username from users where $clause order by username"); my $users = WebGUI::SQL->buildHashRef("select userId,username from users where $clause order by username");
$tabform->getTab("privileges")->select( $tabform->getTab("privileges")->selectList(
-name=>"ownerUserId", -name=>"ownerUserId",
-options=>$users, -options=>$users,
-label=>WebGUI::International::get(108), -label=>WebGUI::International::get(108),
@ -311,6 +344,15 @@ sub getEditForm {
return $tabform; return $tabform;
} }
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/adminConsole/small/assets.gif' if ($small);
return $session{config}{extrasURL}.'/adminConsole/assets.gif';
}
sub getId { sub getId {
my $self = shift; my $self = shift;
return $self->get("assetId"); return $self->get("assetId");
@ -329,28 +371,19 @@ sub getIndexerParams {
} }
sub getName {
return WebGUI::International::get('asset','Asset');
}
sub getNextChildRank {
my $self = shift;
my ($lineage) = WebGUI::SQL->quickArray("select max(lineage) from asset where parentId=".quote($self->getId));
my $rank;
if (defined $lineage) {
$rank = $self->getRank($lineage);
$rank++;
} else {
$rank = 1;
}
return $self->formatRank($rank);
}
sub getLineage { sub getLineage {
my $self = shift; my $self = shift;
my $relatives = shift; my $relatives = shift;
my $rules = shift; my $rules = shift;
my $lineage = $self->get("lineage"); my $lineage = $self->get("lineage");
my $whereExclusion = " and state='published'";
if (exists $rules->{excludeClasses}) {
my @set;
foreach my $className (@{$rules->{excludeClasses}}) {
push(@set,"className <> ".quote($className));
}
$whereExclusion .= 'and ('.join(" and ",@set).')';
}
my $whereSiblings; my $whereSiblings;
if (isIn("siblings",@{$relatives})) { if (isIn("siblings",@{$relatives})) {
$whereSiblings = "(parentId=".quote($self->get("parentId"))." and assetId<>".quote($self->getId).")"; $whereSiblings = "(parentId=".quote($self->get("parentId"))." and assetId<>".quote($self->getId).")";
@ -379,15 +412,17 @@ sub getLineage {
if ($whereSiblings ne "" || $whereExact ne "") { if ($whereSiblings ne "" || $whereExact ne "") {
$whereDescendants = " or "; $whereDescendants = " or ";
} }
my $lineageLength = length($lineage); $whereDescendants .= "lineage like ".quote($lineage.'%')." and lineage<>".quote($lineage);
$whereDescendants .= "lineage like ".quote($lineage.'%')." and length(lineage)> ".$lineageLength; if (exists $rules->{endingLineageLength}) {
$whereDescendants .= " and length(lineage) <= ".($rules->{endingLineageLength}*6);
}
} }
my $sql = "select assetId from asset where $whereSiblings $whereExact $whereDescendants order by lineage"; my $sql = "select assetId,className from asset where $whereSiblings $whereExact $whereDescendants $whereExclusion order by lineage";
my @lineage; my @lineage;
my $sth = WebGUI::SQL->read($sql); my $sth = WebGUI::SQL->read($sql);
while (my ($assetId) = $sth->array) { while (my ($assetId,$className) = $sth->array) {
if ($rules->{returnOjbects}) { if ($rules->{returnObjects}) {
push(@lineage,WebGUI::Asset->new($assetId); push(@lineage,WebGUI::Asset->newByDynamicClass($assetId, $className));
} else { } else {
push(@lineage,$assetId); push(@lineage,$assetId);
} }
@ -396,9 +431,31 @@ sub getLineage {
return \@lineage; return \@lineage;
} }
sub getLineageLength {
my $self = shift;
return length($self->get("lineage"))/6;
}
sub getName {
return WebGUI::International::get('asset','Asset');
}
sub getNextChildRank {
my $self = shift;
my ($lineage) = WebGUI::SQL->quickArray("select max(lineage) from asset where parentId=".quote($self->getId));
my $rank;
if (defined $lineage) {
$rank = $self->getRank($lineage);
$rank++;
} else {
$rank = 1;
}
return $self->formatRank($rank);
}
sub getParent { sub getParent {
my $self = shift; my $self = shift;
return WebGUI::Asset->new($self->get("parentId")); return WebGUI::Asset->newByDynamicClass($self->get("parentId"));
} }
sub getParentLineage { sub getParentLineage {
@ -421,6 +478,12 @@ sub getUiLevel {
return 0; return 0;
} }
sub getUrl {
my $self = shift;
my $params = shift;
return WebGUI::URL::gateway($self->get("url"),$params);
}
sub getValue { sub getValue {
my $self = shift; my $self = shift;
my $key = shift; my $key = shift;
@ -437,6 +500,12 @@ sub getValue {
return undef; return undef;
} }
sub hasChildren {
my $self = shift;
my ($hasChildren) = WebGUI::SQL->read("select count(*) from asset where parentId=".quote($self->getId));
return $hasChildren;
}
sub new { sub new {
my $class = shift; my $class = shift;
my $assetId = shift; my $assetId = shift;
@ -457,23 +526,75 @@ sub new {
$sql .= " where asset.assetId=".quote($assetId); $sql .= " where asset.assetId=".quote($assetId);
$properties = WebGUI::SQL->quickHashRef($sql); $properties = WebGUI::SQL->quickHashRef($sql);
return undef unless (exists $properties->{assetId}); return undef unless (exists $properties->{assetId});
foreach my $property (keys %{$overrideProperties}) {
unless (isIn($property, qw(assetId className parentId lineage state))) {
$properties->{$property} = $overrideProperties->{$property};
}
}
} }
if (defined $overrideProperties) {
foreach my $definition (@{$class->definition}) {
foreach my $property (keys %{$definition->{properties}}) {
if (exists $overrideProperties->{$property}) {
$properties->{$property} = $overrideProperties->{$property};
}
}
}
}
if (defined $properties) { if (defined $properties) {
return bless { _properties=>$properties }, $class; my $object = { _properties => $properties };
bless $object, $class;
return $object;
} }
return undef; return undef;
} }
sub newByDynamicClass {
my $class = shift;
my $assetId = shift;
my $className = shift;
unless (defined $className) {
($className) = WebGUI::SQL->quickArray("select className from asset where assetId=".quote($assetId));
}
if ($className eq "") {
WebGUI::HTTP::setStatus('404',"Page Not Found");
WebGUI::ErrorHandler::fatalError("The page not found page doesn't exist.") if ($assetId eq $session{setting}{notFoundPage});
return WebGUI::Asset->newByDynamicClass($session{setting}{notFoundPage});
}
my $cmd = "use ".$className;
eval ($cmd);
WebGUI::ErrorHandler::fatalError("Couldn't compile asset package: ".$className.". Root cause: ".$@) if ($@);
my $assetObject = eval{$className->new($assetId)};
WebGUI::ErrorHandler::fatalError("Couldn't create asset instance for ".$assetId.". Root cause: ".$@) if ($@);
return $assetObject;
}
sub newByUrl {
my $class = shift;
my $url = shift || $session{env}{PATH_INFO};
$url = lc($url);
$url =~ s/\/$//;
$url =~ s/^\///;
$url =~ s/\'//;
$url =~ s/\"//;
my $asset;
if ($url ne "") {
$asset = WebGUI::SQL->quickHashRef("select assetId, className from asset where url=".quote($url));
return WebGUI::Asset->newByDynamicClass($asset->{assetId}, $asset->{className});
}
return $class->newByDynamicClass($session{setting}{defaultPage});
}
sub republish {
my $self = shift;
WebGUI::SQL->write("update asset set state='published' where lineage like ".quote($self->get("lineage").'%'));
$self->{_properties}{state} = "published";
}
sub paste { sub paste {
my $self = shift; my $self = shift;
my $newParentId = shift; my $assetId = shift;
if ($self->setParent($newParentId)) { my $pastedAsset = WebGUI::Asset->new($assetId);
WebGUI::SQL->write("update asset set state='published' where lineage like ".quote($self->get("lineage").'%')); if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self->getId)) {
$pastedAsset->republish;
return 1; return 1;
} }
return 0; return 0;
@ -508,6 +629,7 @@ sub setParent {
my $self = shift; my $self = shift;
my $newParentId = shift; my $newParentId = shift;
return 0 if ($newParentId eq $self->get("parentId")); # don't move it to where it already is return 0 if ($newParentId eq $self->get("parentId")); # don't move it to where it already is
return 0 if ($newParentId eq $self->getId); # don't move it to itself
my $parent = WebGUI::Asset->new($newParentId); my $parent = WebGUI::Asset->new($newParentId);
if (defined $parent) { if (defined $parent) {
my $oldLineage = $self->get("lineage"); my $oldLineage = $self->get("lineage");
@ -549,6 +671,16 @@ sub setRank {
return 1; return 1;
} }
sub setSize {
my $self = shift;
my $extra = shift;
my $sizetest;
foreach my $key (keys %{$self->get}) {
$sizetest .= $self->get($key);
}
WebGUI::SQL->write("update asset set assetSize=".(length($sizetest)+$extra)." where assetId=".quote($self->getId));
}
sub swapRank { sub swapRank {
my $self = shift; my $self = shift;
my $second = shift; my $second = shift;
@ -563,17 +695,30 @@ sub swapRank {
} }
sub trash {
my $self = shift;
WebGUI::SQL->beginTransaction;
WebGUI::SQL->write("update asset set state='limbo' where lineage like ".quote($self->get("lineage").'%'));
WebGUI::SQL->write("update asset set state='trash' where assetId=".quote($self->getId));
WebGUI::SQL->commit;
$self->{_properties}{state} = "trash";
}
sub update { sub update {
my $self = shift; my $self = shift;
my $properties = shift; my $properties = shift;
WebGUI::SQL->beginTransaction; WebGUI::SQL->beginTransaction;
foreach my $definition (@{$self->definition}) { foreach my $definition (@{$self->definition}) {
my @setPairs; my @setPairs;
if ($definition->{tableName} eq "asset") {
push(@setPairs,"lastUpdated=".time());
}
foreach my $property (keys %{$definition->{properties}}) { foreach my $property (keys %{$definition->{properties}}) {
my $value = $properties->{$property} || $definition->{properties}{$property}{defaultValue}; my $value = $properties->{$property} || $definition->{properties}{$property}{defaultValue};
if (defined $value) { if (defined $value) {
if (exists $definition->{properties}{$property}{filter}) { if (exists $definition->{properties}{$property}{filter}) {
$value = $self->$definition->{properties}{$property}{filter}($value); my $filter = $definition->{properties}{$property}{filter};
$value = $self->$filter($value);
} }
$self->{_properties}{$property} = $value; $self->{_properties}{$property} = $value;
push(@setPairs, $property."=".quote($value)); push(@setPairs, $property."=".quote($value));
@ -583,6 +728,7 @@ sub update {
WebGUI::SQL->write("update ".$definition->{tableName}." set ".join(",",@setPairs)." where assetId=".quote($self->getId)); WebGUI::SQL->write("update ".$definition->{tableName}." set ".join(",",@setPairs)." where assetId=".quote($self->getId));
} }
} }
$self->setSize;
WebGUI::SQL->commit; WebGUI::SQL->commit;
return 1; return 1;
} }
@ -596,18 +742,57 @@ sub www_copy {
return ""; return "";
} }
sub www_copyList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
my $newAsset = $self->duplicate;
$newAsset->cut;
foreach my $assetId ($session{cgi}->param("assetId")) {
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
if ($asset->canEdit) {
my $newAsset = $asset->duplicate;
$newAsset->cut;
}
}
return $self->manageAssets();
}
sub www_cut { sub www_cut {
my $self = shift; my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit; return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->cut; $self->cut;
return ""; return $self->getParent->www_view;
}
sub www_cutList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
foreach my $assetId ($session{cgi}->param("assetId")) {
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
if ($asset->canEdit) {
$asset->cut;
}
}
return $self->manageAssets();
} }
sub www_delete { sub www_delete {
my $self = shift; my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit; return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->delete; $self->trash;
return ""; return $self->getParent->www_view;
}
sub www_deleteList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
foreach my $assetId ($session{cgi}->param("assetId")) {
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
if ($asset->canEdit) {
$asset->trash;
}
}
return $self->manageAssets();
} }
sub www_demote { sub www_demote {
@ -620,7 +805,7 @@ sub www_demote {
sub www_edit { sub www_edit {
my $self = shift; my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit; return WebGUI::Privilege::insufficient() unless $self->canEdit;
return $self->getAdminConsole->render($self->getEditForm); return $self->getAdminConsole->render($self->getEditForm->print);
} }
sub www_editSave { sub www_editSave {
@ -628,7 +813,7 @@ sub www_editSave {
my %data; my %data;
foreach my $definition (@{$self->definition}) { foreach my $definition (@{$self->definition}) {
foreach my $property (keys %{$definition->{properties}}) { foreach my $property (keys %{$definition->{properties}}) {
my $data{$property} = WebGUI::FormProcessor::process( $data{$property} = WebGUI::FormProcessor::process(
$property, $property,
$definition->{properties}{fieldType}, $definition->{properties}{fieldType},
$definition->{properties}{defaultValue} $definition->{properties}{defaultValue}
@ -636,16 +821,135 @@ sub www_editSave {
} }
} }
$self->update(\%data); $self->update(\%data);
return $self->www_manageAssets if ($session{form}{afterEdit} eq "assetManager");
return ""; return "";
} }
sub www_editTree {
return "not yet implemented";
}
sub www_editTreeSave {
return "not yet implemented";
}
sub www_manageAssets {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/ActiveWidgets/runtime/styles/xp/grid.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setLink($session{config}{extrasURL}.'/assetManager/assetManager.css', {rel=>"stylesheet",type=>"text/css"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/ActiveWidgets/source/lib/grid.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Tools.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/ContextMenu.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Asset.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/Display.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/EventManager.js', {type=>"text/javascript"});
WebGUI::Style::setScript($session{config}{extrasURL}.'/assetManager/AssetManager.js', {type=>"text/javascript"});
my $children = $self->getLineage(["descendants"],{returnObjects=>1, endingLineageLength=>$self->getLineageLength+1});
my $output;
$output = '
<div id="contextMenu" class="contextMenu"></div>
<div id="propertiesWindow" class="propertiesWindow"></div>
<div id="crumbtrail"></div>
<div id="workspace" style="height: 200px;">Retrieving Assets...</div>
<div id="dragImage" class="dragIdentifier">hello</div>
';
$output .= "<script>\n";
$output .= "/* assetId, url, title */\nvar crumbtrail = [\n";
my $ancestors = $self->getLineage(["self","ancestors"],{returnObjects=>1});
foreach my $ancestor (@{$ancestors}) {
$output .= '[';
$output .= "'".$ancestor->getId."',";
$output .= "'".$ancestor->getUrl."',";
my $title = $ancestor->get("title");
$title =~ s/\'/\\\'/g;
$output .= "'".$title."'";
$output .= "],\n";
}
$output .= "];\n";
$output .= "var columnHeadings = ['Rank','Title','Type','Last Updated','Size'];\n";
$output .= "/*rank, title, type, lastUpdate, size, url, assetId, icon */\nvar assets = [\n";
foreach my $child (@{$children}) {
$output .= '[';
$output .= $child->getRank.",";
my $title = $child->get("title");
$title =~ s/\'/\\\'/g;
$output .= "'".$title."',";
$output .= "'".$child->getName."',";
$output .= "'".WebGUI::DateTime::epochToHuman($child->get("lastUpdated"))."',";
$output .= "'".formatBytes($child->get("assetSize"))."',";
#my $hasChildren = "false";
$output .= "'".$child->getUrl."',";
$output .= "'".$child->getId."',";
$output .= "'".$child->getIcon(1)."'";
#$hasChildren = "true" if ($child->hasChildren);
#$output .= $hasChildren;
$output .= "],\n";
}
$output .= "];\n var labels = new Array();\n";
$output .= "labels['edit'] = 'Edit';\n";
$output .= "labels['cut'] = 'Cut';\n";
$output .= "labels['copy'] = 'Copy';\n";
$output .= "labels['move'] = 'Move';\n";
$output .= "labels['view'] = 'View';\n";
$output .= "labels['delete'] = 'Delete';\n";
$output .= "labels['go'] = 'Go';\n";
$output .= "labels['properties'] = 'Properties';\n";
$output .= "labels['editTree'] = 'Edit Tree';\n";
$output .= "var manager = new AssetManager(assets,columnHeadings,labels,crumbtrail); manager.renderAssets();\n</script>\n";
$output .= '<div style="font-size: 18px;">'.WebGUI::International::get(1).'
<div class="adminConsoleSpacer">
&nbsp;
</div>
<div style="float: left; padding-right: 30px; font-size: 14px;"><b>'.WebGUI::International::get(1083).'</b><br />';
foreach my $link (@{$self->getAssetAdderLinks}) {
$output .= '<a href="'.$link->{url}.'">'.$link->{label}.'</a><br />';
}
$output .= '</div>';
my $clipboard = WebGUI::Clipboard::getAssetsInClipboard();
my %options;
tie %options, 'Tie::IxHash';
my $hasClips = 0;
foreach my $item (@{$clipboard}) {
$options{$item->{assetId}} = $item->{title};
$hasClips = 1;
}
if ($hasClips) {
$output .= '<div style="float: left; padding-right: 30px; font-size: 14px;"><b>'.WebGUI::International::get(1082).'</b><br />'
.WebGUI::Form::formHeader()
.WebGUI::Form::hidden({name=>"func",value=>"pasteList"})
.WebGUI::Form::checkList({name=>"assetId",options=>\%options})
.'<br />'
.WebGUI::Form::submit({value=>"Paste"})
.WebGUI::Form::formFooter()
.' </div> ';
}
$output .= '
<div class="adminConsoleSpacer">
&nbsp;
</div>
</div>
';
return $self->getAdminConsole->render($output);
}
sub www_paste { sub www_paste {
my $self = shift; my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit; return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->paste($session{form}{newParentId}); $self->paste($session{form}{assetId});
return ""; return "";
} }
sub www_pasteList {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
foreach my $clipId ($session{cgi}->param("assetId")) {
$self->paste($clipId);
}
return $self->manageAssets();
}
sub www_promote { sub www_promote {
my $self = shift; my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit; return WebGUI::Privilege::insufficient() unless $self->canEdit;
@ -653,10 +957,29 @@ sub www_promote {
return ""; return "";
} }
sub www_view { sub www_setParent {
my $self = shift; my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit; return WebGUI::Privilege::insufficient() unless $self->canEdit;
return "No view has been defined for this asset."; my $newParent = shift;
$self->setParent($newParent) if (defined $newParent);
return $self->www_manageAssets();
} }
sub www_setRank {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
my $newRank = $session{form}{rank};
$self->setRank($newRank) if (defined $newRank);
return $self->www_manageAssets();
}
sub www_view {
my $self = shift;
return WebGUI::Privilege::noAccess() unless $self->canView;
return "No view has been implemented for this asset.";
}
1; 1;

View file

@ -108,6 +108,18 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
if ($small) {
my $storage = WebGUI::Storage->new($self->get("storageId"));
return $storage->getFileIconUrl($self->get("filename"));
}
return $session{config}{extrasURL}.'/assets/file.gif';
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getName =head2 getName
@ -151,26 +163,26 @@ Gathers data from www_edit and persists it.
sub www_editSave { sub www_editSave {
my $self = shift; my $self = shift;
$self->SUPER::www_editSave(); my $output = $self->SUPER::www_editSave();
my $storage = WebGUI::Storage->create; my $storage = WebGUI::Storage->create;
my $filename = $storage->addFileFromFormPost("file"); my $filename = $storage->addFileFromFormPost("file");
if (defined $filename) { if (defined $filename) {
my $oldVersions; my $oldVersions;
if ($self->get($filename)) { # do file versioning if ($self->get($filename)) { # do file versioning
my @old = split("\n",$self->get("olderVersions")); my @old = split("\n",$self->get("olderVersions"));
push(@old,$self->get{"storageId")."|".$self->get("filename")); push(@old,$self->get("storageId")."|".$self->get("filename"));
$oldVersions = join("\n",@old); $oldVersions = join("\n",@old);
} }
$self->update({ $self->update({
filename=>$filename, filename=>$filename,
storageId=>$storage->getId, storageId=>$storage->getId,
fileSize=>$storage->getFileSize,
olderVersions=>$oldVersions olderVersions=>$oldVersions
}); });
$self->setSize($storage->getFileSize($filename));
} else { } else {
$storage->delete; $storage->delete;
} }
return ""; return $output;
} }

View file

@ -98,16 +98,16 @@ sub generateThumbnail {
} }
if ($self->getValue("filename") && $hasImageMagick) { if ($self->getValue("filename") && $hasImageMagick) {
my $storage = WebGUI::Storage->new($self->get("storageId")); my $storage = WebGUI::Storage->new($self->get("storageId"));
$image = Image::Magick->new; my $image = Image::Magick->new;
$error = $image->Read($storage->getPath($storage->get("filename"))); my $error = $image->Read($storage->getPath($storage->get("filename")));
if ($error) { if ($error) {
$self->_addError("Couldn't read image for thumnail creation: ".$error); $self->_addError("Couldn't read image for thumnail creation: ".$error);
return 0; return 0;
} }
($x, $y) = $image->Get('width','height'); my ($x, $y) = $image->Get('width','height');
$n = $self->get("thumbnailSize"); my $n = $self->get("thumbnailSize");
if ($x > $n || $y > $n) { if ($x > $n || $y > $n) {
$r = $x>$y ? $x / $n : $y / $n; my $r = $x>$y ? $x / $n : $y / $n;
$image->Scale(width=>($x/$r),height=>($y/$r)); $image->Scale(width=>($x/$r),height=>($y/$r));
} }
if (isIn($storage->getFileExtension($self->get("filename")), qw(tif tiff bmp))) { if (isIn($storage->getFileExtension($self->get("filename")), qw(tif tiff bmp))) {
@ -152,6 +152,15 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/image.gif' unless ($small);
$self->SUPER::getIcon(1);
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getName =head2 getName

View file

@ -92,6 +92,15 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/redirect.gif' if ($small);
return $session{config}{extrasURL}.'/assets/redirect.gif';
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getUiLevel () =head2 getUiLevel ()

View file

@ -18,6 +18,7 @@ use CGI::Util qw(rearrange);
use DBI; use DBI;
use strict qw(subs vars); use strict qw(subs vars);
use Tie::IxHash; use Tie::IxHash;
use WebGUI::Asset;
use WebGUI::AdminConsole; use WebGUI::AdminConsole;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::FormProcessor; use WebGUI::FormProcessor;
@ -32,6 +33,7 @@ use WebGUI::Node;
use WebGUI::Page; use WebGUI::Page;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::Style;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::TabForm; use WebGUI::TabForm;
use WebGUI::Template; use WebGUI::Template;
@ -40,9 +42,11 @@ use WebGUI::Utility;
use WebGUI::MetaData; use WebGUI::MetaData;
use WebGUI::Wobject::WobjectProxy; use WebGUI::Wobject::WobjectProxy;
our @ISA = qw(WebGUI::Asset);
=head1 NAME =head1 NAME
Package WebGUI::Wobject Package WebGUI::Asset::Wobject
=head1 DESCRIPTION =head1 DESCRIPTION
@ -83,7 +87,19 @@ sub definition {
cacheTimeoutVisitor=>{ cacheTimeoutVisitor=>{
fieldType=>'interval', fieldType=>'interval',
defaultValue=>600 defaultValue=>600
} },
templateId=>{
fieldType=>'template',
defaultValue=>undef
},
styleTemplateId=>{
fieldType=>'template',
defaultValue=>undef
},
printableStyleTemplateId=>{
fieldType=>'template',
defaultValue=>undef
}
} }
}); });
return $class->SUPER::definition($definition); return $class->SUPER::definition($definition);
@ -115,7 +131,7 @@ A comparison expression to be used when checking whether the action should be al
sub confirm { sub confirm {
return WebGUI::Privilege::vitalComponent() if ($_[4]); return WebGUI::Privilege::vitalComponent() if ($_[4]);
my $noURL = $_[3] || WebGUI::URL::page(); my $noURL = $_[3] || $_[0]->getUrl;
my $output = '<h1>'.WebGUI::International::get(42).'</h1>'; my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
$output .= $_[1].'<p>'; $output .= $_[1].'<p>';
$output .= '<div align="center"><a href="'.$_[2].'">'.WebGUI::International::get(44).'</a>'; $output .= '<div align="center"><a href="'.$_[2].'">'.WebGUI::International::get(44).'</a>';
@ -174,24 +190,24 @@ sub getEditForm {
$tabform->getTab("layout")->template( $tabform->getTab("layout")->template(
-name=>"styleTemplateId", -name=>"styleTemplateId",
-label=>WebGUI::International::get(1073), -label=>WebGUI::International::get(1073),
-value=>($page{styleId} || 2), -value=>$self->getValue("styleTemplateId"),
-namespace=>'style', -namespace=>'style',
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp} -afterEdit=>'op=editPage&amp;npp='.$session{form}{npp}
); );
$tabform->getTab("layout")->template( $tabform->getTab("layout")->template(
-name=>"printableStyleTemplateId", -name=>"printableStyleTemplateId",
-label=>WebGUI::International::get(1079), -label=>WebGUI::International::get(1079),
-value=>($page{printableStyleId} || 3), -value=>$self->getValue("printableStyleTemplateId"),
-namespace=>'style', -namespace=>'style',
-afterEdit=>'op=editPage&amp;npp='.$session{form}{npp} -afterEdit=>'op=editPage&amp;npp='.$session{form}{npp}
); );
if ($childCount) { # if ($childCount) {
$tabform->getTab("layout")->yesNo( $tabform->getTab("layout")->yesNo(
-name=>"recurseStyle", -name=>"recurseStyle",
-subtext=>' &nbsp; '.WebGUI::International::get(106), -subtext=>' &nbsp; '.WebGUI::International::get(106),
-uiLevel=>9 -uiLevel=>9
); );
} # }
$tabform->getTab("properties")->HTMLArea( $tabform->getTab("properties")->HTMLArea(
-name=>"description", -name=>"description",
-label=>WebGUI::International::get(85), -label=>WebGUI::International::get(85),
@ -209,6 +225,7 @@ sub getEditForm {
-value=>$self->getValue("cacheTimeoutVisitor"), -value=>$self->getValue("cacheTimeoutVisitor"),
-uiLevel=>8 -uiLevel=>8
); );
return $tabform;
} }
@ -237,7 +254,20 @@ Logs the view of the wobject to the passive profiling mechanism.
sub logView { sub logView {
my $self = shift; my $self = shift;
WebGUI::PassiveProfiling::add($self->get("assetId")); if ($session{setting}{passiveProfilingEnabled}) {
WebGUI::PassiveProfiling::add($self->get("assetId"));
# not sure what this will do in the new model
# WebGUI::PassiveProfiling::addPage(); # add wobjects on asset to passive profile log
}
# disabled for the time being because it's dangerous
# if ($session{form}{op} eq "" && $session{setting}{trackPageStatistics} && $session{form}{wid} ne "new") {
# WebGUI::SQL->write("insert into pageStatistics (dateStamp, userId, username, ipAddress, userAgent, referer,
# assetId, assetTitle, wobjectId, wobjectFunction) values (".time().",".quote($session{user}{userId})
# .",".quote($session{user}{username}).",
# ".quote($session{env}{REMOTE_ADDR}).", ".quote($session{env}{HTTP_USER_AGENT}).",
# ".quote($session{env}{HTTP_REFERER}).", ".quote($session{asset}{assetId}).",
# ".quote($session{asset}{title}).", ".quote($session{form}{wid}).", ".quote($session{form}{func}).")");
# }
return; return;
} }
@ -261,16 +291,10 @@ sub processMacros {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 processTemplate ( templateId, vars [ , namespace ] ) =head2 processTemplate ( vars, namespace [ , templateId ] )
Returns the content generated from this template. Returns the content generated from this template.
B<NOTE:> Only for use in wobjects that support templates.
=head3 templateId
An id referring to a particular template in the templates table.
=head3 hashRef =head3 hashRef
A hash reference containing variables and loops to pass to the template engine. A hash reference containing variables and loops to pass to the template engine.
@ -279,27 +303,41 @@ A hash reference containing variables and loops to pass to the template engine.
A namespace to use for the template. Defaults to the wobject's namespace. A namespace to use for the template. Defaults to the wobject's namespace.
=head3 templateId
An id referring to a particular template in the templates table. Defaults to $self->get("templateId").
=cut =cut
sub processTemplate { sub processTemplate {
my $self = shift; my $self = shift;
my $templateId = shift;
my $var = shift; my $var = shift;
my $namespace = shift || $self->get("namespace"); my $namespace = shift;
if ($self->{_useMetaData}) { my $templateId = shift || $self->get("templateId");
my $meta = WebGUI::MetaData::getMetaDataFields($self->get("wobjectId")); my $meta = WebGUI::MetaData::getMetaDataFields($self->get("wobjectId"));
foreach my $field (keys %$meta) { foreach my $field (keys %$meta) {
$var->{$meta->{$field}{fieldName}} = $meta->{$field}{value}; $var->{$meta->{$field}{fieldName}} = $meta->{$field}{value};
}
} }
my $wobjectToolbar = deleteIcon('func=delete',$self->get("url"),WebGUI::International::get(43))
.editIcon('func=edit',$self->get("url"))
.moveUpIcon('func=promote',$self->get("url"))
.moveDownIcon('func=demote',$self->get("url"))
# .moveTopIcon('func=moveTop&wid='.${$wobject}{wobjectId})
# .moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId})
.cutIcon('func=cut',$self->get("url"))
.copyIcon('func=copy',$self->get("url"));
# if (${$wobject}{namespace} ne "WobjectProxy" && isIn("WobjectProxy",@{$session{config}{wobjects}})) {
# $wobjectToolbar .= shortcutIcon('func=createShortcut');
#}
$var->{'controls'} = $wobjectToolbar;
my %vars = ( my %vars = (
%{$self->{_property}}, %{$self->{_properties}},
%{$var} %{$var}
); );
if (defined $self->get("_WobjectProxy")) { if (defined $self->get("_WobjectProxy")) {
$vars{isShortcut} = 1; $vars{isShortcut} = 1;
my ($originalPageURL) = WebGUI::SQL->quickArray("select urlizedTitle from page where pageId=".quote($self->get("pageId")),WebGUI::SQL->getSlave); my ($originalPageURL) = WebGUI::SQL->quickArray("select url from asset where assetId=".quote($self->getId),WebGUI::SQL->getSlave);
$vars{originalURL} = WebGUI::URL::gateway($originalPageURL."#".$self->get("wobjectId")); $vars{originalURL} = WebGUI::URL::gateway($originalPageURL."#".$self->getId);
} }
return WebGUI::Template::process($templateId,$namespace, \%vars); return WebGUI::Template::process($templateId,$namespace, \%vars);
} }
@ -320,6 +358,14 @@ sub purge {
#-------------------------------------------------------------------
sub view {
my $self = shift;
return "No view has been created for this wobject.";
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 www_createShortcut ( ) =head2 www_createShortcut ( )
@ -360,12 +406,47 @@ B<NOTE:> This method should only need to be extended if you need to do some spec
sub www_editSave { sub www_editSave {
my $self = shift; my $self = shift;
$self->SUPER::www_editSave(); my $output = $self->SUPER::www_editSave();
WebGUI::MetaData::metaDataSave($self->getId); WebGUI::MetaData::metaDataSave($self->getId);
return ""; return $output;
} }
#-------------------------------------------------------------------
sub www_view {
my $self = shift;
$self->logView();
return WebGUI::Privilege::noAccess() unless $self->canView;
my $cache;
my $output;
my $useCache = (
$session{form}{op} eq "" &&
(
( $self->get("cacheTimeout") > 10 && $session{user}{userId} !=1) ||
( $self->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} == 1)
) &&
not $session{var}{adminOn}
);
# if ($useCache) {
# $cache = WebGUI::Cache->new("asset_".$self->getId."_".$session{user}{userId});
# $output = $cache->get;
# }
unless ($output) {
$output = $self->view;
my $ttl;
if ($session{user}{userId} == 1) {
$ttl = $self->get("cacheTimeoutVisitor");
} else {
$ttl = $self->get("cacheTimeout");
}
# $cache->set($output, $ttl) if ($useCache && !WebGUI::HTTP::isRedirect());
}
return WebGUI::Style::process($output,$self->get("styleTemplateId"));
}
1; 1;

View file

@ -22,8 +22,7 @@ use WebGUI::International;
use WebGUI::Paginator; use WebGUI::Paginator;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::URL; use WebGUI::Asset::Wobject;
use WebGUI::Wobject;
our @ISA = qw(WebGUI::Asset::Wobject); our @ISA = qw(WebGUI::Asset::Wobject);
@ -61,21 +60,21 @@ sub getEditForm {
my $tabform = $self->SUPER::getEditForm(); my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("properties")->text( $tabform->getTab("properties")->text(
-name=>"linkTitle", -name=>"linkTitle",
-label=>WebGUI::International::get(7,$self->get("namespace")), -label=>WebGUI::International::get(7,"Article"),
-value=>$self->getValue("linkTitle"), -value=>$self->getValue("linkTitle"),
-uiLevel=>3 -uiLevel=>3
); );
$tabform->getTab("properties")->url( $tabform->getTab("properties")->url(
-name=>"linkURL", -name=>"linkURL",
-label=>WebGUI::International::get(8,$self->get("namespace")), -label=>WebGUI::International::get(8,"Article"),
-value=>$self->getValue("linkURL"), -value=>$self->getValue("linkURL"),
-uiLevel=>3 -uiLevel=>3
); );
$tabform->getTab("layout")->yesNo( $tabform->getTab("layout")->yesNo(
-name=>"convertCarriageReturns", -name=>"convertCarriageReturns",
-label=>WebGUI::International::get(10,$_[0]->get("namespace")), -label=>WebGUI::International::get(10,"Article"),
-value=>$_[0]->getValue("convertCarriageReturns"), -value=>$self->getValue("convertCarriageReturns"),
-subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,$_[0]->get("namespace")).'</span>', -subtext=>' &nbsp; <span style="font-size: 8pt;">'.WebGUI::International::get(11,"Article").'</span>',
-uiLevel=>5, -uiLevel=>5,
-defaultValue=>0 -defaultValue=>0
); );
@ -83,6 +82,15 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getIcon {
my $self = shift;
my $small = shift;
return $session{config}{extrasURL}.'/assets/small/article.gif' if ($small);
return $session{config}{extrasURL}.'/assets/article.gif';
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getName { sub getName {
return WebGUI::International::get(1,"Article"); return WebGUI::International::get(1,"Article");
@ -90,31 +98,8 @@ sub getName {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_edit { sub view {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("article add/edit");
return $self->getAdminConsole->render($self->getEditForm,WebGUI::International::get("12","Article"));
}
#-------------------------------------------------------------------
sub www_editSave {
my ($image, $attachment, %property);
$_[0]->SUPER::www_editSave() if ($_[0]->get("wobjectId") eq "new");
$image = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
$image->save("image");
$attachment = WebGUI::Attachment->new("",$_[0]->get("wobjectId"));
$attachment->save("attachment");
$property{image} = $image->getFilename if ($image->getFilename ne "");
$property{attachment} = $attachment->getFilename if ($attachment->getFilename ne "");
return $_[0]->SUPER::www_editSave(\%property);
}
#-------------------------------------------------------------------
sub www_view {
my $self = shift; my $self = shift;
$self->logView() if ($session{setting}{passiveProfilingEnabled});
my ($file, %var); my ($file, %var);
if ($self->get("image") ne "") { if ($self->get("image") ne "") {
$file = WebGUI::Attachment->new($self->get("image"),$self->get("wobjectId")); $file = WebGUI::Attachment->new($self->get("image"),$self->get("wobjectId"));
@ -125,7 +110,7 @@ sub www_view {
if ($self->get("convertCarriageReturns")) { if ($self->get("convertCarriageReturns")) {
$var{description} =~ s/\n/\<br\>\n/g; $var{description} =~ s/\n/\<br\>\n/g;
} }
$var{"new.template"} = WebGUI::URL::page("wid=".$self->get("wobjectId")."&func=view")."&overrideTemplateId="; $var{"new.template"} = $self->getUrl("wid=".$self->get("wobjectId")."&func=view")."&overrideTemplateId=";
$var{"description.full"} = $var{description}; $var{"description.full"} = $var{description};
$var{"description.full"} =~ s/\^\-\;//g; $var{"description.full"} =~ s/\^\-\;//g;
$var{"description.first.100words"} = $var{"description.full"}; $var{"description.first.100words"} = $var{"description.full"};
@ -150,7 +135,7 @@ sub www_view {
$var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s; $var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s;
$var{"description.first.sentence"} = $var{"description.first.2sentences"}; $var{"description.first.sentence"} = $var{"description.first.2sentences"};
$var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s; $var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s;
my $p = WebGUI::Paginator->new(WebGUI::URL::page("wid=".$self->get("wobjectId")."&func=view"),1); my $p = WebGUI::Paginator->new($self->getUrl("wid=".$self->get("wobjectId")."&func=view"),1);
if ($session{form}{makePrintable} || $var{description} eq "") { if ($session{form}{makePrintable} || $var{description} eq "") {
$var{description} =~ s/\^\-\;//g; $var{description} =~ s/\^\-\;//g;
$p->setDataByArrayRef([$var{description}]); $p->setDataByArrayRef([$var{description}]);
@ -167,7 +152,7 @@ sub www_view {
$var{"attachment.url"} = $file->getURL; $var{"attachment.url"} = $file->getURL;
$var{"attachment.name"} = $file->getFilename; $var{"attachment.name"} = $file->getFilename;
} }
my $callback = WebGUI::URL::page("func=view&amp;wid=".$self->get("wobjectId")); my $callback = $self->getUrl("func=view&amp;wid=".$self->get("wobjectId"));
if ($self->get("allowDiscussion")) { if ($self->get("allowDiscussion")) {
my $forum = WebGUI::Forum->new($self->get("forumId")); my $forum = WebGUI::Forum->new($self->get("forumId"));
$var{"replies.count"} = ($forum->get("replies") + $forum->get("threads")); $var{"replies.count"} = ($forum->get("replies") + $forum->get("threads"));
@ -188,10 +173,20 @@ sub www_view {
forumId=>$self->get("forumId") forumId=>$self->get("forumId")
}); });
} else { } else {
return $self->processTemplate($templateId,\%var); return $self->processTemplate(\%var, "Article", $templateId);
} }
} }
#-------------------------------------------------------------------
sub www_edit {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
$self->getAdminConsole->setHelp("article add/edit");
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get("12","Article"));
}
1; 1;

View file

@ -101,7 +101,7 @@ The URL to any page. Defaults to the current page.
sub copyIcon { sub copyIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'copy.gif" align="middle" border="0" alt="Copy" title="Copy" /></a>'; $output .= '<img src="'._getBaseURL().'copy.gif" align="middle" border="0" alt="Copy" title="Copy" /></a>';
return $output; return $output;
@ -125,7 +125,7 @@ The URL to any page. Defaults to the current page.
sub cutIcon { sub cutIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'cut.gif" align="middle" border="0" alt="Cut" title="Cut" /></a>'; $output .= '<img src="'._getBaseURL().'cut.gif" align="middle" border="0" alt="Cut" title="Cut" /></a>';
return $output; return $output;
@ -158,7 +158,7 @@ sub deleteIcon {
$confirmText = qq| onclick="return confirm('$confirmText')" |; $confirmText = qq| onclick="return confirm('$confirmText')" |;
} }
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'" '.$confirmText.'>'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'" '.$confirmText.'>';
$output .= '<img src="'._getBaseURL().'delete.gif" align="middle" border="0" alt="Delete" title="Delete" /></a>'; $output .= '<img src="'._getBaseURL().'delete.gif" align="middle" border="0" alt="Delete" title="Delete" /></a>';
@ -195,7 +195,7 @@ The URL to any page. Defaults to the current page.
sub editIcon { sub editIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'edit.gif" align="middle" border="0" alt="Edit" title="Edit" /></a>'; $output .= '<img src="'._getBaseURL().'edit.gif" align="middle" border="0" alt="Edit" title="Edit" /></a>';
return $output; return $output;
@ -219,7 +219,7 @@ The URL to any page. Defaults to the current page.
sub exportIcon { sub exportIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
# TODO Change icon to Jeffs export icon # TODO Change icon to Jeffs export icon
$output .= '<img src="'._getBaseURL().'export.gif" align="middle" border="0" alt="Export" title="Export" /></a>'; $output .= '<img src="'._getBaseURL().'export.gif" align="middle" border="0" alt="Export" title="Export" /></a>';
@ -292,7 +292,7 @@ The URL to any page. Defaults to the current page.
sub manageIcon { sub manageIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'manage.gif" align="middle" border="0" alt="Manage" title="Manage" /></a>'; $output .= '<img src="'._getBaseURL().'manage.gif" align="middle" border="0" alt="Manage" title="Manage" /></a>';
return $output; return $output;
@ -316,7 +316,7 @@ The URL to any page. Defaults to the current page.
sub moveBottomIcon { sub moveBottomIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'moveBottom.gif" align="middle" border="0" alt="Move To Bottom" title="Move To Bottom" /></a>'; $output .= '<img src="'._getBaseURL().'moveBottom.gif" align="middle" border="0" alt="Move To Bottom" title="Move To Bottom" /></a>';
return $output; return $output;
@ -340,7 +340,7 @@ The URL to any page. Defaults to the current page.
sub moveDownIcon { sub moveDownIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'moveDown.gif" align="middle" border="0" alt="Move Down" title="Move Down" /></a>'; $output .= '<img src="'._getBaseURL().'moveDown.gif" align="middle" border="0" alt="Move Down" title="Move Down" /></a>';
return $output; return $output;
@ -364,7 +364,7 @@ The URL to any page. Defaults to the current page.
sub moveLeftIcon { sub moveLeftIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'moveLeft.gif" align="middle" border="0" alt="Move Left" title="Move Left" /></a>'; $output .= '<img src="'._getBaseURL().'moveLeft.gif" align="middle" border="0" alt="Move Left" title="Move Left" /></a>';
return $output; return $output;
@ -388,7 +388,7 @@ The URL to any page. Defaults to the current page.
sub moveRightIcon { sub moveRightIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'moveRight.gif" align="middle" border="0" alt="Move Right" title="Move Right" /></a>'; $output .= '<img src="'._getBaseURL().'moveRight.gif" align="middle" border="0" alt="Move Right" title="Move Right" /></a>';
return $output; return $output;
@ -412,7 +412,7 @@ The URL to any page. Defaults to the current page.
sub moveTopIcon { sub moveTopIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'moveTop.gif" align="middle" border="0" alt="Move To Top" title="Move To Top" /></a>'; $output .= '<img src="'._getBaseURL().'moveTop.gif" align="middle" border="0" alt="Move To Top" title="Move To Top" /></a>';
return $output; return $output;
@ -436,7 +436,7 @@ The URL to any page. Defaults to the current page.
sub moveUpIcon { sub moveUpIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'moveUp.gif" align="middle" border="0" alt="Move Up" title="Move Up" /></a>'; $output .= '<img src="'._getBaseURL().'moveUp.gif" align="middle" border="0" alt="Move Up" title="Move Up" /></a>';
return $output; return $output;
@ -472,7 +472,7 @@ The URL to any page. Defaults to the current page.
sub pasteIcon { sub pasteIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'paste.gif" align="middle" border="0" alt="Paste" title="Paste" /></a>'; $output .= '<img src="'._getBaseURL().'paste.gif" align="middle" border="0" alt="Paste" title="Paste" /></a>';
return $output; return $output;
@ -496,7 +496,7 @@ The URL to any page. Defaults to the current page.
sub shortcutIcon { sub shortcutIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'shortcut.gif" align="middle" border="0" alt="Shortcut" title="Create Shortcut" /></a>'; $output .= '<img src="'._getBaseURL().'shortcut.gif" align="middle" border="0" alt="Shortcut" title="Create Shortcut" /></a>';
return $output; return $output;
@ -520,7 +520,7 @@ The URL to any page. Defaults to the current page.
sub viewIcon { sub viewIcon {
my ($output, $pageURL); my ($output, $pageURL);
$pageURL = $_[1] || $session{page}{urlizedTitle}; $pageURL = $_[1] || $session{env}{PATH_INFO};
$output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">'; $output = '<a href="'.WebGUI::URL::gateway($pageURL,$_[0]).'">';
$output .= '<img src="'._getBaseURL().'view.gif" align="middle" border="0" alt="View" title="View" /></a>'; $output .= '<img src="'._getBaseURL().'view.gif" align="middle" border="0" alt="View" title="View" /></a>';
return $output; return $output;

View file

@ -14,6 +14,7 @@ use strict qw(refs vars);
use Tie::CPHash; use Tie::CPHash;
use Tie::IxHash; use Tie::IxHash;
use WebGUI::AdminConsole; use WebGUI::AdminConsole;
use WebGUI::Clipboard;
use WebGUI::Grouping; use WebGUI::Grouping;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro; use WebGUI::Macro;
@ -37,18 +38,18 @@ sub process {
$var{'packages.label'} = WebGUI::International::get(376); $var{'packages.label'} = WebGUI::International::get(376);
my @packages; my @packages;
my $i; my $i;
my $sth = WebGUI::SQL->read("select pageId,title from page where parentId='5'"); # my $sth = WebGUI::SQL->read("select pageId,title from page where parentId='5'");
while (my %data = $sth->hash) { # while (my %data = $sth->hash) {
$data{title} =~ s/'//g; # $data{title} =~ s/'//g;
push(@packages, { # push(@packages, {
'package.url'=>WebGUI::URL::page('op=deployPackage&pid='.$data{pageId}), # 'package.url'=>WebGUI::URL::page('op=deployPackage&pid='.$data{pageId}),
'package.label'=>$data{title}, # 'package.label'=>$data{title},
'package.count'=>$i # 'package.count'=>$i
}); # });
$i++; # $i++;
} # }
$sth->finish; # $sth->finish;
$var{package_loop} = \@packages; # $var{package_loop} = \@packages;
#--contenttypes adder #--contenttypes adder
$var{'contentTypes.label'} = WebGUI::International::get(1083); $var{'contentTypes.label'} = WebGUI::International::get(1083);
foreach my $namespace (@{$session{config}{wobjects}}) { foreach my $namespace (@{$session{config}{wobjects}}) {
@ -81,64 +82,18 @@ sub process {
$var{'addpage.label'} = WebGUI::International::get(2); $var{'addpage.label'} = WebGUI::International::get(2);
#--clipboard paster #--clipboard paster
$var{'clipboard.label'} = WebGUI::International::get(1082); $var{'clipboard.label'} = WebGUI::International::get(1082);
%hash2 = (); my $clipboard = WebGUI::Clipboard::getAssetsInClipboard();
foreach my $item (@{$clipboard}) {
# get pages and store in array of arrays in order to integrate with wobjects and sort by buffer date my $title = $item->{title};
if ($session{setting}{sharedClipboard} eq "1") { $title =~ s/'//g; # stops it from breaking the javascript menus
$query = "select bufferDate,pageId,title from page where parentId='2' order by bufferDate"; push(@{$var{clipboard_loop}}, {
} else { 'clipboard.label'=>$title,
$query = "select bufferDate,pageId,title from page where parentId='2' " 'clipboard.url'=>WebGUI::URL::page("func=paste&assetId=".$item->{assetId})
." and bufferUserId=".quote($session{user}{userId})
." order by bufferDate";
}
$r = WebGUI::SQL->read($query);
while (%cphash = $r->hash) {
$cphash{title} =~ s/'//g;
push @item, [ $cphash{bufferDate},
WebGUI::URL::page('op=pastePage&pageId='.$cphash{pageId}),
$cphash{title} . ' ('. WebGUI::International::get(2) .')' ];
}
$r->finish;
# get wobjects and store in array of arrays in order to integrate with pages and sort by buffer date
if ($session{setting}{sharedClipboard} eq "1") {
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId='2' "
." order by bufferDate";
} else {
$query = "select bufferDate,wobjectId,title,namespace from wobject where pageId='2' "
." and bufferUserId=".quote($session{user}{userId})
." order by bufferDate";
}
$r = WebGUI::SQL->read($query);
while (%cphash = $r->hash) {
$cphash{title} =~ s/'//g;
push @item, [ $cphash{bufferDate},
WebGUI::URL::page('func=paste&wid='.$cphash{wobjectId}),
$cphash{title} . ' ('. $cphash{namespace} .')' ];
}
$r->finish;
# Reverse sort by bufferDate and and create hash from list values
my @sorted_item = sort {$b->[0] <=> $a->[0]} @item;
@item = ();
for $i ( 0 .. $#sorted_item ) {
$hash2{ $sorted_item[$i][1] } = $sorted_item[$i][2];
}
@sorted_item = ();
my @clipboard;
$i = 0;
foreach my $key (keys %hash2) {
push(@clipboard,{
'clipboard.url'=>$key,
'clipboard.label'=>$hash2{$key},
'clipboard.count'=>$i
}); });
$i++;
} }
$var{'clipboard_loop'} = \@clipboard;
#--admin functions #--admin functions
%hash = ( %hash = (
'http://validator.w3.org/check?uri='.WebGUI::URL::escape(WebGUI::URL::page())=>WebGUI::International::get(399), 'http://validator.w3.org/check?uri=referer'=>WebGUI::International::get(399),
); );
my $acParams = WebGUI::AdminConsole->getAdminConsoleParams; my $acParams = WebGUI::AdminConsole->getAdminConsoleParams;
$hash{$acParams->{url}} = $acParams->{title} if ($acParams->{canUse}); $hash{$acParams->{url}} = $acParams->{title} if ($acParams->{canUse});

View file

@ -22,9 +22,9 @@ use WebGUI::URL;
sub process { sub process {
if (WebGUI::Grouping::isInGroup(12)) { if (WebGUI::Grouping::isInGroup(12)) {
my %var; my %var;
my @param = WebGUI::Macro::getParams($_[0]); my ($turnOn,$turnOff,$templateName) = WebGUI::Macro::getParams($_[0]);
my $turnOn = $param[0] || WebGUI::International::get(516); $turnOn |= WebGUI::International::get(516);
my $turnOff = $param[1] || WebGUI::International::get(517); $turnOff |= WebGUI::International::get(517);
if ($session{var}{adminOn}) { if ($session{var}{adminOn}) {
$var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin'); $var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin');
$var{'toggle.text'} = $turnOff; $var{'toggle.text'} = $turnOff;
@ -32,7 +32,7 @@ sub process {
$var{'toggle.url'} = WebGUI::URL::page('op=switchOnAdmin'); $var{'toggle.url'} = WebGUI::URL::page('op=switchOnAdmin');
$var{'toggle.text'} = $turnOn; $var{'toggle.text'} = $turnOn;
} }
return WebGUI::Template::process(WebGUI::Template::getIdByName($param[2],"Macro/AdminToggle"),"Macro/AdminToggle",\%var); return WebGUI::Template::process(WebGUI::Template::getIdByName($templateName,"Macro/AdminToggle")||1,"Macro/AdminToggle",\%var);
} }
return ""; return "";
} }

View file

@ -16,7 +16,9 @@ use WebGUI::URL;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub process { sub process {
return WebGUI::URL::getScriptURL().$session{page}{urlizedTitle}; my $pathinfo = $session{env}{PATH_INFO};
$pathinfo =~ s/^\/(.*)/$1/;
return WebGUI::URL::getScriptURL().$pathinfo;
} }

View file

@ -23,7 +23,7 @@ sub process {
if ($session{setting}{defaultPage} eq $session{page}{pageId}) { if ($session{setting}{defaultPage} eq $session{page}{pageId}) {
$temp = $session{page}{urlizedTitle}; $temp = $session{page}{urlizedTitle};
} else { } else {
($temp) = WebGUI::SQL->quickArray("select urlizedTitle from page where pageId=".quote($session{setting}{defaultPage}),WebGUI::SQL->getSlave); ($temp) = WebGUI::SQL->quickArray("select url from asset where assetId=".quote($session{setting}{defaultPage}),WebGUI::SQL->getSlave);
} }
$temp = WebGUI::URL::gateway($temp); $temp = WebGUI::URL::gateway($temp);
if ($param[0] ne "linkonly") { if ($param[0] ne "linkonly") {

View file

@ -32,7 +32,7 @@ sub process {
$var{'toggle.url'} = WebGUI::URL::page('op=logout'); $var{'toggle.url'} = WebGUI::URL::page('op=logout');
$var{'toggle.text'} = $logout; $var{'toggle.text'} = $logout;
} }
return WebGUI::Template::process(WebGUI::Template::getIdByName($param[3],"Macro/LoginToggle"), "Macro/LoginToggle", \%var); return WebGUI::Template::process(WebGUI::Template::getIdByName($param[3],"Macro/LoginToggle")||1, "Macro/LoginToggle", \%var);
} }

View file

@ -217,7 +217,6 @@ sub buildHashRef {
%hash = $_[0]->buildHash($_[1],$_[2]); %hash = $_[0]->buildHash($_[1],$_[2]);
return \%hash; return \%hash;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -88,7 +88,7 @@ The error message to add to the object.
sub _addError { sub _addError {
my $self = shift; my $self = shift;
my $errorMessage = shift; my $errorMessage = shift;
push(@$self->{_errors},$errorMessage); push(@{$self->{_errors}},$errorMessage);
WebGUI::ErrorHandler::warn($errorMessage); WebGUI::ErrorHandler::warn($errorMessage);
} }
@ -375,7 +375,7 @@ sub get {
my $class = shift; my $class = shift;
my $id = shift; my $id = shift;
my $parts = _getStorageParts($id); my $parts = _getStorageParts($id);
bless {_id => $id, _part1 => $part->[0], _part2 => $part->[1]}, $class; bless {_id => $id, _part1 => $parts->[0], _part2 => $parts->[1]}, $class;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -473,18 +473,8 @@ Returns the size of this file.
sub getFileSize { sub getFileSize {
my $self = shift; my $self = shift;
my $filename = shift; my $filename = shift;
my ($size);
my (@attributes) = stat($self->getPath($filename)); my (@attributes) = stat($self->getPath($filename));
if ($attributes[7] > 1048576) { return $attributes[7];
$size = round($attributes[7]/1048576);
$size .= 'MB';
} elsif ($attributes[7] > 1024) {
$size = round($attributes[7]/1024);
$size .= 'kB';
} else {
$size = $attributes[7].'B';
}
return $size;
} }

View file

@ -108,7 +108,7 @@ sub getTemplate {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 process ( content [ , templateId ] ) =head2 process ( content, templateId )
Returns a parsed style with content based upon the current WebGUI session information. Returns a parsed style with content based upon the current WebGUI session information.
@ -118,19 +118,16 @@ The content to be parsed into the style. Usually generated by WebGUI::Page::gene
=head3 templateId =head3 templateId
The unique identifier for the template to retrieve. Defaults to the style template tied to the current page. The unique identifier for the template to retrieve.
=cut =cut
sub process { sub process {
my %var; my %var;
$var{'body.content'} = shift; $var{'body.content'} = shift;
my $templateId = shift || $session{page}{styleId}; my $templateId = shift;
if ($session{page}{makePrintable}) { if ($session{page}{makePrintable}) {
$templateId = $session{page}{printableStyleId}; $templateId = $session{page}{printableStyleId};
} elsif ($session{page}{useAdminStyle}) {
#$templateId = $session{setting}{adminStyleId};
$templateId = "adminConsole";
} elsif ($session{scratch}{personalStyleId} ne "") { } elsif ($session{scratch}{personalStyleId} ne "") {
$templateId = $session{scratch}{personalStyleId}; $templateId = $session{scratch}{personalStyleId};
} elsif ($session{page}{useEmptyStyle}) { } elsif ($session{page}{useEmptyStyle}) {

View file

@ -96,17 +96,17 @@ Returns a hash reference containing all of the template parameters.
=head3 templateId =head3 templateId
Defaults to "1". Specify the templateId of the template to retrieve. Specify the templateId of the template to retrieve.
=head3 namespace =head3 namespace
Defaults to "page". Specify the namespace of the template to retrieve. Specify the namespace of the template to retrieve.
=cut =cut
sub get { sub get {
my $templateId = shift || 1; my $templateId = shift;
my $namespace = shift || "page"; my $namespace = shift;
return WebGUI::SQL->quickHashRef("select * from template where templateId=".quote($templateId)." and namespace=".quote($namespace),WebGUI::SQL->getSlave); return WebGUI::SQL->quickHashRef("select * from template where templateId=".quote($templateId)." and namespace=".quote($namespace),WebGUI::SQL->getSlave);
} }
@ -162,11 +162,11 @@ Evaluate a template replacing template commands for HTML.
=head3 templateId =head3 templateId
Defaults to "1". Specify the templateId of the template to retrieve. Specify the templateId of the template to retrieve.
=head3 namespace =head3 namespace
Defaults to "page". Specify the namespace of the template to retrieve. Specify the namespace of the template to retrieve.
=head3 vars =head3 vars
@ -175,8 +175,8 @@ A hash reference containing template variables and loops. Automatically includes
=cut =cut
sub process { sub process {
my $templateId = shift || 1; my $templateId = shift;
my $namespace = shift || "page"; my $namespace = shift;
my $vars = shift; my $vars = shift;
my $file = _getTemplateFile($templateId,$namespace); my $file = _getTemplateFile($templateId,$namespace);
my $fileCacheDir = $session{config}{uploadsPath}.$session{os}{slash}."temp".$session{os}{slash}."templatecache"; my $fileCacheDir = $session{config}{uploadsPath}.$session{os}{slash}."temp".$session{os}{slash}."templatecache";
@ -202,7 +202,8 @@ sub process {
} }
} }
if ($session{config}{templateCacheType} eq "file" && not $error) { if ($session{config}{templateCacheType} eq "file" && not $error) {
$params{file_cache} = 1; # disabled until we can figure out what's wrong with it
# $params{file_cache} = 1;
} elsif ($session{config}{templateCacheType} eq "memory") { } elsif ($session{config}{templateCacheType} eq "memory") {
$params{cache} = 1; $params{cache} = 1;
} elsif ($session{config}{templateCacheType} eq "ipc") { } elsif ($session{config}{templateCacheType} eq "ipc") {

View file

@ -121,12 +121,12 @@ Name value pairs to add to the URL in the form of:
sub gateway { sub gateway {
my $url = getScriptURL().$_[0]; my $url = getScriptURL().$_[0];
if ($_[1]) {
$url = append($url,$_[1]);
}
if ($session{setting}{preventProxyCache} == 1) { if ($session{setting}{preventProxyCache} == 1) {
$url = append($url,"noCache=".randint(0,1000).';'.time()); $url = append($url,"noCache=".randint(0,1000).';'.time());
} }
if ($_[1]) {
$url = append($url,$_[1]);
}
return $url; return $url;
} }
@ -258,13 +258,15 @@ sub page {
} else { } else {
$url = getScriptURL(); $url = getScriptURL();
} }
$url .= $session{page}{urlizedTitle}; my $pathinfo = $session{env}{PATH_INFO};
if ($pairs) { $pathinfo =~ s/^\/(.*)/$1/;
$url = append($url,$pairs); $url .= $pathinfo;
}
if ($session{setting}{preventProxyCache} == 1) { if ($session{setting}{preventProxyCache} == 1) {
$url = append($url,"noCache=".randint(0,1000).';'.time()); $url = append($url,"noCache=".randint(0,1000).';'.time());
} }
if ($pairs) {
$url = append($url,$pairs);
}
return $url; return $url;
} }

View file

@ -22,7 +22,7 @@ use Tie::IxHash;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&isBetween &makeTabSafe &makeArrayTabSafe &randomizeHash &commify &randomizeArray our @EXPORT = qw(&isBetween &makeTabSafe &makeArrayTabSafe &randomizeHash &commify &randomizeArray
&sortHashDescending &sortHash &isIn &makeCommaSafe &makeArrayCommaSafe &randint &round); &formatBytes &sortHashDescending &sortHash &isIn &makeCommaSafe &makeArrayCommaSafe &randint &round);
=head1 NAME =head1 NAME
@ -37,6 +37,7 @@ This package provides miscellaneous but useful utilities to the WebGUI programme
use WebGUI::Utility; use WebGUI::Utility;
$string = commify($integer); $string = commify($integer);
$size = formatBytes($integer);
$boolean = isIn($value, @array); $boolean = isIn($value, @array);
makeArrayCommaSafe(\@array); makeArrayCommaSafe(\@array);
makeArrayTabSafe(\@array); makeArrayTabSafe(\@array);
@ -73,6 +74,32 @@ sub commify {
return scalar reverse $text; return scalar reverse $text;
} }
#-------------------------------------------------------------------
=head2 formatBytes ( integer )
Returns a formatted file size like "3MB" or "44kB".
=head3 integer
An integer representing the number of bytes to format.
=cut
sub formatBytes {
my $size = shift;
if ($size > 1048576) {
return round($size/1048576).'MB';
} elsif ($size > 1024) {
return round($size/1024).'kB';
} else {
return $size.'B';
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 isBetween ( value, first, second ) =head2 isBetween ( value, first, second )

View file

@ -2075,10 +2075,6 @@ Choose which group can view this page. If you want both visitors and registered
Choose the group that can edit this page. The group assigned editing rights can also always view the page. Choose the group that can edit this page. The group assigned editing rights can also always view the page.
<p> <p>
<b>Wobject privileges?</b><br>
Allows content managers to specify view/edit privileges on a per wobject basis rather than relying on the privileges on the page.
<p>
<b>Recursively set privileges?</b><br> <b>Recursively set privileges?</b><br>
You can optionally give the privileges of this page to all pages under this page. You can optionally give the privileges of this page to all pages under this page.
<p> <p>
@ -4018,11 +4014,6 @@ The toolbar for manipulating the properties of the page.
lastUpdated => 1031514049 lastUpdated => 1031514049
}, },
'1003' => {
message => q|Wobject privileges?|,
lastUpdated => 1056041703
},
'555' => { '555' => {
message => q|Edit this user's karma.|, message => q|Edit this user's karma.|,
lastUpdated => 1031514049 lastUpdated => 1031514049

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB