0
@@ -29,7 +29,7 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
["status", String, {}],
0
["lastPastOccurrence", cosmo.datetime.Date, {}]
0
- //mixins for master item stamps
0
+ //mixins for master item stamps
0
constructor: function(kwArgs){
0
this.initializeProperties(kwArgs);
0
@@ -40,11 +40,11 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
return this.getStartDate();
0
if (this.getStartDate() == null){
0
var endDate = this.getStartDate().clone();
0
endDate.addDuration(duration);
0
if (this.getAnyTime() || this.getAllDay()){
0
@@ -52,7 +52,7 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
if (this.getAnyTime() || this.getAtTime()){
0
@@ -69,20 +69,22 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
var duration = new cosmo.model.Duration(this.getStartDate(), endDate);
0
this.setDuration(duration);
0
+ // setStartDate will automatically move recurrences and modifications appropriately,
0
+ // unless noMove is passed
0
setStartDate: function (/*cosmo.datetime.Date*/ newStartDate){
0
var oldDate = this.getStartDate();
0
this.__setProperty("startDate", newStartDate);
0
- //if this event stamp is attached to an item, and already has a
0
+ //if this event stamp is attached to an item, and already has a
0
//previous start date we may have some updating to do
0
if (this.item && oldDate){
0
- var diff = dojo.date.difference(oldDate,
0
+ var diff = dojo.date.difference(oldDate,
0
newStartDate, cosmo.datetime.util.dateParts.SECOND);
0
//if there are modifications, we need to move the recurrenceid's for all of them
0
if (!cosmo.util.lang.isEmpty(this.item._modifications)){
0
//first copy the modifications into a new hash
0
var mods = this.item._modifications;
0
@@ -90,15 +92,15 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
- for (var x in oldMods){
0
+ for (var y in oldMods){
0
var rId = mod.getRecurrenceId().clone();
0
rId.add(cosmo.datetime.util.dateParts.SECOND, diff);
0
mod.setRecurrenceId(rId);
0
this.item.addModification(mod);
0
//also, if there are exdates, we need to move the recurrenceid's for all of them too
0
if (this._exdates && this._exdates.length > 0){
0
var oldExdates = this._exdates;
0
@@ -106,12 +108,12 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
for (var x = 0; x < oldExdates.length; x++){
0
var exdate = oldExdates[x];
0
exdate.add(cosmo.datetime.util.dateParts.SECOND, diff);
0
- newExdates.push(exdate);
0
+ newExdates.push(exdate);
0
- this._ex
ates = newExdates;
0
+ this._ex
dates = newExdates;
0
// get rid of occurrences before newStartDate
0
@@ -130,19 +132,19 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
return !this.getDuration() || this.getDuration().isZero();
0
- applyChange: function(propertyName, changeValue, type){
0
- //this handles the case of setting the master start date or end date
0
+ applyChange: function(propertyName, changeValue, type){
0
+ //this handles the case of setting the master start date or end date
0
- if ( (propertyName == "startDate" || propertyName =="endDate")
0
+ if ( (propertyName == "startDate" || propertyName =="endDate")
0
&& this.isOccurrenceStamp()){
0
var getterAndSetter = cosmo.model.util.getGetterAndSetterName(propertyName);
0
var getterName = getterAndSetter[0];
0
var setterName = getterAndSetter[1];
0
- var diff = dojo.date.difference(this[getterName](),
0
+ var diff = dojo.date.difference(this[getterName](),
0
cosmo.datetime.util.dateParts.SECOND);
0
var masterDate = this.getMaster().getEventStamp()[getterName]();
0
@@ -154,7 +156,7 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
if (propertyName == "startDate"){
0
this.item.recurrenceId.add(cosmo.datetime.util.dateParts.SECOND,diff);
0
this.inherited("applyChange", arguments);
0
@@ -167,7 +169,7 @@ cosmo.model.declareStamp("cosmo.model.EventStamp", "event", "http://osafoundatio
0
return this.recurrenceId;
0
//we don't want to inherit from the one from the master....
0
setStartDate: function (newStartDate){
0
this.__setProperty("startDate", newStartDate);
Comments
No one has commented yet.