From: hickert Date: Mon, 6 Aug 2007 08:23:02 +0000 (+0000) Subject: Added divlist to FAIscript dialog, with sorting parameter X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7e15a2f69b60ef65d2bda2c1ec6027c8420c4604;p=gosa.git Added divlist to FAIscript dialog, with sorting parameter git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6964 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_divlist.inc b/include/class_divlist.inc index cd12a5ebd..2c28bc7cf 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -24,7 +24,7 @@ class divlist { $this->i_currentPage = 0; $this->i_entriesPerPage = 10; $this->s_height = "450"; - $this->s_width = "600"; + $this->s_width = "600px"; $this->s_summary = ""; $this->a_entries = array(); $this->a_header = array(); @@ -56,6 +56,9 @@ class divlist { function SetWidth($s_width) { $this->s_width= $s_width; + if(preg_match("/^[0-9]*$/",$this->s_width)){ + $this->s_width .="px"; + } } function SetEntriesPerPage($i_num){ @@ -66,11 +69,11 @@ class divlist { $s_return = ""; if(!$this->force_height){ $s_return.= ""; } else { $s_return.= "
"; } @@ -105,9 +108,9 @@ class divlist { // Using scrolltable? if($this->i_entriesPerPage == 0) { if(!$this->force_height) { - $s_return.= "\n
"; + $s_return.= "\n
"; } else { - $s_return.= "\n
"; + $s_return.= "\n
"; } } @@ -149,10 +152,10 @@ class divlist { if($this->i_entriesPerPage == 0) { // We need to construct a "body"-table that is width-of-scrollbar thinner than the "head"-table. if(!$this->force_height) { - $s_return .= "\n
"; + $s_return .= "\n
"; $s_return .= ""; } else { - $s_return .= "\n
"; + $s_return .= "\n
"; $s_return .= ""; } } diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 537c35318..3f9d0612e 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -31,7 +31,9 @@ class faiScript extends plugin var $dialog = NULL; // a dialog, e.g. new disk dialog var $SubObjects = array(); // All leafobjects of this object - var $FAIstate =""; + var $FAIstate = ""; + var $sort_by = "name"; + var $sort_order = "up"; var $base =""; var $release =""; @@ -213,11 +215,24 @@ class faiScript extends plugin /* Sort entries */ $tmp = $keys = array(); - foreach($this->SubObjects as $key => $entry){ - $keys[$key]=$key; + + if($this->sort_by == "name"){ + foreach($this->SubObjects as $key => $entry){ + $keys[$key]=$entry['cn']; + } + }elseif($this->sort_by == "priority"){ + foreach($this->SubObjects as $key => $entry){ + $keys[$key]=$entry['FAIpriority']; + } } + natcasesort($keys); - foreach($keys as $key){ + + if($this->sort_order == "down"){ + $keys =array_reverse($keys); + } + + foreach($keys as $key => $order_var){ $tmp[$key]=$this->SubObjects[$key]; } $this->SubObjects = $tmp; @@ -239,8 +254,16 @@ class faiScript extends plugin /* Divlist added 23.02.2006 Containing FAIscripts */ - $divlist = new divSelectBox("FAIscripts"); - $divlist->setHeight(400); + $divlist = new divlist("FAIscripts"); + $plug = $_GET['plug']; + + $divlist->SetHeader(array( array("string"=>""._("Name").""), + array("string"=>""._("Priority").""), + array("string"=>_("Download")), + array("string"=>_("Action")))); + $divlist->SetHeight(300); + $divlist->SetWidth("100%"); + if((chkacl($this->acl,"cn")!="") || ($this->FAIstate == "freeze")){ $img_edit = ""; $img_remo = ""; @@ -260,6 +283,7 @@ class faiScript extends plugin } $divlist->AddEntry(array( array("string"=>$name['name']), + array("string"=>$name['FAIpriority'] , "attach" => "style='width:20px;'"), array("string"=>$down , "attach" => "style='width:20px;'"), array("string"=>str_replace("%s",base64_encode($key),$img_edit.$img_remo), "attach"=>"style='border-right: 0px;width:50px;text-align:right;'"))); @@ -298,6 +322,7 @@ class faiScript extends plugin $a_return[$obj['cn']]['name']= $obj['cn']; } $a_return[$obj['cn']]['dn']= $obj['dn']; + $a_return[$obj['cn']]['FAIpriority']= $obj['FAIpriority']; }else{ if((isset($obj['description']))&&(!empty($obj['description']))){ $a_return[$obj['cn']]= $obj['cn']." [".stripslashes($obj['description'])."]"; @@ -334,6 +359,18 @@ class faiScript extends plugin } } } + + /* Get sort order */ + if(isset($_GET['sort']) && in_array($_GET['sort'],array("name","priority"))){ + if($this->sort_by == $_GET['sort']){ + if($this->sort_order == "up"){ + $this->sort_order = "down"; + }elseif($this->sort_order == "down"){ + $this->sort_order = "up"; + } + } + $this->sort_by = $_GET['sort']; + } } diff --git a/plugins/admin/fai/faiScript.tpl b/plugins/admin/fai/faiScript.tpl index cc5b1fe4e..2d518cc31 100644 --- a/plugins/admin/fai/faiScript.tpl +++ b/plugins/admin/fai/faiScript.tpl @@ -32,13 +32,12 @@

  -

- +
+ {$Entry_divlist}