Merge branch '2013.03'
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 20 Aug 2013 08:29:47 +0000 (10:29 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 20 Aug 2013 08:29:47 +0000 (10:29 +0200)
Conflicts:
tine20/Felamimail/Backend/Cache/Sql/Message.php
tine20/Tinebase/js/widgets/dialog/EditDialog.js
tine20/Tinebase/js/widgets/relation/GenericPickerGridPanel.js
tine20/library/OpenDocument/Document.php

1  2 
tine20/Admin/js/user/EditDialog.js
tine20/Felamimail/Backend/Cache/Sql/Message.php
tine20/Tinebase/Core.php
tine20/Tinebase/js/ux/WindowFactory.js
tine20/Tinebase/js/widgets/dialog/EditDialog.js
tine20/Tinebase/js/widgets/relation/GenericPickerGridPanel.js
tine20/library/OpenDocument/Document.php

Simple merge
@@@ -318,4 -318,63 +318,63 @@@ class Felamimail_Backend_Cache_Sql_Mess
          
          return $this->_db->delete($this->_tablePrefix . $this->_tableName, $where);
      }
 -
++    
+     /**
+      * converts record into raw data for adapter
+      *
+      * @param  Tinebase_Record_Abstract $_record
+      * @return array
+      */
+     protected function _recordToRawData($_record)
+     {
+         $result = parent::_recordToRawData($_record);
+         
+         if (isset($result['structure'])) {
+             $jsonStructure = Zend_Json::encode($result['structure']);
+             if ($jsonStructure === FALSE) {
+                 if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' '
+                     . 'Could not encode structure: ' . print_r($result['structure'], TRUE));
+                 $result['structure'] = NULL;
+             } else {
+                 $result['structure'] = $jsonStructure;
+             }
+         }
+         
+         return $result;
+     }
+     
+     /**
+      * converts raw data from adapter into a single record
+      *
+      * @param  array $_rawData
+      * @return Tinebase_Record_Abstract
+      */
+     protected function _rawDataToRecord(array $_rawData)
+     {
+         if (isset($_rawData['structure'])) {
+             $_rawData['structure'] = Zend_Json::decode($_rawData['structure']);
+         }
+         
+         $result = parent::_rawDataToRecord($_rawData);
+         
+         return $result;
+     }
+     
+     /**
+      * converts raw data from adapter into a set of records
+      *
+      * @param  array $_rawDatas of arrays
+      * @return Tinebase_Record_RecordSet
+      */
+     protected function _rawDataToRecordSet(array $_rawDatas)
+     {
+         foreach($_rawDatas as &$_rawData) {
+             if(isset($_rawData['structure'])) {
+                 $_rawData['structure'] = Zend_Json::decode($_rawData['structure']);
+             }
+         }
+         $result = parent::_rawDataToRecordSet($_rawDatas);
+         
+         return $result;
+     }
  }
Simple merge
@@@ -545,7 -463,20 +545,20 @@@ Tine.widgets.dialog.EditDialog = Ext.ex
          
          var fieldsToCopy = this.recordClass.getFieldNames().diff(omitFields),
              recordData = Ext.copyTo({}, this.record.data, fieldsToCopy);
 -
 +        
+         // handle alarms if any
+         if (recordData.hasOwnProperty('alarms')) {
+             var alarms = recordData.alarms;
+             for (var index = 0; index < alarms.length; index++) {
+                 Ext.each(['id', 'record_id', 'sent_time', 'sent_message'],
+                     function(prop) {
+                         alarms[index][prop] = null;
+                     }
+                 );
+                 alarms[index].sent_status = 'pending';
+             }
+         }
 -
++        
          this.record = new this.recordClass(recordData, 0);
      },
      
