From: helge Date: Mon, 28 Mar 2005 15:31:09 +0000 (+0000) Subject: added escapeJS/framework bindings to some elements X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80e6b6a066db1198c2eefa988a1070be74a0f51a;p=sope added escapeJS/framework bindings to some elements added support for non-xml tag endings git-svn-id: http://svn.opengroupware.org/SOPE/trunk@704 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/WOExtensions/ChangeLog b/sope-appserver/WOExtensions/ChangeLog index ed7e88ff..db1dd918 100644 --- a/sope-appserver/WOExtensions/ChangeLog +++ b/sope-appserver/WOExtensions/ChangeLog @@ -1,3 +1,31 @@ +2005-03-28 Stephane Corthesy + + * v4.5.23 + + * JSAlertPanel: added new bindings, escapeJS and framework; + fixed html 'onclick' attribute + + * JSConfirmPanel: added new bindings, escapeJS and framework; replaced + deprecated 'language' html attribute by 'type' + + * JSImageFlyover.m: replaced deprecated 'language' html attribute by + 'type' + + * JSModalWindow: added 'framework' binding + + * JSValidatedField: added new binding, escapeJS; replaced deprecated + 'language' html attribute by 'type' + + * JSImageFlyover.api, WOCollapsibleComponentContent.api: added + defaults to framework binding + +2005-03-28 Helge Hess + + * JSValidatedField.m, JSModalWindow.m, JSAlertPanel.m, + JSConfirmPanel.m, JSImageFlyover.m, WOCheckBoxMatrix.m, + WORadioButtonMatrix.m, WOTabPanel.m: minor code cleanups, added some + support for non-xml style elements + 2005-01-04 Marcus Mueller * common.h, JSConfirmPanel.m, JSAlertPanel.m, JSImageFlyover.m, diff --git a/sope-appserver/WOExtensions/JSAlertPanel.api b/sope-appserver/WOExtensions/JSAlertPanel.api index f8e4ba0e..28b04ea1 100644 --- a/sope-appserver/WOExtensions/JSAlertPanel.api +++ b/sope-appserver/WOExtensions/JSAlertPanel.api @@ -11,6 +11,10 @@ + + + + diff --git a/sope-appserver/WOExtensions/JSAlertPanel.m b/sope-appserver/WOExtensions/JSAlertPanel.m index 3ed65cb4..3fd45d1d 100644 --- a/sope-appserver/WOExtensions/JSAlertPanel.m +++ b/sope-appserver/WOExtensions/JSAlertPanel.m @@ -32,7 +32,10 @@ WOAssociation *targetWindow; WOAssociation *string; + /* non WO */ WOElement *template; + WOAssociation *escapeJS; + WOAssociation *framework; } @end @@ -66,6 +69,8 @@ self->filename = WOExtGetProperty(_config,@"filename"); self->targetWindow = WOExtGetProperty(_config,@"targetWindow"); self->string = WOExtGetProperty(_config,@"string"); + self->escapeJS = WOExtGetProperty(_config,@"escapeJS"); + self->framework = WOExtGetProperty(_config,@"framework"); funcCount = 0; if (self->action) funcCount++; @@ -100,6 +105,8 @@ RELEASE(self->targetWindow); RELEASE(self->string); RELEASE(self->template); + RELEASE(self->escapeJS); + RELEASE(self->framework); [super dealloc]; } @@ -133,10 +140,13 @@ comp = [_ctx component]; // link - [_response appendContentString:@"alertMessage) ? [self->alertMessage stringValueInComponent: comp] : @"Press OK."; + if (self->escapeJS != nil && [self->escapeJS boolValueInComponent: comp]) { + tmp = [tmp stringByApplyingJavaScriptEscaping]; + } [_response appendContentHTMLString:tmp]; [_response appendContentString:@"');\""]; [_response appendContentString:@" href=\""]; @@ -160,14 +170,19 @@ [_response appendContentString:@" >"]; // link content - if (self->filename) { + if (self->filename != nil) { WOResourceManager *rm; + NSString *frameworkName; + frameworkName = (self->framework != nil) + ? [self->framework stringValueInComponent:comp] + : [comp frameworkName]; + rm = [[_ctx application] resourceManager]; languages = [_ctx resourceLookupLanguages]; tmp = [rm urlForResourceNamed:[self->filename stringValueInComponent:comp] - inFramework:[comp frameworkName] + inFramework:frameworkName languages:languages request:[_ctx request]]; @@ -175,16 +190,20 @@ [_response appendContentString:tmp]; [_response appendContentString:@"\""]; - if (self->altTag) { + if (self->altTag != nil) { [_response appendContentString:@" alt=\""]; [_response appendContentString: [self->altTag stringValueInComponent:comp]]; [_response appendContentString:@"\" "]; } - [_response appendContentString:@" />"]; + + [_response appendContentString: + (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")]; } + [self->template appendToResponse:_response inContext:_ctx]; - if (self->string) + + if (self->string != nil) [_response appendContentString:[self->string stringValueInComponent:comp]]; /* close link */ diff --git a/sope-appserver/WOExtensions/JSConfirmPanel.api b/sope-appserver/WOExtensions/JSConfirmPanel.api index bbb048ee..7bd83a69 100644 --- a/sope-appserver/WOExtensions/JSConfirmPanel.api +++ b/sope-appserver/WOExtensions/JSConfirmPanel.api @@ -13,6 +13,8 @@ + + diff --git a/sope-appserver/WOExtensions/JSConfirmPanel.m b/sope-appserver/WOExtensions/JSConfirmPanel.m index 4854f602..1d0f13ef 100644 --- a/sope-appserver/WOExtensions/JSConfirmPanel.m +++ b/sope-appserver/WOExtensions/JSConfirmPanel.m @@ -35,6 +35,8 @@ /* non WO */ WOAssociation *showPanel; WOElement *template; + WOAssociation *escapeJS; + WOAssociation *framework; } @end @@ -69,6 +71,8 @@ self->targetWindow = WOExtGetProperty(_config,@"targetWindow"); self->string = WOExtGetProperty(_config,@"string"); self->showPanel = WOExtGetProperty(_config,@"showPanel"); + self->escapeJS = WOExtGetProperty(_config,@"escapeJS"); + self->framework = WOExtGetProperty(_config,@"framework"); funcCount = 0; if (self->action) funcCount++; @@ -104,6 +108,8 @@ [self->string release]; [self->template release]; [self->showPanel release]; + [self->escapeJS release]; + [self->framework release]; [super dealloc]; } @@ -122,11 +128,11 @@ return nil; } - if (self->pageName) { - name = [self->pageName stringValueInComponent: [_ctx component]]; + if (self->pageName != nil) { + name = [self->pageName stringValueInComponent: [_ctx component]]; result = [[_ctx application] pageWithName:name inContext:_ctx]; } - else if (self->action) { + else if (self->action != nil) { result = [self->action valueInComponent:[_ctx component]]; } else { @@ -145,7 +151,7 @@ return; [_response appendContentString: - @"