From 374c8db63dca02dcf62d64448dc408897925c19f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 26 May 2010 08:24:42 -0400
Subject: [PATCH] Improved some list templates and the dashboard template.
---
interface/lib/classes/remoting.inc.php | 54 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 7e4256e..8166002 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -40,6 +40,9 @@
private $session_timeout = 600;
private $server;
+ public $oldDataRecord;
+ public $dataRecord;
+ public $id;
/*
These variables shall stay global.
@@ -232,33 +235,39 @@
public function mail_user_filter_add($session_id, $client_id, $params)
{
+ global $app;
if (!$this->checkPerm($session_id, 'mail_user_filter_add')){
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params);
+ $app->plugin->raiseEvent('mail:mail_user_filter:on_after_insert',$this);
return $affected_rows;
}
public function mail_user_filter_update($session_id, $client_id, $primary_id, $params)
{
+ global $app;
if (!$this->checkPerm($session_id, 'mail_user_filter_update'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params);
+ $app->plugin->raiseEvent('mail:mail_user_filter:on_after_update',$this);
return $affected_rows;
}
public function mail_user_filter_delete($session_id,$domain_id)
{
+ global $app;
if (!$this->checkPerm($session_id, 'mail_user_filter_delete'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php',$domain_id);
+ $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
return $affected_rows;
}
@@ -882,6 +891,26 @@
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../client/form/client.tform.php');
return $app->remoting_lib->getDataRecord($client_id);
+ }
+
+ public function client_get_id($session_id, $sys_userid)
+ {
+ global $app;
+ if(!$this->checkPerm($session_id, 'client_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+
+ $sys_userid = intval($sys_userid);
+
+ $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
+ if(isset($rec['client_id'])) {
+ return intval($rec['client_id']);
+ } else {
+ $this->server->fault('no_client_found', 'There is no sysuser account for this client ID.');
+ return false;
+ }
+
}
@@ -1913,11 +1942,11 @@
$app->uses('remoting_lib');
- //* Load the form definition
- $app->remoting_lib->loadFormDef($formdef_file);
-
//* load the user profile of the client
$app->remoting_lib->loadUserProfile($client_id);
+
+ //* Load the form definition
+ $app->remoting_lib->loadFormDef($formdef_file);
//* Get the SQL query
$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
@@ -1945,7 +1974,9 @@
}
-
+ // set a few values for compatibility with tform actions, mostly used by plugins
+ $this->id = $insert_id;
+ $this->dataRecord = $params;
return $insert_id;
@@ -1958,11 +1989,11 @@
$app->uses('remoting_lib');
- //* Load the form definition
- $app->remoting_lib->loadFormDef($formdef_file);
-
//* load the user profile of the client
$app->remoting_lib->loadUserProfile($client_id);
+
+ //* Load the form definition
+ $app->remoting_lib->loadFormDef($formdef_file);
//* Get the SQL query
$sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id);
@@ -1972,6 +2003,12 @@
}
$old_rec = $app->remoting_lib->getDataRecord($primary_id);
+
+ // set a few values for compatibility with tform actions, mostly used by plugins
+ $this->oldDataRecord = $old_rec;
+ $this->id = $primary_id;
+ $this->dataRecord = $params;
+
$app->db->query($sql);
@@ -1999,6 +2036,9 @@
$app->uses('remoting_lib');
+ //* load the user profile of the client
+ $app->remoting_lib->loadUserProfile($client_id);
+
//* Load the form definition
$app->remoting_lib->loadFormDef($formdef_file);
--
Gitblit v1.9.1