mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 11:55:24 +00:00
(html,js) Add reminder/alarm to event editor
This commit is contained in:
@@ -190,6 +190,15 @@
|
||||
md-highlight-flags="^i">{{card.$$email}}</span>
|
||||
</span>
|
||||
</md-autocomplete>
|
||||
<!-- reminder -->
|
||||
<md-checkbox ng-model="editor.event.$hasAlarm"
|
||||
label:aria-label="Reminder:">
|
||||
<var:string label:value="Reminder:"/>
|
||||
</md-checkbox>
|
||||
<div class="sg-subcontent"
|
||||
ng-show="editor.event.$hasAlarm">
|
||||
<var:component className="UIxReminderEditor" />
|
||||
</div>
|
||||
<!-- cancel/reset/save -->
|
||||
<div class="fieldset md-layout-margin" layout="row" layout-align="end center">
|
||||
<md-button type="button" ng-click="editor.cancel()">
|
||||
|
||||
@@ -1,56 +1,58 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<!DOCTYPE var:component>
|
||||
<var:component
|
||||
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:toolbar="none"
|
||||
const:popup="YES">
|
||||
<container
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:label="OGo:label"
|
||||
>
|
||||
<div layout="row" layout-align="start center">
|
||||
<md-input-container class="md-input-number">
|
||||
<input type="number" label:aria-label="quantity" ng-model="editor.event.alarm.quantity"/>
|
||||
</md-input-container>
|
||||
<md-select ng-model="editor.event.alarm.unit">
|
||||
<var:foreach list="unitsList" item="item">
|
||||
<md-option var:value="item"><var:string value="itemText"/></md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
<md-select ng-model="editor.event.alarm.reference">
|
||||
<var:foreach list="referencesList" item="item">
|
||||
<md-option var:value="item"><var:string value="itemText"/></md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
<md-select ng-model="editor.event.alarm.relation">
|
||||
<var:foreach list="relationsList" item="item">
|
||||
<md-option var:value="item"><var:string value="itemText"/></md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
</div>
|
||||
|
||||
<form name="reminder_form" id="reminder_form" href="editReminder">
|
||||
<div>
|
||||
<fieldset>
|
||||
<legend><var:string label:value="Reminder Details"/></legend>
|
||||
<input type="text" id="quantityField"
|
||||
class="textField"
|
||||
size="2"
|
||||
/><var:popup list="unitsList" const:id="unitsList" item="item"
|
||||
string="itemText" var:value="item" selection="minutes"
|
||||
/><var:popup list="referencesList" const:id="referencesList" item="item"
|
||||
string="itemText" var:value="item" selection="BEFORE"
|
||||
/><br/>
|
||||
<var:popup list="relationsList" const:id="relationsList" item="item"
|
||||
string="itemText" var:value="item" selection="START"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<var:if condition="emailAlarmsEnabled">
|
||||
<fieldset>
|
||||
<legend><var:string label:value="Choose a Reminder Action"/></legend>
|
||||
<select const:name="actionList" const:id="actionList">
|
||||
<option const:value="display"><var:string label:value="Show an Alert"/></option>
|
||||
<option const:value="email"><var:string label:value="Send an E-mail"/></option>
|
||||
</select><br/>
|
||||
<label><input type="checkbox" const:disabled="1"
|
||||
const:name="emailOrganizer" const:id="emailOrganizer"/>
|
||||
<var:string label:value="Email Organizer"/></label><br/>
|
||||
<label><input type="checkbox" const:disabled="1"
|
||||
const:name="emailAttendees" const:id="emailAttendees"/>
|
||||
<var:string label:value="Email Attendees"/></label>
|
||||
</fieldset>
|
||||
</var:if>
|
||||
|
||||
<div id="windowButtons">
|
||||
<a id="okButton" href="#" class="button actionButton"
|
||||
><span><var:string label:value="OK"/></span></a>
|
||||
<a id="cancelButton" href="#" class="button"
|
||||
><span><var:string label:value="Cancel"/></span></a>
|
||||
</div>
|
||||
<var:if condition="emailAlarmsEnabled">
|
||||
<div layout="row" layout-align="space-around center">
|
||||
<md-radio-group layout="row" layout-align="space-around center"
|
||||
ng-model="editor.event.alarm.action">
|
||||
<md-radio-button value="display">
|
||||
<var:string label:value="Show an Alert"/>
|
||||
</md-radio-button>
|
||||
<md-radio-button value="email">
|
||||
<var:string label:value="Send an E-mail"/>
|
||||
</md-radio-button>
|
||||
</md-radio-group>
|
||||
</div>
|
||||
</form>
|
||||
<div layout="row" layout-align="space-around center"
|
||||
ng-show="editor.event.canRemindAttendeesByEmail()">
|
||||
<md-checkbox ng-model="editor.event.alarm.organizer"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0"
|
||||
label:aria-label="Email Organizer">
|
||||
<var:string label:value="Email Organizer"/>
|
||||
</md-checkbox>
|
||||
<md-checkbox ng-model="editor.event.alarm.attendees"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0"
|
||||
label:aria-label="Email Attendees">
|
||||
<var:string label:value="Email Attendees"/>
|
||||
</md-checkbox>
|
||||
</div>
|
||||
</var:if>
|
||||
|
||||
</var:component>
|
||||
</container>
|
||||
|
||||
@@ -245,6 +245,7 @@
|
||||
|
||||
this.categories = [];
|
||||
this.repeat = {};
|
||||
this.alarm = { action: 'display', quantity: 5, unit: 'MINUTES', reference: 'BEFORE', relation: 'START' };
|
||||
angular.extend(this, data);
|
||||
|
||||
if (this.startDate)
|
||||
@@ -291,6 +292,8 @@
|
||||
this.repeat.end = 'never';
|
||||
this.$hasCustomRepeat = this.hasCustomRepeat();
|
||||
|
||||
this.$hasAlarm = angular.isDefined(data.alarm);
|
||||
|
||||
// Allow the event to be moved to a different calendar
|
||||
this.destinationCalendar = this.pid;
|
||||
|
||||
@@ -471,7 +474,7 @@
|
||||
/**
|
||||
* @function hasAttendee
|
||||
* @memberof Component.prototype
|
||||
* @desc Verify if one of the email addresses of a Card instance matches an attendee
|
||||
* @desc Verify if one of the email addresses of a Card instance matches an attendee.
|
||||
* @param {Object} card - an Card object instance
|
||||
* @returns true if the Card matches an attendee
|
||||
*/
|
||||
@@ -482,7 +485,18 @@
|
||||
});
|
||||
});
|
||||
return angular.isDefined(attendee);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function canRemindAttendeesByEmail
|
||||
* @memberof Component.prototype
|
||||
* @desc Verify if the component's reminder must be send by email and if it has at least one attendee.
|
||||
* @returns true if attendees can receive a reminder by email
|
||||
*/
|
||||
Component.prototype.canRemindAttendeesByEmail = function() {
|
||||
return this.alarm.action == 'email' &&
|
||||
this.attendees && this.attendees.length > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $reset
|
||||
@@ -591,6 +605,17 @@
|
||||
delete component.repeat;
|
||||
}
|
||||
|
||||
if (this.$hasAlarm) {
|
||||
if (this.alarm.action == 'email' && !(this.attendees && this.attendees.length > 0)) {
|
||||
// No attendees; email reminder must be sent to organizer only
|
||||
this.alarm.attendees = 0;
|
||||
this.alarm.organizer = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
component.alarm = {};
|
||||
}
|
||||
|
||||
function formatTime(dateString) {
|
||||
// YYYY-MM-DDTHH:MM-ZZ:00 => YYYY-MM-DD HH:MM
|
||||
var date = new Date(dateString.substring(0,10) + ' ' + dateString.substring(11,16)),
|
||||
|
||||
Reference in New Issue
Block a user