diff --git a/docs/upgrades/upgrade_5.2.6-5.3.0.sql b/docs/upgrades/upgrade_5.2.6-5.3.0.sql index 8c6220034..c4142eff8 100644 --- a/docs/upgrades/upgrade_5.2.6-5.3.0.sql +++ b/docs/upgrades/upgrade_5.2.6-5.3.0.sql @@ -557,11 +557,10 @@ delete from settings where name='proxiedClientAddress'; insert into settings(name,value) values('proxiedClientAddress', '0'); delete from international where languageId=1 and namespace='WebGUI' and internationalId=973; insert into international (internationalId,languageId,namespace,message,lastUpdated) values (973,1,'WebGUI','If proxied, use real client IP address?', 1053459227); -delete from international where languageId=1 and namespace='Article' and internationalId=73; -insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (73,1,'Article','The following template variables are available for article templates.\r\n

\r\n\r\ndescription.full
\r\nThe full description without any pagination. (For the paginated description use "description" instead.)\r\n

\r\n\r\ndescription.first.100characters
\r\nThe first 100 characters of the description.\r\n

\r\n\r\ndescription.first.20words
\r\nThe first 20 words of the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n

\r\n\r\ndescription.first.paragraph
\r\nThe first paragraph of the description. The first paragraph is determined by the first carriage return found in the text.\r\n

\r\n\r\nattachment.box
\r\nOutputs a standard WebGUI attachment box including icon, filename, and attachment indicator.\r\n

\r\n\r\nattachment.icon
\r\nThe URL to the icon image for this attachment type.\r\n

\r\n\r\nattachment.name
\r\nThe filename for this attachment.\r\n

\r\n\r\nattachment.url
\r\nThe URL to download this attachment.\r\n

\r\n\r\nimage.thumbnail
\r\nThe URL to the thumbnail for the attached image.\r\n

\r\n\r\nimage.url
\r\nThe URL to the attached image.\r\n

\r\n\r\npost.label
\r\nThe translated label to add a comment to this article.\r\n

\r\n\r\n\r\npost.URL
\r\nThe URL to add a comment to this article.\r\n

\r\n\r\nreplies.count
\r\nThe number of comments attached to this article.\r\n

\r\n\r\nreplies.label
\r\nThe translated text indicating that you can view the replies.\r\n

\r\n\r\nreplies.url
\r\nThe URL to view the replies to this article.\r\n

\r\n\r\n\r\nfirstPage
\r\nA link to the first page in the paginator.\r\n

\r\n\r\nlastPage
\r\nA link to the last page in the paginator.\r\n

\r\n\r\nnextPage
\r\nA link to the next page forward in the paginator.\r\n

\r\n\r\npreviousPage
\r\nA link to the next page backward in the paginator.\r\n

\r\n\r\npageList
\r\nA list of links to all the pages in the paginator.\r\n

\r\n\r\nmultiplePages
\r\nA conditional indicating whether there is more than one page in the paginator.\r\n

\r\n\r\nisFirstPage
\r\nA conditional indicating whether the visitor is viewing the first page.\r\n

\r\n\r\nisLastPage
\r\nA conditional indicating whether the visitor is viewing the last page.\r\n

\r\n\r\n', 1053469941,NULL); delete from international where languageId=1 and namespace='WebGUI' and internationalId=828; insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (828,1,'WebGUI','Most wobjects have templates that allow you to change the layout of the wobject\'s user interface. Those wobjects that do have templates all have a common set of template variables that you can use for layout, as well as their own custom variables. The following is a list of the common template variables shared among all wobjects.\r\n

\r\ntitle
\r\nThe title for this wobject.\r\n

\r\n\r\ndisplayTitle
\r\nA conditional variable for whether or not the title should be displayed.\r\n

\r\n\r\ndescription
\r\nThe description of this wobject.\r\n

\r\n\r\nwobjectId
\r\nThe unique identifier that WebGUI uses to control this wobject.\r\n

\r\n\r\nisShortcut
\r\nA conditional indicating if this wobject is a shortcut to an original wobject.\r\n

\r\n\r\noriginalURL
\r\nIf this wobject is a shortcut, then this URL will direct you to the original wobject.\r\n

', 1053469640,NULL); - +delete from international where languageId=1 and namespace='Article' and internationalId=73; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (73,1,'Article','The following template variables are available for article templates.\r\n

\r\n\r\nnew.template
\r\nArticles have the special ability to change their template so that you can allow users to see different views of the article. You do this by creating a link with a URL like this (replace 999 with the template Id you wish to use):

\r\n<a href="<tmpl_var new.template>999">Read more...</a>\r\n

\r\ndescription.full
\r\nThe full description without any pagination. (For the paginated description use "description" instead.)\r\n

\r\n\r\ndescription.first.100words
\r\nThe first 100 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n

\r\n\r\ndescription.first.75words
\r\nThe first 75 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n

\r\n\r\ndescription.first.50words
\r\nThe first 50 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n

\r\n\r\ndescription.first.25words
\r\nThe first 25 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n

\r\n\r\ndescription.first.10words
\r\nThe first 10 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words.\r\n

\r\n\r\ndescription.first.paragraph
\r\nThe first paragraph of the description. The first paragraph is determined by the first carriage return found in the text.\r\n

\r\n\r\ndescription.first.2paragraphs
\r\nThe first two paragraphs of the description. A paragraph is determined by counting the carriage returns found in the text.\r\n

\r\n\r\ndescription.first.sentence
\r\nThe first sentence in the description. A sentence is determined by counting the periods found in the text.\r\n

\r\n\r\ndescription.first.2sentences
\r\nThe first two sentences in the description. A sentence is determined by counting the periods found in the text.\r\n

\r\n\r\ndescription.first.3sentences
\r\nThe first three sentences in the description. A sentence is determined by counting the periods found in the text.\r\n

\r\n\r\ndescription.first.4sentences
\r\nThe first four sentences in the description. A sentence is determined by counting the periods found in the text.\r\n

\r\n\r\n\r\n\r\nattachment.box
\r\nOutputs a standard WebGUI attachment box including icon, filename, and attachment indicator.\r\n

\r\n\r\nattachment.icon
\r\nThe URL to the icon image for this attachment type.\r\n

\r\n\r\nattachment.name
\r\nThe filename for this attachment.\r\n

\r\n\r\nattachment.url
\r\nThe URL to download this attachment.\r\n

\r\n\r\nimage.thumbnail
\r\nThe URL to the thumbnail for the attached image.\r\n

\r\n\r\nimage.url
\r\nThe URL to the attached image.\r\n

\r\n\r\npost.label
\r\nThe translated label to add a comment to this article.\r\n

\r\n\r\n\r\npost.URL
\r\nThe URL to add a comment to this article.\r\n

\r\n\r\nreplies.count
\r\nThe number of comments attached to this article.\r\n

\r\n\r\nreplies.label
\r\nThe translated text indicating that you can view the replies.\r\n

\r\n\r\nreplies.url
\r\nThe URL to view the replies to this article.\r\n

\r\n\r\n\r\nfirstPage
\r\nA link to the first page in the paginator.\r\n

\r\n\r\nlastPage
\r\nA link to the last page in the paginator.\r\n

\r\n\r\nnextPage
\r\nA link to the next page forward in the paginator.\r\n

\r\n\r\npreviousPage
\r\nA link to the next page backward in the paginator.\r\n

\r\n\r\npageList
\r\nA list of links to all the pages in the paginator.\r\n

\r\n\r\nmultiplePages
\r\nA conditional indicating whether there is more than one page in the paginator.\r\n

\r\n\r\nisFirstPage
\r\nA conditional indicating whether the visitor is viewing the first page.\r\n

\r\n\r\nisLastPage
\r\nA conditional indicating whether the visitor is viewing the last page.\r\n

\r\n\r\n', 1053770001,NULL); diff --git a/lib/WebGUI/URL.pm b/lib/WebGUI/URL.pm index 17776912b..7d5b9661e 100644 --- a/lib/WebGUI/URL.pm +++ b/lib/WebGUI/URL.pm @@ -145,7 +145,7 @@ sub gateway { $url = append($url,$_[1]); } if ($session{setting}{preventProxyCache} == 1) { - $url = append($url,randint(0,1000).';'.time()); + $url = append($url,"noCache=".randint(0,1000).';'.time()); } return $url; } @@ -203,7 +203,7 @@ sub page { $url = append($url,$_[0]); } if ($session{setting}{preventProxyCache} == 1) { - $url = append($url,randint(0,1000).';'.time()); + $url = append($url,"noCache=".randint(0,1000).';'.time()); } return $url; } diff --git a/lib/WebGUI/Wobject/Article.pm b/lib/WebGUI/Wobject/Article.pm index 9164eebc9..71cb44a25 100644 --- a/lib/WebGUI/Wobject/Article.pm +++ b/lib/WebGUI/Wobject/Article.pm @@ -133,13 +133,31 @@ sub www_view { if ($_[0]->get("convertCarriageReturns")) { $var{description} =~ s/\n/\\n/g; } + $var{"new.template"} = WebGUI::URL::page("wid=".$_[0]->get("wobjectId")."&func=view")."&templateId="; $var{"description.full"} = $var{description}; $var{"description.full"} =~ s/\^\-\;//g; - $var{"description.first.100characters"} = substr($var{"description.full"},0,100); - $var{"description.first.20words"} = $var{"description.full"}; - $var{"description.first.20words"} =~ s/(((\S+)\s+){20}).*/$1/s; - $var{"description.first.paragraph"} = $var{"description.full"}; - $var{"description.first.paragraph"} =~ s/^(.*?)\n.*/$1/s; + $var{"description.first.100words"} = $var{"description.full"}; + $var{"description.first.100words"} =~ s/(((\S+)\s+){100}).*/$1/s; + $var{"description.first.75words"} = $var{"description.first.100words"}; + $var{"description.first.75words"} =~ s/(((\S+)\s+){75}).*/$1/s; + $var{"description.first.50words"} = $var{"description.first.75words"}; + $var{"description.first.50words"} =~ s/(((\S+)\s+){50}).*/$1/s; + $var{"description.first.25words"} = $var{"description.first.50words"}; + $var{"description.first.25words"} =~ s/(((\S+)\s+){25}).*/$1/s; + $var{"description.first.10words"} = $var{"description.first.25words"}; + $var{"description.first.10words"} =~ s/(((\S+)\s+){10}).*/$1/s; + $var{"description.first.2paragraphs"} = $var{"description.full"}; + $var{"description.first.2paragraphs"} =~ s/^((.*?\n){2}).*/$1/s; + $var{"description.first.paragraph"} = $var{"description.first.2paragraphs"}; + $var{"description.first.paragraph"} =~ s/^(.*?\n).*/$1/s; + $var{"description.first.4sentences"} = $var{"description.full"}; + $var{"description.first.4sentences"} =~ s/^((.*?\.){4}).*/$1/s; + $var{"description.first.3sentences"} = $var{"description.first.4sentences"}; + $var{"description.first.3sentences"} =~ s/^((.*?\.){3}).*/$1/s; + $var{"description.first.2sentences"} = $var{"description.first.3sentences"}; + $var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s; + $var{"description.first.sentence"} = $var{"description.first.2sentences"}; + $var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s; if ($session{form}{makePrintable}) { $var{description} =~ s/\^\-\;//g; $var{isFirstPage} = 1; @@ -172,7 +190,7 @@ sub www_view { $var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); $var{"post.label"} = WebGUI::International::get(24,$_[0]->get("namespace")); } - return $_[0]->processTemplate($_[0]->get("templateId"),\%var); + return $_[0]->processTemplate($_[0]->getValue("templateId"),\%var); }