summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a60d017)
raw | patch | inline | side by side (parent: a60d017)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 4 Jun 2009 09:07:35 +0000 (09:07 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 4 Jun 2009 09:07:35 +0000 (09:07 +0000) |
- Make getpos work properly with numeric indices
- Don't show 'Move Up' link on first item and no 'Move Down' on
last item.
- Remove cobineArrays function, because its not needed anymore
These changes fixes various behaviour problems with
the Move Up/Down functionality.
(Trac #2637)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13694 594d385d-05f5-0310-b6e9-bd551577e9d8
- Don't show 'Move Up' link on first item and no 'Move Down' on
last item.
- Remove cobineArrays function, because its not needed anymore
These changes fixes various behaviour problems with
the Move Up/Down functionality.
(Trac #2637)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13694 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc
index d92e5178ba23248087e8cdf2bfaed76fe5638642..1faedc2f26ee7999d1d60ff11c8cad9781c052c4 100644 (file)
$tmp2 = array();
foreach($tmp as $class){
if(!empty($class)){
- $tmp2[trim($class)] = trim($class);
+ $class = trim($class);
+ $tmp2[] = $class;
}
}
/* Sort assigned classes */
if(is_array($tmp2)){
foreach($tmp2 as $class){
- $this->FAIclasses[$class]=$class;
+ $this->FAIclasses[]=$class;
}
}
$this->old_cn = $this->cn;
}
-
- /* Combine new array, used for up down buttons */
- function combineArrays($ar0,$ar1,$ar2)
- {
- $ret = array();
- if(is_array($ar0))
- foreach($ar0 as $ar => $a){
- $ret[$ar]=$a;
- }
- if(is_array($ar1))
- foreach($ar1 as $ar => $a){
- $ret[$ar]=$a;
- }
- if(is_array($ar2))
- foreach($ar2 as $ar => $a){
- $ret[$ar]=$a;
- }
- return($ret);
- }
-
-
function acl_base_for_current_object($dn)
{
if($dn == "new" || $dn == ""){
function getpos($atr,$attrs)
{
$i = 0;
- foreach($attrs as $attr => $name) {
- $i++;
- if($attr == $atr){
+ foreach($attrs as $value) {
+ if($atr == $value) {
return($i);
}
+ $i++;
}
- return(-1);
}
/* Transports the given Arraykey one position up*/
function ArrayUp($atr,$attrs)
{
- $ret = $attrs;
- $pos = $this->getpos($atr,$attrs) ;
- $cn = count($attrs);
- if(!(($pos == -1)||($pos == 1))){
- $before = array_slice($attrs,0,($pos-2));
- $mitte = array_reverse(array_slice($attrs,($pos-2),2));
- $unten = array_slice($attrs,$pos);
- $ret = array();
- $ret = $this->combineArrays($before,$mitte,$unten);
+ $index = $this->getpos($atr,$attrs);
+ $res = $attrs;
+
+ for($i=0;$i<count($attrs);$i++) {
+ if ($i==$index) {
+ $left_index = $index - 1;
+ $res[$left_index] = $attrs[$index];
+ $res[$index] = $attrs[$left_index];
+ }
}
- return($ret);
+
+ return($res);
}
/* Transports the given Arraykey one position down*/
function ArrayDown($atr,$attrs)
{
- $ret = $attrs;
- $pos = $this->getpos($atr,$attrs) ;
- $cn = count($attrs);
- if(!(($pos == -1)||($pos == $cn))){
- $before = array_slice($attrs,0,($pos-1));
- $mitte = array_reverse(array_slice($attrs,($pos-1),2));
- $unten = array_slice($attrs,($pos+1));
- $ret = array();
- $ret = $this->combineArrays($before,$mitte,$unten);
+ $index = $this->getpos($atr,$attrs);
+ $res = $attrs;
+
+ for($i=0;$i<count($attrs);$i++) {
+ if ($i==$index) {
+ $left_index = ($index+1);
+ $res[$left_index] = $attrs[$index];
+ $res[$index] = $attrs[$left_index];
+ }
}
- return($ret);
+
+ return($res);
}
/* class one position up */
}else{
$ret = $this->dialog->save();
foreach($ret as $class){
- $this->FAIclasses[$class] =$class;
+ $this->FAIclasses[] =$class;
}
$this->is_dialog=false;
unset($this->dialog);
$actions = "<input type='image' src='images/lists/trash.png' title='"._("Remove class from profile")."' name='DEL_%KEY%'>";
/* Up down buttons */
- $linkupdown = " <input type='image' name='sortup_%s' alt='up' title='"._("Up")."' src='images/lists/sort-up.png' align='top' >";
- $linkupdown.= "<input type='image' name='sortdown_%s' alt='down' title='"._("Down")."' src='images/lists/sort-down.png' >";
-
+ $linkup = " <input type='image' name='sortup_%s' alt='up' title='"._("Up")."' src='images/lists/sort-up.png' align='top' >";
+ $linkdown = " <input type='image' name='sortdown_%s' alt='down' title='"._("Down")."' src='images/lists/sort-down.png' >";
/* Append fai classes to divlist */
if($this->acl_is_readable("FAIclass")){
+ $i = 1;
foreach($this->FAIclasses as $usedClass){
+ if($i==1) {
+ $linkupdown = " " . $linkdown;
+ } elseif ($i<count($this->FAIclasses)) {
+ $linkupdown = $linkup . $linkdown;
+ }
+ else {
+ $linkupdown = $linkup;
+ }
+
$str = " ";
$act = "";
$field3 = array("string"=>" ", "attach"=>"style='border-right:none;'");
}
$divlist->AddEntry(array($field1,$field2,$field3));
+ $i++;
}
}
$tmp2 = array();
foreach($tmp as $class){
if(!empty($class)){
- $tmp2[trim($class)] = trim($class);
+ $class = trim($class);
+ $tmp2[] = $class;
}
}
/* Sort assigned classes */
if(is_array($tmp2)){
foreach($tmp2 as $class){
- $this->FAIclasses[$class]=$class;
+ $this->FAIclasses[]=$class;
}
}
}