mail app-> sieve update

This commit is contained in:
Hadi Nategh 2013-08-09 17:47:53 +00:00
parent b66acb3d4b
commit 82faa1bd87
9 changed files with 773 additions and 378 deletions

View File

@ -0,0 +1,50 @@
<?php
/**
* EGroupware EMail - timed vacation
*
* @link http://www.stylite.de
* @package felamimail
* @author Ralf Becker <rb@stylite.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Class containing callback to set/reset vacation notice in future (timed vacation)
*
* Rest of class is moved to emailadmin_sieve and accessible via incomming server object (IMAP).
*/
class mail_bosieve
{
/**
* Callback for the async job to enable/disable the vacation message
*
* @param array $_vacation
*/
function async_vacation($_vacation)
{
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'('.print_r($_vacation,true).')');
// unset the fm_preferences session object, to force the reload/rebuild
$GLOBALS['egw']->session->appsession('fm_preferences','felamimail',serialize(array()));
$GLOBALS['egw']->session->appsession('session_data','emailadmin',serialize(array()));
$_restoreSession = false; // as in async, each call may be for a different user
$bopreferences = CreateObject('felamimail.bopreferences',$_restoreSession);
$mailPreferences = $bopreferences->getPreferences();
$icServer = $mailPreferences->getIncomingServer(0);
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.'->LoginName:'.$icServer->loginName);
//error_log(__METHOD__.__LINE__.array2string($_vacation));
try
{
$ret = $icServer->setVacationUser($icServer->loginName,$_vacation['scriptName'],$_vacation);
}
catch (Exception $e) {
error_log(__METHOD__.'::'.__LINE__.' call for '.$icServer->loginName.','.$_vacation['scriptName'].' failed for reason:'.$e->getMessage());
$ret = false;
}
if ($ret) $icServer->setAsyncJob($_vacation);
if ($ret===false) $icServer->setAsyncJob($_vacation,null,true); //reschedule
return $ret;
}
}

View File

