forked from extern/egroupware
merged lars folder-fixes to 1.0
This commit is contained in:
parent
5e023ce4bd
commit
3b2158f2da
@ -453,13 +453,13 @@
|
||||
|
||||
if(is_array($list))
|
||||
{
|
||||
// return always the inbox
|
||||
$folders['INBOX'] = 'INBOX';
|
||||
#_debug_array($list);
|
||||
reset($list);
|
||||
$folders = array();
|
||||
while (list($key, $val) = each($list))
|
||||
{
|
||||
// remove the {host:port/imap/...} part
|
||||
$folderNameIMAP = $this->decodeFolderName(preg_replace("/{.*}/","",$val->name));
|
||||
$folderNameIMAP = $this->decodeFolderName(preg_replace("/{.*}/",'',$val->name));
|
||||
$folderParts = explode(".",$folderNameIMAP);
|
||||
reset($folderParts);
|
||||
$displayName = "";
|
||||
@ -479,6 +479,8 @@
|
||||
}
|
||||
#exit;
|
||||
ksort($folders,SORT_STRING);
|
||||
// return always the inbox
|
||||
$folders = array_merge(array('INBOX' => 'INBOX'),$folders);
|
||||
reset($folders);
|
||||
return $folders;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/***************************************************************************\
|
||||
* phpGroupWare - FeLaMiMail *
|
||||
* eGroupWare - FeLaMiMail *
|
||||
* http://www.linux-at-work.de *
|
||||
* http://www.phpgw.de *
|
||||
* http://www.phpgroupware.org *
|
||||
@ -218,6 +218,118 @@
|
||||
$this->viewMainScreen();
|
||||
}
|
||||
|
||||
function createHTMLFolder($_folders, $_selected, $_topFolderName, $_topFolderDescription)
|
||||
{
|
||||
$folderImageDir = substr($GLOBALS['phpgw']->common->image('phpgwapi','foldertree_line.gif'),0,-19);
|
||||
|
||||
// careful! "d = new..." MUST be on a new line!!!
|
||||
$folder_tree_new = "<script type='text/javascript'>d = new dTree('d','".$folderImageDir."');d.config.inOrder=true;d.config.closeSameLevel=true;";
|
||||
|
||||
$allFolders = array();
|
||||
|
||||
// create a list of all folders, also the ones which are not subscribed
|
||||
foreach($_folders as $key => $value)
|
||||
{
|
||||
$folderParts = explode('.',$key);
|
||||
$partCount = count($folderParts);
|
||||
$string = '';
|
||||
for($i = 0; $i < $partCount; $i++)
|
||||
{
|
||||
if(!empty($string)) $string .= '.';
|
||||
$string .= $folderParts[$i];
|
||||
$allFolders[$string] = $folderParts[$i];
|
||||
}
|
||||
}
|
||||
|
||||
// keep track of the last parent id
|
||||
$parentStack = array();
|
||||
$counter = 0;
|
||||
$folder_name = $_topFolderName;
|
||||
$folder_title = $_topFolderDescription;
|
||||
$folder_icon = $folderImageDir."foldertree_base.gif";
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, 0);
|
||||
$parent = -1;
|
||||
$folder_tree_new .= "d.add(0,-1,'$folder_name','javascript:void(0);','','','$folder_title');";
|
||||
$counter++;
|
||||
|
||||
foreach($allFolders as $key => $value)
|
||||
{
|
||||
$countedDots = substr_count($key,".");
|
||||
#print "$value => $counted_dots<br>";
|
||||
|
||||
|
||||
// hihglight currently selected mailbox
|
||||
if ($_selected == $key)
|
||||
{
|
||||
$folder_name = "<font style=\"background-color: #dddddd\">$value</font>";
|
||||
$openTo = $counter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_name = $value;
|
||||
}
|
||||
|
||||
$folder_title = $value;
|
||||
if ($key == 'INBOX')
|
||||
{
|
||||
$folder_icon = $folderImageDir."foldertree_felamimail_sm.png";
|
||||
$folderOpen_icon = $folderImageDir."foldertree_felamimail_sm.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_icon = $folderImageDir."foldertree_folder.gif";
|
||||
$folderOpen_icon = '';
|
||||
}
|
||||
|
||||
// we are on the same level
|
||||
if($countedDots == count($parentStack) -1)
|
||||
{
|
||||
// remove the last entry
|
||||
array_pop($parentStack);
|
||||
// get the parent
|
||||
$parent = end($parentStack);
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
// we go one level deeper
|
||||
elseif($countedDots > count($parentStack) -1)
|
||||
{
|
||||
// get the parent
|
||||
$parent = end($parentStack);
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
// we go some levels up
|
||||
elseif($countedDots < count($parentStack))
|
||||
{
|
||||
$stackCounter = count($parentStack);
|
||||
while(count($parentStack) > $countedDots)
|
||||
{
|
||||
array_pop($parentStack);
|
||||
}
|
||||
$parent = end($parentStack);
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
|
||||
// some special handling for the root icon
|
||||
// the first icon requires $parent to be -1
|
||||
if($parent == '')
|
||||
$parent = 0;
|
||||
|
||||
// Node(id, pid, name, url, urlClick, urlOut, title, target, icon, iconOpen, open) {
|
||||
$folder_tree_new .= "d.add($counter,$parent,'$folder_name','#','document.messageList.mailbox.value=\'$key\'; document.messageList.submit();','','$key','','$folder_icon','$folderOpen_icon');\n";
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$folder_tree_new.= "document.write(d);
|
||||
d.openTo('$openTo','true');
|
||||
</script>";
|
||||
|
||||
return $folder_tree_new;
|
||||
}
|
||||
|
||||
|
||||
function deleteMessage()
|
||||
{
|
||||
$preferences = ExecMethod('felamimail.bopreferences.getPreferences');
|
||||
@ -607,7 +719,7 @@
|
||||
else
|
||||
{
|
||||
$folders = $this->bofelamimail->getFolderList('true');
|
||||
|
||||
|
||||
$headers = $this->bofelamimail->getHeaders($this->startMessage, $maxMessages, $this->sort);
|
||||
|
||||
|
||||
@ -936,133 +1048,20 @@
|
||||
|
||||
@reset($folders);
|
||||
|
||||
// Start of the new folder tree system
|
||||
// 29-12-2003 NDEE
|
||||
// ToDo
|
||||
// check how many mails in folder
|
||||
// different style of parsing folders into file
|
||||
// open to active folder on reload
|
||||
|
||||
$folderImageDir = substr($GLOBALS['phpgw']->common->image('phpgwapi','foldertree_line.gif'),0,-19);
|
||||
// Start of the new folder tree system
|
||||
// 29-12-2003 NDEE
|
||||
// ToDo
|
||||
// check how many mails in folder
|
||||
// different style of parsing folders into file
|
||||
// open to active folder on reload
|
||||
|
||||
// careful! "d = new..." MUST be on a new line!!!
|
||||
$folder_tree_new = "<script type='text/javascript'>d = new dTree('d','".$folderImageDir."');d.config.inOrder=true;d.config.closeSameLevel=true;";
|
||||
|
||||
$allFolders = array();
|
||||
|
||||
// create a list of all folders, also the ones which are not subscribed
|
||||
if (isset($folders) && is_array($folders))
|
||||
{
|
||||
foreach($folders as $key => $value)
|
||||
{
|
||||
$folderParts = explode('.',$key);
|
||||
$partCount = count($folderParts);
|
||||
$string = '';
|
||||
for($i = 0; $i < $partCount; $i++)
|
||||
{
|
||||
if(!empty($string)) $string .= '.';
|
||||
$string .= $folderParts[$i];
|
||||
$allFolders[$string] = $folderParts[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// keep track of the last parent id
|
||||
$parentStack = array();
|
||||
$counter = 0;
|
||||
$folder_name = 'IMAP Server';
|
||||
$folder_title = $mailPreferences['username'].'@'.$mailPreferences['imapServerAddress'];
|
||||
$folder_icon = $folderImageDir."foldertree_base.gif";
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, 0);
|
||||
$parent = -1;
|
||||
#$folder_tree_new .= "d.add('0','-1','$folder_name','#','','','$folder_title','','$folder_icon');";
|
||||
$folder_tree_new .= "d.add(0,-1,'$folder_name','javascript:void(0);','','','$folder_title');";
|
||||
$counter++;
|
||||
|
||||
foreach($allFolders as $key => $value)
|
||||
{
|
||||
$countedDots = substr_count($key,".");
|
||||
#print "$value => $counted_dots<br>";
|
||||
|
||||
|
||||
// hihglight currently selected mailbox
|
||||
if ($this->mailbox == $key)
|
||||
{
|
||||
$folder_name = "<font style=\"background-color: #dddddd\">$value</font>";
|
||||
$openTo = $counter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_name = $value;
|
||||
}
|
||||
|
||||
$folder_title = $value;
|
||||
if ($key == 'INBOX')
|
||||
{
|
||||
$folder_icon = $folderImageDir."foldertree_felamimail_sm.png";
|
||||
$folderOpen_icon = $folderImageDir."foldertree_felamimail_sm.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_icon = $folderImageDir."foldertree_folder.gif";
|
||||
$folderOpen_icon = '';
|
||||
}
|
||||
|
||||
// we are on the same level
|
||||
if($countedDots == count($parentStack) -1)
|
||||
{
|
||||
// remove the last entry
|
||||
array_pop($parentStack);
|
||||
// get the parent
|
||||
$parent = end($parentStack);
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
// we go one level deeper
|
||||
elseif($countedDots > count($parentStack) -1)
|
||||
{
|
||||
// get the parent
|
||||
$parent = end($parentStack);
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
// we go some levels up
|
||||
elseif($countedDots < count($parentStack))
|
||||
{
|
||||
$stackCounter = count($parentStack);
|
||||
while(count($parentStack) > $countedDots)
|
||||
{
|
||||
array_pop($parentStack);
|
||||
}
|
||||
$parent = end($parentStack);
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
|
||||
// some special handling for the root icon
|
||||
// the first icon requires $parent to be -1
|
||||
#if($counter==0)
|
||||
#{
|
||||
# $parent = -1;
|
||||
# $folder_icon = $folderImageDir."/foldertree_felamimail_sm.png";
|
||||
#}
|
||||
if($parent == '')
|
||||
$parent = 0;
|
||||
|
||||
// Node(id, pid, name, url, urlClick, urlOut, title, target, icon, iconOpen, open) {
|
||||
$folder_tree_new .= "d.add($counter,$parent,'$folder_name','#','document.messageList.mailbox.value=\'$key\'; document.messageList.submit();','','$folder_title $key','','$folder_icon','$folderOpen_icon');\n";
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$folder_tree_new.= "document.write(d);
|
||||
d.openTo('$openTo','true');
|
||||
</script>";
|
||||
$folder_tree_new = $this->createHTMLFolder($folders, $this->mailbox, 'IMAP Server', $mailPreferences['username'].'@'.$mailPreferences['imapServerAddress']);
|
||||
|
||||
$this->t->set_var('current_mailbox',$current_mailbox);
|
||||
$this->t->set_var('folder_tree',$folder_tree_new);
|
||||
$this->t->set_var('foldertree_image_path',PHPGW_IMAGES_DIR.'/foldertree/');
|
||||
#$this->t->set_var('foldertree_image_path',PHPGW_IMAGES_DIR.'/foldertree/');
|
||||
|
||||
// Finish of the new folder tree system
|
||||
|
||||
$this->t->set_var('options_folder',$options_folder);
|
||||
|
||||
|
301
felamimail/inc/class.uipreferences.inc.php
Normal file
301
felamimail/inc/class.uipreferences.inc.php
Normal file
@ -0,0 +1,301 @@
|
||||
<?php
|
||||
/***************************************************************************\
|
||||
* eGroupWare - FeLaMiMail *
|
||||
* http://www.linux-at-work.de *
|
||||
* http://www.phpgw.de *
|
||||
* http://www.egroupware.org *
|
||||
* Written by : Lars Kneschke [lkneschke@linux-at-work.de] *
|
||||
* ------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\***************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
class uipreferences
|
||||
{
|
||||
|
||||
var $public_functions = array
|
||||
(
|
||||
'listFolder' => 'True',
|
||||
'showHeader' => 'True',
|
||||
'getAttachment' => 'True'
|
||||
);
|
||||
|
||||
function uipreferences()
|
||||
{
|
||||
$this->t = $GLOBALS['phpgw']->template;
|
||||
#$this->t->egroupware_hack = False;
|
||||
$this->bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['phpgw']->translation->charset());
|
||||
$this->uiwidgets = CreateObject('felamimail.uiwidgets');
|
||||
$this->bofelamimail->openConnection('',OP_HALFOPEN);
|
||||
|
||||
|
||||
$this->rowColor[0] = $GLOBALS['phpgw_info']["theme"]["bg01"];
|
||||
$this->rowColor[1] = $GLOBALS['phpgw_info']["theme"]["bg02"];
|
||||
|
||||
}
|
||||
|
||||
function display_app_header()
|
||||
{
|
||||
if(!@is_object($GLOBALS['phpgw']->js))
|
||||
{
|
||||
$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
|
||||
}
|
||||
$GLOBALS['phpgw']->js->validate_file('foldertree','foldertree');
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
}
|
||||
|
||||
function listFolder()
|
||||
{
|
||||
// rename a mailbox
|
||||
if(isset($GLOBALS['HTTP_POST_VARS']['newMailboxName']))
|
||||
{
|
||||
#print "rename to: ".$GLOBALS['HTTP_POST_VARS']['newMailboxName'];
|
||||
|
||||
$oldMailboxName = $this->selectedFolder;
|
||||
$newMailboxName = $GLOBALS['HTTP_POST_VARS']['newMailboxName'];
|
||||
|
||||
if($position = strrpos($oldMailboxName,'.'))
|
||||
{
|
||||
$newMailboxName = substr($oldMailboxName,0,$position+1).$newMailboxName;
|
||||
}
|
||||
|
||||
|
||||
if($this->bofelamimail->imap_renamemailbox($oldMailboxName, $newMailboxName))
|
||||
{
|
||||
$this->bofelamimail->sessionData['preferences']['mailbox']
|
||||
= $newMailboxName;
|
||||
$this->bofelamimail->saveSessionData();
|
||||
}
|
||||
}
|
||||
|
||||
// delete a Folder
|
||||
if(isset($GLOBALS['HTTP_POST_VARS']['deleteFolder']) && $this->bofelamimail->sessionData['preferences']['mailbox'] != 'INBOX')
|
||||
{
|
||||
if($this->bofelamimail->imap_deletemailbox($this->bofelamimail->sessionData['preferences']['mailbox']))
|
||||
{
|
||||
$this->bofelamimail->sessionData['preferences']['mailbox']
|
||||
= "INBOX";
|
||||
$this->bofelamimail->saveSessionData();
|
||||
}
|
||||
}
|
||||
|
||||
// create a new Mailbox
|
||||
if(isset($GLOBALS['HTTP_POST_VARS']['newSubFolder']))
|
||||
{
|
||||
$oldMailboxName = $this->bofelamimail->sessionData['preferences']['mailbox'].'.';
|
||||
$oldMailboxName = ($oldMailboxName == '--topfolderselected--.') ? '' : $oldMailboxName;
|
||||
$newMailboxName = $oldMailboxName.$GLOBALS['HTTP_POST_VARS']['newSubFolder'];
|
||||
|
||||
$this->bofelamimail->imap_createmailbox($newMailboxName,True);
|
||||
}
|
||||
|
||||
$folderList = $this->bofelamimail->getFolderList();
|
||||
|
||||
// check user input BEGIN
|
||||
|
||||
// the name of the new current folder
|
||||
if(get_var('mailboxName',array('POST')) &&
|
||||
(in_array(get_var('mailboxName',array('POST')),array_flip($folderList)) ||
|
||||
get_var('mailboxName',array('POST')) == '--topfolderselected--'))
|
||||
{
|
||||
$this->bofelamimail->sessionData['preferences']['mailbox']
|
||||
= get_var('mailboxName',array('POST'));
|
||||
$this->bofelamimail->saveSessionData();
|
||||
}
|
||||
|
||||
$this->selectedFolder = $this->bofelamimail->sessionData['preferences']['mailbox'];
|
||||
|
||||
// (un)subscribe to a folder??
|
||||
if(isset($GLOBALS['HTTP_POST_VARS']['folderStatus']))
|
||||
{
|
||||
$this->bofelamimail->subscribe($this->selectedFolder,$GLOBALS['HTTP_POST_VARS']['folderStatus']);
|
||||
}
|
||||
|
||||
|
||||
$this->selectedFolder = $this->bofelamimail->sessionData['preferences']['mailbox'];
|
||||
|
||||
// check user input END
|
||||
|
||||
|
||||
if($this->selectedFolder != '--topfolderselected--')
|
||||
$folderStatus = $this->bofelamimail->getFolderStatus($this->selectedFolder);
|
||||
$mailPrefs = $this->bofelamimail->getMailPreferences();
|
||||
|
||||
$this->display_app_header();
|
||||
|
||||
$this->t->set_file(array("body" => "preferences_manage_folder.tpl"));
|
||||
$this->t->set_block('body','main');
|
||||
#$this->t->set_block('body','select_row');
|
||||
$this->t->set_block('body','folder_settings');
|
||||
$this->t->set_block('body','mainFolder_settings');
|
||||
$this->t->set_block('body','folder_acl');
|
||||
|
||||
$this->translate();
|
||||
|
||||
#print "<pre>";print_r($folderList);print "</pre>";
|
||||
// set the default values for the sort links (sort by subject)
|
||||
$linkData = array
|
||||
(
|
||||
'menuaction' => 'felamimail.uipreferences.listFolder'
|
||||
);
|
||||
$this->t->set_var('form_action',$GLOBALS['phpgw']->link('/index.php',$linkData));
|
||||
|
||||
// create the link to show folder settings
|
||||
#$linkData = array
|
||||
#(
|
||||
# 'menuaction' => 'felamimail.uipreferences.listFolder',
|
||||
# 'display' => 'settings'
|
||||
#);
|
||||
#$this->t->set_var('settings_url',$GLOBALS['phpgw']->link('/index.php',$linkData));
|
||||
|
||||
// create the link to show folder acl
|
||||
#$linkData = array
|
||||
#(
|
||||
# 'menuaction' => 'felamimail.uipreferences.listFolder',
|
||||
# 'display' => 'acl'
|
||||
#);
|
||||
#$this->t->set_var('acl_url',$GLOBALS['phpgw']->link('/index.php',$linkData));
|
||||
|
||||
// folder select box
|
||||
#while(list($key,$value) = @each($folderList))
|
||||
#{
|
||||
# $currentFolderStatus = $this->bofelamimail->getFolderStatus($key);
|
||||
# $this->t->set_var('folder_name',$value);
|
||||
# $this->t->set_var('folder_value',$key);
|
||||
# if($this->selectedFolder == $key)
|
||||
# {
|
||||
# $this->t->set_var('selected','selected');
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $this->t->set_var('selected','');
|
||||
# }
|
||||
# if($currentFolderStatus['subscribed'])
|
||||
# {
|
||||
# $this->t->set_var('subscribed','S');
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $this->t->set_var('subscribed','U');
|
||||
# }
|
||||
# $this->t->parse('select_rows','select_row',True);
|
||||
#}
|
||||
$folderTree = $this->uiwidgets->createHTMLFolder
|
||||
(
|
||||
$folderList,
|
||||
$this->selectedFolder,
|
||||
'folderList',
|
||||
'mailboxName',
|
||||
'IMAP Server',
|
||||
$mailPrefs['username'].'@'.$mailPrefs['imapServerAddress']
|
||||
);
|
||||
$this->t->set_var('folder_tree',$folderTree);
|
||||
|
||||
switch($_GET['display'])
|
||||
{
|
||||
case 'acl':
|
||||
$uiBaseClass = CreateObject('felamimail.uibaseclass');
|
||||
#$uiBaseClass->accounts_popup('calendar');
|
||||
$this->t->parse('settings_view','folder_acl',True);
|
||||
break;
|
||||
|
||||
case 'settings':
|
||||
default:
|
||||
// selected folder data
|
||||
if($folderStatus['subscribed'])
|
||||
{
|
||||
$this->t->set_var('subscribed_checked','checked');
|
||||
$this->t->set_var('unsubscribed_checked','');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->t->set_var('subscribed_checked','');
|
||||
$this->t->set_var('unsubscribed_checked','checked');
|
||||
}
|
||||
|
||||
if(is_array($quota))
|
||||
{
|
||||
$this->t->set_var('storage_usage',$quota['STORAGE']['usage']);
|
||||
$this->t->set_var('storage_limit',$quota['STORAGE']['limit']);
|
||||
$this->t->set_var('message_usage',$quota['MESSAGE']['usage']);
|
||||
$this->t->set_var('message_limit',$quota['MESSAGE']['limit']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->t->set_var('storage_usage',lang('unknown'));
|
||||
$this->t->set_var('storage_limit',lang('unknown'));
|
||||
$this->t->set_var('message_usage',lang('unknown'));
|
||||
$this->t->set_var('message_limit',lang('unknown'));
|
||||
}
|
||||
|
||||
if($this->selectedFolder != '--topfolderselected--')
|
||||
{
|
||||
$this->t->parse('settings_view','folder_settings',True);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->t->parse('settings_view','mainFolder_settings',True);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$mailBoxTreeName = '';
|
||||
$mailBoxName = $this->selectedFolder;
|
||||
if($position = strrpos($this->selectedFolder,'.'))
|
||||
{
|
||||
$mailBoxTreeName = substr($this->selectedFolder,0,$position+1);
|
||||
$mailBoxName = substr($this->selectedFolder,$position+1);
|
||||
}
|
||||
|
||||
$this->t->set_var('mailboxTreeName',$mailBoxTreeName);
|
||||
$this->t->set_var('mailboxNameShort',$mailBoxName);
|
||||
$this->t->set_var('mailboxName',$mailBoxName);
|
||||
$this->t->set_var('folderName',$this->selectedFolder);
|
||||
$this->t->set_var('imap_server',$mailPrefs['imapServerAddress']);
|
||||
|
||||
$this->t->pparse("out","main");
|
||||
$this->bofelamimail->closeConnection();
|
||||
}
|
||||
|
||||
function translate()
|
||||
{
|
||||
$this->t->set_var("lang_folder_name",lang('folder name'));
|
||||
$this->t->set_var("lang_folder_list",lang('folderlist'));
|
||||
$this->t->set_var("lang_select",lang('select'));
|
||||
$this->t->set_var("lang_folder_status",lang('folder status'));
|
||||
$this->t->set_var("lang_subscribed",lang('subscribed'));
|
||||
$this->t->set_var("lang_unsubscribed",lang('unsubscribed'));
|
||||
$this->t->set_var("lang_subscribe",lang('subscribe'));
|
||||
$this->t->set_var("lang_unsubscribe",lang('unsubscribe'));
|
||||
$this->t->set_var("lang_update",lang('update'));
|
||||
$this->t->set_var("lang_rename_folder",lang('rename folder'));
|
||||
$this->t->set_var("lang_create_subfolder",lang('create subfolder'));
|
||||
$this->t->set_var("lang_delete_folder",lang('delete folder'));
|
||||
$this->t->set_var("lang_confirm_delete",addslashes(lang("Do you really want to delete the '%1' folder?",$this->bofelamimail->sessionData['preferences']['mailbox'])));
|
||||
$this->t->set_var("lang_delete",lang('delete'));
|
||||
$this->t->set_var("lang_imap_server",lang('IMAP Server'));
|
||||
$this->t->set_var("lang_folder_settings",lang('folder settings'));
|
||||
$this->t->set_var("lang_folder_acl",lang('folder acl'));
|
||||
$this->t->set_var("lang_anyone",lang('anyone'));
|
||||
$this->t->set_var("lang_reading",lang('reading'));
|
||||
$this->t->set_var("lang_writing",lang('writing'));
|
||||
$this->t->set_var("lang_posting",lang('posting'));
|
||||
$this->t->set_var("lang_none",lang('none'));
|
||||
$this->t->set_var("lang_rename",lang('rename'));
|
||||
$this->t->set_var("lang_create",lang('create'));
|
||||
$this->t->set_var('lang_open_all',lang("open all"));
|
||||
$this->t->set_var('lang_close_all',lang("close all"));
|
||||
|
||||
$this->t->set_var("th_bg",$GLOBALS['phpgw_info']["theme"]["th_bg"]);
|
||||
$this->t->set_var("bg01",$GLOBALS['phpgw_info']["theme"]["bg01"]);
|
||||
$this->t->set_var("bg02",$GLOBALS['phpgw_info']["theme"]["bg02"]);
|
||||
$this->t->set_var("bg03",$GLOBALS['phpgw_info']["theme"]["bg03"]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -59,6 +59,135 @@
|
||||
$this->template->set_file(array("body" => 'uiwidgets.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* create a folder tree
|
||||
*
|
||||
* this function will create a foldertree based on javascript
|
||||
*
|
||||
* @param _folders array containing the list of folders
|
||||
* @param _selected string containing the selected folder
|
||||
* @param _topFolderName string containing the top folder name
|
||||
* @param _topFolderDescription string containing the description for the top folder
|
||||
*
|
||||
* @returns the html code, to be added into the template
|
||||
*/
|
||||
function createHTMLFolder($_folders, $_selected, $_formName, $_valueName, $_topFolderName, $_topFolderDescription)
|
||||
{
|
||||
$folderImageDir = substr($GLOBALS['phpgw']->common->image('phpgwapi','foldertree_line.gif'),0,-19);
|
||||
|
||||
// careful! "d = new..." MUST be on a new line!!!
|
||||
$folder_tree_new = "<script type='text/javascript'>d = new dTree('d','".$folderImageDir."');d.config.inOrder=true;d.config.closeSameLevel=true;";
|
||||
|
||||
$allFolders = array();
|
||||
|
||||
// create a list of all folders, also the ones which are not subscribed
|
||||
foreach($_folders as $key => $value)
|
||||
{
|
||||
$folderParts = explode('.',$key);
|
||||
$partCount = count($folderParts);
|
||||
$string = '';
|
||||
for($i = 0; $i < $partCount; $i++)
|
||||
{
|
||||
if(!empty($string)) $string .= '.';
|
||||
$string .= $folderParts[$i];
|
||||
$allFolders[$string] = $folderParts[$i];
|
||||
}
|
||||
}
|
||||
|
||||
// keep track of the last parent id
|
||||
$parentStack = array();
|
||||
$counter = 0;
|
||||
$folder_name = $_topFolderName;
|
||||
$folder_title = $_topFolderDescription;
|
||||
$folder_icon = $folderImageDir."foldertree_base.gif";
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, 0);
|
||||
$parent = -1;
|
||||
#$folder_tree_new .= "d.add(0,-1,'$folder_name','javascript:void(0);','','','$folder_title');";
|
||||
if($_selected == '--topfolderselected--')
|
||||
{
|
||||
$folder_name = "<font style=\"background-color: #dddddd\">$folder_name</font>";
|
||||
}
|
||||
$folder_tree_new .= "d.add(0,-1,'$folder_name','#','document.$_formName.$_valueName.value=\'--topfolderselected--\'; document.$_formName.submit();','','$folder_title');\n";
|
||||
|
||||
$counter++;
|
||||
|
||||
foreach($allFolders as $key => $value)
|
||||
{
|
||||
$countedDots = substr_count($key,".");
|
||||
#print "$value => $counted_dots<br>";
|
||||
|
||||
|
||||
// hihglight currently selected mailbox
|
||||
if ($_selected == $key)
|
||||
{
|
||||
$folder_name = "<font style=\"background-color: #dddddd\">$value</font>";
|
||||
$openTo = $counter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_name = $value;
|
||||
}
|
||||
|
||||
$folder_title = $value;
|
||||
if ($key == 'INBOX')
|
||||
{
|
||||
$folder_icon = $folderImageDir."foldertree_felamimail_sm.png";
|
||||
$folderOpen_icon = $folderImageDir."foldertree_felamimail_sm.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_icon = $folderImageDir."foldertree_folder.gif";
|
||||
$folderOpen_icon = '';
|
||||
}
|
||||
|
||||
// we are on the same level
|
||||
if($countedDots == count($parentStack) -1)
|
||||
{
|
||||
// remove the last entry
|
||||
array_pop($parentStack);
|
||||
// get the parent
|
||||
$parent = end($parentStack);
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
// we go one level deeper
|
||||
elseif($countedDots > count($parentStack) -1)
|
||||
{
|
||||
// get the parent
|
||||
$parent = end($parentStack);
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
// we go some levels up
|
||||
elseif($countedDots < count($parentStack))
|
||||
{
|
||||
$stackCounter = count($parentStack);
|
||||
while(count($parentStack) > $countedDots)
|
||||
{
|
||||
array_pop($parentStack);
|
||||
}
|
||||
$parent = end($parentStack);
|
||||
// and put the current counter on top
|
||||
array_push($parentStack, $counter);
|
||||
}
|
||||
|
||||
// some special handling for the root icon
|
||||
// the first icon requires $parent to be -1
|
||||
if($parent == '')
|
||||
$parent = 0;
|
||||
|
||||
// Node(id, pid, name, url, urlClick, urlOut, title, target, icon, iconOpen, open) {
|
||||
$folder_tree_new .= "d.add($counter,$parent,'$folder_name','#','document.$_formName.$_valueName.value=\'$key\'; document.$_formName.submit();','','$key','','$folder_icon','$folderOpen_icon');\n";
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$folder_tree_new.= "document.write(d);
|
||||
d.openTo('$openTo','true');
|
||||
</script>";
|
||||
|
||||
return $folder_tree_new;
|
||||
}
|
||||
|
||||
/**
|
||||
* create multiselectbox
|
||||
*
|
||||
|
243
felamimail/templates/default/preferences_manage_folder.tpl
Normal file
243
felamimail/templates/default/preferences_manage_folder.tpl
Normal file
@ -0,0 +1,243 @@
|
||||
<!-- BEGIN main -->
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<th width="210px" class="th">
|
||||
{lang_folder_list}
|
||||
</th>
|
||||
<th class="th">
|
||||
{lang_folder_settings}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form name="folderList" method="post" action="{form_action}">
|
||||
<div id="divFolderTree" style="overflow:auto; width:210px; height:474px; margin-bottom: 0px;padding-left: 0px; padding-top:0px; z-index:100; border : 1px solid Silver;">
|
||||
<table width=100% BORDER="0" style="table-layout:fixed;padding-left:2;">
|
||||
<tr>
|
||||
<td width="100%" valign="top" nowrap style="font-size:10px">
|
||||
{folder_tree}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" valign="bottom" nowrap style="font-size:10px">
|
||||
<br>
|
||||
<p align="center">
|
||||
<small><a href="javascript: d.openAll();">{lang_open_all}</a> | <a href="javascript: d.closeAll();">{lang_close_all}</a></small>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="mailboxName">
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
<td valign="top">
|
||||
{settings_view}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td>
|
||||
<table border="1" width="100%">
|
||||
<tr>
|
||||
<td width="100"align="left">
|
||||
{lang_quota_status}
|
||||
</td>
|
||||
<td align="center">
|
||||
<table width="100%" border="1">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Storage Limit<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
STORAGE usage level is:
|
||||
</td>
|
||||
<td width="50%">
|
||||
{storage_usage}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
STORAGE limit level is:
|
||||
</td>
|
||||
<td>
|
||||
{storage_limit}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Message Limit<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
MESSAGE usage level is:
|
||||
</td>
|
||||
<td>
|
||||
{message_usage}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
MESSAGE limit level is:
|
||||
</td>
|
||||
<td>
|
||||
{message_limit}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr> -->
|
||||
</table>
|
||||
|
||||
<!-- END main -->
|
||||
|
||||
<!-- BEGIN folder_settings -->
|
||||
<table border="0" width="100%" cellpadding=2 cellspacing=0>
|
||||
<tr class="th">
|
||||
<td colspan="3">
|
||||
<b>Host: {imap_server} Foldername: {folderName}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"align="left">
|
||||
{lang_folder_status}
|
||||
</td>
|
||||
<td align="center">
|
||||
<form action="{form_action}" method="post" name="subscribeList">
|
||||
<input type="radio" name="folderStatus" value="subscribe" onchange="document.subscribeList.submit()" id="subscribed" {subscribed_checked}>
|
||||
<label for="subscribed">{lang_subscribed}</label>
|
||||
<input type="radio" name="folderStatus" value="unsubscribe" onchange="document.subscribeList.submit()" id="unsubscribed" {unsubscribed_checked}>
|
||||
<label for="unsubscribed">{lang_unsubscribed}</label>
|
||||
</td>
|
||||
<td>
|
||||
<noscript><input type="submit" value="{lang_update}" name="un_subscribe"></noscript>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"align="left">
|
||||
{lang_rename_folder}
|
||||
</td>
|
||||
<td align="center">
|
||||
<form action="{form_action}" method="post" name="renameMailbox">
|
||||
<input type="text" size="30" name="newMailboxName" value="{mailboxNameShort}" onchange="document.renameMailbox.submit()">
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="submit" value="{lang_rename}" name="renameMailbox">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"align="left">
|
||||
{lang_create_subfolder}
|
||||
</td>
|
||||
<td align="center">
|
||||
<form action="{form_action}" method="post" name="createSubFolder">
|
||||
<input type="text" size="30" name="newSubFolder" onchange="document.createSubFolder.submit()">
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="submit" value="{lang_create}" name="createSubFolder">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"align="left">
|
||||
|
||||
</td>
|
||||
<td align="center" colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"align="left">
|
||||
{lang_delete_folder}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td align="center">
|
||||
<form action="{form_action}" method="post" name="deleteFolder">
|
||||
<input type="submit" value="{lang_delete}" name="deleteFolder" onClick="return confirm('{lang_confirm_delete}')">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END folder_settings -->
|
||||
|
||||
<!-- BEGIN mainFolder_settings -->
|
||||
<table border="0" width="100%" cellpadding=2 cellspacing=0>
|
||||
<tr class="th">
|
||||
<td colspan="3">
|
||||
<b>Host: {imap_server}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150"align="left">
|
||||
{lang_create_subfolder}
|
||||
</td>
|
||||
<td align="center">
|
||||
<form action="{form_action}" method="post" name="createSubFolder">
|
||||
<input type="text" size="30" name="newSubFolder" onchange="document.createSubFolder.submit()">
|
||||
</td>
|
||||
<td align="center">
|
||||
<input type="submit" value="{lang_create}" name="createSubFolder">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END mainFolder_settings -->
|
||||
|
||||
<!-- BEGIN folder_acl -->
|
||||
<table width="100%" cellpadding=2 cellspacing=0>
|
||||
<tr>
|
||||
<td width="50%" align="center">
|
||||
<a href="{settings_url}">{lang_folder_settings}</a>
|
||||
</td>
|
||||
<td width="50%" align="center">
|
||||
{lang_folder_acl}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="1" width="100%" cellpadding=2 cellspacing=0>
|
||||
<tr>
|
||||
<td width="150" align="left">
|
||||
{lang_username}
|
||||
</td>
|
||||
<td align="center">
|
||||
<b>{lang_acl}</b>
|
||||
</td>
|
||||
<td align="center">
|
||||
<b>{lang_shortcut}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="150" align="left">
|
||||
{lang_anyone}
|
||||
</td>
|
||||
<td align="center">
|
||||
A<input type="checkbox" name="acl_a">
|
||||
C<input type="checkbox" name="acl_c">
|
||||
D<input type="checkbox" name="acl_d">
|
||||
I<input type="checkbox" name="acl_i">
|
||||
L<input type="checkbox" name="acl_l">
|
||||
P<input type="checkbox" name="acl_p">
|
||||
R<input type="checkbox" name="acl_r">
|
||||
S<input type="checkbox" name="acl_s">
|
||||
W<input type="checkbox" name="acl_w">
|
||||
</td>
|
||||
<td align="center">
|
||||
<select>
|
||||
<option>{lang_reading}</option>
|
||||
<option>{lang_writing}</option>
|
||||
<option>{lang_posting}</option>
|
||||
<option>{lang_none}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END folder_acl -->
|
Loading…
Reference in New Issue
Block a user