Monotone-Parent: f8b29d68c36441f92d7ffe8056a95fd25a2fd409

Monotone-Revision: 60b451d63d7516a7e662359127f629d2c70e3f25

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-10-18T14:44:58
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-10-18 14:44:58 +00:00
parent 4e7ed2dab8
commit 67f33463b1
6 changed files with 57 additions and 37 deletions

View File

@ -1,3 +1,11 @@
2007-10-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Common/UIxPageFrame.m ([UIxPageFrame
-productLocalizableStrings]): new method that returns the
product-specific translation dictionary as a JSON hash.
([UIxPageFrame -commonLocalizableStrings]): same as above but for
the "Common" framework.
2007-10-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailActions.m ([UIxMailActions -copyAction]):

View File

@ -39,6 +39,9 @@
BOOL isPopup;
}
- (NSString *) commonLocalizableStrings;
- (NSString *) productLocalizableStrings;
- (NSString *) pageJavaScriptURL;
- (NSString *) productJavaScriptURL;
- (BOOL) hasPageSpecificJavaScript;
@ -49,8 +52,6 @@
- (BOOL) hasPageSpecificCSS;
- (BOOL) hasProductSpecificCSS;
- (NSString *) productFrameworkName;
- (void) setPopup: (BOOL) popup;
- (BOOL) isPopup;

View File

@ -23,8 +23,10 @@
#import <NGObjWeb/SoComponent.h>
#import <NGObjWeb/WOComponent.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SOGoUI/UIxComponent.h>
#import <SOGo/SOGoUser.h>
#import <Main/build.h>
@ -166,6 +168,40 @@
/* page based JavaScript */
- (NSString *) _stringsForFramework: (NSString *) framework
{
NSDictionary *table;
NSString *language, *frameworkName;
frameworkName = [NSString stringWithFormat: @"%@.SOGo",
(framework ? framework : [self frameworkName])];
language = [[context activeUser] language];
table
= [[self resourceManager] stringTableWithName: @"Localizable"
inFramework: frameworkName
languages: [NSArray arrayWithObject: language]];
/* table is not really an NSDict44ionary but a hackish variation thereof */
table = [NSDictionary dictionaryWithDictionary: table];
return [table jsonRepresentation];
}
- (NSString *) commonLocalizableStrings
{
return [NSString stringWithFormat: @"var clabels = %@;",
[self _stringsForFramework: nil]];
}
- (NSString *) productLocalizableStrings
{
NSString *frameworkName;
frameworkName = [[context page] frameworkName];
return [NSString stringWithFormat: @"var labels = %@;",
[self _stringsForFramework: frameworkName]];
}
- (NSString *) pageJavaScriptURL
{
WOComponent *page;
@ -190,15 +226,6 @@
return [self urlForResourceFilename: fwJSFilename];
}
- (NSString *) productFrameworkName
{
WOComponent *page;
page = [context page];
return [NSString stringWithFormat: @"%@.SOGo", [page frameworkName]];
}
- (BOOL) hasPageSpecificJavaScript
{
return ([[self pageJavaScriptURL] length] > 0);
@ -300,5 +327,4 @@
return [cc isMacBrowser];
}
@end /* UIxPageFrame */

View File

@ -42,6 +42,8 @@
const:negate="YES"
>var UserFolderURL = '<var:string value="userFolderPath" />';
var UserLogin = '<var:string value="shortUserNameForDisplay" />';</var:if>
<var:string value="commonLocalizableStrings" const:escapeHTML="NO"/>
<var:string value="productLocalizableStrings" const:escapeHTML="NO"/>
</script>
<script type="text/javascript" rsrc:src="events.js"><!-- space required --></script>
<script type="text/javascript" rsrc:src="prototype.js"><!-- space required --></script>
@ -55,15 +57,11 @@
<script type="text/javascript" rsrc:src="generic.js"><!-- space required --></script>
<script type="text/javascript" rsrc:src="SOGoDragAndDrop.js"><!-- space required --></script>
<script type="text/javascript" rsrc:src="SOGoDragHandles.js"><!-- space required --></script>
<var:if condition="hasProductSpecificJavaScript"><script type="text/javascript"
var:src="productJavaScriptURL"><!-- space required --></script></var:if>
<var:if condition="hasPageSpecificJavaScript"><script type="text/javascript"
var:src="pageJavaScriptURL"><!-- space required --></script></var:if>
<var:js-stringtable
var:framework="productFrameworkName"
const:identifier="labels" />
<var:js-stringtable
const:identifier="clabels" />
<var:if condition="shortUserNameForDisplay" const:value="anonymous"
const:negate="YES"
><var:if condition="shortUserNameForDisplay" const:value="wrongusernamepassword"

View File

@ -301,7 +301,7 @@ function onMenuWriteToContact(event) {
var emailCell = contactRow.down('td', 1);
if (!emailCell.firstChild) { // .nodeValue is the contact email address
window.alert(labels["The selected contact has no email address."].decodeEntities());
window.alert(labels["The selected contact has no email address."]);
return false;
}
@ -343,7 +343,7 @@ function onToolbarWriteToSelectedContacts(event) {
}
if (rowsWithEmail == 0) {
window.alert(labels["The selected contact has no email address."].decodeEntities());
window.alert(labels["The selected contact has no email address."]);
}
else if (document.body.hasClassName("popup"))
window.close();

View File

@ -999,7 +999,7 @@ function folderSubscriptionCallback(http) {
http.callbackData["method"](http.callbackData["data"]);
}
else
window.alert(clabels["Unable to subscribe to that folder!"].decodeEntities());
window.alert(clabels["Unable to subscribe to that folder!"]);
document.subscriptionAjaxRequest = null;
}
else
@ -1025,7 +1025,7 @@ function subscribeToFolder(refreshCallback, refreshCallbackData) {
}
else
refreshCallbackData["window"].alert(clabels["You cannot subscribe to a folder that you own!"]
.decodeEntities());
);
}
function folderUnsubscriptionCallback(http) {
@ -1035,7 +1035,7 @@ function folderUnsubscriptionCallback(http) {
http.callbackData["method"](http.callbackData["data"]);
}
else
window.alert(clabels["Unable to unsubscribe from that folder!"].decodeEntities());
window.alert(clabels["Unable to unsubscribe from that folder!"]);
document.unsubscriptionAjaxRequest = null;
}
}
@ -1061,7 +1061,7 @@ function unsubscribeFromFolder(folder, refreshCallback, refreshCallbackData) {
rfCbData);
}
else
window.alert(clabels["You cannot unsubscribe from a folder that you own!"].decodeEntities());
window.alert(clabels["You cannot unsubscribe from a folder that you own!"]);
}
}
@ -1337,25 +1337,12 @@ function onLoadHandler(event) {
initTabs();
configureDragHandles();
configureLinkBanner();
translateLabels();
var progressImage = $("progressIndicator");
if (progressImage)
progressImage.parentNode.removeChild(progressImage);
Event.observe(document.body, "contextmenu", onBodyClickContextMenu);
}
function translateLabels() {
if (typeof labels != "undefined") {
for (var key in labels)
labels[key] = labels[key].decodeEntities();
}
if (typeof clabels != "undefined") {
for (var key in clabels)
clabels[key] = clabels[key].decodeEntities();
}
}
function onBodyClickContextMenu(event) {
preventDefault(event);
}