diff --git a/docs/upgrades/upgrade_5.2.4-5.3.0.sql b/docs/upgrades/upgrade_5.2.4-5.3.0.sql index 129da4781..1b0a52462 100644 --- a/docs/upgrades/upgrade_5.2.4-5.3.0.sql +++ b/docs/upgrades/upgrade_5.2.4-5.3.0.sql @@ -1,5 +1,17 @@ insert into webguiVersion values ('5.3.0','upgrade',unix_timestamp()); delete from international where languageId=1 and namespace='WebGUI' and internationalId=844; insert into international (internationalId,languageId,namespace,message,lastUpdated) values (844,1,'WebGUI','These macros have to do with users and logins.\r\n

\r\n\r\n^a; or ^a(); - My Account Link
\r\nA link to your account information. In addition you can change the link text by creating a macro like this ^a("Account Info");. \r\n

\r\n\r\nNOTES: You can also use the special case ^a(linkonly); to return only the URL to the account page and nothing more. Also, the .myAccountLink style sheet class is tied to this macro.\r\n

\r\n\r\n\r\n^AdminText();
\r\nDisplays a small text message to a user who is in admin mode. Example: ^AdminText("You are in admin mode!");\r\n

\r\n\r\n^AdminToggle; or ^AdminToggle();
\r\nPlaces a link on the page which is only visible to content managers and adminstrators. The link toggles on/off admin mode. You can optionally specify other messages to display like this: ^AdminToggle("Edit On","Edit Off");\r\n

\r\n\r\n\r\n\r\n^GroupText();
\r\nDisplays a small text message to the user if they belong to the specified group. Example: ^GroupText("Visitors","You need an account to do anything cool on this site!");\r\n

\r\n\r\n^L; or ^L(); - Login Box
\r\nA small login form. You can also configure this macro. You can set the width of the login box like this ^L(20);. You can also set the message displayed after the user is logged in like this ^L(20,Hi ^a(^@;);. Click %here% if you wanna log out!)\r\n

\r\n\r\nNOTE: The .loginBox style sheet class is tied to this macro.\r\n

\r\n\r\n^LoginToggle; or ^LoginToggle();
\r\nDisplays a "Login" or "Logout" message depending upon whether the user is logged in or not. You can optionally specify other labels like this: ^LoginToggle("Click here to log in.","Click here to log out.");. You can also use the special case ^LoginToggle(linkonly); to return only the URL with no label.\r\n

\r\n\r\n^@; - Username
\r\nThe username of the currently logged in user.\r\n

\r\n\r\n\r\n^#; - User ID
\r\nThe user id of the currently logged in user.\r\n

\r\n\r\n', 1050100597); +delete from template where namespace='Article' and templateId<10; +INSERT INTO template VALUES (4,'Linked Image with Caption','\r\n

\r\n\r\n\r\n\r\n\r\n
\r\n
\r\n \r\n \">\r\n \" border=\"0\">\r\n
\r\n \r\n \" border=\"0\">\r\n
\r\n
\r\n
\r\n\r\n\r\n\r\n\r\n

\r\n\r\n\r\n\r\n

\r\n\r\n\r\n\r\n\r\n

\r\n
\r\n
\r\n\r\n\r\n \r\n·\r\n\r\n·\r\n\r\n\r\n\r\n\r\n\r\n\r\n

\r\n \r\n \r\n
\"> ()\">
\r\n\r\n\r\n\r\n','Article'); +INSERT INTO template VALUES (1,'Default Article','\r\n

\r\n
\r\n\r\n\r\n\r\n
\r\n \" align=\"right\" border=\"0\">\r\n\r\n\r\n\r\n\r\n

\r\n\r\n\r\n\r\n\r\n\r\n \r\n

\">\r\n \r\n\r\n\r\n

\r\n\r\n\r\n\r\n\r\n \r\n·\r\n\r\n·\r\n\r\n\r\n\r\n\r\n\r\n

\r\n
\r\n
\r\n\r\n\r\n\r\n

\r\n \r\n \r\n
\"> ()\">
\r\n\r\n\r\n','Article'); +INSERT INTO template VALUES (2,'Center Image','\r\n

\r\n
\r\n\r\n\r\n\r\n
\" border=\"0\">
\r\n
\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n\r\n \r\n

\">\r\n \r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n·\r\n\r\n·\r\n\r\n\r\n\r\n\r\n\r\n

\r\n \r\n \r\n
\"> ()\">
\r\n\r\n','Article'); +INSERT INTO template VALUES (3,'Left Align Image','\r\n

\r\n
\r\n\r\n\r\n\r\n
\r\n \" align=\"left\" border=\"0\">\r\n\r\n\r\n\r\n\r\n

\r\n\r\n\r\n\r\n\r\n\r\n \r\n

\">\r\n \r\n\r\n\r\n

\r\n\r\n\r\n\r\n\r\n

\r\n
\r\n
\r\n\r\n\r\n\r\n \r\n·\r\n\r\n·\r\n\r\n\r\n\r\n\r\n\r\n\r\n

\r\n \r\n \r\n
\"> ()\">
\r\n\r\n\r\n','Article'); +delete from international where languageId=1 and namespace='Article' and internationalId=71; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (71,1,'Article','Articles are the Swiss Army knife of WebGUI. Most pieces of static content can be added via the Article.\r\n

\r\n\r\nNOTE: You can create a multi-paged article by placing the seperator macro (^-;) at various places through-out your article.\r\n\r\n

\r\nTemplate
\r\nSelect a template to layout your article.\r\n

\r\n\r\nImage
\r\nChoose an image (.jpg, .gif, .png) file from your hard drive. This file will be uploaded to the server and displayed in your article.\r\n

\r\n\r\n\r\nAttachment
\r\nIf you wish to attach a word processor file, a zip file, or any other file for download by your users, then choose it from your hard drive.\r\n

\r\n\r\nLink Title
\r\nIf you wish to add a link to your article, enter the title of the link in this field. \r\n

\r\nExample: Google\r\n

\r\n\r\nLink URL
\r\nIf you added a link title, now add the URL (uniform resource locator) here. \r\n

\r\nExample: http://www.google.com\r\n\r\n

\r\n\r\nConvert carriage returns?
\r\nIf you\'re publishing HTML there\'s generally no need to check this option, but if you aren\'t using HTML and you want a carriage return every place you hit your "Enter" key, then check this option.\r\n

\r\n\r\nAllow discussion?
\r\nChecking this box will enable responses to your article much like Articles on Slashdot.org.\r\n

\r\n\r\n\r\nFilter Post
\r\nSelect the level of content filtering you wish to perform on all discussion posts.\r\n

\r\n\r\nWho can post?
\r\nSelect the group that is allowed to post to this discussion.\r\n

\r\n\r\nEdit Timeout
\r\nHow long should a user be able to edit their post before editing is locked to them?\r\n

\r\nNOTE: Don\'t set this limit too high. One of the great things about discussions is that they are an accurate record of who said what. If you allow editing for a long time, then a user has a chance to go back and change his/her mind a long time after the original statement was made.\r\n

\r\n\r\nKarma Per Post
\r\nHow much karma should be given to a user when they post to this discussion?\r\n

\r\n\r\nWho can moderate?
\r\nSelect the group that is allowed to moderate this discussion.\r\n

\r\n\r\nModeration Type?
\r\nYou can select what type of moderation you\'d like for your users. After-the-fact means that when a user posts a message it is displayed publically right away. Pre-emptive means that a moderator must preview and approve users posts before allowing them to be publically visible. Alerts for new posts will automatically show up in the moderator\'s WebGUI Inbox.\r\n

\r\nNOTE: In both types of moderation the moderator can always edit or delete the messages posted by your users.\r\n

\r\n\r\nAdd edit stamp to posts?
\r\nDo you wish to "stamp" all edits so that you can track who edited a post and when?\r\n

', 1050146714); +delete from international where languageId=1 and namespace='Article' and internationalId=73; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (73,1,'Article','The following template variables are available for article templates.\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', 1050146621); + + + diff --git a/lib/WebGUI/Wobject/Article.pm b/lib/WebGUI/Wobject/Article.pm index 1f1441090..d4bafae74 100644 --- a/lib/WebGUI/Wobject/Article.pm +++ b/lib/WebGUI/Wobject/Article.pm @@ -18,6 +18,7 @@ use WebGUI::HTML; use WebGUI::HTMLForm; use WebGUI::Icon; use WebGUI::International; +use WebGUI::Paginator; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; @@ -141,6 +142,23 @@ sub www_view { if ($_[0]->get("convertCarriageReturns")) { $var{description} =~ s/\n/\/g; } + if ($session{form}{makePrintable}) { + $var{description} =~ s/\^\-\;//g; + $var{isFirstPage} = 1; + $var{isLastPage} = 1; + } else { + my @pages = split(/\^\-\;/,$var{description}); + my $p = WebGUI::Paginator->new(WebGUI::URL::page("wid=".$_[0]->get("wobjectId")."&func=view"),\@pages,1); + $var{description} = $p->getPage; + $var{firstPage} = $p->getFirstPageLink; + $var{lastPage} = $p->getLastPageLink; + $var{nextPage} = $p->getNextPageLink; + $var{pageList} = $p->getPageLinks; + $var{previousPage} = $p->getPreviousPageLink; + $var{multiplePages} = ($p->getNumberOfPages > 1); + $var{isLastPage} = ($p->getNumberOfPages == $p->getPageNumber); + $var{isFirstPage} = (1 == $p->getPageNumber); + } if ($_[0]->get("attachment") ne "") { $file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId")); $var{"attachment.box"} = $file->box;