summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a8d784)
raw | patch | inline | side by side (parent: 8a8d784)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 15 Sep 2011 07:52:48 +0000 (07:52 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 15 Sep 2011 07:52:48 +0000 (07:52 +0000) |
Backports from 2.7
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.7@20984 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.7@20984 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_ItemSelector.inc | patch | blob | history | |
gosa-core/include/class_listing.inc | patch | blob | history | |
gosa-core/include/class_sortableListing.inc | patch | blob | history |
index f3eca46910af2515bac978b4e09c88a33c43b767..4b7d180b78dbe03916c2d17d4410389d20b1b476 100644 (file)
foreach ($bases as $path => $data) {
// Build path style display
- $this->pathMapping[$path]= $path == $this->releaseBase? '/' : $data['name'];
+ $this->pathMapping[$path]= preg_replace("/^".preg_quote($this->releaseBase,'/')."\/?/i", "/", $path);
$this->releaseInfo[$path]['name'] = $data['name'];
$this->releaseInfo[$path]['description'] = $data['desc'];
}
if(isset($_REQUEST["BPID_{$this->pid}"]) && $_REQUEST["BPID_{$this->pid}"] == $this->pid) {
if (isset($_POST['bs_rebase_'.$this->pid])) {
$new_base= base64_decode(get_post('bs_rebase_'.$this->pid));
-
- if (isset($this->pathMapping[$new_base])) {
- $this->base= $new_base;
- $this->action= 'rebase';
- } else {
- $this->lastState= false;
- return false;
+ if($new_base){
+ if (isset($this->pathMapping[$new_base])) {
+ $this->base= $new_base;
+ $this->action= 'rebase';
+ } else {
+ $this->lastState= false;
+ return false;
+ }
}
}else{
// Input field set?
});";
}
$this->tree.= "</script>";
+ $selected= $this->base == $this->releaseBase?"Selected":"";
$this->tree.= "<div class='treeList'
style=' display:none;
max-height:".$this->height."px'
window.clearTimeout(rtimer);\"
onmouseout=\"
rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\">
+ <a class='treeList$selected' $link>/ ["._("Root")."]</a>
<ul class='treeList'>\n";
$first= true;
$last_indent= 1;
+ $baseDepth = 0;
foreach ($this->pathMapping as $base => $dummy) {
+ // Do not render the base element
+ if($base == $this->releaseBase){
+ $baseDepth = 1;
+ continue;
+ }
+
// Build path style display
$elements= explode('/', substr($base, strlen($this->releaseBase), strlen($base)));
- $indent= count($elements) ;
-
+ $indent= count($elements) - $baseDepth ;
+
if (!$first && ($indent == $last_indent)) {
$this->tree.= "</li>\n";
}
index 4e3ef82ccb5edec0f9cefdaa96587e9719a52eb9..5f04cdf3171a7afaec3a68837a978771564a0ba6 100644 (file)
var $departmentRootVisible= false;
var $multiSelect= false;
var $singleSelect= false;
+ var $noAclChecks= false;
var $template;
var $headline;
var $base;
var $height= 0;
var $scrollPosition= 0;
var $baseSelector;
-
+ var $aclToObjectClass = array();
function listing($source, $isString = FALSE)
{
$this->xmlData= $this->xmlData["list"];
// Load some definition values
- foreach (array("departmentBrowser", "departmentRootVisible", "multiSelect","singleSelect", "baseMode") as $token) {
+ foreach (array("departmentBrowser", "departmentRootVisible", "multiSelect","singleSelect", "baseMode", "noAclChecks") as $token) {
if (isset($this->xmlData['definition'][$token]) &&
$this->xmlData['definition'][$token] == "true"){
$this->$token= true;
$this->objectTypes[$tmp['objectClass']]= $tmp;
if (isset($this->xmlData['definition']['objectType'][$index]['category'])){
$this->categories[]= $otype['category'];
+
+ if(isset($otype['category']) && isset($otype['class'])){
+ $this->aclToObjectClass[$otype['category']."/".$otype['class']][] = $otype['objectClass'];
+ }
}
}
}
$height= $this->height;
}
- $result.= "<div class='listContainer' id='d_scrollbody' style='min-height:".($height+25)."px;'>\n";
+ $result.= "<div class='listContainer' id='d_scrollbody' style='height:{$height}px; overflow: auto;min-height:".($height+25)."px;'>\n";
$result.= "<table summary='$this->headline' style='width:100%;table-layout:fixed' cellspacing='0' cellpadding='0' id='t_scrolltable'>\n";
$this->numColumns= count($this->colprops) + (($this->multiSelect|$this->singleSelect)?1:0);
}
// Fill with contents, sort as configured
+ $ui = get_userinfo();
foreach ($this->entries as $row => $entry) {
$trow= "";
$this->filter->setBase($this->base);
$this->entries= $this->filter->query();
+ // Check entry acls
+ if(!$this->noAclChecks){
+ foreach($this->entries as $row => $entry){
+ $acl = "";
+ $found = false;
+ foreach($this->aclToObjectClass as $category => $ocs){
+ if(count(array_intersect($ocs, $entry['objectClass']))){
+ $acl .= $ui->get_permissions($entry['dn'],$category, 0);
+ $found = true;
+ }
+ }
+ if(!preg_match("/r/", $acl) && $found){
+ unset($this->entries[$row]);
+ continue;
+ }
+ }
+ }
+
// Fix filter if querie returns NULL
if ($this->entries == null) {
$this->entries= array();
diff --git a/gosa-core/include/class_sortableListing.inc b/gosa-core/include/class_sortableListing.inc
index df89b48217e8e38d4b139b03233c2458e9789490..e6632b147c03dd1fdf35177fd269a39a2614f052 100644 (file)
private $acl= "";
private $modified= false;
-
+
public function sortableListing($data= array(), $displayData= null, $reorderable= false)
{
global $config;
$this->sortColumn = $id;
}
- /*
- *
- * Examples
- * DatenARray ($data)
- * @param: array( arbitrary object, arbitrary object)
- * Datenarray will be manipulated by add, del and sort operations. According to this it will be returned from this widget.
- * The index of a data entry must correspond to the entry of the "display array" following.
- * DisplayArray ($displyData)
- * @param: array("eins" array( "data"=> array("Uno", "2", "x" ) , "zwei" array( "data"=> array("Due", "3", "y" ))) ;
- * label pointing on a list of columns that will be shown in the list.
- */
+ /*
+ *
+ * Examples
+ * DatenARray ($data)
+ * @param: array( arbitrary object, arbitrary object)
+ * Datenarray will be manipulated by add, del and sort operations. According to this it will be returned from this widget.
+ * The index of a data entry must correspond to the entry of the "display array" following.
+ * DisplayArray ($displyData)
+ * @param: array("eins" array( "data"=> array("Uno", "2", "x" ) , "zwei" array( "data"=> array("Due", "3", "y" ))) ;
+ * label pointing on a list of columns that will be shown in the list.
+ */
public function setListData($data, $displayData= null)
{
// Save data to display
$this->setDisplayData($displayData);
}
- //setting flat data
+ //setting flat data
private function setData($data)
{
$this->data= $data;
}
- // collecting the display data -
+ // collecting the display data -
private function setDisplayData($data)
{
if (!is_array($data)) {
public function render()
- {
+ {
$result= "<div class='sortableListContainer' id='scroll_".$this->id."' style='min-width:".$this->width.";height: ".$this->height."'>\n";
$result.= "<table summary='"._("Sortable list")."' border='0' cellpadding='0' cellspacing='0' width='100%' style='width:100%' ".(!empty($this->cssclass)?" class='".$this->cssclass."'":"").">\n";
$action_width= 0;
// Render table body if we've read permission
$result.= " <tbody id='".$this->id."'>\n";
$reorderable= $this->reorderable?"":" style='cursor:default'";
+
if (strpos($this->acl, 'r') !== false) {
foreach ($this->mapping as $nr => $row) {
$editable= $this->editable?" onClick='$(\"edit_".$this->id."_$nr\").click()'":"";
foreach ($_POST as $key => $value) {
$value = get_post($key);
if (preg_match('/^del_'.$this->id.'_([0-9]+)$/', $key, $matches)) {
+
+
+ if(!isset($this->mapping[$matches[1]])) return;
+
$this->active_index= $this->mapping[$matches[1]];
// Ignore request if mode requests it
foreach ($_POST as $key => $value) {
$value = get_post($key);
if (preg_match('/^edit_'.$this->id.'_([0-9]+)$/', $key, $matches)) {
+
+ if(!isset($this->mapping[$matches[1]])) return;
+
$this->active_index= $this->mapping[$matches[1]];
// Ignore request if mode requests it
}
- private function deleteEntry($id)
+ public function deleteEntry($id)
{
// Remove mapping
$index= array_search($id, $this->mapping);
if ($index !== false) {
+ $target = $this->mapping[$index];
+ $key = $this->keys[$target];
+
unset($this->mapping[$index]);
+ if(isset($this->displayData[$target])){
+ unset($this->displayData[$target]);
+ unset($this->data[$key]);
+ unset($this->keys[$target]);
+ }
$this->mapping= array_values($this->mapping);
$this->modified= true;
}
// Extract data
$tmp= array();
- foreach($this->displayData as $item) {
+ foreach($this->displayData as $key => $item) {
if (isset($item[$this->sortColumn])){
- $tmp[]= $item[$this->sortColumn];
+ $tmp[$key]= $item[$this->sortColumn];
} else {
- $tmp[]= "";
+ $tmp[$key]= "";
}
}
}
// Append to data and mapping
+ $this->displayData[]= $displayEntry['data'];
+ $this->mapping[]= max(array_keys($this->displayData));
+ $this->modified= true;
if ($key) {
$this->data[$key]= $entry;
$this->keys[]= $key;
} else {
$this->data[]= $entry;
- $this->keys[]= count($this->mapping);
+ $this->keys[]= max(array_keys($this->displayData));
}
- $this->displayData[]= $displayEntry['data'];
- $this->mapping[]= count($this->mapping);
- $this->modified= true;
-
// Find the number of coluns
reset($this->displayData);
$first= current($this->displayData);