diff --git a/docs/upgrades/templates-6.99.0/help.tmpl b/docs/upgrades/templates-6.99.0/help.tmpl new file mode 100644 index 000000000..39a9380f1 --- /dev/null +++ b/docs/upgrades/templates-6.99.0/help.tmpl @@ -0,0 +1,50 @@ +#PBtmplHelp000000000001 +

+ + +
+ +
+
+
:
+
+
+
+
+ + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +~~~ + + diff --git a/docs/upgrades/upgrade_6.8.9-6.99.0.pl b/docs/upgrades/upgrade_6.8.9-6.99.0.pl index 0a4c5e607..afce16825 100644 --- a/docs/upgrades/upgrade_6.8.9-6.99.0.pl +++ b/docs/upgrades/upgrade_6.8.9-6.99.0.pl @@ -43,7 +43,6 @@ addDisabletoRichEditor(); addNavigationMimeType(); addIndexes(); addDatabaseCache(); -updateHelpTemplate(); fixImportNodePrivileges(); addAdManager(); updateMatrix(); @@ -1057,30 +1056,6 @@ sub ip2cidr { } -#------------------------------------------------- -sub updateHelpTemplate { - print "\tUpdating Help template.\n" unless ($quiet); - my $template = <

- - -
- - -
-
- -
: -
-
-
-
-
-EOT - my $asset = WebGUI::Asset->new($session,"PBtmplHelp000000000001","WebGUI::Asset::Template"); - $asset->addRevision({template=>$template}); -} - #------------------------------------------------- sub installSQLForm { print "\tInstalling SQLForm tables.\n" unless ($quiet); diff --git a/lib/WebGUI/Help/Asset_Folder.pm b/lib/WebGUI/Help/Asset_Folder.pm index 7eacf41b1..d73e49ca5 100644 --- a/lib/WebGUI/Help/Asset_Folder.pm +++ b/lib/WebGUI/Help/Asset_Folder.pm @@ -37,7 +37,70 @@ our $HELP = { 'folder template' => { title => 'folder template title', body => 'folder template body', - fields => [ + fields => [ ], + variables => [ + { + name => 'addFile.url', + }, { + name => "addFile.label", + }, { + name => "subfolder_loop", + variables => [ + { + name => "id", + description => "folder id" + }, { + name => "url", + description => "folder url" + }, { + name => "title", + description => "folder title" + }, { + name => "icon.small", + description => "folder icon.small" + }, { + name => "icon.big", + description => "folder icon.big" + } + ] + }, { + name => "file_loop", + variables => [ + { + name => "id", + }, { + name => "canView", + }, { + name => "title", + }, { + name => "synopsis", + }, { + name => "size", + }, { + name => "date.epoch", + }, { + name => "icon.small", + }, { + name => "icon.big", + }, { + name => "type", + }, { + name => "url", + }, { + name => "isImage", + }, { + name => "canEdit", + }, { + name => "controls", + }, { + name => "isFile", + }, { + name => "thumbnail.url", + }, { + name => "file.url", + } + ], + } ], related => [ { diff --git a/lib/WebGUI/International.pm b/lib/WebGUI/International.pm index c1afbca5f..616ddc632 100644 --- a/lib/WebGUI/International.pm +++ b/lib/WebGUI/International.pm @@ -86,7 +86,7 @@ A string that specifies the language that the user should see. Defaults to the =cut -my $safeRe = qr/[^\w\d\s\/]/; +my $safeRe = qr/[^\.\w\d\s\/]/; sub get { my ($self, $id, $namespace, $language) = @_; diff --git a/lib/WebGUI/Operation/Help.pm b/lib/WebGUI/Operation/Help.pm index bd2b0ac00..e150577bd 100644 --- a/lib/WebGUI/Operation/Help.pm +++ b/lib/WebGUI/Operation/Help.pm @@ -247,6 +247,7 @@ sub www_viewHelp { 'uiLevel' => $row->{uiLevel}, } if ($uiOverride || ($userUiLevel >= ($row->{uiLevel} || 1))); } + $vars{variable_loop1} = _getTemplateVars($session, 1, $help->{variables}, $i18n); my $body = WebGUI::Asset::Template->new($session,"PBtmplHelp000000000001")->process(\%vars); my $uiOverrideText = $uiOverride ? $i18n->get('show my fields','WebGUI') : $i18n->get('show all fields','WebGUI'); $ac->addSubmenuItem(_link($session, $session->form->process("hid"), $namespace).";uiOverride=".!$uiOverride, $uiOverrideText) if $userUiLevel < 9; @@ -259,6 +260,29 @@ sub www_viewHelp { ); } +sub _getTemplateVars { + my $session = shift; + my $level = shift; + my $variables = shift; + my $i18n = shift; + my $template = []; + foreach my $row (@{$variables}) { + my $indent = []; + my $label = ""; + if (exists $row->{variables}) { + my $newLevel = $level + 1; + $indent = _getTemplateVars($session, $newLevel, $row->{variables}, $i18n); + $label = "variable_loop".$newLevel; + } + push ( @{$template}, { + title => $row->{name}, + description=> $i18n->get($row->{description} || $row->{name}), + $label => $indent + }); + } + return $template; +} + #------------------------------------------------------------------- =head2 _viewHelpIndex ( $session ) diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index dfa2dd344..9f3108fba 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -371,7 +371,9 @@ sub open { my $config = WebGUI::Config->new($webguiRoot,$configFile); my $self = {_config=>$config, _server=>$server}; bless $self , $class; - $self->{_request} = Apache2::Request->new($request, POST_MAX => 1024 * $self->setting->get("maxAttachmentSize")) if (defined $request); + #$self->{_request} = Apache2::Request->new($request, POST_MAX => 1024 * $self->setting->get("maxAttachmentSize")) if (defined $request); + # something screwed about POST_MAX, must look at this later + $self->{_request} = Apache2::Request->new($request) if (defined $request); my $sessionId = shift || $self->http->getCookies->{"wgSession"} || $self->id->generate; my $noFuss = shift; $self->{_var} = WebGUI::Session::Var->new($self,$sessionId, $noFuss); diff --git a/lib/WebGUI/i18n/English/Asset_Folder.pm b/lib/WebGUI/i18n/English/Asset_Folder.pm index b1fcafad0..12f63617a 100644 --- a/lib/WebGUI/i18n/English/Asset_Folder.pm +++ b/lib/WebGUI/i18n/English/Asset_Folder.pm @@ -62,95 +62,160 @@ to do you want to go to the new Folder?

