summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 074b6cd)
raw | patch | inline | side by side (parent: 074b6cd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 21 Jan 2008 11:16:00 +0000 (11:16 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 21 Jan 2008 11:16:00 +0000 (11:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8518 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc
index 6cf2291880998373a64ddc88dfae8ad46231b79a..0b2e3e83f2ed30950f2006e15a0677bf3f1a3d63 100644 (file)
$this->i_port = $port;
$this->f_timeout = $timeout;
$this->s_encryption_key = $key;
+ if($connect){
+ $this->connect();
+ }
}
public function connect()
public function __reload()
{
- echo "<b>Reload</b>";
$this->entries = array();
$this->pointer = 0;
+ $this->b_error = FALSE;
+ $this->s_error = "";
+
$xml_msg = "<xml><header>gosa_query_jobdb</header><where><status>*</status></where></xml>";
$this->connect();
if($this->is_connected){
$str = trim($this->o_sock->read());
$entries = $this->xml_to_array($str);
if(!isset($entries['XML'])){
- print_a($entries);
- echo htmlentities($str);
$this->set_error("Couldn't parse xml.");
$this->disconnect();
return(FALSE);
$ret = array_values($entries['XML']);
}
$this->entries = $ret;
- $this->disconnect();
return(TRUE);
}
$this->set_error("Could not establish socket connection.");
public function decrease_entry_priority($id)
{
- echo $id;
}
public function increase_entry_priority($id)
{
- echo $id;
}
public function max_entry_priority($id)
{
- echo $id;
}
public function min_entry_priority($id)
{
- echo $id;
}
public function id_exists($id)
public function get_entry($id)
{
- foreach($this->entries as $entry){
- if($entry['ID'] == $id){
- return($entry);
+ if(!is_numeric($id)){
+ trigger_error("gosaSupportDaemon::get_entry() requires an integer value as ID parameter.");
+ return;
+ }
+
+ $this->b_error = FALSE;
+ $this->s_error = "";
+
+ $xml_msg = "<xml>
+ <header>gosa_query_jobdb</header>
+ <where>id</where>
+ <id>".$id."</id>
+ </xml>";
+
+ $this->connect();
+ if($this->is_connected){
+ $this->o_sock->write($xml_msg);
+ $str = trim($this->o_sock->read());
+ $entries = $this->xml_to_array($str);
+ if(!isset($entries['XML']['ANSWER1'])){
+ $this->set_error("Entry with id (".$id.") not found.");
+ $this->disconnect();
+ return(FALSE);
+ }else{
+ $ret = array_values($entries['XML']['ANSWER1']);
+ return($ret);
}
}
+ $this->set_error("Could not establish socket connection.");
+ return(FALSE);
}
public function update_entry($id,$entry)
$xml_msg = "";
if($this->is_connected){
- $this->o_sock->write($xml_msg);
- $str = trim($this->o_sock->read());
- $entries = $this->xml_to_array($str);
- $this->disconnect();
+ #$this->o_sock->write($xml_msg);
+ #$str = trim($this->o_sock->read());
+ #$entries = $this->xml_to_array($str);
+ #$this->disconnect();
return(TRUE);
}
$this->set_error("Could not establish socket connection.");
public function remove_entry($id)
{
+ $this->b_error = FALSE;
+ $this->s_error = "";
+
+ $xml_msg = "<xml>
+ <header>gosa_delete_jobdb_entry</header>
+ <where>id</where>
+ <id>".$id."</id>
+ </xml>";
+ $this->connect();
+ if($this->is_connected){
+ $this->o_sock->write($xml_msg);
+ return(TRUE);
+ }
+ $this->set_error("Could not establish socket connection.");
+ return(FALSE);
}
}
diff --git a/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc b/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc
index c02d3c012292b069ca8248318a7359f462a5d103..cc1dc8865b61ecb15f5a1691f66e4ad9340ce4a1 100644 (file)
# $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'> ";
# }
-# /* Display remove button if allowed */
-# if($this->parent->acl_is_removeable()){
-# $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
-# }
+ /* Display remove button if allowed */
+ if($this->parent->acl_is_removeable()){
+ $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
+ }
/* Add priority options */
if(preg_match("/w/",$this->parent->getacl(""))){
diff --git a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc
index b40fdc1b8b0f4776bda861519eef614ec83951fe..e727422aa43d8e71e0249544986133cbe3029fea 100644 (file)
/* Include config object */
$this->config= &$config;
$this->divlist = new divListMasses($this->config,$this);
- $this->o_queue = new gosaSupportDaemon("10.3.67.111","20082","secret-gosa-password",FALSE,0.2);
+ $this->o_queue = new gosaSupportDaemon("10.3.67.111","20081","secret-gosa-password",TRUE,0.2);
}
$s_entry = $s_action = "";
$arr = array(
- "/^prio_top_/" => "prio_top",
- "/^prio_increase_/" => "prio_increase",
- "/^prio_decrease_/" => "prio_decrease",
- "/^prio_bottom_/" => "prio_bottom",
+ "/^prio_top_/" => "prio_top",
+ "/^prio_increase_/" => "prio_increase",
+ "/^prio_decrease_/" => "prio_decrease",
+ "/^prio_bottom_/" => "prio_bottom",
- "/^multiple_prio_top_/" => "mprio_top",
- "/^multiple_prio_increase_/" => "mprio_increase",
- "/^multiple_prio_decrease_/" => "mprio_decrease",
- "/^multiple_prio_bottom_/" => "mprio_bottom",
+ "/^multiple_prio_top_/" => "mprio_top",
+ "/^multiple_prio_increase_/" => "mprio_increase",
+ "/^multiple_prio_decrease_/" => "mprio_decrease",
+ "/^multiple_prio_bottom_/" => "mprio_bottom",
- "/^edit_task_/" => "edit",
- "/^remove_task_/" => "remove",
- "/^new_task_/" => "new_task",
- "/^remove_multiple_task_/" => "remove_multiple");
+ "/^edit_task_/" => "edit",
+ "/^remove_task_/" => "remove",
+ "/^new_task_/" => "new_task",
+ "/^remove_multiple_task_/" => "remove_multiple");
foreach($arr as $regex => $action){
foreach($_POST as $name => $value){
$s_entry = $_GET['id'];
}
+
/************
- * REMOVE
+ * Handle Priority modifications
************/
-
+
if(preg_match("/^mprio_/",$s_action) || preg_match("/^prio_/",$s_action)){
switch($s_action){
default : trigger_error("Undefined priority setting used.");
}
if($this->o_queue->is_error()){
- msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
}
}
if($s_action == "remove_multiple" || $s_action == "remove"){
if(!$this->acl_is_removeable()){
- msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
+ msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
}else{
if($s_action == "remove"){
}else{
$ids = $this->list_get_selected_items();
}
-
$this->ids_to_remove = $ids;
$tmp = "";
foreach($this->ids_to_remove as $key => $id){
if($this->o_queue->id_exists($id)){
$task = $this->o_queue->get_entry($id);
- $tmp.= "\n".$task['ID'];
+ $tmp.= "\n".$task['5']." ".$task['3'];
}else{
unset($this->ids_to_remove[$key]);
}
/* Remove specified tasks */
if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
foreach($this->ids_to_remove as $id){
- if($this->o_queue->id_exists($id)){
- $this->o_queue->remove_entry($id);
- }
+ $this->o_queue->remove_entry($id);
}
$this->save();
}
}
- /************
- * EDIT
- ************/
-
- /* Edit selected entry */
- if($s_action == "edit"){
- $entry = $this->o_queue->get_entry($s_entry);
- if($entry){
- $this->dialog = new goto_task($this->config,$this,$entry);
- $this->current = $s_entry;
- }
- }
-
- /* New entry */
- if($s_action== "new_task" && $this->acl_is_createable()){
- $this->dialog = new goto_task($this->config,$this);
- $this->current = -1;
- }
-
- /* Close dialog */
- if(isset($_POST['close_goto_task'])){
- $this->dialog = FALSE;
- $this->current = -1;
- }
-
- /* Close dialog */
- if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){
- $this->dialog->save_object();
- $msgs = $this->dialog->check();
- if(count($msgs)){
- foreach($msgs as $msg){
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- }else{
-
- if($this->o_queue->id_exists($this->current)){
- $this->o_queue->update_entry($this->current,$this->dialog->save());
- }else{
- $tmp = $this->dialog->save();
- $tmp2= array();
- $targets =$tmp['Target'];
- foreach($targets as $target){
- $tmp['Target'] = array($target);
- $tmp2[] = $tmp;
- }
- if(!$this->o_queue->add_multiple($tmp2)){
- msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
- }
- }
- if(!isset($_POST['apply_goto_task'])){
- $this->dialog = FALSE;
- $this->current = -1;
- }
- $this->save();
- }
- }
-
- /* Display dialogs if currently opened */
- if(is_object($this->dialog)){
- $this->dialog->save_object();
- return($this->dialog->execute());
- }
+ /************
+ * EDIT
+ ************/
+
+ /* Edit selected entry */
+ if($s_action == "edit"){
+ $entry = $this->o_queue->get_entry($s_entry);
+ if($entry){
+ $this->dialog = new goto_task($this->config,$this,$entry);
+ $this->current = $s_entry;
+ }
+ }
+
+ /* New entry */
+ if($s_action== "new_task" && $this->acl_is_createable()){
+ $this->dialog = new goto_task($this->config,$this);
+ $this->current = -1;
+ }
+
+ /* Close dialog */
+ if(isset($_POST['close_goto_task'])){
+ $this->dialog = FALSE;
+ $this->current = -1;
+ }
+
+ /* Close dialog */
+ if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){
+ $this->dialog->save_object();
+ $msgs = $this->dialog->check();
+ if(count($msgs)){
+ foreach($msgs as $msg){
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+ }
+ }else{
+
+ if($this->o_queue->id_exists($this->current)){
+ $this->o_queue->update_entry($this->current,$this->dialog->save());
+ }else{
+ $tmp = $this->dialog->save();
+ $tmp2= array();
+ $targets =$tmp['Target'];
+ foreach($targets as $target){
+ $tmp['Target'] = array($target);
+ $tmp2[] = $tmp;
+ }
+ if(!$this->o_queue->add_multiple($tmp2)){
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ }
+ }
+ if(!isset($_POST['apply_goto_task'])){
+ $this->dialog = FALSE;
+ $this->current = -1;
+ }
+ $this->save();
+ }
+ }
+
+ /* Display dialogs if currently opened */
+ if(is_object($this->dialog)){
+ $this->dialog->save_object();
+ return($this->dialog->execute());
+ }
/************
* Handle Divlist
return($this->divlist->Draw());
}
-
+
/*! \brief Request list of queued jobs.
* @return Returns an array of all queued jobs.
*/
$ret[]= $entry;
}
$map = array("QueuePosition" => "ID",
- "Action" => "STATUS",
- "TaskID" => "HEADERTAG",
- "TargetName" => "MACADDRESS",
- "Schedule" => "TIMESTAMP");
+ "Action" => "STATUS",
+ "TaskID" => "HEADERTAG",
+ "TargetName" => "MACADDRESS",
+ "Schedule" => "TIMESTAMP");
$sort_tmp = array();
foreach($ret as $entry_id => $entry){
$sort_tmp[$entry_id] = $entry[$map[$this->sort_by]];
$sort = $_GET['sort'];
if($this->sort_by == $sort){
if($this->sort_dir == "up"){
- $this->sort_dir = "down";
+ $this->sort_dir = "down";
}else{
- $this->sort_dir = "up";
+ $this->sort_dir = "up";
}
}
$this->sort_by = $sort;
return($ret);
}
-
+
function save()
{
// We do not save anything here.
/*! \brief Return a list of all selected items.
- @return Array Returns an array containing all selected item ids.
+ @return Array Returns an array containing all selected item ids.
*/
function list_get_selected_items()
{
}
- function get_actions()
- {
- /* Prepare list of available actions */
- $actions = array(
- "gosa_ping" => _("GOsa ping"),
- "ping" => _("Ping"),
- "sayHello" => _("Say hello"));
- return($actions);
- }
+ function get_actions()
+ {
+ /* Prepare list of available actions */
+ $actions = array(
+ "gosa_ping" => _("GOsa ping"),
+ "ping" => _("Ping"),
+ "sayHello" => _("Say hello"));
+ return($actions);
+ }
static function plInfo()
{
return (array(
- "plShortName" => _("System mass deployment"),
- "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 0,
- "plSection" => array("addon"),
- "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
- "plProvidedAcls" => array("Comment" => _("Description"),
- "Action" => _("Action"),
- "Day" => _("Day"),
- "Minute" => _("Minute"),
- "Hour" => _("Hour"),
- "Month" => _("Month"),
- "Weekday" => _("Week day"),
- "Target" => _("Target"))
- ));
+ "plShortName" => _("System mass deployment"),
+ "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("addon"),
+ "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
+ "plProvidedAcls" => array("Comment" => _("Description"),
+ "Action" => _("Action"),
+ "Day" => _("Day"),
+ "Minute" => _("Minute"),
+ "Hour" => _("Hour"),
+ "Month" => _("Month"),
+ "Weekday" => _("Week day"),
+ "Target" => _("Target"))
+ ));
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: