summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0474ca2)
raw | patch | inline | side by side (parent: 0474ca2)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 5 May 2008 09:50:18 +0000 (09:50 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 5 May 2008 09:50:18 +0000 (09:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10757 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/addons/goto/class_goto_log_view.inc | [new file with mode: 0644] | patch | blob |
gosa-plugins/goto/addons/goto/class_gotomasses.inc | patch | blob | history | |
gosa-plugins/goto/addons/goto/log_view.tpl | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-plugins/goto/addons/goto/class_goto_log_view.inc b/gosa-plugins/goto/addons/goto/class_goto_log_view.inc
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+
+class goto_log_view extends plugin
+{
+
+ var $mac;
+ var $logs;
+ var $event;
+ var $parent;
+ var $config;
+
+ var $o_queue;
+
+ var $selected_date;
+ var $selected_file = 0;
+
+ var $attributes = array("selected_file","selected_date");
+
+ function __construct($config,$event,&$parent)
+ {
+ $this->config = $config;
+ $this->event = $event;
+ $this->parent = $parent;
+
+ /* Try to fetch logs for the given event (mac)
+ */
+ $this->o_queue = new gosaSupportDaemon();
+
+ /* Fetch logs for this event (mac)
+ */
+ if(isset($this->event['MACADDRESS'])){
+ $this->mac = $this->event['MACADDRESS'];
+ }
+ $res = $this->o_queue->get_log_info_for_mac($this->mac);
+ if($this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ }
+ if(!isset($res[$this->mac]) || !is_array($res[$this->mac])){
+ $this->logs = array();
+ }else{
+ $this->selected_date = key($res[$this->mac]);
+ $this->logs = $res;
+ }
+ }
+
+ function execute()
+ {
+ $smarty = get_smarty();
+ $smarty->assign("logs",$this->logs);
+ $smarty->assign("logs_available", isset($this->logs[$this->mac]));
+ $smarty->assign("mac",$this->mac);
+ $smarty->assign("selected_file",$this->selected_file);
+ $smarty->assign("selected_date",$this->selected_date);
+ $smarty->assign("log_file", $this->get_log($this->mac,$this->selected_date,$this->selected_file));
+ return($smarty->fetch(get_template_path('log_view.tpl', TRUE)));
+ }
+
+
+ function get_log($mac,$date,$file)
+ {
+ $this->mac = "00:01:6c:9d:b9:fa";
+ $res = $this->o_queue->get_log_file($mac,$date,$file);
+ if($this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ }
+ $res = nl2br(htmlentities($res));
+ return($res);
+ }
+
+
+ function save_object()
+ {
+ plugin::save_object();
+ foreach($this->attributes as $attr){
+ if(isset($_POST[$attr])){
+ $this->$attr = get_post($attr);
+ }
+ }
+ }
+
+}
+
+
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/addons/goto/class_gotomasses.inc b/gosa-plugins/goto/addons/goto/class_gotomasses.inc
index cd1c0222387870eae7fe09a799e4cd7d7aa84c78..dc3a9ce1260871d0dd4a4256293a79a704cd2908 100644 (file)
"/^prio_down_/" => "prio_down",
"/^edit_task_/" => "edit",
+ "/^log_view_/" => "logview",
"/^remove_task_/" => "remove",
"/^new_task_/" => "new_task");;
}
}
+
+ /************
+ * LOG VIEW
+ ************/
+
+ if($s_action == "logview"){
+ $id = $s_entry;
+ $type = FALSE;
+ if(isset($this->entries[$id])){
+ $event = $this->entries[$s_entry];
+ $this->dialog = new goto_log_view($this->config,$event,&$this);
+ }
+ }
+
+
/************
* REMOVE
************/
$divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Action'>"._("Status").$sort_img_4."</a>",
"attach"=>"style='width:80px;'"));
$divlist->AddHeader(array("string"=>_("Action"),
- "attach"=>"style='border-right:0px;width:120px;'"));
+ "attach"=>"style='border-right:0px;width:140px;'"));
/* Reload the list of entries */
$prio_actions="";
$action = "";
+
/* If WAITING add priority action
*/
if(in_array($task['STATUS'],array("waiting"))){
title='"._("Resume job")."' name='resume_".$key."'> ";
}
- /* If PROCESSING add abort action
- */
- if(in_array($task['STATUS'],array("processing")) && preg_match("/install/",$task['HEADERTAG'])){
- $prio_actions.= "<input class='center' type='image' src='images/small_error.png'
- title='"._("Abort execution")."' name='abort_process_".$key."'>";
- }
-
/* If PAUSED or WAITING add execution action
*/
if(in_array($task['STATUS'],array("paused","waiting"))){
title='"._("Force execution now!")."' name='execute_process_".$key."'> ";
}
+ /* Add logview button, currently ever.
+ */
+ if(TRUE){
+ $action .= "<input type='image' src='images/lists/new.png' name='log_view_".$key."'
+ class='center' alt='"._("Log view")."'> ";
+ }
+
/* If PAUSED or WAITING add edit action
*/
if(in_array($task['STATUS'],array("waiting"))){
class='center' alt='"._("Edit")."'>";
}
+ /* If PROCESSING add abort action
+ */
+ if(in_array($task['STATUS'],array("processing")) && preg_match("/install/",$task['HEADERTAG'])){
+ $action.= "<img src='images/empty.png'>";
+ $action.= "<input class='center' type='image' src='images/small_error.png'
+ title='"._("Abort execution")."' name='abort_process_".$key."'>";
+ }
+
/* If WAITING or ERROR add remove action
*/
if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error","processed"))){
"attach" => "style='".$color.";width:120px;'");
$field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:140px;'");
$field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'");
- $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'");
+ $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:140px;border-right:0px;'");
$divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4));
}
diff --git a/gosa-plugins/goto/addons/goto/log_view.tpl b/gosa-plugins/goto/addons/goto/log_view.tpl
--- /dev/null
@@ -0,0 +1,47 @@
+
+<h2>{t}Log view{/t}</h2>
+
+{if $logs_available}
+ <table>
+ <tr>
+ <td>{t}Creation time{/t}: </td>
+ <td>
+ <select name="selected_date" onChange="document.mainform.submit();">
+ {foreach from=$logs.$mac item=stuff key=date}
+ {if $date == $selected_date}
+ <option value="{$date}" selected>{$stuff.REAL_DATE|date_format:"%d.%m.%Y %H:%m:%S"}</option>
+ {else}
+ <option value="{$date}">{$stuff.REAL_DATE|date_format:"%d.%m.%Y %H:%m:%S"}</option>
+ {/if}
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Log file{/t}: </td>
+ <td>
+ <select name="selected_file" onChange="document.mainform.submit();">
+ {foreach from=$logs.$mac.$selected_date.FILES item=filename}
+ {if $filename == $selected_file}
+ <option value="{$filename}" selected>{$filename}</option>
+ {else}
+ <option value="{$filename}">{$filename}</option>
+ {/if}
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ </table>
+
+ <h2>{t}Log file{/t}</h2>
+ <div style="width:100%;height:350px; overflow-y: scroll; background-color:#EEEEEE; border: solid 1px;">
+ {$log_file}
+ </div>
+{else}
+ <h2>No logs for this host</h2>
+{/if}
+
+<p class='seperator'></p>
+<div style='text-align:right;width:100%; padding-right:5px; padding-top:5px;'>
+ <input type='submit' name='abort_event_dialog' value='{msgPool type=okButton}'>
+</div>