Quantcast

r42419 - in /trunk/mail: inc/class.mail_ui.inc.php js/app.js

classic Classic list List threaded Threaded
1 message Options
leithoff leithoff
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

r42419 - in /trunk/mail: inc/class.mail_ui.inc.php js/app.js

Author: leithoff
Date: Fri May 10 09:24:27 2013
New Revision: 42419

URL: http://svn.stylite.de/viewvc/egroupware?rev=42419&view=rev
Log:
fully implement rename folder action on tree popup menu action. Subfolders are now subscribed and Re-Ided

Modified:
    trunk/mail/inc/class.mail_ui.inc.php
    trunk/mail/js/app.js

Modified: trunk/mail/inc/class.mail_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/inc/class.mail_ui.inc.php?rev=42419&r1=42418&r2=42419&view=diff
==============================================================================
--- trunk/mail/inc/class.mail_ui.inc.php (original)
+++ trunk/mail/inc/class.mail_ui.inc.php Fri May 10 09:24:27 2013
@@ -2187,6 +2187,7 @@
  $del = $this->mail_bo->getHierarchyDelimiter(false);
  $oA = array();
  list($profileID,$folderName) = explode(self::$delimiter,$decodedFolderName,2);
+ $hasChildren = false;
  if (is_numeric($profileID))
  {
  if ($profileID != $this->mail_bo->profileID) return; // only current connection
@@ -2197,6 +2198,32 @@
  {
  //error_log(__METHOD__.__LINE__."$folderName, $parentFolder, $_newName");
  $oldFolderInfo = $this->mail_bo->getFolderStatus($folderName,false);
+ //error_log(__METHOD__.__LINE__.array2string($oldFolderInfo));
+ if (!empty($oldFolderInfo['attributes']) && stripos(array2string($oldFolderInfo['attributes']),'\hasnochildren')=== false)
+ {
+ $hasChildren=true; // translates to: hasChildren -> dynamicLoading
+ $delimiter = $this->mail_bo->getHierarchyDelimiter();
+ $nameSpace = $this->mail_bo->_getNameSpaces();
+ $prefix = $this->mail_bo->getFolderPrefixFromNamespace($nameSpace, $folderName);
+ //error_log(__METHOD__.__LINE__.'->'."$_folderName, $delimiter, $prefix");
+ $fragments = array();
+ $subFolders = $this->mail_bo->getMailBoxesRecursive($folderName, $delimiter, $prefix);
+ foreach ($subFolders as $k => $folder)
+ {
+ // we do not monitor failure or success on subfolders
+ if ($folder == $folderName)
+ {
+ unset($subFolders[$k]);
+ }
+ else
+ {
+ $rv = $this->mail_bo->subscribe($folder, false);
+ $fragments[$profileID.self::$delimiter.$folder] = substr($folder,strlen($folderName));
+ }
+ }
+ //error_log(__METHOD__.__LINE__.' Fetched Subfolders->'.array2string($fragments));
+ }
+
  $this->mail_bo->reopen('INBOX');
  if($newFolderName = $this->mail_bo->renameFolder($folderName, $parentFolder, $_newName)) {
  $this->mail_bo->resetFolderObjectCache($profileID);
@@ -2207,6 +2234,24 @@
  $this->mail_bo->reopen($newFolderName);
  $fS = $this->mail_bo->getFolderStatus($newFolderName,false);
  //error_log(__METHOD__.__LINE__.array2string($fS));
+ if ($hasChildren)
+ {
+ $subFolders = $this->mail_bo->getMailBoxesRecursive($newFolderName, $delimiter, $prefix);
+ foreach ($subFolders as $k => $folder)
+ {
+ // we do not monitor failure or success on subfolders
+ if ($folder == $folderName)
+ {
+ unset($subFolders[$k]);
+ }
+ else
+ {
+ $rv = $this->mail_bo->subscribe($folder, true);
+ }
+ }
+ //error_log(__METHOD__.__LINE__.' Fetched Subfolders->'.array2string($subFolders));
+ }
+
  $oA[$_folderName]['id'] = $profileID.self::$delimiter.$newFolderName;
  $oA[$_folderName]['olddesc'] = $oldFolderInfo['shortDisplayName'];
  if ($fS['unseen'])
@@ -2218,6 +2263,22 @@
  {
  $oA[$_folderName]['desc'] = $fS['shortDisplayName'];
  }
+ foreach($fragments as $oldFolderName => $fragment)
+ {
+ //error_log(__METHOD__.__LINE__.':'.$oldFolderName.'->'.$profileID.self::$delimiter.$newFolderName.$fragment);
+ $oA[$oldFolderName]['id'] = $profileID.self::$delimiter.$newFolderName.$fragment;
+ $oA[$oldFolderName]['olddesc'] = '#skip-user-interaction-message#';
+ $fS = $this->mail_bo->getFolderStatus($newFolderName.$fragment,false);
+ if ($fS['unseen'])
+ {
+ $oA[$oldFolderName]['desc'] = '<b>'.$fS['shortDisplayName'].' ('.$fS['unseen'].')</b>';
+
+ }
+ else
+ {
+ $oA[$oldFolderName]['desc'] = $fS['shortDisplayName'];
+ }
+ }
  }
  }
  //error_log(__METHOD__.__LINE__.array2string($oA));

Modified: trunk/mail/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/js/app.js?rev=42419&r1=42418&r2=42419&view=diff
==============================================================================
--- trunk/mail/js/app.js (original)
+++ trunk/mail/js/app.js Fri May 10 09:24:27 2013
@@ -188,7 +188,8 @@
  var selectedNode = ftree.getSelectedNode();
  for (var i in _status)
  {
- app.mail.app_refresh(egw.lang("Renamed Folder %1 to %2",_status[i]['olddesc'],_status[i]['desc'], 'mail'));
+ // if olddesc is undefined or #skip# then skip the message, as we process subfolders
+ if (typeof _status[i]['olddesc'] !== 'undefined' && _status[i]['olddesc'] !== '#skip-user-interaction-message#') app.mail.app_refresh(egw.lang("Renamed Folder %1 to %2",_status[i]['olddesc'],_status[i]['desc'], 'mail'));
  ftree.renameItem(i,_status[i]['id'],_status[i]['desc']);
  //alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
  if (_status[i]['id']==selectedNode.id)


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
eGroupWare-cvs mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs
Loading...