Monotone-Parent: 6de228594e5feb001f4208313d8363017d61a463

Monotone-Revision: b83048b6a7cb04b3bd23bb087f18cf0d7c495d49

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-12T16:42:59
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2006-10-12 16:42:59 +00:00
parent 9fa766dae5
commit 142dff8d5e
12 changed files with 117 additions and 260 deletions

View File

@ -1,5 +1,12 @@
2006-10-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Scheduler/UIxTaskEditor.m ([UIxTaskEditor -saveAction]),
UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor
-saveAction]), UI/MailerUI/UIxMailEditor.m ([UIxMailEditor
-sendAction]), UI/Contacts/UIxContactEditor.m ([UIxContactEditor
-saveAction]):
return a UIxJSClose component if everything went fine.
* UI/Scheduler/UIxTaskEditor.h: interface extracted from
UIxTaskEditor.m.

View File

@ -366,11 +366,6 @@
return @"edit";
}
- (NSString *) contactUID
{
return [[self clientObject] nameInContainer];
}
- (CardElement *) _elementWithTag: (NSString *) tag
ofType: (NSString *) type
{
@ -462,10 +457,11 @@
[self _saveEmails];
}
- (id) saveAction
- (id <WOActionResults>) saveAction
{
id <SOGoContactObject> contact;
id result;
NSString *jsRefreshMethod;
contact = [self clientObject];
card = [contact vCard];
@ -474,7 +470,15 @@
[self _saveSnapshot];
[contact save];
result = [self redirectToLocation: @".."];
if ([[[[self context] request] formValueForKey: @"nojs"] intValue])
result = [self redirectToLocation: [self applicationPath]];
else
{
jsRefreshMethod
= [NSString stringWithFormat: @"refreshContacts(\"%@\")",
[contact nameInContainer]];
result = [self jsCloseWithRefreshMethod: jsRefreshMethod];
}
}
else
result = [NSException exceptionWithHTTPStatus: 400 /* Bad Request */

View File

@ -19,7 +19,7 @@
02111-1307, USA.
*/
#include <SOGoUI/UIxComponent.h>
#import <SOGoUI/UIxComponent.h>
/*
UIxMailEditor
@ -48,16 +48,16 @@
@end
#include <SoObjects/Mailer/SOGoDraftObject.h>
#include <SoObjects/Mailer/SOGoMailFolder.h>
#include <SoObjects/Mailer/SOGoMailAccount.h>
#include <SoObjects/Mailer/SOGoMailAccounts.h>
#include <SoObjects/Mailer/SOGoMailIdentity.h>
#include <SoObjects/SOGo/WOContext+Agenor.h>
#include <NGMail/NGMimeMessage.h>
#include <NGMail/NGMimeMessageGenerator.h>
#include <NGObjWeb/SoSubContext.h>
#include "common.h"
#import <SoObjects/Mailer/SOGoDraftObject.h>
#import <SoObjects/Mailer/SOGoMailFolder.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoMailAccounts.h>
#import <SoObjects/Mailer/SOGoMailIdentity.h>
#import <SoObjects/SOGo/WOContext+Agenor.h>
#import <NGMail/NGMimeMessage.h>
#import <NGMail/NGMimeMessageGenerator.h>
#import <NGObjWeb/SoSubContext.h>
#import "common.h"
@implementation UIxMailEditor
@ -491,11 +491,13 @@ static NSArray *infoKeys = nil;
return nil;
}
- (id)sendAction {
- (id <WOActionResults>) sendAction
{
NSException *error;
NSString *mailPath;
NSDictionary *h;
id <WOActionResults> result;
// TODO: need to validate whether we have a To etc
/* first, save form data */
@ -553,8 +555,12 @@ static NSArray *infoKeys = nil;
if ((error = [[self clientObject] delete]) != nil)
return error;
// if everything is ok, close the window (send a JS closing the Window)
return [self pageWithName:@"UIxMailWindowCloser"];
if ([[[[self context] request] formValueForKey: @"nojs"] intValue])
result = [self redirectToLocation: [self applicationPath]];
else
result = [self jsCloseWithRefreshMethod: nil];
return result;
}
- (id)deleteAction {

View File

@ -23,72 +23,6 @@
#import <NGCards/NSCalendarDate+NGCards.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGoUI/UIxComponent.h>
/* TODO: CLEAN UP */
@class NSString;
@class iCalPerson;
@class iCalRecurrenceRule;
@interface UIxAppointmentEditor : UIxComponent
{
NSString *iCalString;
NSString *errorText;
id item;
/* individual values */
NSCalendarDate *startDate;
NSCalendarDate *endDate;
NSCalendarDate *cycleUntilDate;
NSString *title;
NSString *location;
NSString *comment;
iCalPerson *organizer;
NSArray *participants; /* array of iCalPerson's */
NSArray *resources; /* array of iCalPerson's */
NSString *priority;
NSArray *categories;
NSString *accessClass;
BOOL isPrivate; /* default: NO */
BOOL checkForConflicts; /* default: NO */
NSDictionary *cycle;
NSString *cycleEnd;
}
- (NSString *)iCalStringTemplate;
- (NSString *)iCalString;
- (void)setIsPrivate:(BOOL)_yn;
- (void)setAccessClass:(NSString *)_class;
- (void)setCheckForConflicts:(BOOL)_checkForConflicts;
- (BOOL)checkForConflicts;
- (BOOL)hasCycle;
- (iCalRecurrenceRule *)rrule;
- (void)adjustCycleControlsForRRule:(iCalRecurrenceRule *)_rrule;
- (NSDictionary *)cycleMatchingRRule:(iCalRecurrenceRule *)_rrule;
- (BOOL)isCycleEndUntil;
- (void)setIsCycleEndUntil;
- (void)setIsCycleEndNever;
- (NSString *)_completeURIForMethod:(NSString *)_method;
- (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values
treatAsResource:(BOOL)_isResource;
- (NSString *)iCalParticipantsAndResourcesStringFromQueryParameters;
- (NSString *)iCalParticipantsStringFromQueryParameters;
- (NSString *)iCalResourcesStringFromQueryParameters;
- (NSString *)iCalStringFromQueryParameter:(NSString *)_qp
format:(NSString *)_format;
- (NSString *)iCalOrganizerString;
- (id)acceptOrDeclineAction:(BOOL)_accept;
@end
#import "common.h"
#import <NGCards/NGCards.h>
@ -99,6 +33,10 @@
#import <Appointments/SOGoAppointmentObject.h>
#import "UIxComponent+Agenor.h"
#import "UIxAppointmentEditor.h"
/* TODO: CLEAN UP */
@implementation UIxAppointmentEditor
+ (int)version {
@ -913,8 +851,8 @@
to:[_apt endDate]];
[self debugWithFormat:@" process: %d events", [infos count]];
ranges = [infos arrayByCreatingDateRangesFromObjectsWithStartDateKey:@"startDate"
andEndDateKey:@"endDate"];
ranges = [infos arrayByCreatingDateRangesFromObjectsWithStartDateKey: @"startDate"
andEndDateKey: @"endDate"];
ranges = [ranges arrayByCompactingContainedDateRanges];
[self debugWithFormat:@" blocked ranges: %@", ranges];
@ -980,9 +918,11 @@
return self;
}
- (id)saveAction {
- (id <WOActionResults>) saveAction
{
iCalEvent *apt;
iCalPerson *p;
id <WOActionResults> result;
NSString *content;
NSException *ex;
@ -1035,7 +975,12 @@
return self;
}
return [self redirectToLocation:[self _completeURIForMethod:@".."]];
if ([[[[self context] request] formValueForKey: @"nojs"] intValue])
result = [self redirectToLocation: [self applicationPath]];
else
result = [self jsCloseWithRefreshMethod: @"refreshAppointments()"];
return result;
}
- (NSString *) saveUrl

View File

@ -33,7 +33,6 @@
{
NSString *iCalString;
NSString *errorText;
NSString *action;
id item;
/* individual values */

View File

@ -23,73 +23,11 @@
#import <NGCards/NSCalendarDate+NGCards.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGoUI/UIxComponent.h>
#import "UIxTaskEditor.h"
/* TODO: CLEAN UP */
@class NSString;
@class iCalPerson;
@class iCalRecurrenceRule;
@interface UIxTaskEditor : UIxComponent
{
NSString *iCalString;
NSString *errorText;
id item;
/* individual values */
NSCalendarDate *startDate;
NSCalendarDate *dueDate;
NSCalendarDate *cycleUntilDate;
NSString *title;
NSString *location;
NSString *comment;
iCalPerson *organizer;
NSArray *participants; /* array of iCalPerson's */
NSArray *resources; /* array of iCalPerson's */
NSString *priority;
NSArray *categories;
NSString *accessClass;
BOOL isPrivate; /* default: NO */
BOOL checkForConflicts; /* default: NO */
NSDictionary *cycle;
NSString *cycleEnd;
}
- (NSString *)iCalStringTemplate;
- (NSString *)iCalString;
- (void)setIsPrivate:(BOOL)_yn;
- (void)setAccessClass:(NSString *)_class;
- (void)setCheckForConflicts:(BOOL)_checkForConflicts;
- (BOOL)checkForConflicts;
- (BOOL)hasCycle;
- (iCalRecurrenceRule *)rrule;
- (void)adjustCycleControlsForRRule:(iCalRecurrenceRule *)_rrule;
- (NSDictionary *)cycleMatchingRRule:(iCalRecurrenceRule *)_rrule;
- (BOOL)isCycleEndUntil;
- (void)setIsCycleEndUntil;
- (void)setIsCycleEndNever;
- (NSString *)_completeURIForMethod:(NSString *)_method;
- (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values
treatAsResource:(BOOL)_isResource;
- (NSString *)iCalParticipantsAndResourcesStringFromQueryParameters;
- (NSString *)iCalParticipantsStringFromQueryParameters;
- (NSString *)iCalResourcesStringFromQueryParameters;
- (NSString *)iCalStringFromQueryParameter:(NSString *)_qp
format:(NSString *)_format;
- (NSString *)iCalOrganizerString;
- (id)acceptOrDeclineAction:(BOOL)_accept;
@end
#import "common.h"
#import <NGCards/NGCards.h>
#import <NGExtensions/NGCalendarDateRange.h>
@ -145,10 +83,13 @@
/* accessors */
- (void)setItem:(id)_item {
- (void) setItem: (id) _item
{
ASSIGN(item, _item);
}
- (id)item {
- (id) item
{
return item;
}
@ -678,8 +619,8 @@
/* save */
/* returned dates are in GMT */
- (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values
treatAsResource:(BOOL)_isResource
- (NSArray *) getICalPersonsFromFormValues: (NSArray *) _values
treatAsResource: (BOOL) _isResource
{
unsigned i, count;
NSMutableArray *result;
@ -905,7 +846,7 @@
[self debugWithFormat:@" process: %d tasks", [infos count]];
ranges = [infos arrayByCreatingDateRangesFromObjectsWithStartDateKey:@"startDate"
andDueDateKey:@"dueDate"];
andEndDateKey:@"dueDate"];
ranges = [ranges arrayByCompactingContainedDateRanges];
[self debugWithFormat:@" blocked ranges: %@", ranges];
@ -929,11 +870,14 @@
/* actions */
- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{
- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq
inContext: (WOContext*) _c
{
return YES;
}
- (id)testAction {
- (id) testAction
{
/* for testing only */
WORequest *req;
iCalToDo *task;
@ -950,9 +894,10 @@
return self;
}
- (id<WOActionResults>)defaultAction {
- (id <WOActionResults>) defaultAction
{
NSString *ical;
/* load iCalendar file */
// TODO: can't we use [clientObject contentAsString]?
@ -968,31 +913,35 @@
/* TODO: we need proper ACLs */
return [self redirectToLocation:[self _completeURIForMethod:@"../view"]];
}
return self;
}
- (id)saveAction {
- (id <WOActionResults>) saveAction
{
iCalToDo *task;
iCalPerson *p;
id <WOActionResults> result;
NSString *content;
NSException *ex;
if (![self isWriteableClientObject]) {
/* return 400 == Bad Request */
return [NSException exceptionWithHTTPStatus:400
reason:@"method cannot be invoked on "
@"the specified object"];
reason: @"method cannot be invoked on "
@"the specified object"];
}
task = [self taskFromString: [self iCalString]];
if (task == nil) {
NSString *s;
s = [self labelForKey:@"Invalid iCal data!"];
[self setErrorText:s];
s = [self labelForKey: @"Invalid iCal data!"];
[self setErrorText: s];
return self;
}
[self saveValuesIntoTask:task];
p = [task findParticipantWithEmail:[self emailForUser]];
if (p) {
@ -1015,8 +964,8 @@
if (content == nil) {
NSString *s;
s = [self labelForKey:@"Could not create iCal data!"];
[self setErrorText:s];
s = [self labelForKey: @"Could not create iCal data!"];
[self setErrorText: s];
return self;
}
@ -1025,8 +974,13 @@
[self setErrorText:[ex reason]];
return self;
}
return [self redirectToLocation:[self _completeURIForMethod:@".."]];
if ([[[[self context] request] formValueForKey: @"nojs"] intValue])
result = [self redirectToLocation: [self applicationPath]];
else
result = [self jsCloseWithRefreshMethod: @"refreshTasks()"];
return result;
}
- (id) changeStatusAction

View File

@ -344,8 +344,7 @@
type="submit"
class="button"
label:value="Save"
name="save:method"
onclick="submitContact(this.form); return false;" />
name="save:method" />
<input
type="submit"
class="button"
@ -358,11 +357,10 @@
label:value="PouetPouet"
name="pouet"
onclick="showCoords(this); return false;" /> -->
<input type="hidden" id="jsaction" />
</div>
</form>
<script type="text/javascript">
initEditorForm('<var:string value="contactUID" />');
initEditorForm();
</script>
</var:component>

View File

@ -13,8 +13,7 @@
<script type="text/javascript" rsrc:src="skycalendar.js">
</script>
<form var:href="saveUrl" name="editform">
<form var:href="saveUrl" name="editform" onsubmit="return validateAptEditor();">
<var:if condition="hasErrorText">
<p style="background-color: #AA0000;">
<var:string value="errorText" />
@ -113,8 +112,7 @@
type="submit"
class="button"
label:value="Save"
name="submitmeeting"
onclick="submitMeeting(this.form);" />
name="submitmeeting" />
<input
type="submit"
class="button"

View File

@ -1,20 +1,17 @@
<?xml version='1.0' standalone='yes'?>
<var:component
<var:component className="UIxPageFrame"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:uix="OGo:uix"
xmlns:rsrc="OGo:url"
xmlns:label="OGo:label"
className="UIxPageFrame"
const:popup="YES"
title="name"
>
title="name">
<script type="text/javascript" rsrc:src="skycalendar.js">
</script>
<form var:href="saveUrl" name="editform">
<form var:href="saveUrl" name="editform" onsubmit="return validateAptEditor();">
<var:if condition="hasErrorText">
<p style="background-color: #AA0000;">
<var:string value="errorText" />
@ -39,20 +36,20 @@
/><var:string label:value="is private" /></label>
<span class="checkBoxList"><var:string label:value="Date" />
<span class="content"><var:component className="UIxTimeDateControl"
const:controlID="startTime"
date="taskStartDate"
const:dayStartHour="8"
const:dayEndHour="18"
/></span></span>
const:controlID="startTime"
date="taskStartDate"
const:dayStartHour="8"
const:dayEndHour="18"
/></span></span>
<a class="button" href="#" onclick="return toggleDetails();" id="detailsButton"
><var:string label:value="Show Details" /></a>
<span class="checkBoxList"><var:string label:value="Due Time" />
<span class="content"><var:component className="UIxTimeDateControl"
const:controlID="endTime"
date="taskDueDate"
const:dayStartHour="8"
const:dayEndHour="18"
/></span></span>
const:controlID="endTime"
date="taskDueDate"
const:dayStartHour="8"
const:dayEndHour="18"
/></span></span>
</div>
<div id="details">
@ -68,7 +65,7 @@
><var:popup list="cycles" item="item"
label:string="$cycleLabel"
selection="cycle"
const:onChange="toggleCycleVisibility(this, 'cycleSelectionFirstLevel', 0);"
const:onChange="toggleCycleVisibility(this, 'cycleSelectionFirstLevel', 0);"
/><span id="cycleSelectionFirstLevel"
><var:popup list="cycleEnds" item="item"
label:string="$item" value="item"
@ -101,20 +98,22 @@
/></span></span>
<label><var:string label:value="Priority" />
<var:popup list="priorities" item="item"
string="itemPriorityText" selection="priority" /></label>
<var:popup list="priorities" item="item"
string="itemPriorityText" selection="priority" /></label>
<label><var:string label:value="Comment"
/><textarea name="comment" var:value="comment" /></label>
</div>
<input type="hidden" name="ical" var:value="iCalString" />
<noscript><input type="hidden" name="nojs" const:value="1" /></noscript>
<div id="buttons">
<input
type="submit"
class="button"
label:value="Save"
name="submittask"
onclick="submitTask(this.form);" />
name="submittask" />
<input
type="submit"
class="button"
@ -127,8 +126,6 @@
value="Test" name="test:method" />
</var:if>
</div>
<input type="hidden" name="ical" var:value="iCalString" />
<!-- input type="hidden" id="jsaction" -->
</form>
<!--

View File

@ -99,24 +99,6 @@ function validateAptEditor() {
return true;
}
function submitMeeting(thisForm) {
// var action = document.getElementById('jsaction');
// action.setAttribute("name", "save:method");
// action.setAttribute("value", "save");
log ("form: " + thisForm);
log ("validating...");
if (validateAptEditor()) {
log ("submitting");
thisForm.submit();
log ("setting timeout...");
window.opener.setTimeout('refreshAppointments();', 200);
log ("we close...");
window.close();
log ("closed");
}
}
function toggleDetails() {
var div = $("details");
var buttons = $("buttons");

View File

@ -95,19 +95,6 @@ function validateContactEditor() {
return true;
}
function submitContact(thisForm) {
var action = $('jsaction');
action.setAttribute("name", "save:method");
action.setAttribute("value", "save");
if (validateContactEditor()) {
thisForm.submit();
if (window.opener.refreshContacts)
window.opener.setTimeout("refreshContacts(\""+ self.contactId +"\");", 200);
window.close();
}
}
function showCoords(node) {
node = $("givenName");
window.alert("x: " + node.cascadeLeftOffset()
@ -140,8 +127,7 @@ function onFnNewValue(event) {
return true;
}
function initEditorForm(contactId) {
self.contactId = contactId;
function initEditorForm() {
displayNameChanged = ($("fn").value.length > 0);
$("fn").onkeydown = onFnKeyDown;
$("sn").onkeyup = onFnNewValue;

View File

@ -99,25 +99,6 @@ function validateAptEditor() {
return true;
}
function submitTask(thisForm) {
// var action = document.getElementById('jsaction');
// action.setAttribute("name", "save:method");
// action.setAttribute("value", "save");
window.opener.log ("form: " + thisForm);
window.opener.log ("validating...");
if (validateAptEditor()) {
window.opener.log ("submitting");
thisForm.submit();
window.opener.log ("setting timeout...");
window.opener.setTimeout('refreshTasks();', 200);
window.opener.log ("we close...");
window.close();
window.opener.log ("closed");
}
}
function toggleDetails() {
var div = $("details");
var buttons = $("buttons");