|, }, 'folder template body' => { - message => q|

The following variables are available in Folder Templates:

- -

addFile.url
-The url for adding files to the Folder.

- -

addFile.label
-The internationalized label for adding files to the Folder.

- -

subfolder_loop
-A loop containing all Folder assets which are children of the Folder.

- -
- -

id
-The assetId of the Folder.

- -

url
-The url of the Folder.

- -

title
-The title of the Folder.

- -

icon.small
-The URL to a small icon of the appropriate type for this Asset.

- -

icon.big
-The URL to a big icon of the appropriate type for this Asset.

- -
- -

file_loop
-A loop containing all non-Folder assets which are children of the Folder.

- -
- -

id
-The assetId of the Asset.

- -

canView
-A conditional indicating if the current user can view this Asset.

- -

title
-The title of the Asset.

- -

synopsis
-The synopsis of the Asset.

- -

size
-The size of the Asset, formatted.

- -

date.epoch
-The date the Asset was last updated, relative to the epoch.

- -

icon.small
-A URL to a small icon that represents the Asset.

- -

icon.big
-A URL to an icon that represents the Asset.

- -

type
-The type of this Asset.

- -

url
-The URL of the Asset.

- -

isImage
-A conditional indicating if this Asset is an Image Asset.

- -

canEdit
-A conditional indicating if this Asset can be edited by the current user.

- -

controls
-The editing control bar for this child

- -

isFile
-A conditional indicating if this Asset is a File Asset.

- -

thumbnail.url
-If this Asset is an Image, the URL to the thumbnail for it.

- -

file.url
-If this Asset is a File Asset (File, Image or Zip Archive), the URL to the actual file for downloading. Otherwise, -this variable will be empty

- -
- |, + message => q|The following variables are available in Folder Templates: |, lastUpdated => 1146775736, }, + 'addFile.url' => { + message => q|The url for adding files to the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'addFile.label' => { + message => q|The internationalized label for adding files to the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'subfolder_loop' => { + message => q|A loop containing all Folder assets which are children of the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'folder id' => { + message => q|The assetId of the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'folder url' => { + message => q|The url of the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'folder title' => { + message => q|The title of the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'folder icon.small' => { + message => q|The URL to a small icon of the appropriate type for this Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'folder icon.big' => { + message => q|The URL to a big icon of the appropriate type for this Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'file_loop' => { + message => q|A loop containing all non-Folder assets which are children of the Folder.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'id' => { + message => q|The assetId of the Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'canView' => { + message => q|A conditional indicating if the current user can view this Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'title' => { + message => q|The title of the Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'synopsis' => { + message => q|The synopsis of the Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'size' => { + message => q|The size of the Asset, formatted.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'date.epoch' => { + message => q|The date the Asset was last updated, relative to the epoch.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'icon.small' => { + message => q|A URL to a small icon that represents the Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'icon.big' => { + message => q|A URL to an icon that represents the Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'type' => { + message => q|The type of this Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'url' => { + message => q|The URL of the Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'isImage' => { + message => q|A conditional indicating if this Asset is an Image Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'canEdit' => { + message => q|A conditional indicating if this Asset can be edited by the current user.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'controls' => { + message => q|The editing control bar for this child.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'isFile' => { + message => q|A conditional indicating if this Asset is a File Asset.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'thumbnail.url' => { + message => q|If this Asset is an Image, the URL to the thumbnail for it.|, + lastupdated => 0, + context => q|Template variable description.| + }, + + 'file.url' => { + message => q|If this Asset is a File Asset (File, Image or Zip Archive), the URL to the actual file for downloading. Otherwise, this variable will be empty.|, + lastupdated => 0, + context => q|Template variable description.| + }, + 'assetName' => { message => q|Folder|, context => q|label for Asset Manager|,