name space issues within mail/js/app.js

This commit is contained in:
Klaus Leithoff 2013-02-13 15:35:12 +00:00
parent 6a0305b849
commit 7fe9c7f97b
5 changed files with 81 additions and 15 deletions

View File

@ -820,14 +820,14 @@ class mail_hooks
{ {
$file += array( $file += array(
'_NewLine_' => '', // give a newline '_NewLine_' => '', // give a newline
'empty trash' => "javascript:egw_appWindow('".$appname."').emptyTrash();", 'empty trash' => "javascript:egw_appWindow('".$appname."').mail_emptyTrash();",
); );
} }
if($preferences->preferences['deleteOptions'] == 'mark_as_deleted') if($preferences->preferences['deleteOptions'] == 'mark_as_deleted')
{ {
$file += array( $file += array(
'_NewLine_' => '', // give a newline '_NewLine_' => '', // give a newline
'compress folder' => "javascript:egw_appWindow('".$appname."').compressFolder();", 'compress folder' => "javascript:egw_appWindow('".$appname."').mail_compressFolder();",
); );
} }
// import Message link - only when the required library is available // import Message link - only when the required library is available

View File

@ -1229,4 +1229,24 @@ error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Star
$response = egw_json_response::get(); $response = egw_json_response::get();
$response->call('egw_refresh',lang('empty trash'),'mail'); $response->call('egw_refresh',lang('empty trash'),'mail');
} }
/**
* compress folder - its called via json, so the function must start with ajax (or the class-name must contain ajax)
* fetches the current folder from session and compresses it
* @return nothing
*/
function ajax_compressFolder()
{
$this->mail_bo->restoreSessionData();
$folder = $this->mail_bo->sessionData['maibox'];
if ($this->mail_bo->folderExists($folder))
{
if(!empty($folder)) {
$this->mail_bo->compressFolder($folder);
}
$response = egw_json_response::get();
$response->call('egw_refresh',lang('compress folder').': '.$folder,'mail');
}
}
} }

View File