@ -2536,6 +2536,7 @@ $content['mailtext'] = 'garbage';
}
public static function ajax_searchAddress() {
error_log(__METHOD__. "request from seachAddress" . $_REQUEST['query']);
$_searchString = trim($_REQUEST['query']);
if ($GLOBALS['egw_info']['user']['apps']['addressbook']) {
//error_log(__METHOD__.__LINE__.array2string($_searchString));
@ -2598,9 +2599,9 @@ $content['mailtext'] = 'garbage';
if(!empty($email) && in_array($completeMailString ,$results) === false) {
$results[] = array(
'id'=>$completeMailString,
'label' => htmlspecialchars($completeMailString),
'label' => $completeMailString,
// Add just name for nice display, with title for hover
'name' => htmlspecialchars($contact['n_fn']),
'name' => $contact['n_fn'],
'title' => $email
);
}

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,7 @@ app.mail = AppJS.extend(
{
// call parent
this._super.apply(this, arguments);
this.et2_obj = et2;
this.et2 = et2.widgetContainer;
var isMainView = false;
var isDisplay = false;
@ -1132,6 +1132,23 @@ app.mail = AppJS.extend(
}
},
sieve_editRules_radiobtn: function()
{
console.log("hi i am radiobtn");
},
/**
*
*/
sieve_vac_all_aliases: function()
{
var addr = this.et2.getWidgetById('addresses');
console.log('say something');
addr.select_all();
//addr.set_autocomplete_url('mail.mail_compose.ajax_searchAddress');
},
/**
* action - handling actions on sieve rules
*
@ -1186,24 +1203,21 @@ app.mail = AppJS.extend(
},
_do_action: function(_typeID, _data,_selectedID)
_do_action: function(_typeID, _data,_selectedID,_msg)
{
if (_typeID && _data)
{
var request = new egw_json_request('mail.mail_sieve.ajax_action', [_typeID,_selectedID]);
var request = egw().json('mail.mail_sieve.ajax_action', [_typeID,_selectedID,_msg],null,null,true);
console.log(request);
request.sendRequest(true,this._callback_do_action,this);
request.sendRequest();
}
},
sieve_refresh: function (_rows,_msg)
sieve_egw_refresh: function(_execid,_msg)
{
var grid = this.et2.getWidgetById('rg');
window.egw_refresh(_msg,this.appname);
if (grid)
{
grid.set_value(_rows);
}
var request = egw().json('mail.mail_sieve.ajax_sieve_egw_refresh', [this.et2_obj.etemplate_exec_id,_msg],null,this.et2_obj,true);
console.log(request);
request.sendRequest();
},
});

View File

@ -90,24 +90,23 @@
</columns>
<rows>
<row>
<radio label="File into:" id="action" options="folder"/>
<radio label="File into:" id="action[]" options="folder"/>
<hbox>
<textbox id="action_folder_text"/>
<description onclick="javascript:window.open('{folder_select_url}', 'windowName', 'width=400,height=500,toolbar=no,resizable=yes'); return false;"/>
<taglist id="action_folder_text" width="40%" autocomplete_url="mail.mail_compose.ajax_searchFolder" autocomplete_params="" allowFreeEntries="false" maxSelection="1" />
</hbox>
</row>
<row>
<radio label="Forward to address:" id="action" options="address"/>
<radio label="Forward to address:" id="action[]" options="address"/>
<hbox>
<textbox id="action_address_text"/>
<taglist-email allowFreeEntries="true" id="action_address_text" width="40%" maxSelection="1" />
</hbox>
</row>
<row>
<radio label="Send a reject message:" id="action" options="reject"/>
<radio label="Send a reject message:" id="action[]" options="reject"/>
<textbox multiline="true" id="action_reject_text"/>
</row>
<row>
<radio label="Discard message" id="action" options="discard"/>
<radio label="Discard message" id="action[]" options="discard"/>
<description/>
</row>
</rows>

View File

@ -1,65 +0,0 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="mail.sieve.editVacation" template="" lang="" group="0" version="1.9.001">
<grid>
<columns>
<column/>
<column width="100%"/>
</columns>
<rows>
<row class="th" valign="top" part="header">
<description value="Edit vacation settings"/>
<description/>
</row>
<row>
<description value="Status:"/>
<hbox>
<radio label="Active" id="status" options="active"/>
<radio label="Deactive" id="status" options="disabled"/>
</hbox>
</row>
<row>
<description value="Respond to mail sent to:"/>
<hbox>
<listbox rows="6" options=",,,,,,0"/>
<description/>
<listbox rows="6" options=",,,,,,0"/>
</hbox>
</row>
<row>
<description value="Validate selected addresses on submit: "/>
<hbox>
<radio label="Active" id="check_mail_sent_to" options="active"/>
<radio label="Deactive" id="check_mail_sent_to" options="disabled"/>
</hbox>
</row>
<row>
<description value="Every:"/>
<menulist>
<menupopup type="select-day" id="days"/>
</menulist>
</row>
<row>
<vbox>
<description value="With message:"/>
<checkbox label="set it as default"/>
</vbox>
<textbox multiline="true" id="vacation_text"/>
</row>
<row>
<description value="Forward messages to Separate multiple addresses by comma:"/>
<textbox id="vacation_forwards"/>
</row>
<row>
<hbox>
<button label="Save" id="button[save]"/>
<button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]"/>
</hbox>
<description/>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="mail.sieve.emailNotification" template="" lang="" group="0" version="1.9.002">
<grid>
<columns>
<column/>
<column width="100%"/>
</columns>
<rows>
<row disabled="!@msg" part="header">
<description align="center" id="msg" span="all" class="message"/>
<description/>
</row>
<row class="th" valign="top" part="header">
<description value="email notification settings"/>
<description/>
</row>
<row>
<description value="Status:"/>
<menulist>
<menupopup id="status"/>
</menulist>
</row>
<row>
<description value="External email address:"/>
<taglist-email id="externalEmail" required="true" width="40%" allowFreeEntries="true" maxSelection="1" />
</row>
<row>
<description value="Display mail subject in notification: "/>
<menulist>
<menupopup id="displaySubject"/>
</menulist>
</row>
<row>
<hbox>
<button label="Save" id="button[save]"/>
<button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]"/>
</hbox>
<description/>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -25,7 +25,7 @@
</grid>
</template>
<template id="mail.sieve.index" template="" lang="" group="0" version="1.9.001">
<description align="left" id="msg" no_lang="1" span="all" class="message"/>
<description id="msg" no_lang="1" class="message" span="all"/>
<grid width="100%">
<columns>
<column width="100%"/>

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="mail.sieve.vacation" template="" lang="" group="0" version="1.9.002">
<grid>
<columns>
<column/>
<column width="100%"/>
</columns>
<rows>
<row disabled="!@msg" part="header">
<description align="center" id="msg" span="all" class="message"/>
<description/>
</row>
<row class="th" valign="top" part="header">
<description value="Edit vacation settings"/>
<description/>
</row>
<row>
<description value="Status:"/>
<hbox>
<menulist>
<menupopup id="status"/>
</menulist>
</hbox>
</row>
<row>
<description value="Respond to mail sent to:"/>
<hbox>
<taglist-email id="addresses" width="40%" allowFreeEntries="true" />
<button label="Add all my aliases" id="AllAddresses" onclick='app.mail.sieve_vac_all_aliases()'/>
</hbox>
</row>
<row>
<description value="Every:"/>
<textbox type="integer" id="days" min="1" max="31"/>
</row>
<row>
<vbox>
<description value="With message:"/>
</vbox>
<textbox multiline="true" id="text" width="40%"/>
</row>
<row>
<description value="Forward messages:"/>
<taglist-email id="forwards" width="40%" allowFreeEntries="true"/>
</row>
<row>
<description value="Validate selected addresses on submit: "/>
<hbox>
<checkbox id="check_mail_sent_to"/>
</hbox>
</row>
<row>
<description value="set it as default:"/>
<hbox>
<checkbox id="set_as_default"/>
</hbox>
</row>
<row>
<hbox>
<button label="Save" id="button[save]"/>
<button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]"/>
</hbox>
<description/>
</row>
</rows>
</grid>
</template>
</overlay>