From ffff7bf4cd43e6e7645654d27ea75cd95d1e6ce3 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 16 Apr 2003 02:38:53 +0000 Subject: [PATCH] Added context to internationalization system. --- docs/upgrades/upgrade_5.2.4-5.3.0.sql | 2 +- lib/WebGUI/Operation/International.pm | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) 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 90b84b1fa..2755dc190 100644 --- a/docs/upgrades/upgrade_5.2.4-5.3.0.sql +++ b/docs/upgrades/upgrade_5.2.4-5.3.0.sql @@ -273,7 +273,7 @@ delete from international where languageId=1 and namespace='WebGUI' and internat insert into international (internationalId,languageId,namespace,message,lastUpdated) values (606,1,'WebGUI','Think of pages as containers for content. For instance, if you want to write a letter to the editor of your favorite magazine you\'d get out a notepad (or open a word processor) and start filling it with your thoughts. The same is true with WebGUI. Create a page, then add your content to the page.\r\n

\r\n\r\nTitle
\r\nThe title of the page is what your users will use to navigate through the site. Titles should be descriptive, but not very long.\r\n

\r\n\r\n\r\nMenu Title
\r\nA shorter or altered title to appear in navigation. If left blank this will default to Title.\r\n

\r\n\r\nPage URL
\r\nWhen you create a page a URL for the page is generated based on the page title. If you are unhappy with the URL that was chosen, you can change it here.\r\n

\r\n\r\nRedirect URL
\r\nWhen this page is visited, the user will be redirected to the URL specified here. \r\n

\r\nNOTE: The redirects will be disabled while in admin mode in order to make it easier to edit the properties of the page.\r\n

\r\n\r\n\r\nHide from navigation?
\r\nSelect yes to hide this page from the navigation.\r\n

\r\nNOTE: This will not hide the page from the page tree (Administrative functions... > Manage page tree.), only from navigation macros.\r\n

\r\n\r\nOpen in new window?
\r\nSelect yes to open this page in a new window. This is often used in conjunction with the Redirect URL parameter.\r\n

\r\n\r\n\r\n\r\nLanguage
\r\nChoose the default language for this page. All WebGUI generated messages will appear in that language and the character set will be changed to the character set for that language.\r\n

\r\n\r\nTemplate
\r\nBy default, WebGUI has one big content area to place wobjects. However, by specifying a template other than the default you can sub-divide the content area into several sections.\r\n

\r\n\r\nSynopsis
\r\nA short description of a page. It is used to populate default descriptive meta tags as well as to provide descriptions on Site Maps.\r\n

\r\n\r\nMeta Tags
\r\nMeta tags are used by some search engines to associate key words to a particular page. There is a great site called Meta Tag Builder that will help you build meta tags if you\'ve never done it before.\r\n

\r\n\r\nAdvanced Users: If you have other things (like JavaScript) you usually put in the area of your pages, you may put them here as well.\r\n

\r\n\r\nUse default meta tags?
\r\nIf you don\'t wish to specify meta tags yourself, WebGUI can generate meta tags based on the page title and your company\'s name. Check this box to enable the WebGUI-generated meta tags.\r\n

\r\n\r\n\r\nStyle
\r\nBy default, when you create a page, it inherits a few traits from its parent. One of those traits is style. Choose from the list of styles if you would like to change the appearance of this page. See Add Style for more details.\r\n

\r\n\r\nIf you select "Yes" below the style pull-down menu, all of the pages below this page will take on the style you\'ve chosen for this page.\r\n

\r\n\r\nStart Date
\r\nThe date when users may begin viewing this page. Note that before this date only content managers with the rights to edit this page will see it.\r\n

\r\n\r\nEnd Date
\r\nThe date when users will stop viewing this page. Note that after this date only content managers with the rights to edit this page will see it.\r\n

\r\n\r\n\r\nOwner
\r\nThe owner of a page is usually the person who created the page. This user always has full edit and viewing rights on the page.\r\n

\r\nNOTE: The owner can only be changed by an administrator.\r\n

\r\n\r\n\r\nWho can view?
\r\nChoose which group can view this page. If you want both visitors and registered users to be able to view the page then you should choose the "Everybody" group.\r\n

\r\n\r\nWho can edit?
\r\nChoose the group that can edit this page. The group assigned editing rights can also always view the page.\r\n

\r\n\r\nYou can optionally recursively give these privileges to all pages under this page.\r\n

\r\n\r\nWhat next?
\r\nIf you leave this on the default setting you\'ll be redirected to the new page after creating it.\r\n

', 1050440606); delete from international where languageId=1 and namespace='WebGUI' and internationalId=831; insert into international (internationalId,languageId,namespace,message,lastUpdated) values (831,1,'WebGUI','Collateral Macros', 1050441851); - +alter table international add column context text; diff --git a/lib/WebGUI/Operation/International.pm b/lib/WebGUI/Operation/International.pm index 0ef4f9d33..b3944f54c 100644 --- a/lib/WebGUI/Operation/International.pm +++ b/lib/WebGUI/Operation/International.pm @@ -90,6 +90,7 @@ sub www_addInternationalMessage { WebGUI::SQL->buildHashRef("select namespace,namespace from international where languageId=1 order by namespace") ,"Namespace",['WebGUI']); $f->textarea("message","Message"); + $f->textarea("context","Context"); $f->submit; $output .= $f->print; return _submenu($output); @@ -102,8 +103,10 @@ sub www_addInternationalMessageSave { and namespace=".quote($session{form}{namespace})); $nextId++; my $namespace = $session{form}{namespace_new} || $session{form}{namespace}; - WebGUI::SQL->write("insert into international (languageId, internationalId, namespace, message, lastUpdated) values - (1,$nextId,".quote($namespace).",".quote($session{form}{message}).",".time().")"); + WebGUI::SQL->write("insert into international (languageId, internationalId, namespace, message, lastUpdated, + context) values + (1,$nextId,".quote($namespace).",".quote($session{form}{message}).",".time().", + ".quote($session{form}{context}).")"); return "Message was added with id $nextId.".www_listInternationalMessages(); } @@ -135,7 +138,7 @@ sub www_deleteLanguageConfirm { #------------------------------------------------------------------- sub www_editInternationalMessage { - my ($output, $message, $f, $language); + my ($output, $message, $context, $f, $language); return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3)); ($language) = WebGUI::SQL->quickArray("select language from language where languageId=".$session{form}{lid}); $output = '

'.WebGUI::International::get(597).'

'; @@ -151,9 +154,13 @@ sub www_editInternationalMessage { and namespace='".$session{form}{namespace}."' and languageId=".$session{form}{lid}); $f->textarea("message",$language,$message); $f->submit; - ($message) = WebGUI::SQL->quickArray("select message from international where internationalId=".$session{form}{iid}." + ($message, $context) = WebGUI::SQL->quickArray("select message,context from international where internationalId=".$session{form}{iid}." and namespace='".$session{form}{namespace}."' and languageId=1"); $f->readOnly(WebGUI::Macro::negate($message),"English"); + $f->readOnly( + -label=>"Message Context", + -value=>$context + ); $output .= $f->print; return _submenu($output); }