@ -8,6 +8,43 @@
* @version $Id$ * @version $Id$
*/ */
var mail_doTimedRefresh;
var mail_refreshTimeOut = 1000*60*3;
mail_startTimerFolderStatusUpdate(mail_refreshTimeOut);
/**
* mail_startTimerFolderStatusUpdate, timer functions, if the counter changes for the current folder
* refresh the message list
* @param timeout
*/
function mail_startTimerFolderStatusUpdate(_refreshTimeOut) {
if (typeof _refreshTimeOut == 'undefined')
{
var minutes = egw.preference('refreshTime','mail');
mail_refreshTimeOut = _refreshTimeOut= 1000*60*(minutes?minutes:3); // either the prefs or 3 Minutes
}
if (mail_refreshTimeOut > _refreshTimeOut) _refreshTimeOut = mail_refreshTimeOut;
if(mail_doTimedRefresh) {
window.clearTimeout(mail_doTimedRefresh);
}
if(_refreshTimeOut > 6000) {
mail_doTimedRefresh = window.setInterval("mail_refreshFolderStatus()", _refreshTimeOut);
}
}
function mail_refreshFolderStatus(_nodeID,mode) {
/*
var nodeToRefresh = 0;
var mode2use = "none";
if (_nodeID) nodeToRefresh = _nodeID;
if (mode) {
if (mode == "forced") {mode2use = mode;}
}
var activeFolders = getTreeNodeOpenItems(nodeToRefresh,mode2use);
queueRefreshFolderList(activeFolders);
*/
}
/** /**
* Refresh given application _targetapp display of entry _app _id, incl. outputting _msg * Refresh given application _targetapp display of entry _app _id, incl. outputting _msg
* *
@ -24,13 +61,13 @@ function app_refresh(_msg, _app, _id, _type)
var bufferExists = false; var bufferExists = false;
window.clearInterval(doStatus); // whatever message was up to be activated window.clearInterval(doStatus); // whatever message was up to be activated
//alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')"); //alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
//myCurrentMsg = getMsg(); //myCurrentMsg = mail_getMsg();
//if (myCurrentMsg.length) { //if (myCurrentMsg.length) {
// clear message after some time // clear message after some time
myMessageBuffer = ""; //myCurrentMsg; myMessageBuffer = ""; //myCurrentMsg;
bufferExists = true; bufferExists = true;
//} //}
setMsg('<span style="font-weight: bold;">' +_msg+ '</span>'); mail_setMsg('<span style="font-weight: bold;">' +_msg+ '</span>');
if (_app=='mail') if (_app=='mail')
{ {
//we may want to trigger some actions, like modifying the grid, disable preview and stuff //we may want to trigger some actions, like modifying the grid, disable preview and stuff
@ -41,10 +78,10 @@ function app_refresh(_msg, _app, _id, _type)
} }
/** /**
* getMsg - gets the current Message * mail_getMsg - gets the current Message
* @return string * @return string
*/ */
function getMsg() function mail_getMsg()
{ {
var msg_wdg = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('msg'); var msg_wdg = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('msg');
if (msg_wdg) if (msg_wdg)
@ -55,10 +92,10 @@ function getMsg()
} }
/** /**
* setMsg - sets a Message, with the msg container, and controls if the container is enabled/disabled * mail_setMsg - sets a Message, with the msg container, and controls if the container is enabled/disabled
* @param string myMsg - the message * @param string myMsg - the message
*/ */
function setMsg(myMsg) function mail_setMsg(myMsg)
{ {
var msg_wdg = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('msg'); var msg_wdg = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('msg');
if (msg_wdg) if (msg_wdg)
@ -69,18 +106,27 @@ function setMsg(myMsg)
} }
/** /**
* emptyTrash * mail_emptyTrash
*/ */
function emptyTrash() { function mail_emptyTrash() {
app_refresh(egw.lang('empty trash'), 'mail'); app_refresh(egw.lang('empty trash'), 'mail');
var request = new egw_json_request('mail.mail_ui.ajax_emptyTrash'); var request = new egw_json_request('mail.mail_ui.ajax_emptyTrash');
request.sendRequest(); request.sendRequest();
} }
/** /**
* changeFolder * mail_compressFolder
*/ */
function changeFolder(folder,_widget) { function mail_compressFolder() {
app_refresh(egw.lang('compress folder'), 'mail');
var request = new egw_json_request('mail.mail_ui.ajax_compressFolder');
request.sendRequest();
}
/**
* mail_changeFolder
*/
function mail_changeFolder(folder,_widget) {
//alert('change Folder called:'+folder); //alert('change Folder called:'+folder);
app_refresh(egw.lang('change folder'), 'mail'); app_refresh(egw.lang('change folder'), 'mail');
var img = _widget.getSelectedNode().images[0]; // fetch first image var img = _widget.getSelectedNode().images[0]; // fetch first image

View File

@ -2,7 +2,7 @@
/** /**
* EGroupware - eTemplates for Application mail * EGroupware - eTemplates for Application mail
* http://www.egroupware.org * http://www.egroupware.org
* generated by soetemplate::dump4setup() 2013-02-12 17:52 * generated by soetemplate::dump4setup() 2013-02-13 16:05
* *
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package mail * @package mail
@ -12,7 +12,7 @@
$templ_version=1; $templ_version=1;
$templ_data[] = array('name' => 'mail.index','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:3:{i:0;a:3:{s:7:"onclick";s:42:"changeFolder(widget.event_args[0],widget);";s:4:"name";s:14:"nm[foldertree]";s:4:"type";s:4:"tree";}i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:3:"msg";}i:2;a:3:{s:4:"name";s:2:"nm";s:4:"size";s:15:"mail.index.rows";s:4:"type";s:9:"nextmatch";}}','size' => '','style' => '','modified' => '1360682502',); $templ_data[] = array('name' => 'mail.index','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:3:{i:0;a:3:{s:7:"onclick";s:47:"mail_changeFolder(widget.event_args[0],widget);";s:4:"name";s:14:"nm[foldertree]";s:4:"type";s:4:"tree";}i:1;a:2:{s:4:"type";s:4:"html";s:4:"name";s:3:"msg";}i:2;a:3:{s:4:"name";s:2:"nm";s:4:"size";s:15:"mail.index.rows";s:4:"type";s:9:"nextmatch";}}','size' => '','style' => '','modified' => '1360682502',);
$templ_data[] = array('name' => 'mail.index.rows','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:6:{s:2:"c1";s:2:"th";s:1:"A";s:2:"25";s:1:"F";s:2:"50";s:1:"E";s:3:"120";s:1:"D";s:3:"120";s:1:"C";s:2:"95";}i:1;a:6:{s:1:"A";a:4:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:2:"ID";s:4:"name";s:3:"uid";s:8:"readonly";s:1:"1";}s:1:"B";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"subject";s:5:"label";s:7:"subject";}s:1:"C";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"date";s:4:"name";s:4:"date";s:5:"align";s:6:"center";}s:1:"D";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:2:"to";s:4:"name";s:9:"toaddress";}s:1:"E";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"from";s:4:"name";s:11:"fromaddress";}s:1:"F";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"size";s:4:"name";s:4:"size";s:5:"align";s:6:"center";}}i:2;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:11:"${row}[uid]";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[subject]";}s:1:"C";a:4:{s:4:"type";s:9:"date-time";s:4:"name";s:12:"${row}[date]";s:8:"readonly";s:1:"1";s:5:"align";s:6:"center";}s:1:"D";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:17:"${row}[toaddress]";s:8:"readonly";s:1:"1";}s:1:"E";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:19:"${row}[fromaddress]";s:8:"readonly";s:1:"1";}s:1:"F";a:5:{s:4:"type";s:8:"vfs-size";s:4:"name";s:12:"${row}[size]";s:7:"no_lang";s:1:"1";s:8:"readonly";s:1:"1";s:5:"align";s:5:"right";}}}s:4:"rows";i:2;s:4:"cols";i:6;}}','size' => '','style' => '','modified' => '1360252030',); $templ_data[] = array('name' => 'mail.index.rows','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:6:{s:2:"c1";s:2:"th";s:1:"A";s:2:"25";s:1:"F";s:2:"50";s:1:"E";s:3:"120";s:1:"D";s:3:"120";s:1:"C";s:2:"95";}i:1;a:6:{s:1:"A";a:4:{s:4:"type";s:16:"nextmatch-header";s:5:"label";s:2:"ID";s:4:"name";s:3:"uid";s:8:"readonly";s:1:"1";}s:1:"B";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"subject";s:5:"label";s:7:"subject";}s:1:"C";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"date";s:4:"name";s:4:"date";s:5:"align";s:6:"center";}s:1:"D";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:2:"to";s:4:"name";s:9:"toaddress";}s:1:"E";a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"from";s:4:"name";s:11:"fromaddress";}s:1:"F";a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:4:"size";s:4:"name";s:4:"size";s:5:"align";s:6:"center";}}i:2;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:11:"${row}[uid]";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:15:"${row}[subject]";}s:1:"C";a:4:{s:4:"type";s:9:"date-time";s:4:"name";s:12:"${row}[date]";s:8:"readonly";s:1:"1";s:5:"align";s:6:"center";}s:1:"D";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:17:"${row}[toaddress]";s:8:"readonly";s:1:"1";}s:1:"E";a:3:{s:4:"type";s:9:"url-email";s:4:"name";s:19:"${row}[fromaddress]";s:8:"readonly";s:1:"1";}s:1:"F";a:5:{s:4:"type";s:8:"vfs-size";s:4:"name";s:12:"${row}[size]";s:7:"no_lang";s:1:"1";s:8:"readonly";s:1:"1";s:5:"align";s:5:"right";}}}s:4:"rows";i:2;s:4:"cols";i:6;}}','size' => '','style' => '','modified' => '1360252030',);

View File

@ -32,7 +32,7 @@
</grid> </grid>
</template> </template>
<template id="mail.index" template="" lang="" group="0" version="1.9.001"> <template id="mail.index" template="" lang="" group="0" version="1.9.001">
<tree id="nm[foldertree]" onclick="changeFolder(widget.event_args[0],widget);" parent_node="tree_target"/> <tree id="nm[foldertree]" onclick="mail_changeFolder(widget.event_args[0],widget);" parent_node="tree_target"/>
<html id="msg"/> <html id="msg"/>
<nextmatch id="nm" options="mail.index.rows"/> <nextmatch id="nm" options="mail.index.rows"/>
</template> </template>