summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce34aab)
raw | patch | inline | side by side (parent: ce34aab)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 7 Sep 2010 12:38:45 +0000 (12:38 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 7 Sep 2010 12:38:45 +0000 (12:38 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19549 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/groupware/personal/groupware/class_groupware.inc | patch | blob | history | |
gosa-plugins/groupware/personal/groupware/generic.tpl | patch | blob | history |
diff --git a/gosa-plugins/groupware/personal/groupware/class_groupware.inc b/gosa-plugins/groupware/personal/groupware/class_groupware.inc
index bf15267c510d8d7e43f425f99f205d739a6fcac3..df9031e71a15e4b851847f7b5fce8809f2217c86 100644 (file)
var $plDescription = "GOsa mail extension.";
var $view_logged = FALSE;
+ var $accountInitialized = FALSE;
+ var $rpcError = FALSE;
+ var $rpcErrorMessage = "";
+
var $attributes = array(
"mailAddress",
"mailLocation",
}
}
- // Get rpc handle to fetch account info and feature availability.
+ // Initialize the plugin using rpc.
+ $this->init();
+ }
+
+ function rpcExec($function)
+ {
+ $params = func_get_args();
+ unset($params[0]);
$rpc = $this->config->getRpcHandle();
- $this->initially_was_account = $this->is_account = $rpc->gwAcctExists($this->uid);
+ $res = call_user_func_array(array($rpc,$function),$params);
+ $this->rpcError = !$rpc->success();
+ if($this->rpcError){
+ $this->rpcErrorMessage = $rpc->getError();
+ return(NULL);
+ }
+ return($res);
+ }
+
+
+ function init()
+ {
+ // Get rpc handle to fetch account info and feature availability.
+ $status = $this->rpcExec('gwAcctExists', $this->uid);
+ if($status !== NULL){
+ $this->initially_was_account = $this->is_account = $status;
+ $this->accountInitialized = TRUE;
+ }
+
// Set vacation start/stop if not set alreasy
$this->vacationStart = time();
new log("view","users/".get_class($this),$this->dn);
}
+ // Check if we were able to initialize the account already.
+ if(!$this->accountInitialized){
+ $this->init();
+ if(!$this->accountInitialized){
+ $smarty = get_smarty();
+ $smarty->assign("initFailed", !$this->accountInitialized);
+ return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
+ }
+ }
+
/****************
Filter editor
****************/
$smarty->assign("displayTemplateSelector", "false");
}
+ $smarty->assign("initFailed", !$this->accountInitialized);
+ $smarty->assign("rpcError", $this->rpcError);
+ $smarty->assign("rpcErrorMessage", $this->rpcErrorMessage);
return($display.$smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
}
{
// Get rpc handle to remove the account
if($this->initially_was_account){
- $rpc = $this->config->getRpcHandle();
- $rpc->gwAcctDel($this->uid,TRUE);
- if(!$rpc->success()){
- echo $rpc->getError();
+ if($this->rpcExec('gwAcctDel', $this->uid) === NULL){
+ msg_dialog::display(_("Error"), _("Groupware account removal failed!"), ERROR_DIALOG);
}
}
}
{
// Get rpc handle to create or update the account
if(!$this->initially_was_account){
- $rpc = $this->config->getRpcHandle();
- $rpc->gwAcctAdd($this->uid,$this->mailAddress);
- if(!$rpc->success()){
- echo $rpc->getError();
+ if($this->rpcExec('gwAcctAdd', $this->uid, $this->mailAddress) === NULL){
+ msg_dialog::display(_("Error"), _("Groupware account creation failed!"), ERROR_DIALOG);
}
}
}
diff --git a/gosa-plugins/groupware/personal/groupware/generic.tpl b/gosa-plugins/groupware/personal/groupware/generic.tpl
index e0f5fd537600bec881d6343cea4a380c1f98c631..a4d1e936faae5f5d287a9bbb8ca248a765bd0df9 100644 (file)
+{if $initFailed}
+ <h3>{t}Communication with backend failed, please check the rpc connection and try again!{/t}</h3>
+ <button name="retry">{t}Retry{/t}</button>
+{elseif $rpcError}
+ <h3>{t}Communication with backend failed, please check the rpc connection and try again!{/t}</h3>
+ <button name="retry">{t}Retry{/t}</button>
+{else}
+
<table summary="{t}Mail settings{/t}" style='width:100%;'>
<tr>
<td style='width:50%; '>
{/if}
<input type='hidden' name='groupwarePluginPosted' value='1'>
-
+{/if}