some css to style the foldertree, move the foldertree around, own app refresh method, handle and visualize NoSelect Folders

This commit is contained in:
Klaus Leithoff 2013-02-13 14:02:02 +00:00
parent 33aac37741
commit cb91c4bb8c
4 changed files with 130 additions and 9 deletions

View File

@ -808,6 +808,13 @@ class mail_hooks
); );
} }
// Destination div for folder tree
$file[] = array(
'no_lang' => true,
'text'=>'<span id="tree_target" class="dtree"/>',
'link'=>false,
'icon' => false
);
// empty trash (if available -> move to trash ) // empty trash (if available -> move to trash )
if($preferences->preferences['deleteOptions'] == 'move_to_trash') if($preferences->preferences['deleteOptions'] == 'move_to_trash')
{ {
@ -836,13 +843,6 @@ class mail_hooks
} }
// Destination div for folder tree
$file[] = array(
'no_lang' => true,
'text'=>'<span id="tree_target"/>',
'link'=>false,
'icon' => false
);
// display them all // display them all
display_sidebox($appname,$menu_title,$file); display_sidebox($appname,$menu_title,$file);

View File

@ -348,6 +348,12 @@ class mail_ui
$oA['im2'] = "MailFolderClosed.png"; // has Children $oA['im2'] = "MailFolderClosed.png"; // has Children
} }
$oA['id'] = $path; // ID holds the PATH $oA['id'] = $path; // ID holds the PATH
if (stripos(array2string($fS['attributes']),'\noselect')!== false)
{
$oA['im0'] = "folderNoSelectClosed.gif"; // one Level
$oA['im1'] = "folderNoSelectOpen.gif";
$oA['im2'] = "folderNoSelectClosed.gif"; // has Children
}
if (stripos(array2string($fS['attributes']),'\hasnochildren')=== false) if (stripos(array2string($fS['attributes']),'\hasnochildren')=== false)
{ {
$oA['child']=1; // translates to: hasChildren -> dynamicLoading $oA['child']=1; // translates to: hasChildren -> dynamicLoading
@ -395,7 +401,7 @@ class mail_ui
if ($createMissingParents) if ($createMissingParents)
{ {
unset($item); unset($item);
$item = array('id' => $parent.$component, 'text' => $component, 'tooltip' => '**missing**'); $item = array('id' => $parent.$component, 'text' => $component, 'im0' => "folderNoSelectClosed.gif",'im1' => "folderNoSelectOpen.gif",'im2' => "folderNoSelectClosed.gif",'tooltip' => '**missing**');
$insert['item'][] =& $item; $insert['item'][] =& $item;
$insert =& $item; $insert =& $item;
} }
@ -1221,6 +1227,6 @@ error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Star
$this->mail_bo->compressFolder($trashFolder); $this->mail_bo->compressFolder($trashFolder);
} }
$response = egw_json_response::get(); $response = egw_json_response::get();
$response->call('egw_refresh',lang('emptied Trash'),'mail'); $response->call('egw_refresh',lang('empty trash'),'mail');
} }
} }

View File

@ -8,10 +8,71 @@
* @version $Id$ * @version $Id$
*/ */
/**
* Refresh given application _targetapp display of entry _app _id, incl. outputting _msg
*
* Default implementation here only reloads window with it's current url with an added msg=_msg attached
*
* @param string _msg message (already translated) to show, eg. 'Entry deleted'
* @param string _app application name
* @param string|int _id=null id of entry to refresh
* @param string _type=null either 'edit', 'delete', 'add' or null
*/
var doStatus;
function app_refresh(_msg, _app, _id, _type)
{
var bufferExists = false;
window.clearInterval(doStatus); // whatever message was up to be activated
//alert("app_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
//myCurrentMsg = getMsg();
//if (myCurrentMsg.length) {
// clear message after some time
myMessageBuffer = ""; //myCurrentMsg;
bufferExists = true;
//}
setMsg('<span style="font-weight: bold;">' +_msg+ '</span>');
if (_app=='mail')
{
//we may want to trigger some actions, like modifying the grid, disable preview and stuff
// TODO: more actions
}
if (bufferExists) doStatus = window.setInterval("egw_appWindow('mail').setMsg(myMessageBuffer);", 10000);
}
/**
* getMsg - gets the current Message
* @return string
*/
function getMsg()
{
var msg_wdg = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('msg');
if (msg_wdg)
{
return msg_wdg.valueOf().htmlNode[0].innerHTML;
}
return "";
}
/**
* setMsg - sets a Message, with the msg container, and controls if the container is enabled/disabled
* @param string myMsg - the message
*/
function setMsg(myMsg)
{
var msg_wdg = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('msg');
if (msg_wdg)
{
msg_wdg.set_value(myMsg);
msg_wdg.set_disabled(myMsg.trim().length==0);
}
}
/** /**
* emptyTrash * emptyTrash
*/ */
function emptyTrash() { function emptyTrash() {
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();
} }
@ -21,8 +82,30 @@ function emptyTrash() {
*/ */
function changeFolder(folder,_widget) { function changeFolder(folder,_widget) {
//alert('change Folder called:'+folder); //alert('change Folder called:'+folder);
app_refresh(egw.lang('change folder'), 'mail');
var img = _widget.getSelectedNode().images[0]; // fetch first image
if (!(img.search(eval('/'+'NoSelect'+'/'))<0))
{
if (_widget.event_args.length==2)
{
folder = _widget.event_args[1];
_widget.set_value(folder);
}
else
{
_widget.set_value('');
}
}
var nm = _widget.getRoot().getWidgetById('nm'); var nm = _widget.getRoot().getWidgetById('nm');
nm.activeFilters["selectedFolder"] = folder; nm.activeFilters["selectedFolder"] = folder;
nm.applyFilters(); nm.applyFilters();
var msg = _widget.getRoot().getWidgetById('msg');
if (msg)
{
window.clearInterval(doStatus);
displayname = _widget.getSelectedLabel();
myMsg = (displayname?displayname:folder)+' '+egw.lang('selected');
app_refresh(myMsg, 'mail');
}
} }

View File

@ -190,3 +190,35 @@ pre {
white-space: -o-pre-wrap; /* Opera 7 */ white-space: -o-pre-wrap; /* Opera 7 */
width: 99%; width: 99%;
} }
.dtree {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #666;
white-space: nowrap;
}
.dtree img {
border: 0px;
vertical-align: middle;
}
.dtree a {
color: #333;
text-decoration: none;
}
.dtree a.node, .dtree a.nodeSel {
white-space: nowrap;
padding: 1px 2px 1px 2px;
}
.dtree a.node:hover, .dtree a.nodeSel:hover {
color: #333;
text-decoration: underline;
}
.dtree a.nodeSel {
background-color: #c0d2ec;
}
.dtree .clip {
overflow: hidden;
}
.dtree table, .dtree tr, .dtree td {
border: none;
}