summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4ccc7c7)
raw | patch | inline | side by side (parent: 4ccc7c7)
| author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
| Thu, 28 Jan 2010 17:33:15 +0000 (17:33 +0000) | ||
| committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
| Thu, 28 Jan 2010 17:33:15 +0000 (17:33 +0000) |
-Not yet finished
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15436 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15436 594d385d-05f5-0310-b6e9-bd551577e9d8
| gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc | [new file with mode: 0644] | patch | blob |
| gosa-plugins/goto/addons/goto/class_gotomasses.inc | patch | blob | history | |
| gosa-plugins/goto/addons/goto/deploy-filter.tpl | [new file with mode: 0644] | patch | blob |
| gosa-plugins/goto/addons/goto/deploy-filter.xml | [new file with mode: 0644] | patch | blob |
| gosa-plugins/goto/addons/goto/deploy-list.tpl | [new file with mode: 0644] | patch | blob |
| gosa-plugins/goto/addons/goto/deploy-list.xml | [new file with mode: 0644] | patch | blob |
| gosa-plugins/goto/addons/goto/main.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc b/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+class filterGotoEvents extends filterLDAP {
+ static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+ {
+
+
+ $o_queue = new gosaSupportDaemon(TRUE,5);
+ $events = DaemonEvent::get_event_types( SYSTEM_EVENT);
+
+
+ $entries = $o_queue->get_queued_entries($event_tags,0,9999999,"id");
+ if ($o_queue->is_error()){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$o_queue->get_error()), ERROR_DIALOG);
+ }
+
+ /* Assign entries by id.
+ */
+ $data= array();
+ foreach($entries as $entry){
+
+ $item = array();
+
+ $item['count'] = 0;
+ $item['dn']= implode($entry,", item=");
+
+ foreach($entry as $name => $value){
+ $item[] = $name;
+ $item[$name]=array('count' => 1, $value);
+ $item['count'] ++;
+ }
+
+
+# /* Skip entries which will be removed within the next seconds */
+# if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$this->recently_removed)){
+# continue;
+# }
+ $data[] = $item;
+ }
+ return($data);
+ }
+}
+?>
diff --git a/gosa-plugins/goto/addons/goto/class_gotomasses.inc b/gosa-plugins/goto/addons/goto/class_gotomasses.inc
index ae0d9470f8833ff72431a6ce9b5fe9d72165ca9f..b62f0734c4d0820e5d74f05615092a83f01b6c03 100644 (file)
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-class gotomasses extends plugin
+class gotomasses extends management
{
- /* Definitions */
- var $plHeadline = "Deployment status";
- var $plDescription = "System deployment status";
- var $plIcon = "plugins/goto/images/goto.png";
- /* attribute list for save action */
- var $attributes= array();
- var $objectclasses= array();
+ var $plHeadline = "System deployment status";
+ var $plDescription = "System deployment status";
+ var $plIcon = "plugins/goto/images/goto.png";
- /* Queue tasks */
var $current = FALSE;
var $dialog = FALSE;
var $ids_to_remove = array();
- var $divlist = NULL;
var $events = array();
var $event_tags = array();
-
- var $sort_by = "Schedule";
- var $sort_dir = "up";
- var $entries = array();
- var $range = 25;
- var $start = 0;
-
var $recently_removed = array();
- function gotomasses(&$config, $dn= NULL)
+ function __construct(&$config, $ui)
{
/* Include config object */
$this->config= &$config;
$this->event_tags[] = $evt['s_Queued_Action'];
}
- /* Load filter settings */
- if(!session::is_set("gotomasses_filter")){
- $gotomasses_filter =
- array(
- "range" => $this->range,
- "sort_by" => $this->sort_by,
- "sort_dir" => $this->sort_dir);
- session::set("gotomasses_filter",$gotomasses_filter);
+ // Build filter
+ # if (session::global_is_set(get_class($this)."_filter")){
+ # $filter= session::global_get(get_class($this)."_filter");
+ # } else {
+ $filter = new filter(get_template_path("deploy-filter.xml", true));
+ $filter->setObjectStorage($this->storagePoints);
+# }
+ $this->setFilter($filter);
+
+ // Build headpage
+ $headpage = new listing(get_template_path("deploy-list.xml", true));
+ $headpage->registerElementFilter("hostName", "gotomasses::filterHostName");
+ $headpage->registerElementFilter("filterTask","gotomasses::filterTask");
+ $headpage->registerElementFilter("filterPeriod","gotomasses::filterPeriod");
+ $headpage->registerElementFilter("filterSchedule","gotomasses::filterSchedule");
+ $headpage->setFilter($filter);
+
+ parent::__construct($config, $ui, "Events", $headpage);
+ }
+
+ static function filterHostName($mac, $name ="")
+ {
+ if(isset($name[0]) && $name[0] != "none"){
+ return($name[0]);
}
- $gotomasses_filter = session::get("gotomasses_filter");
- foreach(array("range","sort_by","sort_dir") as $attr) {
- $this->$attr = $gotomasses_filter[$attr];
+ return($mac[0]);
+ }
+
+ static function filterTask($tag)
+ {
+ $tag = $tag[0];
+ $str = $tag;
+
+ /* Check if this event exists as Daemon class
+ * In this case, display a more accurate entry.
+ */
+ $events = DaemonEvent::get_event_types( SYSTEM_EVENT);
+ if(isset($events['QUEUED'][$tag])){
+ $evt_name = $events['QUEUED'][$tag];
+ $event_type = $events['BY_CLASS'][$evt_name];
+ $str = $event_type['s_Menu_Name'];
+
+ if(strlen($str) > 20){
+ $str = substr($str,0,18)."...";
+ }
+
+ if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){
+ $str = $event_type['ListImage']." ".$str;
+ }
}
+ return($str);
}
+ static function filterPeriod($periodic=array())
+ {
+ $period = "";
+ if(isset($periodic[0]) && !preg_match("/none/i",$periodic[0])){
+ $tmp = explode("_", $periodic[0]);
+ if(count($tmp) == 2){
+ $period= $tmp[0]." "._($tmp[1]);
+ }
+ }
+ return($period);
+ }
+
+ static function filterSchedule($stamp)
+ {
+ if ($stamp['0'] == "19700101000000"){
+ return(_("immediately"));
+ } else {
+ return(date("d.m.Y H:i:s",strtotime($stamp[0])));
+ }
+ }
+
+
+
+
+
+
+
+
- function execute()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ function _execute()
{
$smarty = get_smarty();
-
+
/************
* Handle posts
************/
-
+
$s_entry = $s_action = "";
$arr = array(
if(isset($_POST['menu_action']) && !empty($_POST['menu_action'])){
$s_action = $_POST['menu_action'];
}
-
+
/* Edit posted from list link */
if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
$s_action = "edit";
/************
* Import CSV file
************/
-
+
if($s_action == "import_file" && $this->acl_is_writeable("")){
$this->dialog = new goto_import_file($this->config,$this);
}
-
+
if(isset($_POST['import_abort'])){
$this->dialog = FALSE;
}
/************
* ADD
************/
-
+
if(preg_match("/^add_event_/",$s_action) && $this->acl_is_writeable("")){
$type = preg_replace("/^add_event_/","",$s_action);
if(isset($this->events['BY_CLASS'][$type])){
}
}
-
+
/************
* LOG VIEW
************/
}
}
- /************
- * Handle Divlist
- ************/
-
- $divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses"));
- $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa tasks."));
- $divlist->SetSummary(_("List of queued jobs"));
- $divlist->EnableCloseButton(FALSE);
- $divlist->EnableSaveButton(FALSE);
- $divlist->SetHeadpageMode();
- $s = ".|"._("Actions")."|\n";
- $s.= "..|<img src='images/lists/new.png' alt='' border='0' class='center'> "._("Create")."\n";
-
- if($this->acl_is_writeable("")){
- foreach($this->events['SCHEDULED'] as $name => $event){
- $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
- }
- }
- if($this->acl_is_removeable()){
- $s.= "..|---|\n";
- $s.= "..|<img src='images/lists/import.png' alt='' border='0' class='center'> "._("Import")."|import_file\n";
- $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'> "._("Remove")."|remove_multiple\n";
- }
- if(preg_match("/w/",$this->getacl(""))){
- $s.= "..|---|\n";
- $s.= "..|<img alt='"._("Resume")."' src='images/status_start.png' border='0' class='center'> "._("Resume")."|resume_all\n";
- $s.= "..|<img alt='"._("Pause")."' src='images/status_pause.png' border='0' class='center'> "._("Pause")."|pause_all\n";
- $s.= "..|<img alt='"._("Abort")."' src='images/small_error.png' border='0' class='center'> "._("Abort")."|abort_process_all\n";
- $s.= "..|<img alt='"._("Execute")."' src='images/rocket.png' border='0' class='center'> "._("Execute")."|execute_process_all\n";
- }
-
- $divlist->SetDropDownHeaderMenu($s);
-
- if($this->sort_dir == "up"){
- $sort_img = "<img src='images/lists/sort-up.png' alt='/\' border=0>";
- }else{
- $sort_img = "<img src='images/lists/sort-down.png' alt='\/' border=0>";
- }
-
- if($this->sort_by == "TargetName"){ $sort_img_1 = $sort_img; } else { $sort_img_1 = "" ;}
- if($this->sort_by == "TaskID"){ $sort_img_2 = $sort_img; } else { $sort_img_2 = "" ;}
- if($this->sort_by == "Schedule"){ $sort_img_3 = $sort_img; } else { $sort_img_3 = "" ;}
- if($this->sort_by == "Action"){ $sort_img_4 = $sort_img; } else { $sort_img_4 = "" ;}
-
- /* Create divlist */
- $divlist->SetListHeader("<input type='image' src='images/lists/reload.png' title='"._("Reload")."'>");
-
- $plug = $_GET['plug'];
- $chk = "<input type='checkbox' id='select_all' name='select_all'
- onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
- /* set Page header */
- $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target").$sort_img_1."</a>"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TaskID'>"._("Task").$sort_img_2."</a>",
- "attach"=>"style='width:120px;'"));
- $divlist->AddHeader(array("string"=>_("Period"),
- "attach"=>"style='width:60px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
- "attach"=>"style='width:140px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Action'>"._("Status").$sort_img_4."</a>",
- "attach"=>"style='width:80px;'"));
- $divlist->AddHeader(array("string"=>_("Action"),
+ /************
+ * Handle Divlist
+ ************/
+
+ $divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses"));
+ $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa tasks."));
+ $divlist->SetSummary(_("List of queued jobs"));
+ $divlist->EnableCloseButton(FALSE);
+ $divlist->EnableSaveButton(FALSE);
+ $divlist->SetHeadpageMode();
+ $s = ".|"._("Actions")."|\n";
+ $s.= "..|<img src='images/lists/new.png' alt='' border='0' class='center'> "._("Create")."\n";
+
+ if($this->acl_is_writeable("")){
+ foreach($this->events['SCHEDULED'] as $name => $event){
+ $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
+ }
+ }
+ if($this->acl_is_removeable()){
+ $s.= "..|---|\n";
+ $s.= "..|<img src='images/lists/import.png' alt='' border='0' class='center'> "._("Import")."|import_file\n";
+ $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'> "._("Remove")."|remove_multiple\n";
+ }
+ if(preg_match("/w/",$this->getacl(""))){
+ $s.= "..|---|\n";
+ $s.= "..|<img alt='"._("Resume")."' src='images/status_start.png' border='0' class='center'> "._("Resume")."|resume_all\n";
+ $s.= "..|<img alt='"._("Pause")."' src='images/status_pause.png' border='0' class='center'> "._("Pause")."|pause_all\n";
+ $s.= "..|<img alt='"._("Abort")."' src='images/small_error.png' border='0' class='center'> "._("Abort")."|abort_process_all\n";
+ $s.= "..|<img alt='"._("Execute")."' src='images/rocket.png' border='0' class='center'> "._("Execute")."|execute_process_all\n";
+ }
+
+ $divlist->SetDropDownHeaderMenu($s);
+
+ if($this->sort_dir == "up"){
+ $sort_img = "<img src='images/lists/sort-up.png' alt='/\' border=0>";
+ }else{
+ $sort_img = "<img src='images/lists/sort-down.png' alt='\/' border=0>";
+ }
+
+ if($this->sort_by == "TargetName"){ $sort_img_1 = $sort_img; } else { $sort_img_1 = "" ;}
+ if($this->sort_by == "TaskID"){ $sort_img_2 = $sort_img; } else { $sort_img_2 = "" ;}
+ if($this->sort_by == "Schedule"){ $sort_img_3 = $sort_img; } else { $sort_img_3 = "" ;}
+ if($this->sort_by == "Action"){ $sort_img_4 = $sort_img; } else { $sort_img_4 = "" ;}
+
+ /* Create divlist */
+ $divlist->SetListHeader("<input type='image' src='images/lists/reload.png' title='"._("Reload")."'>");
+
+ $plug = $_GET['plug'];
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+ /* set Page header */
+ $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target").$sort_img_1."</a>"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TaskID'>"._("Task").$sort_img_2."</a>",
+ "attach"=>"style='width:120px;'"));
+ $divlist->AddHeader(array("string"=>_("Period"),
+ "attach"=>"style='width:60px;'"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
+ "attach"=>"style='width:140px;'"));
+ $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:140px;'"));
$prio_actions.= "<input class='center' type='image' src='plugins/goto/images/prio_decrease.png'
title='"._("Move down")."' name='prio_down_".$key."'> ";
}
-
+
/* If WAITING add pause action
*/
if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
$display2= $task['HEADERTAG'];
-
+
/* Check if this event exists as Daemon class
* In this case, display a more accurate entry.
*/
}
$status = $task['STATUS'];
-
+
if($status == "waiting"){
$status = "<img class='center' src='plugins/goto/images/clock.png' alt=''> "._("Waiting");
}
}
/* Special handling for all entries that have
- STATUS == "processing" && PROGRESS == NUMERIC
+ STATUS == "processing" && PROGRESS == NUMERIC
*/
if($status == "processing" && isset($task['PROGRESS'])){
$percent = $task['PROGRESS'];
if ($percent == "goto-activation"){
$status = "<img class='center' src='images/lists/off.png' alt=''> "._("Locked");
- /* Show hardware detect? */
+ /* Show hardware detect? */
} elseif ($percent == "goto-hardware-detection") {
$status = "<img class='center' src='plugins/goto/images/hardware.png' alt=''> "._("Detection");
- /* Real percent */
+ /* Real percent */
} else {
- if (preg_match('/install/', $task['HEADERTAG'])){
+ if (preg_match('/install/', $task['HEADERTAG'])){
$status = "<img src='progress.php?x=80&y=13&p=".$task['PROGRESS']."' alt=''
- id='progress_".preg_replace("/:/","_",$task['MACADDRESS'])."'>";
+ id='progress_".preg_replace("/:/","_",$task['MACADDRESS'])."'>";
} else {
$status = preg_replace('/ /', ' ', _("in progress"));
}
/* Create each field */
$field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$key."'>" ,
- "attach" => "style='width:20px;".$color."'");
+ "attach" => "style='width:20px;".$color."'");
$field1 = array("string" => $display,
- "attach" => $tooltip."style='".$color."'");
+ "attach" => $tooltip."style='".$color."'");
$field1a= array("string" => $display2,
- "attach" => "style='".$color.";width:120px;'");
+ "attach" => "style='".$color.";width:120px;'");
$field1b= array("string" => $period,
- "attach" => "style='".$color.";width:60px;'");
+ "attach" => "style='".$color.";width:60px;'");
if ($task['TIMESTAMP'] == "19700101000000"){
- $field2 = array("string" => _("immediately"),"attach" => "style='".$color.";width:140px;'");
+ $field2 = array("string" => _("immediately"),"attach" => "style='".$color.";width:140px;'");
} else {
- $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:140px;'");
+ $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:140px;border-right:0px;'");
$divlist->AddElement(array($field0,$field1,$field1a,$field1b,$field2,$field3,$field4));
- }
-
- $smarty = get_smarty();
- $smarty->assign("events",$this->events);
- $smarty->assign("start",$this->start);
- $smarty->assign("start_real", ($this->start + 1));
- $smarty->assign("ranges", array("10" => "10",
- "20" => "20",
- "25" => "25",
- "50" => "50",
- "100"=> "100",
- "200"=> "200",
- "9999" => "*"));
-
- $count = $this->o_queue->number_of_queued_entries($this->event_tags);
- if(!$count) $count = $this->range;
+ }
+
+ $smarty = get_smarty();
+ $smarty->assign("events",$this->events);
+ $smarty->assign("start",$this->start);
+ $smarty->assign("start_real", ($this->start + 1));
+ $smarty->assign("ranges", array("10" => "10",
+ "20" => "20",
+ "25" => "25",
+ "50" => "50",
+ "100"=> "100",
+ "200"=> "200",
+ "9999" => "*"));
+
+ $count = $this->o_queue->number_of_queued_entries($this->event_tags);
+ if(!$count) $count = $this->range;
$divlist->SetListFooter(range_selector($count, $this->start, $this->range,"range"));
- $smarty->assign("range",$this->range);
+ $smarty->assign("range",$this->range);
$smarty->assign("div",$divlist->Draw());
+
+ return(management::execute());
return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
}
/*! \brief Move an entry up or down in the queue, by updating its execution timestamp
- @param $id Integer The ID of the entry which should be updated.
- @param $type String "up" / "down"
- @return boolean TRUE in case of success else FALSE
- */
+ @param $id Integer The ID of the entry which should be updated.
+ @param $type String "up" / "down"
+ @return boolean TRUE in case of success else FALSE
+ */
public function update_priority($id,$type = "up")
{
if($type == "up"){
* 'waiting'
*/
$data = array("status" => "waiting");
-
+
/* Check if given ids are valid and check if the status
* allows resuming.
*/
* waiting and setting the timestamp to current time.
*/
$data = array( "timestamp" => date("YmdHis",time()),
- "status" => "waiting");
+ "status" => "waiting");
/* Only allow execution of paused or waiting entries
*/
$tmp->add_targets($update_ids);
$tmp->set_type(TRIGGERED_EVENT);
$this->recently_removed = $update_ids;
-
+
if(!$this->o_queue->append($tmp)){
msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
return(FALSE);
$sort.= " DESC";
}
}
-
+
/* Get entries. */
$start = $this->start;
$stop = $this->range;
/* Assign entries by id.
*/
$this->entries = array();
-
+
foreach($entries as $entry){
-
+
/* Skip entries which will be removed within the next seconds */
if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$this->recently_removed)){
continue;
$this->recently_removed = array();
}
+ function save_object(){}
/*! \brief Handle post jobs, like sorting.
*/
- function save_object()
+ function _save_object()
{
/* Check for sorting changes
*/
if(isset($_POST['range']) && is_numeric($_POST['range'])){
$this->range = $_POST['range'];
}
-
+
/* Save filter settings */
$gotomasses_filter = session::get("gotomasses_filter");
foreach(array("range","sort_by","sort_dir") as $attr){
$gotomasses_filter[$attr] = $this->$attr;
}
session::set("gotomasses_filter",$gotomasses_filter);
-
+
/* Page changed. */
if(isset($_GET['start'])){
$start = $_GET['start'];
"plProvidedAcls" => array("Comment" => _("Description"))
));
}
+
+
+ function set_acl_base($base)
+ {
+ $this->acl_base= $base;
+ }
+
+
+ function set_acl_category($category)
+ {
+ $this->acl_category= "$category/";
+ }
+
+
+ function acl_is_writeable($attribute,$skip_write = FALSE)
+ {
+ if($this->read_only) return(FALSE);
+ $ui= get_userinfo();
+ return preg_match('/w/', $ui->get_permissions($this->acl_base, $this->acl_category.get_class($this), $attribute, $skip_write));
+ }
+
+
+ function acl_is_readable($attribute)
+ {
+ $ui= get_userinfo();
+ return preg_match('/r/', $ui->get_permissions($this->acl_base, $this->acl_category.get_class($this), $attribute));
+ }
+
+
+ function acl_is_createable($base ="")
+ {
+ if($this->read_only) return(FALSE);
+ $ui= get_userinfo();
+ if($base == "") $base = $this->acl_base;
+ return preg_match('/c/', $ui->get_permissions($base, $this->acl_category.get_class($this), '0'));
+ }
+
+
+ function acl_is_removeable($base ="")
+ {
+ if($this->read_only) return(FALSE);
+ $ui= get_userinfo();
+ if($base == "") $base = $this->acl_base;
+ return preg_match('/d/', $ui->get_permissions($base, $this->acl_category.get_class($this), '0'));
+ }
+
+ function acl_is_moveable($base = "")
+ {
+ if($this->read_only) return(FALSE);
+ $ui= get_userinfo();
+ if($base == "") $base = $this->acl_base;
+ return preg_match('/m/', $ui->get_permissions($base, $this->acl_category.get_class($this), '0'));
+ }
+
+
+ function getacl($attribute,$skip_write= FALSE)
+ {
+ $ui= get_userinfo();
+ $skip_write |= $this->read_only;
+ return $ui->get_permissions($this->acl_base, $this->acl_category.get_class($this), $attribute,$skip_write);
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/gosa-plugins/goto/addons/goto/deploy-filter.tpl b/gosa-plugins/goto/addons/goto/deploy-filter.tpl
--- /dev/null
@@ -0,0 +1,40 @@
+<div class="contentboxh">
+ <p class="contentboxh">
+ <img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}
+ </p>
+</div>
+
+<div class="contentboxb">
+
+<div style="border-top:1px solid #AAAAAA"></div>
+
+{$TEMPLATES} <LABEL for='TEMPLATES'>{t}Show templates{/t}</LABEL><br>
+{$FUNCTIONAL} <LABEL for='FUNCTIONAL'>{t}Show functional users{/t}</LABEL><br>
+{$POSIX} <LABEL for='POSIX'>{t}Show POSIX users{/t}</LABEL><br>
+{$MAIL} <LABEL for='MAIL'>{t}Show Mail users{/t}</LABEL><br>
+{$SAMBA} <LABEL for='SAMBA'>{t}Show Samba users{/t}</LABEL><br>
+
+ <div style="border-top:1px solid #AAAAAA"></div>
+ {$SCOPE}
+
+ <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+ <tr>
+ <td>
+ <label for="NAME">
+ <img src="images/lists/search.png" align=middle> Name
+ </label>
+ </td>
+ <td>
+ {$NAME}
+ </td>
+ </tr>
+ </table>
+
+ <table summary="" width="100%" style="background:#EEEEEE;border-top:1px solid #B0B0B0;">
+ <tr>
+ <td width="100%" align="right">
+ {$APPLY}
+ </td>
+ </tr>
+ </table>
+</div>
diff --git a/gosa-plugins/goto/addons/goto/deploy-filter.xml b/gosa-plugins/goto/addons/goto/deploy-filter.xml
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<filterdef>
+ <definition>
+ <category>users</category>
+ <template>deploy-filter.tpl</template>
+ <initial>true</initial>
+ </definition>
+
+ <search>
+ <query>
+ <backend>GotoEvents</backend>
+ <filter>(&(objectClass=gosaAccount)$TEMPLATES$NAME(|$FUNCTIONAL$SAMBA$POSIX$MAIL))</filter>
+ <attribute>dn</attribute>
+ <attribute>objectClass</attribute>
+ <attribute>givenName</attribute>
+ <attribute>sn</attribute>
+ <attribute>uid</attribute>
+ <attribute>userPassword</attribute>
+ </query>
+ <scope>auto</scope>
+ </search>
+
+ <element>
+ <type>textfield</type>
+ <tag>NAME</tag>
+ <size>20</size>
+ <maxlength>60</maxlength>
+ <default></default>
+ <unset></unset>
+ <set>(|(cn=*$*)(sn=*$*)(givenName=*$*))</set>
+ <alphabet>true</alphabet>
+ <autocomplete>
+ <backend>GotoEvents</backend>
+ <filter>(&(objectClass=gosaAccount)(|(cn=*$NAME*)(sn=*$NAME*)(givenName=*$NAME*)))</filter>
+ <attribute>cn</attribute>
+ <frequency>0.5</frequency>
+ <characters>3</characters>
+ </autocomplete>
+ </element>
+
+ <element>
+ <type>checkbox</type>
+ <tag>TEMPLATES</tag>
+ <default></default>
+ <unset>(!(objectClass=gosaUserTemplate))</unset>
+ <set></set>
+ </element>
+
+ <element>
+ <type>checkbox</type>
+ <tag>FUNCTIONAL</tag>
+ <default>true</default>
+ <unset></unset>
+ <set>(!(|(objectClass=posixAccount)(objectClass=sambaSamAccount)(objectClass=gosaMailAccount)(objectClass=gofaxAccount)(objectClass=gofonAccount)))</set>
+ </element>
+
+ <element>
+ <type>checkbox</type>
+ <tag>POSIX</tag>
+ <default>true</default>
+ <unset></unset>
+ <set>(objectClass=posixAccount)</set>
+ </element>
+
+ <element>
+ <type>checkbox</type>
+ <tag>MAIL</tag>
+ <default>true</default>
+ <unset></unset>
+ <set>(objectClass=gosaMailAccount)</set>
+ </element>
+
+ <element>
+ <type>checkbox</type>
+ <tag>SAMBA</tag>
+ <default>true</default>
+ <unset></unset>
+ <set>(objectClass=sambaSamAccount)</set>
+ </element>
+
+</filterdef>
diff --git a/gosa-plugins/goto/addons/goto/deploy-list.tpl b/gosa-plugins/goto/addons/goto/deploy-list.tpl
--- /dev/null
@@ -0,0 +1,31 @@
+<input type='image' src='images/empty.png' name='no_action_posted' value='do_nothing' alt='' style='width:2px;height:2px;'>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=2>
+ <tr>
+ <td style="vertical-align:top; width:50%;">
+ <div class="contentboxh">
+ <p class="contentboxh"> {$HEADLINE} {$SIZELIMIT}</p>
+ </div>
+
+ <div class="contentboxb">
+ <div style='background:white;padding:3px;'>
+ <table><tr>
+ <td>{$ROOT} </td><td>{$BACK} </td><td>{$HOME} </td><td>{$RELOAD} </td><td>{$SEPARATOR} </td><td>{t}Base{/t} {$BASE} </td><td>{$SEPARATOR} </td><td><img src='images/rocket.png' alt='' class='center'></td><td> {$ACTIONS}</td>
+ </tr></table>
+ </div>
+ </div>
+
+ <div style='height:4px;'>
+ </div>
+
+ <input type="hidden" id="d_save" value="450">
+ <input type="hidden" id="d_space" value="760">
+ {$LIST}
+ </td>
+ <td style='vertical-align:top'>
+ {$FILTER}
+ </td>
+ </tr>
+</table>
+
+<input type="hidden" name="ignore">
diff --git a/gosa-plugins/goto/addons/goto/deploy-list.xml b/gosa-plugins/goto/addons/goto/deploy-list.xml
--- /dev/null
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<list>
+ <definition>
+ <departmentBrowser>false</departmentBrowser>
+ <departmentRootVisible>false</departmentRootVisible>
+ <baseMode>false</baseMode>
+ <multiSelect>true</multiSelect>
+ <template>deploy-list.tpl</template>
+ <label>List of events</label>
+ <defaultSortColumn>1</defaultSortColumn>
+
+ <objectType>
+ <label>Event</label>
+ <objectClass>FAKE_OC__gotoEvent</objectClass>
+ <category>gotomasses</category>
+ <class>gotomasses</class>
+ <image>images/empty.png</image>
+ </objectType>
+
+ </definition>
+
+ <table>
+ <layout>|||||||</layout>
+
+ <column>
+ <label>Target</label>
+ <sortAttribute>MACADDRESS</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:hostName(MACADDRESS,PLAINNAME)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Task</label>
+ <sortAttribute>givenName</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:filterTask(HEADERTAG)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Period</label>
+ <sortAttribute>uid</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:filterPeriod(PERIODIC)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Schedule</label>
+ <sortAttribute>uid</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:filterSchedule(TIMESTAMP)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Status</label>
+ <sortAttribute>uid</sortAttribute>
+ <sortType>string</sortType>
+ <value>%{filter:filterStatus(TIMESTAMP)}</value>
+ <export>true</export>
+ </column>
+
+ <column>
+ <label>Actions</label>
+ <value>%{filter:actions(dn,row,objectClass)}</value>
+ </column>
+
+ </table>
+
+ <actionmenu>
+
+ <action>
+ <type>sub</type>
+ <image>images/lists/new.png</image>
+ <label>Create</label>
+
+ <action>
+ <name>new</name>
+ <type>entry</type>
+ <image>plugins/users/images/list_new_user.png</image>
+ <label>User</label>
+ </action>
+
+ <action>
+ <name>new_template</name>
+ <type>entry</type>
+ <image>plugins/users/images/select_template.png</image>
+ <label>Template</label>
+ </action>
+ </action>
+
+ <action>
+ <type>separator</type>
+ </action>
+
+ <action>
+ <name>edit</name>
+ <type>entry</type>
+ <image>images/lists/edit.png</image>
+ <label>Edit</label>
+ </action>
+
+ <action>
+ <name>remove</name>
+ <type>entry</type>
+ <image>images/lists/trash.png</image>
+ <label>Remove</label>
+ </action>
+
+ <action>
+ <name>password</name>
+ <type>entry</type>
+ <image>plugins/users/images/list_password.png</image>
+ <label>Change password</label>
+ </action>
+
+ <action>
+ <type>separator</type>
+ </action>
+
+ <action>
+ <name>lockUsers</name>
+ <type>entry</type>
+ <image>images/lists/locked.png</image>
+ <acl>uniBonnAccount/password[w]</acl>
+ <label>Lock users</label>
+ </action>
+
+ <action>
+ <name>unlockUsers</name>
+ <type>entry</type>
+ <image>images/lists/unlocked.png</image>
+ <acl>uniBonnAccount/password[w]</acl>
+ <label>Unlock users</label>
+ </action>
+
+ <action>
+ <name>sendMessage</name>
+ <type>entry</type>
+ <depends>DaemonEvent_notify</depends>
+ <image>plugins/goto/images/notify.png</image>
+ <label>Send message</label>
+ </action>
+
+ <action>
+ <type>separator</type>
+ </action>
+
+ <action>
+ <name>templatize</name>
+ <type>entry</type>
+ <image>plugins/users/images/wizard.png</image>
+ <label>Apply template</label>
+ </action>
+
+ <action>
+ <type>separator</type>
+ </action>
+
+ <action>
+ <type>exporter</type>
+ </action>
+
+ <action>
+ <type>separator</type>
+ </action>
+
+ <action>
+ <type>copypaste</type>
+ </action>
+
+ <action>
+ <type>snapshot</type>
+ </action>
+
+ </actionmenu>
+
+ <actiontriggers snapshot="true" copypaste="true">
+
+ <action>
+ <name>newfromtpl</name>
+ <type>entry</type>
+ <image>images/lists/new.png</image>
+ <objectclass>gosaUserTemplate</objectclass>
+ <label>New user from template</label>
+ </action>
+
+ <action>
+ <name>cp</name>
+ <objectclass>!gosaUserTemplate</objectclass>
+ <type>copypaste</type>
+ </action>
+
+ <action>
+ <name>edit</name>
+ <type>entry</type>
+ <objectclass>gosaAccount</objectclass>
+ <image>images/lists/edit.png</image>
+ <label>Edit user</label>
+ </action>
+
+ <action>
+ <name>lock</name>
+ <type>entry</type>
+ <objectclass>!gosaUserTemplate</objectclass>
+ <image>%{filter:lockImage(userPassword)}</image>
+ <acl>uniBonnAccount/password[w]</acl>
+ <label>%{filter:lockLabel(userPassword)}</label>
+ </action>
+
+ <action>
+ <name>password</name>
+ <type>entry</type>
+ <objectclass>!gosaUserTemplate</objectclass>
+ <image>plugins/users/images/list_password.png</image>
+ <label>Change password</label>
+ </action>
+
+ <action>
+ <name>snapshot</name>
+ <type>snapshot</type>
+ <objectclass>!gosaUserTemplate</objectclass>
+ </action>
+
+ <action>
+ <name>remove</name>
+ <type>entry</type>
+ <image>images/lists/trash.png</image>
+ <objectclass>gosaAccount</objectclass>
+ <acl>users/user[d]</acl>
+ <label>Remove user</label>
+ </action>
+
+ </actiontriggers>
+
+</list>
index af6b0ab7e3e7b569174ca9b3b28c813154de4676..a63d2106e0f03cfea5e93a25a20a3c3fdc9c7414 100644 (file)
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
/* Remove locks created by this plugin
*/
if ($remove_lock){
if(session::is_set('gotomasses')){
- // Nothing to unlock here
+ $macl = session::get('gotomasses');
+ $macl->remove_lock();
}
}
session::un_set('gotomasses');
}else{
+ /* Create gotomasses object on demand */
+ if (!session::is_set('gotomasses')){
+ $gotomasses= new gotomasses ($config, $ui);
+ session::set('gotomasses',$gotomasses);
+ }
+ $gotomasses = session::get('gotomasses');
+ $display= $gotomasses->execute();
- /* Create gotomasses object on demand */
- if (!session::is_set('gotomasses') || isset($_POST['reload_gotomass_data'])){
- $gotomasses= new gotomasses ($config);
- $gotomasses->set_acl_category("gotomasses");
-
- /* Check root dn and user dn for acl informations */
- $gotomasses->set_acl_base($config->current['BASE']);
- if($gotomasses->getacl("") == ""){
- $gotomasses->set_acl_base($ui->dn);
- }
-
- /* Check if we have acl on our own base */
- if($gotomasses->getacl("") == ""){
- $gotomasses->set_acl_base(dn2base($ui->dn));
- }
- session::set("gotomasses",$gotomasses);
- }
- $gotomasses = session::get('gotomasses');
-
- /* Execute formular */
- $display= $gotomasses->save_object();
- if(isset($_POST['save_gotomass_changes'])){
- $gotomasses->save();
- }
- $display= $gotomasses->execute ();
-
- /* Page header*/
- $display= print_header(get_template_path('plugins/goto/images/goto.png'), _("System deployment status")).$display;
+ /* Reset requested? */
+ if (isset($_GET['reset']) && $_GET['reset'] == 1){
+ session::un_set ('gotomasses');
+ }
- /* Store changes in session */
- session::set('gotomasses',$gotomasses);
+ /* Show and save dialog */
+ session::set('gotomasses',$gotomasses);
}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>