flag messages from preview; load translations for ajaxcalls, when needed

This commit is contained in:
Klaus Leithoff 2014-01-27 12:18:16 +00:00
parent 2685f4d46e
commit 22d6fc05ee
2 changed files with 40 additions and 23 deletions

View File

@ -687,13 +687,13 @@ class mail_ui
array_unshift($fFP,$this->mail_bo->profileID);
$oA['path'] = $fFP;
$path = $key; //$obj->folderName; //$obj->delimiter
if ($fS['unseen']) $oA['text'] = '<b>'.$oA['text'].' ('.$fS['unseen'].')</b>';
if ($path=='INBOX')
{
$oA['im0'] = $oA['im1']= $oA['im2'] = "kfm_home.png";
}
elseif (in_array($obj->shortFolderName,mail_bo::$autoFolders))
{
$oA['text'] = lang($oA['text']);
//echo $obj->shortFolderName.'<br>';
$oA['im0'] = $oA['im1']= $oA['im2'] = "MailFolder".$obj->shortFolderName.".png";
//$image2 = "'MailFolderPlain.png'";
@ -710,6 +710,7 @@ class mail_ui
$oA['im1'] = "folderOpen.gif";
$oA['im2'] = "MailFolderClosed.png"; // has Children
}
if ($fS['unseen']) $oA['text'] = '<b>'.$oA['text'].' ('.$fS['unseen'].')</b>';
$path = $this->mail_bo->profileID.self::$delimiter.$key; //$obj->folderName; //$obj->delimiter
$oA['id'] = $path; // ID holds the PATH
if (!empty($fS['attributes']) && stripos(array2string($fS['attributes']),'\noselect')!== false)
@ -3228,6 +3229,7 @@ blockquote[type=cite] {
*/
function ajax_setFolderStatus($_folder)
{
translation::add_app('mail');
//error_log(__METHOD__.__LINE__.array2string($_folder));
if ($_folder)
{
@ -3242,6 +3244,7 @@ blockquote[type=cite] {
if ($folderName)
{
$fS = $this->mail_bo->getFolderStatus($folderName,false);
if (in_array($fS['shortDisplayName'],mail_bo::$autoFolders)) $fS['shortDisplayName']=lang($fS['shortDisplayName']);
//error_log(__METHOD__.__LINE__.array2string($fS));
if ($fS['unseen'])
{
@ -3334,6 +3337,7 @@ blockquote[type=cite] {
//error_log(__METHOD__.__LINE__.' OldFolderName:'.array2string($_folderName).' NewName:'.array2string($_newName));
if ($_folderName)
{
translation::add_app('mail');
$decodedFolderName = $this->mail_bo->decodeEntityFolderName($_folderName);
$_newName = $this->mail_bo->decodeEntityFolderName($_newName);
$del = $this->mail_bo->getHierarchyDelimiter(false);
@ -3574,6 +3578,8 @@ blockquote[type=cite] {
$response = egw_json_response::get();
if ($success)
{
translation::add_app('mail');
$oldFolderInfo = $this->mail_bo->getFolderStatus($oldParentFolder,false);
$folderInfo = $this->mail_bo->getFolderStatus($parentFolder,false);
$refreshData = array(
@ -3733,6 +3739,8 @@ blockquote[type=cite] {
// Send full info back in the response
if($getFolders)
{
translation::add_app('mail');
$refreshData = array(
$icServerID => $this->getFolderTree(true, $icServerID, true)
);
@ -3748,6 +3756,7 @@ blockquote[type=cite] {
function ajax_refreshQuotaDisplay($icServerID=null)
{
//error_log(__METHOD__.__LINE__.array2string($icServerID));
translation::add_app('mail');
if (is_null($icServerID)) $icServerID = $this->mail_bo->profileID;
$rememberServerID = $this->mail_bo->profileID;
if ($icServerID && $icServerID != $this->mail_bo->profileID)
@ -3789,7 +3798,9 @@ blockquote[type=cite] {
*/
function ajax_emptyTrash($icServerID)
{
error_log(__METHOD__.__LINE__.' '.$icServerID);
//error_log(__METHOD__.__LINE__.' '.$icServerID);
translation::add_app('mail');
$rememberServerID = $this->mail_bo->profileID;
if ($icServerID && $icServerID != $this->mail_bo->profileID)
{
@ -3824,7 +3835,9 @@ blockquote[type=cite] {
*/
function ajax_compressFolder($_folderName)
{
error_log(__METHOD__.__LINE__.' '.$_folderName);
//error_log(__METHOD__.__LINE__.' '.$_folderName);
translation::add_app('mail');
$this->mail_bo->restoreSessionData();
$decodedFolderName = $this->mail_bo->decodeEntityFolderName($_folderName);
list($icServerID,$folderName) = explode(self::$delimiter,$decodedFolderName,2);

View File

@ -726,7 +726,7 @@ app.classes.mail = AppJS.extend(
var activeFolders = tree_wdg.getTreeNodeOpenItems(nodeToRefresh,mode2use);
//alert(activeFolders.join('#,#'));
this.mail_queueRefreshFolderList(activeFolders);
this.mail_queueRefreshFolderList((mode=='thisfolderonly'&&nodeToRefresh?[_nodeID]:activeFolders));
if (_refreshGridArea)
{
// maybe to use the mode forced as trigger for grid reload and using the grids own autorefresh
@ -770,28 +770,16 @@ app.classes.mail = AppJS.extend(
},
/**
* Queues a refreshFolderList request for 1ms. Actually this will just execute the
* Queues a refreshFolderList request for 10ms. Actually this will just execute the
* code after the calling script has finished.
*/
mail_queueRefreshFolderList: function(_folders)
{
this.mail_queuedFolders.push(_folders);
this.mail_queuedFoldersIndex++;
// Copy idx onto the anonymous function scope
var idx = this.mail_queuedFoldersIndex;
var self = this;
// as jsonq is too fast wrap it to be delayed a bit, to ensure the folder actions
// are executed last of the queue
window.setTimeout(function() {
if (idx == self.mail_queuedFoldersIndex)
{
//var folders = mail_queuedFolders.join(",");
self.mail_queuedFoldersIndex = 0;
self.mail_queuedFolders = [];
egw.json('mail.mail_ui.ajax_setFolderStatus',[_folders])
.sendRequest(true);
}
}, 10);
egw.jsonq('mail.mail_ui.ajax_setFolderStatus',[_folders]);
}, 100);
},
/**
@ -1170,6 +1158,14 @@ app.classes.mail = AppJS.extend(
{
var do_nmactions = true;
var msg;
var ftree;
var _folder;
if (_action.id=='read')
{
ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
var _foldernode = ftree.getSelectedNode();
_folder = _foldernode.id;
}
if (typeof _elems == 'undefined')
{
do_nmactions = false;//indicates that this action is probably a popup?
@ -1184,6 +1180,8 @@ app.classes.mail = AppJS.extend(
{
msg = {};
msg['msg'] = [this.mail_currentlyFocussed];
_elems = msg;
do_nmactions = true;// is triggered from preview
}
}
}
@ -1271,7 +1269,8 @@ app.classes.mail = AppJS.extend(
{
this.mail_flagMessages(_action.id,msg_set);
}
// No further update needed
// No further update needed, only in case of read, the counters should be refreshed
if (_action.id=='read') this.mail_refreshFolderStatus(_folder,'thisfolderonly',false,true);
return;
}
}
@ -1279,7 +1278,10 @@ app.classes.mail = AppJS.extend(
{
this.mail_flagMessages(_action.id,msg,(do_nmactions?false:true));
}
this.mail_refreshFolderStatus();
// only refresh counter. not grid as the ajaxmethod is called asyncronously
// on flagging, only seen/unseen has effect on counterdisplay
if (_action.id=='read') this.mail_refreshFolderStatus(_folder,'thisfolderonly',false,true);
//this.mail_refreshFolderStatus();
},
/**
@ -1752,6 +1754,8 @@ app.classes.mail = AppJS.extend(
*/
mail_getFormData: function(_actionObjects) {
var messages = {};
// if
if (typeof _actionObjects['msg'] != 'undefined' && _actionObjects['msg'].length>0) return _actionObjects;
if (_actionObjects.length>0)
{
messages['msg'] = [];