@@@ -478,18 -471,14 +481,18 @@@ Tine.widgets.relation.GenericPickerGrid
  
      /**
       * returns the type editors for each row in the grid
 -     * @param {} relation
 +     * 
 +     * @param {Object} config
 +     * @param {Tine.Tinebase.Application}
 +     * 
       * @return {}
       */
 -    getTypeEditor: function(config) {
 +    getTypeEditor: function(config, app) {
-         var data = [];
+         var data = [['', '']];
          Ext.each(config, function(c){
 -            data.push([c.type.toUpperCase(), c.text]);
 +            data.push([c.type.toUpperCase(), app.i18n._hidden(c.text)]);
          });
 +        
          return new Ext.form.ComboBox({
              store: new Ext.data.ArrayStore({
                  fields: ['id', 'value'],
              displayField: 'value',
              valueField: 'id',
              mode: 'local',
-             }
 +            constrainsConfig: config,
 +            listeners: {
 +                scope: this,
 +                select: this.onTypeChange
++            },
+             tpl: '<tpl for="."><div class="x-combo-list-item">{value}&nbsp;</div></tpl>'
          });
      },
  
@@@ -359,45 -243,45 +359,49 @@@ class OpenDocument_Documen
              file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'meta.xml', $this->_meta);
              file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'settings.xml', $this->_settings);
              file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'META-INF/manifest.xml', $this->_manifest);
 -        }
 -        
 -        // ObjectReplacements
 -//        $images = $this->_document->xpath('//draw:image');
 -//        foreach($images as $image) {
 -//            $image_sxe = dom_import_simplexml($image);
 -//            $image_sxe->parentNode->removeChild($image_sxe);
 -//        }
 -//        
 -//        $images = $this->_document->xpath('//draw:image');
 -//        Tinebase_Core::getLogger()->err(print_r($images, TRUE));
 -        
 -        file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'content.xml', $this->_document->saveXML());
 -        file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'styles.xml', $this->_styles);
 -        
 -        $zip = new ZipArchive();
 -        $opened = $zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
 -        if( $opened !== true ) {
 -            throw new Exception('could not open zip file');
 -        }
 -
 -        $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tempDir));
 -        
 -        foreach ($iterator as $fullFilename => $cur) {
 -            // the second parameter of the addFile function needs always the unix directory separator
 -            $localname = str_replace('\\', '/', substr($fullFilename, strlen($tempDir)+1));
              
 -            // exclude . and ..
 -            $localname_parts = pathinfo($localname);
 -            $localbasename = $localname_parts['basename'];
 -            if ($localbasename !== '.' && $localbasename !== '..') {
 -                $zip->addFile($fullFilename, $localname);
 +            file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'content.xml', $this->_document->saveXML());
 +            file_put_contents($tempDir . DIRECTORY_SEPARATOR . 'styles.xml', $this->_styles);
 +            
 +            $zip = new ZipArchive();
 +            $opened = $zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
 +            
 +            if( $opened !== true ) {
 +                throw new Exception('could not open zip file');
 +            }
 +            
 +            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tempDir));
 +            
 +            foreach ($iterator as $fullFilename => $cur) {
 +                // the second parameter of the addFile function needs always the unix directory separator
 +                $localname = str_replace('\\', '/', substr($fullFilename, strlen($tempDir)+1));
-                 if ($localname !== 'mimetype' && $localname !== '.' && $localname !== '..') {
++                
++                // exclude . and ..
++                $localname_parts = pathinfo($localname);
++                $localbasename = $localname_parts['basename'];
++                if ($localbasename !== 'mimetype' && $localbasename !== '.' && $localbasename !== '..') {
 +                    $zip->addFile($fullFilename, $localname);
 +                }
 +            }
 +    
 +            $zip->close();
 +            
 +            // delete files / remove dir
 +            removeDir($tempDir);
 +            
 +            
 +        } else {
 +            $templateZip = new ZipArchive();
 +            if ($templateZip->open($this->_templateFile) === TRUE) {
 +                $templateZip->close();
 +                
 +                copy($this->_templateFile, $filename);
 +                
 +                $templateZip->open($filename);
 +                $templateZip->addFromString('content.xml', $this->_document->saveXML());
 +                $templateZip->close();
              }
          }
 -
 -        $zip->close();
 -        
 -        // delete files / remove dir
 -        removeDir($tempDir);
          
          return $filename;
      }
              }
              $dom_sxe = dom_import_simplexml($newChild);
              $newStyle = $domStyles->ownerDocument->importNode($dom_sxe, true);
 -            $domStyles->appendChild($newStyle);        
 +            $domStyles->appendChild($newStyle);
          }
 -        
 -        #if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $styles[0]->generateXML());
      }
- }
+ }