Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Sep 2015 15:48:42 +0000 (17:48 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Sep 2015 15:48:42 +0000 (17:48 +0200)
1  2 
tine20/Filemanager/js/NodeGridPanel.js
tine20/Tinebase/User.php
tine20/Tinebase/User/Ldap.php

@@@ -34,6 -34,13 +34,6 @@@ Tine.Filemanager.NodeGridPanel = Ext.ex
      filesProperty: 'files',
      
      /**
 -     * @cfg showTopToolbar
 -     * @type Boolean
 -     * TODO     think about that -> when we deactivate the top toolbar, we lose the dropzone for files!
 -     */
 -    //showTopToolbar: null,
 -    
 -    /**
       * config values
       * @private
       */
              Ext.MessageBox.show({
                  title: selections[0].data.type == 'folder' ? this.app.i18n._('Folder has been published successfully') : this.app.i18n._('File has been published successfully'), 
                  msg: String.format(this.app.i18n._("Url: {0}") + '<br />' + this.app.i18n._("Valid Until: {1}"), record.get('url'), record.get('expiry_time')), 
+                 width:900,
                  buttons: Ext.Msg.OK,
                  icon: Ext.MessageBox.INFO,
                  scope: this
          var app = this.app,
              nodeName = Tine.Filemanager.Model.Node.getContainerName();
          
 -        Ext.MessageBox.prompt(_('New Folder'), _('Please enter the name of the new folder:'), function(_btn, _text) {
 +        Ext.MessageBox.prompt(this.app.i18n._('New Folder'), this.app.i18n._('Please enter the name of the new folder:'), function(_btn, _text) {
              var currentFolderNode = app.getMainScreen().getCenterPanel().currentFolderNode;
              if(currentFolderNode && _btn == 'ok') {
                  if (! _text) {
 -                    Ext.Msg.alert(String.format(_('No {0} added'), nodeName), String.format(_('You have to supply a {0} name!'), nodeName));
 +                    Ext.Msg.alert(String.format(this.app.i18n._('No {0} added'), nodeName), String.format(this.app.i18n._('You have to supply a {0} name!'), nodeName));
                      return;
                  }
                  
      onUploadFail: function () {
          Ext.MessageBox.alert(
              _('Upload Failed'), 
 -            _('Could not upload file. Filesize could be too big. Please notify your Administrator. Max upload size: ') 
 +            _('Could not upload file. Filesize could be too big. Please notify your Administrator. Max upload size:') + ' ' 
              + Tine.Tinebase.common.byteRenderer(Tine.Tinebase.registry.get('maxFileUploadSize')) 
          ).setIcon(Ext.MessageBox.ERROR);
          
diff --combined tine20/Tinebase/User.php
@@@ -480,8 -480,7 +480,8 @@@ class Tinebase_Use
                      self::createContactForSyncedUser($currentUser);
                  }
              }
 -        
 +            
 +            Tinebase_Timemachine_ModificationLog::setRecordMetaData($currentUser, 'update');
              $syncedUser = $userBackend->updateUserInSqlBackend($currentUser);
              if (! empty($user->container_id)) {
                  $syncedUser->container_id = $user->container_id;
              if ($user->visibility !== Tinebase_Model_FullUser::VISIBILITY_HIDDEN) {
                  self::createContactForSyncedUser($user);
              }
 +            Tinebase_Timemachine_ModificationLog::setRecordMetaData($user, 'create');
              $syncedUser = $userBackend->addUserInSqlBackend($user);
              $userBackend->addPluginUser($syncedUser, $user);
          }
              $contact = $addressbook->getByUserId($syncedUser->getId());
              $originalContact = clone $contact;
  
+             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
+                 . ' user: ' .print_r($syncedUser->toArray(), true));
              Tinebase_User::getInstance()->updateContactFromSyncBackend($syncedUser, $contact);
              $contact = self::_user2Contact($syncedUser, $contact);
  
              if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
-                 . print_r($syncedUser->toArray(), true)
-                 . ' new: ' . print_r($contact->toArray(), true)
-                 . ' orig:' . print_r($originalContact->toArray(), true));
+                 . ' new contact: ' . print_r($contact->toArray(), true)
+                 . ' orig contact:' . print_r($originalContact->toArray(), true));
  
              // TODO allow to diff jpegphoto, too / maybe this should only be done when called via CLI/cronjob
              $diff = $contact->diff($originalContact, array('jpegphoto'));
              if (! $diff->isEmpty() || ($originalContact->jpegphoto == 0 && ! empty($contact->jpegphoto))) {
                  // add modlog info
                  Tinebase_Timemachine_ModificationLog::setRecordMetaData($contact, 'update');
 -                Tinebase_Container::getInstance()->increaseContentSequence($contact->container_id);
 -
 +                if ($contact->container_id !== null) {
 +                    Tinebase_Container::getInstance()->increaseContentSequence($contact->container_id);
 +                }
 +                
                  if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
                      . ' Updating contact data for user ' . $syncedUser->accountLoginName);
                  if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
          } catch (Addressbook_Exception_NotFound $aenf) {
              self::createContactForSyncedUser($syncedUser);
              $syncedUser = Tinebase_User::getInstance()->updateUserInSqlBackend($syncedUser);
+         } catch (Tinebase_Exception_NotFound $tenf) {
+             if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+                 . ' Contact information seems to be missing in sync backend');
+             Tinebase_Exception::log($tenf);
          }
      }
      
          // update or create user in local sql backend
          try {
              $userBackend->getUserByProperty('accountLoginName', $adminLoginName);
 +            Tinebase_Timemachine_ModificationLog::setRecordMetaData($user, 'update');
              $user = $userBackend->updateUserInSqlBackend($user);
          } catch (Tinebase_Exception_NotFound $ten) {
              // call addUser here to make sure, sql user plugins (email, ...) are triggered
 +            Tinebase_Timemachine_ModificationLog::setRecordMetaData($user, 'create');
              $user = $userBackend->addUser($user);
          }
          
          // set the password for the account
 -        Tinebase_User::getInstance()->setPassword($user, $adminPassword);
 +        // empty password triggers password change dialogue during first login
 +        if (!empty($adminPassword)) {
 +            Tinebase_User::getInstance()->setPassword($user, $adminPassword);
 +        }
  
          // add the admin account to all groups
          Tinebase_Group::getInstance()->addGroupMember($adminGroup, $user);
@@@ -360,9 -360,7 +360,9 @@@ class Tinebase_User_Ldap extends Tineba
          $metaData = $this->_getMetaData($user);
  
          $encryptionType = isset($this->_options['pwEncType']) ? $this->_options['pwEncType'] : Tinebase_User_Abstract::ENCRYPT_SSHA;
 -        $userpassword = $_encrypt ? Hash_Password::generate($encryptionType, $_password) : $_password;
 +        $userpassword = ($_encrypt && $encryptionType !== Tinebase_User_Abstract::ENCRYPT_PLAIN)
 +            ? Hash_Password::generate($encryptionType, $_password)
 +            : $_password;
          
          $ldapData = array(
              'userpassword'     => $userpassword,
      public function updateUserInSyncBackend(Tinebase_Model_FullUser $_account)
      {
          if ($this->_isReadOnlyBackend) {
 -            return;
 +            return $_account;
          }
          
          $ldapEntry = $this->_getLdapEntry('accountId', $_account);
              $this->_rowNameMapping['accountId'], $userId
          );
  
+         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE))
+             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__
+                 . ' fetch meta data - filter: ' . $filter);
          $result = $this->_ldap->search(
              $filter,
              $this->_baseDn,
              'adr_two_postalcode'    => 'mozillahomepostalcode',
              'adr_two_region'        => 'mozillahomestate',
              'adr_two_street'        => 'mozillahomestreet',
 -            'adr_one_region'        => 'l',
 +            'adr_one_locality'      => 'l',
              'adr_one_postalcode'    => 'postalcode',
              'adr_one_street'        => 'street',
              'adr_one_region'        => 'st',