summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23c35e5)
raw | patch | inline | side by side (parent: 23c35e5)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Jan 2010 11:58:11 +0000 (11:58 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 19 Jan 2010 11:58:11 +0000 (11:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15197 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_sortableListing.inc | patch | blob | history |
diff --git a/gosa-core/include/class_sortableListing.inc b/gosa-core/include/class_sortableListing.inc
index 8ebd88c4b42b80eef9aa9c8745c3eac14c6d0603..2dc8237a9b8b3a10ec99e04ce7b72e216e62cf1b 100644 (file)
}
+ function setReorderable($flag)
+ {
+ $this->reorderable= $flag;
+ }
+
+
function setInstantDelete($flag)
{
$this->instantDelete= $flag;
if (strpos($this->acl, 'w') === false) {
$edit_image= $this->editable?"<img class='center' src='images/lists/edit-grey.png' alt='"._("Edit")."'>":"";
} else {
- $edit_image= $this->editable?"<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='%ID' title='"._("Edit this entry")."'>":"";
+ $edit_image= $this->editable?"<input class='center' type='image' src='images/lists/edit.png' alt='"._("Edit")."' name='%ID' id='%ID' title='"._("Edit this entry")."'>":"";
}
if (strpos($this->acl, 'd') === false) {
$delete_image= $this->deleteable?"<img class='center' src='images/lists/trash-grey.png' alt='"._("Delete")."'>":"";
// 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) {
- $result.= " <tr class='sortableListItem".($nr&1?'Odd':'')."' id='item_".$this->id."_$nr'>\n";
+ $editable= $this->editable?" onclick='$(\"edit_".$this->id."_$nr\").click()'":"";
+ $result.= " <tr class='sortableListItem".($nr&1?'Odd':'')."' id='item_".$this->id."_$nr'$reorderable$editable>\n";
foreach ($this->displayData[$row] as $column) {
$result.= " <td>".htmlentities($column)."</td>\n";
}
// Append script stuff if needed
$result.= '<script type="text/javascript" language="javascript">';
- $result.= ' function updateOrder(){';
- $result.= ' var ampcharcode= \'%26\';';
- $result.= ' var serializeOpts = Sortable.serialize(\''.$this->id.'\')+"='.$this->id.'";';
- $result.= ' $("reorder_'.$this->id.'").value= serializeOpts;';
- $result.= ' document.mainform.submit();';
- $result.= ' }';
- $result.= 'Position.includeScrollOffsets = true;';
- $result.= ' Sortable.create(\''.$this->id.'\',{tag:\'tr\', ghosting:false, constraint:\'vertical\', scroll:\'scroll_'.$this->id.'\',onUpdate : updateOrder});';
+ if ($this->reorderable) {
+ $result.= ' function updateOrder(){';
+ $result.= ' var ampcharcode= \'%26\';';
+ $result.= ' var serializeOpts = Sortable.serialize(\''.$this->id.'\')+"='.$this->id.'";';
+ $result.= ' $("reorder_'.$this->id.'").value= serializeOpts;';
+ $result.= ' document.mainform.submit();';
+ $result.= ' }';
+ $result.= 'Position.includeScrollOffsets = true;';
+ $result.= ' Sortable.create(\''.$this->id.'\',{tag:\'tr\', ghosting:false, constraint:\'vertical\', scroll:\'scroll_'.$this->id.'\',onUpdate : updateOrder});';
+ }
$result.= '$("scroll_'.$this->id.'").scrollTop= '.$this->scrollPosition.';';
$result.= 'var box = $("scroll_'.$this->id.'").onscroll= function() {$("position_'.$this->id.'").value= this.scrollTop;}';
$result.= '</script>';