mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
add simple list interface for manage identities and accounts (based on grid widget)
This commit is contained in:
parent
90dc7e6662
commit
451aa51beb
@ -807,16 +807,14 @@ class mail_hooks
|
||||
#$mailPreferences = ExecMethod('mail.bopreferences.getPreferences');
|
||||
$menu_title = lang('Preferences'); // ToDo: remove Preferences sub-menu from sidebox
|
||||
$file = array();
|
||||
/*
|
||||
|
||||
if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) {
|
||||
$linkData = array (
|
||||
'menuaction' => 'mail.uipreferences.listAccountData',
|
||||
'menuaction' => 'mail.mail_uipreferences.index',
|
||||
);
|
||||
$file['Manage eMail Accounts and Identities'] = egw::link('/index.php',$linkData);
|
||||
|
||||
}
|
||||
*/
|
||||
if ($preferences->preferences['prefcontroltestconnection'] <> 'none') $file['Test Connection'] = egw::link('/index.php','menuaction=mail.mail_ui.TestConnection&appname=mail');
|
||||
|
||||
if($preferences->ea_user_defined_signatures) {
|
||||
$linkData = array (
|
||||
@ -824,6 +822,9 @@ class mail_hooks
|
||||
);
|
||||
$file['Manage Signatures'] = egw::link('/index.php',$linkData);
|
||||
}
|
||||
|
||||
if ($preferences->preferences['prefcontroltestconnection'] <> 'none') $file['Test Connection'] = egw::link('/index.php','menuaction=mail.mail_ui.TestConnection&appname=mail');
|
||||
|
||||
/*
|
||||
if(empty($preferences->preferences['prefpreventmanagefolders']) || $preferences->preferences['prefpreventmanagefolders'] == 0) {
|
||||
$file['Manage Folders'] = egw::link('/index.php',array('menuaction'=>'mail.uipreferences.listFolder'));
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Mail - interface class for compose mails in popup
|
||||
* EGroupware - Mail - interface and bo class for signatures
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package mail
|
||||
@ -16,6 +16,7 @@ class mail_signatures
|
||||
var $public_functions = array
|
||||
(
|
||||
'index' => True,
|
||||
'edit' => True,
|
||||
);
|
||||
|
||||
/**
|
||||
|
161
mail/inc/class.mail_uipreferences.inc.php
Normal file
161
mail/inc/class.mail_uipreferences.inc.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware - Mail - interface class for identities and accounts
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package mail
|
||||
* @author Klaus Leithoff [kl@stylite.de]
|
||||
* @copyright (c) 2013 by Klaus Leithoff <kl-AT-stylite.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
include_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate.inc.php');
|
||||
|
||||
class mail_uipreferences
|
||||
{
|
||||
var $public_functions = array
|
||||
(
|
||||
'index' => True,
|
||||
'edit' => True,
|
||||
);
|
||||
|
||||
/**
|
||||
* nextMatch name for index
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
static $nm_index = 'acc';
|
||||
|
||||
/**
|
||||
* Reference to felamimail_bo
|
||||
*
|
||||
* @var felamimail_bo
|
||||
*/
|
||||
var $mail_bo;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
function __construct($_signatureID = NULL)
|
||||
{
|
||||
$this->accountID = $GLOBALS['egw_info']['user']['account_id'];
|
||||
$this->mail_bo = mail_bo::getInstance(true,$icServerID);
|
||||
$this->bopreferences = $this->mail_bo->bopreferences;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Main signature list page
|
||||
*
|
||||
* @param array $content=null
|
||||
* @param string $msg=null
|
||||
*/
|
||||
function index(array $content=null,$msg=null)
|
||||
{
|
||||
//Instantiate an etemplate_new object
|
||||
$tmpl = new etemplate_new('mail.accounts.index');
|
||||
if (!is_array($content))
|
||||
{
|
||||
$content['acc']= $this->get_rows($rows,$readonlys);
|
||||
|
||||
// Set content-menu actions
|
||||
$tmpl->set_cell_attribute('acc', 'actions',$this->get_actions());
|
||||
|
||||
$sel_options = array(
|
||||
'status' => array(
|
||||
'ENABLED' => lang('Enabled'),
|
||||
'DISABLED' => lang('Disabled'),
|
||||
)
|
||||
);
|
||||
}
|
||||
if ($msg)
|
||||
{
|
||||
$content['msg'] = $msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($msg);
|
||||
unset($content['msg']);
|
||||
}
|
||||
$tmpl->exec('mail.mail_uipreferences.index',$content,$sel_options,$readonlys);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get actions / context menu for index
|
||||
*
|
||||
* Changes here, require to log out, as $content[self::$nm_index] get stored in session!
|
||||
* @var &$action_links
|
||||
*
|
||||
* @return array see nextmatch_widget::egw_actions()
|
||||
*/
|
||||
private function get_actions(array &$action_links=array())
|
||||
{
|
||||
$actions = array(
|
||||
'open' => array(
|
||||
'caption' => lang('Open'),
|
||||
'icon' => 'view',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.mail.account_open',
|
||||
'allowOnMultiple' => false,
|
||||
'default' => true,
|
||||
),
|
||||
'delete' => array(
|
||||
'caption' => lang('delete'),
|
||||
'icon' => 'delete',
|
||||
'group' => ++$group,
|
||||
'onExecute' => 'javaScript:app.mail.account_delete',
|
||||
'allowOnMultiple' => false,
|
||||
),
|
||||
);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to fetch the rows for the nextmatch widget
|
||||
*
|
||||
* @param array $query
|
||||
* @param array &$rows
|
||||
* @param array &$readonlys
|
||||
*/
|
||||
function get_rows($query,&$rows)
|
||||
{
|
||||
if (!isset($this->bopreferences)) $this->bopreferences = CreateObject('mail_bopreferences');
|
||||
$preferences =& $this->bopreferences->getPreferences();
|
||||
$allAccountData = $this->bopreferences->getAllAccountData($preferences);
|
||||
if ($allAccountData) {
|
||||
foreach ($allAccountData as $tmpkey => $accountData)
|
||||
{
|
||||
$identity =& $accountData['identity'];
|
||||
|
||||
#_debug_array($identity);
|
||||
|
||||
foreach($identity as $key => $value) {
|
||||
if(is_object($value) || is_array($value)) {
|
||||
continue;
|
||||
}
|
||||
switch($key) {
|
||||
default:
|
||||
$tempvar[$key] = $value;
|
||||
}
|
||||
}
|
||||
$tempvar['id_key']=$tmpkey;
|
||||
$accountArray[]=$tempvar;
|
||||
}
|
||||
}
|
||||
$rows =$accountArray;//we are fetching the rows here
|
||||
foreach ($rows as $i => &$row)
|
||||
{
|
||||
$row['row_id']='account::'.($row['fm_accountid']?$row['fm_accountid']:$this->accountID).'::'.$row['id'];
|
||||
$row['description'] = mail_bo::generateIdentityString($allAccountData[$row['id_key']]['identity']);
|
||||
$row['default'] = ($row['default']?'Default':'');
|
||||
}
|
||||
array_unshift($rows,array(''=> ''));
|
||||
//_debug_array($rows);
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
?>
|
41
mail/templates/default/accounts.index.xet
Normal file
41
mail/templates/default/accounts.index.xet
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="mail.accounts.index.rows" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" id="acc" class="egwGridView_grid">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
<description value="ID"/>
|
||||
<description value="Description"/>
|
||||
<description align="center" value="Default"/>
|
||||
</row>
|
||||
<row class="row" >
|
||||
<description id="${row}[id]" readonly="true"/>
|
||||
<description id="${row}[description]" no_lang="1"/>
|
||||
<description align="center" id="${row}[default]" no_lang="1" readonly="true"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="mail.accounts.index" template="" lang="" group="0" version="1.9.001">
|
||||
<description id="msg" no_lang="1" class="message" span="all"/>
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column width="100%"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<buttononly class="$cont[hideIfSigDisabled]" align="right" label="Add" id="add" onclick="window.open(egw::link('/index.php','menuaction=mail.mail_uipreferences.edit'),'_blank','dependent=yes,width=600,height=400,scrollbars=yes,status=yes'); return false;"/>
|
||||
</row>
|
||||
<row>
|
||||
<template id="rows"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user