Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 6 Feb 2015 09:05:30 +0000 (10:05 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 6 Feb 2015 09:05:30 +0000 (10:05 +0100)
tine20/Calendar/js/EventEditDialog.js
tine20/Calendar/js/RrulePanel.js
tine20/Tinebase/WebDav/Container/Abstract.php

index db39f40..cdb8892 100644 (file)
@@ -345,7 +345,9 @@ Tine.Calendar.EventEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
         
         this.on('render', function() {this.getForm().add(organizerCombo);}, this);
         
-        this.rrulePanel = new Tine.Calendar.RrulePanel({});
+        this.rrulePanel = new Tine.Calendar.RrulePanel({
+            eventEditDialog : this
+        });
         this.alarmPanel = new Tine.widgets.dialog.AlarmPanel({});
         this.attendeeStore = this.attendeeGridPanel.getStore();
         
index a779588..5fa44d5 100644 (file)
@@ -3,7 +3,7 @@
  * 
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
  * @author      Cornelius Weiss <c.weiss@metaways.de>
- * @copyright   Copyright (c) 2007-2008 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2007-2015 Metaways Infosystems GmbH (http://www.metaways.de)
  */
 
 Ext.ns('Tine.Calendar');
@@ -19,6 +19,12 @@ Tine.Calendar.RrulePanel = Ext.extend(Ext.Panel, {
      */    
     activeRuleCard: null,
     
+    /**
+     * the event edit dialog (parent)
+     * @type Tine.Calendar.EventEditDialog
+     */
+    eventEditDialog: null,
+    
     layout: 'form',
     frame: true,
     
@@ -68,7 +74,6 @@ Tine.Calendar.RrulePanel = Ext.extend(Ext.Panel, {
             id: this.idPrefix + 'tglbtn' + 'NONE',
             xtype: 'tbbtnlockedtoggle',
             enableToggle: true,
-            //pressed: true,
             text: this.app.i18n._('None'),
             handler: this.onFreqChange.createDelegate(this, ['NONE']),
             toggleGroup: this.idPrefix + 'freqtglgroup'
@@ -374,12 +379,33 @@ Tine.Calendar.RrulePanel.AbstractCard = Ext.extend(Ext.Panel, {
     },
     
     isValid: function(record) {
-        var until = this.until.getValue();
+        var until = this.until.getValue(),
+            freq = this.freq;
+        
         if (Ext.isDate(until) && Ext.isDate(record.get('dtstart'))) {
             if (until.getTime() < record.get('dtstart').getTime()) {
                 this.until.markInvalid(this.app.i18n._('Until has to be after event start'));
                 return false;
             }
+        } 
+        
+        if (Ext.isDate(record.get('dtend')) && Ext.isDate(record.get('dtstart'))) {
+            var dayDifference = (record.get('dtend').getTime() - record.get('dtstart').getTime()) / 1000 / 60 / 60 / 24,
+                dtendField = this.rrulePanel.eventEditDialog.getForm().findField('dtend');
+            
+            if(freq == 'DAILY' && dayDifference >= 1) {
+                dtendField.markInvalid(this.app.i18n._('The event is longer than the recurring interval'));
+                return false;
+            } else if(freq == 'WEEKLY' && dayDifference >= 7) {
+                dtendField.markInvalid(this.app.i18n._('The event is longer than the recurring interval'));
+                return false;
+            } else if(freq == 'MONTHLY' && dayDifference >= 28) {
+                dtendField.markInvalid(this.app.i18n._('The event is longer than the recurring interval'));
+                return false;
+            } else if(freq == 'YEARLY' && dayDifference >= 365) {
+                dtendField.markInvalid(this.app.i18n._('The event is longer than the recurring interval'));
+                return false;
+            }
         }
         
         return true;
index cbb66e7..9e77434 100644 (file)
@@ -423,20 +423,19 @@ abstract class Tinebase_WebDav_Container_Abstract extends \Sabre\DAV\Collection
         foreach ($mutations as $key => $value) {
             switch ($key) {
                 case '{DAV:}displayname':
-                    if ($value === $this->_container->uuid) {
-                        if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ 
-                            . ' It is not allowed to overwrite the name with the uuid');
-                        if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ 
+                    if ($value === $this->_container->uuid || $value === $this->_container->getId()) {
+                        if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ 
+                            . ' It is not allowed to overwrite the name with the uuid/id');
+                        if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
                             . ' ' . print_r(array(
                                 'useIdAsName' => $this->_useIdAsName,
                                 'container'   => $this->_container->toArray(),
                                 'new value'   => $value
                             ), true));
-                        $result['403'][$key] = null;
                     } else {
                         $this->_container->name = $value;
-                        $result['200'][$key] = null;
                     }
+                    $result['200'][$key] = null;
                     break;
                     
                 case '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}calendar-description':