diff --git a/docs/upgrades/upgrade_5.2.6-5.3.0.pl b/docs/upgrades/upgrade_5.2.6-5.3.0.pl index 2b05e3679..3cfa0bcdc 100644 --- a/docs/upgrades/upgrade_5.2.6-5.3.0.pl +++ b/docs/upgrades/upgrade_5.2.6-5.3.0.pl @@ -32,6 +32,7 @@ $macros->{SpecificDropMenu} = "SpecificDropMenu"; $macros->{LastModified} = "LastModified"; $macros->{PreviousDropMenu} = "PreviousDropMenu"; $macros->{TopDropMenu} = "TopDropMenu"; +$macros->{EditableToggle} = "EditableToggle"; $macros->{SI} = "SI_scaledImage"; $conf->set("macros"=>$macros); my $wobjects = $conf->get("wobjects"); 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 938ff895c..f44f492f7 100644 --- a/docs/upgrades/upgrade_5.2.6-5.3.0.sql +++ b/docs/upgrades/upgrade_5.2.6-5.3.0.sql @@ -200,8 +200,6 @@ delete from international where languageId=1 and namespace='WebGUI' and internat insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (846,1,'WebGUI','These macros are mainly useful in maintaining styles in WebGUI.\r\n

\r\n\r\n^AdminBar;
\r\nPlaces the administrative tool bar on the page. This is a required element in the "body" segment of the Style Manager.\r\n

\r\n\r\n\r\n^c; - Company Name
\r\nThe name of your company specified in the settings by your Administrator.\r\n

\r\n\r\n\r\n^e; - Company Email Address
\r\nThe email address for your company specified in the settings by your Administrator.\r\n

\r\n\r\n^Extras;
\r\nReturns the path to the WebGUI "extras" folder, which contains things like WebGUI icons.\r\n

\r\n\r\n^LastModified; or ^LastModified();
\r\nDisplays the date that the current page was last modified based upon the wobjects on the page. The date is defaultly displayed based upon the user\'s date preferences. Optionally, it can take two parameters. The first is text to display before the date. The second is a date format string (see the D (date) macro for details.\r\n

\r\nExample: ^LastModified("Updated: ","%c %D, %y");\r\n

\r\n\r\n\r\n^PageTitle;
\r\nDisplays the title of the current page.\r\n

\r\n\r\nNOTE: If you begin using admin functions or the indepth functions of any wobject, the page title will become a link that will quickly bring you back to the page.\r\n

\r\n\r\n^r; or ^r(); - Make Page Printable
\r\nCreates a link to remove the style from a page to make it printable. In addition, you can change the link text by creating a macro like this ^r("Print Me!");.\r\n

\r\n\r\nBy default, when this link is clicked, the current page\'s style is replaced with the "Make Page Printable" style in the Style Manager. However, that can be overridden by specifying the name of another style as the second parameter, like this: ^r("Print!","WebGUI");\r\n

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

\r\n\r\n^RootTitle;
\r\nReturns the title of the root of the current page. For instance, the main root in WebGUI is the "Home" page. Many advanced sites have many roots and thus need a way to display to the user which root they are in.\r\n

\r\n\r\n^u; - Company URL
\r\nThe URL for your company specified in the settings by your Administrator.\r\n

\r\n\r\n\r\n\r\n^?; - Search
\r\nAdd a search box to the page. The search box is tied to WebGUI\'s built-in search engine.\r\n

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

\r\n\r\n^Spacer();
\r\nCreate a spacer in your layout. Great for creating blocks of color with divs and tables. It takes two parameters, width and height.\r\n

\r\nExample: ^Spacer("100","50");\r\n

\r\n\r\n^-;
\r\nThis is known as the separator macro. It must appear exactly once in every style. Wherever it appears is where the content for any given page will be put.\r\n

', 1051223157,NULL); delete from international where languageId=1 and namespace='WebGUI' and internationalId=842; insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (842,1,'WebGUI','These macros are used to create navigation on the site.\r\n

\r\n\r\n^C; or ^C(); - Crumb Trail
\r\nA dynamically generated crumb trail to the current page. You can optionally specify a delimeter to be used between page names by using ^C(::);. The default delimeter is >.\r\n

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

\r\n\r\n^FlexMenu;
\r\nThis menu macro creates a top-level menu that expands as the user selects each menu item.\r\n

\r\n\r\n^H; or ^H(); - Home Link
\r\nA link to the home page of this site. In addition you can change the link text by creating a macro like this ^H("Go Home");.\r\n

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

\r\n\r\n^M; or ^M(); - Current Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the current level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^M(3);. If you set the macro to "0" it will track the entire site tree.\r\n

\r\n\r\n^m; - Current Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the current level. You can optionally specify a delimeter to be used between page names by using ^m(:--:);. The default delimeter is ·.\r\n

\r\n\r\n^PreviousDropMenu;
\r\nCreate a drop down menu containing the sub-pages at the previous level in the page tree.\r\n

\r\nExample: ^PreviousDropMenu;\r\n

\r\n\r\n^P; or ^P(); - Previous Menu (Vertical)
\r\nA vertical menu containing the sub-pages at the previous level. In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^P(3);. If you set the macro to "0" it will track the entire site tree.\r\n

\r\n\r\n^p; - Previous Menu (Horizontal)
\r\nA horizontal menu containing the sub-pages at the previous level. You can optionally specify a delimeter to be used between page names by using ^p(:--:);. The default delimeter is ·.\r\n

\r\n\r\n^rootmenu; or ^rootmenu(); (Horizontal)
\r\nCreates a horizontal menu of the various roots on your system (except for the WebGUI system roots). You can optionally specify a menu delimiter like this: ^rootmenu(|);\r\n

\r\n\r\n^RootTab;
\r\nCreate a tab navigation system from the roots on your site (except WebGUI\'s system roots) similar to the tabs used in the tab forms (editing wobjects or pages).\r\n

\r\nNOTE: Has two special style sheet classes: .RootTabOn{} and .RootTabOff{}.\r\n

\r\nExample:
\r\n<style>\r\n.rootTabOn {\r\n line-height: 17px;\r\n font-size: 16px;\r\n spacing: 3px;\r\n border: 1px solid black;\r\n border-bottom-width: 0px;\r\n background-color: #333333;\r\n z-index: 10000;\r\n padding: 3px 9px 5px 9px;\r\n color: white;\r\n}\r\n\r\n.rootTabOn A, .rootTabOn A:visited {\r\n color: white;\r\n font-weight: bold;\r\n text-decoration: none;\r\n}\r\n\r\n.rootTabOff {\r\n line-height: 15px;\r\n font-size: 14px;\r\n border: 1px solid black;\r\n border-bottom-width: 0px;\r\n background-color: #c8c8c8;\r\n z-index: 1000;\r\n padding: 2px 9px 2px 9px;\r\n}\r\n\r\n.rootTabOff A, .rootTabOff A:visited {\r\n color: black;\r\n text-decoration: underline;\r\n}\r\n\r\n.rootTabOff A:hover {\r\n font-weight: bold;\r\n}\r\n</style>\r\n^RootTab;\r\n

\r\n\r\n\r\n^SpecificDropMenu();
\r\nCreate a drop down menu starting at a specific point in your navigation tree. This takes two parameters. The first is the url of the page to start with and the second (optional parameter) is the depth to traverse to.\r\n

\r\nExample: ^SpecificDropMenu("home",3);\r\n

\r\n\r\n^S(); - Specific SubMenu (Vertical)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^S("home",0);. The first value is the urlized title of the page and the second value is the depth you\'d like the menu to go. By default it will show only the first level. To go three levels deep create a macro like this ^S("home",3);.\r\n

\r\n\r\n\r\n^s(); - Specific SubMenu (Horizontal)
\r\nThis macro allows you to get the submenu of any page, starting with the page you specified. For instance, you could get the home page submenu by creating a macro that looks like this ^s("home");. The value is the urlized title of the page. You can optionally specify a delimeter to be used between page names by using ^s("home",":--:");. The default delimeter is ·.\r\n

\r\n\r\n^Synopsis; or ^Synopsis(); Menu
\r\nThis macro allows you to get the submenu of a page along with the synopsis of each link. You may specify an integer to specify how many levels deep to traverse the page tree.\r\n

\r\n\r\nNOTES: The .synopsis_sub, .synopsis_summary, and .synopsis_title style sheet classes are tied to this macro.\r\n

\r\n\r\n^TopDropMenu;
\r\nCreate a drop down menu of your top level navigation.\r\n

\r\nExample: ^TopDropMenu;\r\n

\r\n\r\n^T; or ^T(); - Top Level Menu (Vertical)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). In addition, you may configure this macro by specifying how many levels deep the menu should go. By default it will show only the first level. To go three levels deep create a macro like this ^T(3);. If you set the macro to "0" it will track the entire site tree.\r\n

\r\n\r\n^t; - Top Level Menu (Horizontal)
\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page). You can optionally specify a delimeter to be used between page names by using ^t(:--:);. The default delimeter is ·.\r\n

\r\n\r\n^/; - System URL
\r\nThe URL to the gateway script (example: /index.pl/).\r\n

\r\n\r\n^\\; - Page URL
\r\nThe URL to the current page (example: /index.pl/pagename).\r\n

\r\n\r\n', 1051222723,NULL); -delete from international where languageId=1 and namespace='WebGUI' and internationalId=844; -insert into international (internationalId,languageId,namespace,message,lastUpdated,context) 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^CanEditText();
\r\nDisplay a message to a user that can edit the current page.\r\n

\r\nExample: ^CanEditText(^AdminToggle;);\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. And you can specify an alternate message to those who are not in the group.\r\n

\r\nExample: ^GroupText("Visitors","You need an account to do anything cool on this site!","We value our registered users!");\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', 1051222028,NULL); delete from international where languageId=1 and namespace='WebGUI' and internationalId=832; insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (832,1,'WebGUI','The collateral management system has several macros for its specific purpose.\r\n

\r\n\r\n^File();
\r\nThis macro builds a quick file link. It creates an icon for the file and outputs the files name. Then it links them both to the file for downloading.\r\n

\r\n\r\n^I();
\r\nThis macro retrieves an image from the collateral management system along with an HTML image tag so that you can quickly display an image from the repository in your content.\r\n

\r\nExample: ^I("logo");\r\n

\r\n\r\n^i();
\r\nThis macro retrieves the URL for any file in the collateral management system.\r\n

\r\nExample: ^i("status report");\r\n

\r\n\r\n\r\n^RandomImage();
\r\nThis macro takes a collateral folder as a parameter. If the folder name is omitted, then the root folder will be used. The macro then randomly chooses an image in the folder and returns it in much the same way the ^I(); macro works.\r\n

\r\nExample: ^RandomImage("site headers");\r\n

\r\n\r\n^RandomSnippet();
\r\nThis macro takes a collateral folder as a parameter. If the folder name is omitted, then the root folder will be used. The macro then randomly chooses a snippet from the folder and returns it in much the same way the ^Snippet(); macro works.\r\n

\r\nExample: ^RandomSnippet("quips");\r\n

\r\n\r\n\r\n^SI();
\r\nThe Scaled Image macro allows images to be found in the collateral and scaled (on the server-side), either maintaining the original aspect ratio or an entirely new ratio of your design. \r\n

\r\nIt takes four parameters. The first is the image name or optionally the collateral id. The second is the width. Set the width to "0" to maintain aspect ratio by height. The third is height. Set the height to "0" to maintain aspect ratio by width. The fourth parameter allows you to specify additional parameters to the image.\r\n

\r\nExamples:
\r\nRetrieving an image by name (no scaling)
\r\n^SI(myimage);\r\n

\r\nRetrieving an image by collateralId (no scaling)
\r\n^SI(66);\r\n

\r\nScaling by width, maintaining aspect ratio
\r\n^SI(66,25);\r\n

\r\nScaling by height, maintaining aspect ratio
\r\n^SI(66,0,25);\r\n

\r\nPlaying with the aspect ratio
\r\n^SI(66,148,25);\r\n

\r\nUsing parameters
\r\n^SI(66,0,0,\'border="0"\');\r\n

\r\n\r\n\r\n^Snippet();
\r\nThis macro retrieves the contents of a snippet in the collateral management system and inserts it into the page.\r\n

\r\nExample: ^Snippet("flash code");\r\n

\r\n\r\n^Thumbnail();
\r\nThis macro retrieves the URL for the thumbnail of any image in the collateral management system.\r\n

\r\nExample: ^Thumbnail("logo");\r\n

\r\n\r\n^ThumbnailLinker();
\r\nThis macro builds a quick image viewer using nothing more than the collateral management system. It creates a thumbnail image with the name of the image under it and then links them both to the full sized image. You can also specify a "1" as a second parameter to have the linker create a new window to display the linked image.\r\n

\r\nExample: ^ThumbnailLinker("logo");\r\n

\r\n\r\n', 1051221379,NULL); delete from help where namespace='MailForm'; @@ -525,4 +523,11 @@ delete from settings where name='sharedTrash'; insert into settings (name,value) values ('sharedTrash','0'); delete from international where languageId=1 and namespace='WebGUI' and internationalId=629; INSERT INTO international (internationalId,languageId,namespace,message,lastUpdated) VALUES (629,1,'WebGUI','Use shared clipboard?
\r\nEnables a single, system-wide clipboard shared by all users. Default is user separated clipboards.\r\n

\r\n\r\nUse shared trash?
\r\nEnables a single, system-wide trash shared by all users. Default is user separated trash.\r\n

\r\n\r\nPrevent Proxy Caching
\r\nSome companies have proxy servers that cause problems with WebGUI. If you\'re experiencing problems with WebGUI, and you have a proxy server, you may want to set this setting to Yes. Beware that WebGUI\'s URLs will not be as user-friendly after this feature is turned on.\r\n

\r\n\r\nShow debugging?
\r\nShow debugging information in WebGUI\'s output. This is primarily useful for WebGUI developers, but can also be interesting for Administrators trying to troubleshoot a problem.\r\n

\r\n\r\nTrack page statistics?
\r\nWebGUI can track some statistical information for your site. However, this will add a little extra strain on your processor and will make your database grow much more quickly. Enable this only if you do not have an external web statistics program.\r\n

\r\n',1052850265); +alter table HttpProxy change ProxiedUrl proxiedUrl text; +delete from international where languageId=1 and namespace='WebGUI' and internationalId=844; +insert into international (internationalId,languageId,namespace,message,lastUpdated,context) 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^CanEditText();
\r\nDisplay a message to a user that can edit the current page.\r\n

\r\nExample: ^CanEditText(^AdminToggle;);\r\n

\r\n\r\n^EditableToggle; or ^EditableToggle();
\r\nExactly the same as AdminToggle, except that the toggle is only displayed if the user has the rights to edit the current page.\r\n

\r\n\r\n^GroupText();
\r\nDisplays a small text message to the user if they belong to the specified group. And you can specify an alternate message to those who are not in the group.\r\n

\r\nExample: ^GroupText("Visitors","You need an account to do anything cool on this site!","We value our registered users!");\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', 1053114197,NULL); INSERT INTO style VALUES (-10,'htmlArea Image Manager','\r\n','\r\n\r\n\r\n\r\n\r\n\r\n^-;\r\n'); + + + + diff --git a/lib/WebGUI/Macro/EditableToggle.pm b/lib/WebGUI/Macro/EditableToggle.pm new file mode 100644 index 000000000..8260ddf28 --- /dev/null +++ b/lib/WebGUI/Macro/EditableToggle.pm @@ -0,0 +1,38 @@ +package WebGUI::Macro::EditableToggle; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2003 Plain Black LLC. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::International; +use WebGUI::Macro; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::URL; + +#------------------------------------------------------------------- +sub process { + my ($temp, @param, $turnOn, $turnOff); + if (WebGUI::Privilege::canEditPage()) { + @param = WebGUI::Macro::getParams($_[0]); + if ($session{var}{adminOn}) { + $turnOff = $param[1] || WebGUI::International::get(517); + $temp = ''.$turnOff.''; + } else { + $turnOn = $param[0] || WebGUI::International::get(516); + $temp = ''.$turnOn.''; + } + } + return $temp; +} + +1; + + diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index 579fd8aa8..315609b9c 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -258,7 +258,9 @@ If specified the wobject will be duplicated to this pageId, otherwise it will be =cut sub duplicate { - my %properties = %{$_[0]->get}; + my %properties; + tie %properties, 'Tie::CPHash'; + %properties = %{$_[0]->get}; $properties{pageId} = $_[1] || 2; if ($properties{pageId} == 2) { $properties{bufferUserId} = $session{user}{userId}; diff --git a/lib/WebGUI/Wobject/HttpProxy.pm b/lib/WebGUI/Wobject/HttpProxy.pm index d999715d1..ec5209bfb 100644 --- a/lib/WebGUI/Wobject/HttpProxy.pm +++ b/lib/WebGUI/Wobject/HttpProxy.pm @@ -149,6 +149,8 @@ sub www_view { $redirect=0; + return $output unless ($proxiedUrl ne ""); + until($redirect == 5) { # We follow max 5 redirects to prevent bouncing/flapping $userAgent = new LWP::UserAgent; $userAgent->agent($session{env}{HTTP_USER_AGENT}); @@ -168,9 +170,8 @@ sub www_view { $header = new HTTP::Headers; $header->referer($_[0]->get("proxiedUrl")); # To get around referrer blocking - if($session{env}{REQUEST_METHOD}=~/GET/i - || $redirect != 0) { # request_method is also GET after a redirection. Just to make sure we're - # not posting the same data over and over again. + if($session{env}{REQUEST_METHOD}=~/GET/i || $redirect != 0) { # request_method is also GET after a redirection. Just to make sure we're + # not posting the same data over and over again. if($redirect == 0 && $session{form}{wid} == $_[0]->get("wobjectId")) { foreach my $input_name (keys %{$session{form}}) { next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's diff --git a/www/extras/htmlArea/popups/macros.html b/www/extras/htmlArea/popups/macros.html index 22b4674b0..8363577d1 100644 --- a/www/extras/htmlArea/popups/macros.html +++ b/www/extras/htmlArea/popups/macros.html @@ -90,6 +90,7 @@ function returnSelected(in_values) { +