+2005-07-08 Helge Hess <helge.hess@opengroupware.org>
+
+ * SoObjects/SoHTTPAuthenticator.m: deprecated -authRealm, replaced with
+ -authRealmInContext: (v4.5.170)
+
+ * WOComponent.m: added support for WODebugTakeValues (v4.5.169)
+
2005-07-06 Helge Hess <helge.hess@opengroupware.org>
* WebDAV/SoObjectWebDAVDispatcher.m: fixed an issue when trying to call
*/
#include "WOInput.h"
-#include "decommon.h"
@interface WOHiddenField : WOInput
{
@end /* WOHiddenField */
+#include "decommon.h"
+
@implementation WOHiddenField
-// responder
+/* generate response */
- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
- if (![[_ctx request] isFromClientComponent]) {
- BOOL isDisabled;
+ NSString *v;
+ BOOL isDisabled;
+
+ if ([[_ctx request] isFromClientComponent])
+ return;
- isDisabled = [self->disabled boolValueInComponent:[_ctx component]];
+ isDisabled = [self->disabled boolValueInComponent:[_ctx component]];
- if (isDisabled) {
- NSString *s;
-
- s = [self->value stringValueInComponent:[_ctx component]];
- [_response appendContentHTMLString:s];
- }
- else {
- NSString *v;
-
- v = [self->value stringValueInComponent:[_ctx component]];
-
- WOResponse_AddCString(_response, "<input type=\"hidden\" name=\"");
- [_response appendContentHTMLAttributeValue:OWFormElementName(self, _ctx)];
- WOResponse_AddCString(_response, "\" value=\"");
- [_response appendContentHTMLAttributeValue:v];
- WOResponse_AddChar(_response, '"');
- [self appendExtraAttributesToResponse:_response inContext:_ctx];
- if (self->otherTagString) {
+ if (isDisabled) {
+ // TODO: this is correct for a _hidden_?
+ v = [self->value stringValueInComponent:[_ctx component]];
+ [_response appendContentHTMLString:v];
+ return;
+ }
+
+ v = [self->value stringValueInComponent:[_ctx component]];
+
+ WOResponse_AddCString(_response, "<input type=\"hidden\" name=\"");
+ [_response appendContentHTMLAttributeValue:OWFormElementName(self, _ctx)];
+ WOResponse_AddCString(_response, "\" value=\"");
+ [_response appendContentHTMLAttributeValue:v];
+ WOResponse_AddChar(_response, '"');
+ [self appendExtraAttributesToResponse:_response inContext:_ctx];
+ if (self->otherTagString != nil) {
WOResponse_AddChar(_response, ' ');
WOResponse_AddString(_response,
[self->otherTagString stringValueInComponent:
[_ctx component]]);
- }
- WOResponse_AddEmptyCloseParens(_response, _ctx);
- }
}
+ WOResponse_AddEmptyCloseParens(_response, _ctx);
}
@end /* WOHiddenField */
@implementation WOInput
-static BOOL takeValueDebugOn = NO;
+static BOOL takeValueDebugOn = YES;
+ (int)version {
return [super version] + 0 /* v2 */;
}
+ (void)initialize {
+ NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+
NSAssert2([super version] == 2,
@"invalid superclass (%@) version %i !",
NSStringFromClass([self superclass]), [super version]);
+
+ if ((takeValueDebugOn = [ud boolForKey:@"WODebugTakeValues"]))
+ NSLog(@"WOInput: WODebugTakeValues on.");
}
- (id)initWithName:(NSString *)_name
/* HTTP basic authentication */
-- (NSString *)authRealm;
+- (NSString *)authRealmInContext:(WOContext *)_ctx;
- (WOResponse *)preprocessCredentialsInContext:(WOContext *)_ctx;
- (NSString *)checkCredentials:(NSString *)_creds;
/* HTTP basic authentication */
- (NSString *)authRealm {
+ // DEPRECATED
return [(WOApplication *)[WOApplication application] name];
}
+- (NSString *)authRealmInContext:(WOContext *)_ctx {
+ return [self authRealm];
+}
/* check for roles */
if ([_reason length] == 0) _reason = @"Unauthorized";
- auth = [NSString stringWithFormat:@"basic realm=\"%@\"", [self authRealm]];
+ auth = [NSString stringWithFormat:@"basic realm=\"%@\"",
+ [self authRealmInContext:_ctx]];
r = [_ctx response];
[r setStatus:401 /* unauthorized */];
NSString *auth;
r = [_ctx response];
- auth = [NSString stringWithFormat:@"basic realm=\"%@\"", [self authRealm]];
+ auth = [NSString stringWithFormat:@"basic realm=\"%@\"",
+ [self authRealmInContext:_ctx]];
[r setStatus:[_e httpStatus] /* unauthorized */];
[r setHeader:auth forKey:@"www-authenticate"];
return YES;
# version file
-SUBMINOR_VERSION:=168
+SUBMINOR_VERSION:=170
# v4.5.122 requires libNGExtensions v4.5.153
# v4.5.91 requires libNGExtensions v4.5.134
static BOOL debugOn = NO;
static BOOL debugComponentAwake = NO;
static BOOL debugTemplates = NO;
+static BOOL debugTakeValues = NO;
static BOOL abortOnAwakeComponentInCtxDealloc = NO;
static BOOL abortOnMissingCtx = NO;
static BOOL wakeupPageOnCreation = NO;
perfLogger = [lm loggerForDefaultKey:@"WOProfileElements"];
debugOn = [WOApplication isDebuggingEnabled];
debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"];
+
+ if ((debugTakeValues = [ud boolForKey:@"WODebugTakeValues"]))
+ NSLog(@"WOComponent: WODebugTakeValues on.");
+
abortOnAwakeComponentInCtxDealloc =
[ud boolForKey:@"WOCoreOnAwakeComponentInCtxDealloc"];
}
/* OWResponder */
-- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{
+- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c {
+ if (debugTakeValues)
+ [self debugWithFormat:@"%s: default says no.", __PRETTY_FUNCTION__];
return NO;
}
- (void)takeValuesFromRequest:(WORequest *)_req inContext:(WOContext *)_ctx {
WOElement *template = nil;
+ if (debugTakeValues)
+ [self debugWithFormat:@"take values from rq 0x%08X", _req];
+
NSAssert1(self->componentFlags.isAwake,
@"component %@ is not awake !", self);
[self _setContext:_ctx];
template = [self _woComponentTemplate];
- if (template == nil)
+ if (template == nil) {
+ if (debugTakeValues)
+ [self debugWithFormat:@"cannot take values, component has no template!"];
return;
-
+ }
+
if (template->takeValues) {
template->takeValues(template,
@selector(takeValuesFromRequest:inContext:),