summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85cb99d)
raw | patch | inline | side by side (parent: 85cb99d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Nov 2007 10:12:59 +0000 (10:12 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 13 Nov 2007 10:12:59 +0000 (10:12 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7787 594d385d-05f5-0310-b6e9-bd551577e9d8
index 60b11d294600f17336025087c6e9307885b34c2f..96629424345da8abb41d1646e952e82659fe59e7 100644 (file)
protected $displayHeaderFlag= TRUE;
protected $displayFooterFlag= TRUE;
- private $numberOfCols= 0;
+ private $numberOfColumns= 0;
/*!
\brief Container for objects
}
-#/*! \brief Renders headline into a string
-#
-# Gets the headline description from the ObjectList object and renders it.
-#
-# \return HTML rendered headline
-# */
-#private function renderHeadline(){
-# $tpl =" <tr>
-# <td class='ObjectListViewport_TD_Header' id='ObjectListViewport_TD_Header_".$this->id."'>
-# <table class='ObjectListViewport_Header_Table' id='ObjectListViewport_Header_Table_".$this->id."'>
-# <tr>
-# {content}
-# </tr>
-# </table>
-# </td>
-# </tr>";
-# $buffer ="";
-# foreach($this->headline as $key => $value){
-# $buffer .= "<td class='ObjectListViewport_Header_Cell' style='".$value['style']."'>".$value['name']."</td>\n";
-# }
-# return(preg_replace("/\{content\}/", $buffer,$tpl));
-#}
-
-
-#/*! \brief Renders footer into a string
-#
-# Gets the footer description from the ObjectList object and renders it.
-#
-# \return HTML rendered footer
-# */
-#private function renderFooter(){
-# $buffer ="<tr>
-# <td class='ObjectListViewport_TD_Footer' id='ObjectListViewport_TD_Footer_".$this->id."'>
-# <table class='ObjectListViewport_Footer_Table'>
-# <tr>
-# <td class='ObjectListViewport_Footer_Cell' colspan='".count($this->headline)."'>".$this->footer."</td>
-# </tr>
-# </table>
-# </td>
-# </tr>";
-# return $buffer;
-#}
-
-
/* FIXME: replace this -> not our task */
private function getEntryIcon($entry,$alt = ""){
return("<img src='images/".$entry['_icon']."' alt='".$alt."' class='center'>");
$tmp = split("\|",trim($buffer,"|"));
$cols = array();
- for($i= 0; $i < $this->numberOfCols; $i++){
+ for($i= 0; $i < $this->numberOfColumns; $i++){
/* If current entry is the last to appen, then skip adding styles */
- if($i == ($this->numberOfCols-1)){
- $cols[$i]['style1'] = $this->headline[$i]['style'];
+ if($i == ($this->numberOfColumns-1)){
+ $cols[$i]['style1'] = $this->columnInformation[$i]['style'];
$cols[$i]['style2'] = "width:100%;overflow:hidden;";
$cols[$i]['value'] = $tmp[$i];
}else{
- $cols[$i]['style1'] = $this->headline[$i]['style'];
- $cols[$i]['style2'] = "width:100%;overflow:hidden;".$this->headline[$i]['style'];
+ $cols[$i]['style1'] = $this->columnInformation[$i]['style'];
+ $cols[$i]['style2'] = "width:100%;overflow:hidden;".$this->columnInformation[$i]['style'];
$cols[$i]['value'] = $tmp[$i];
}
}
$smarty = get_smarty();
$smarty->assign("OLV_Entries",$entries);
$smarty->assign("OLV_List_Id",$this->id);
+ $smarty->assign("OLV_Multiselect_Enabled",$this->multiselect);
/* Footer variables */
$smarty->assign("OLV_Footer_Enabled",$this->displayFooterFlag);
$smarty->assign("OLV_Footer_Message",$this->footer);
- $smarty->assign("OLV_Num_Cols",$this->numberOfCols);
+ $smarty->assign("OLV_Num_Cols",$this->numberOfColumns);
/* Assign Headline values */
$smarty->assign("OLV_Header_Enabled",$this->displayHeaderFlag);
- $smarty->assign("OLV_Header",$this->headline);
+ $smarty->assign("OLV_Header",$this->columnInformation);
return($smarty->fetch("ObjectListViewport.tpl"));
}
/* Each cell definition is seperated by |
* split by and go through each definition
*/
- $this->headline= array();
- $this->numberOfCols= 0;
+ $this->columnInformation= array();
+ $this->numberOfColumns= 0;
$tmp= split("\|", trim($data, "|"));
$cell_formats= array();
}
$cell_formats[$key]= array("name" => $name, "width" => $width, "alignment" => $alignment, "style" => $style);
- $this->numberOfCols++;
+ $this->numberOfColumns++;
}
- $this->headline= $cell_formats;
+ $this->columnInformation= $cell_formats;
}
}
index bd7b3d0ba8e5cd70f9c73ef76bb920ab2aa38297..d7043ab94e8dd35a386aea36ee36d83aa135bb05 100644 (file)
/* This is good for testing... */
error_reporting (E_ALL | E_STRICT);
+
+function get_smarty()
+{
+ echo "Smarty fake in each ./tests/ListTest[1-9]/index.php";
+ date_default_timezone_set("europe/berlin");
+ $smarty = new smarty;
+ /* Set template compile directory */
+ $smarty->compile_dir= '/var/spool/gosa/';
+ $smarty->template_dir = '../';
+ $smarty->caching= false;
+ $smarty->php_handling= SMARTY_PHP_REMOVE;
+ return($smarty);
+}
+
+
+
/* Escape all preg_* relevant characters */
function normalizePreg($input)
{
index e4f58136a0642d81031db71ad974af3115d10926..9ffc3c3c1e79ad5de6f0c6bc07498dbe05d102a6 100644 (file)
/* This is good for testing... */
error_reporting (E_ALL | E_STRICT);
+
+function get_smarty()
+{
+ echo "Smarty fake in each ./tests/ListTest[1-9]/index.php";
+ date_default_timezone_set("europe/berlin");
+ $smarty = new smarty;
+ /* Set template compile directory */
+ $smarty->compile_dir= '/var/spool/gosa/';
+ $smarty->template_dir = '../';
+ $smarty->caching= false;
+ $smarty->php_handling= SMARTY_PHP_REMOVE;
+ return($smarty);
+}
+
+
+
/* Escape all preg_* relevant characters */
function normalizePreg($input)
{
index 3f483cf8bf5d2e814f28421b79546e18a4101ba6..ef4b866fc496f06fcd2394e525f741752240d70c 100644 (file)
height: 22px;
}
-
+.ObjectListViewport_Entry_Checkbox {
+}
index 3327ce1b954fb0db635b7948201f8a276046b20e..dc42d5ff420ba1bbe640333a1a141ad7a3b73979 100644 (file)
-
/* Register resize event to force redraw of all
* displayed lists
*/
window.onload = updateObjectListViewportSize;
window.onresize = updateObjectListViewportSize;
- function updateObjectListViewportSize() {
-
- var header = 0;
- var footer = 0;
- var viewport = 0;
- var viewport_w = 0;
- var all = new Array();
- var i = 0;
- var list_id = "";
- var calc = 0;
-
- /* Somehow IE do not need to be resized
- * So skip the following part if the client uses ie
- */
- if(document.all && !window.opera){
- all = getElementsByStyleClass('ObjectListViewport_Entry_Cover');
- for (i = 0; i < all.length; ++i){
- document.getElementById(all[i].id).style.height= "100%";
- }
- return;
- }
-
- all = getElementsByStyleClass('ObjectListViewport');
- for (i = 0; i < all.length; ++i){
-
- list_id = all[i].id.replace(/^ObjectListViewport/,"");
-
- /* Set Viewport to min height, to ensure
- * that resize will work correctly in konqueror
- */
- document.getElementById('ObjectListViewport_Entry_Cover' + list_id).style.height= "50px";
-
- /* Get values of displayed header and footer heights to be
- * able to recalculate the Viewport
- */
- viewport = getObjectHeight('ObjectListViewport_Table' + list_id);
-
- /* Get Header height for ViewPort height calculation */
- if(document.getElementById('ObjectListViewport_TD_Header' + list_id)){
- header = getObjectHeight('ObjectListViewport_TD_Header' + list_id);
- }else{
- header =0;
- }
-
- /* Get Footer height for ViewPort height calculation */
- if(document.getElementById('ObjectListViewport_TD_Footer' + list_id)){
- footer = getObjectHeight('ObjectListViewport_TD_Footer' + list_id);
- }else{
- footer = 0
- }
-
- /* Calculate the new visible entry part height. */
- calc = (viewport - ( header + footer ));
- document.getElementById('ObjectListViewport_Entry_Cover' + list_id).style.height = calc;
-
- /* Reduce width of entry list, we need some space to
- * display the scrollbar without breaking the layout
- * Only required if a header is shown.
- */
- if(document.getElementById('ObjectListViewport_TD_Header' + list_id)){
- viewport_w = getObjectWidth('ObjectListViewport_Table' + list_id);
- document.getElementById('ObjectListViewport_Entry_Table' + list_id).style.width = (viewport_w - 18) + 'px';
- document.getElementById('ObjectListViewport_Header_Table' + list_id).style.width = (viewport_w - 18) + 'px';
- }
- }
+function toggle_all_(regex,state_object)
+{
+ state = document.getElementById(state_object).checked;
+ chk_set_all(regex, state);
+}
+
+/* Toggle checkbox that matches regex */
+function chk_set_all(regex,value)
+{
+ var all = getElementsByStyleClass('ObjectListViewport_Entry_Checkbox');
+ for (var i = 0; i < all.length; ++i){
+ if(document.getElementById(all[i].id) && all[i].id.match(regex)){
+ document.getElementById(all[i].id).checked= value;
+ }
}
+}
+
+
+function updateObjectListViewportSize() {
+ var header = 0;
+ var footer = 0;
+ var viewport = 0;
+ var viewport_w = 0;
+ var all = new Array();
+ var i = 0;
+ var list_id = "";
+ var calc = 0;
- /* Return all elements of a specific class */
- function getElementsByStyleClass (className) {
- var all = document.all ? document.all : document.getElementsByTagName('*');
- var elements = new Array();
- for (var e = 0; e < all.length; e++)
- if (all[e].className == className)
- elements[elements.length] = all[e];
- return elements;
+ /* Somehow IE do not need to be resized
+ * So skip the following part if the client uses ie
+ */
+ if(document.all && !window.opera){
+ all = getElementsByStyleClass('ObjectListViewport_Entry_Cover');
+ for (i = 0; i < all.length; ++i){
+ document.getElementById(all[i].id).style.height= "100%";
}
+ return;
+ }
+
+ all = getElementsByStyleClass('ObjectListViewport');
+ for (i = 0; i < all.length; ++i){
+
+ list_id = all[i].id.replace(/^ObjectListViewport/,"");
+
+ /* Set Viewport to min height, to ensure
+ * that resize will work correctly in konqueror
+ */
+ document.getElementById('ObjectListViewport_Entry_Cover' + list_id).style.height= "50px";
+
+ /* Get values of displayed header and footer heights to be
+ * able to recalculate the Viewport
+ */
+ viewport = getObjectHeight('ObjectListViewport_Table' + list_id);
+ /* Get Header height for ViewPort height calculation */
+ if(document.getElementById('ObjectListViewport_TD_Header' + list_id)){
+ header = getObjectHeight('ObjectListViewport_TD_Header' + list_id);
+ }else{
+ header =0;
+ }
- /* Return integer value of style attribute width for specified ID */
- function getObjectWidth(obj){
- if(document.getElementById(obj)){
- obj = getComputedStyle(document.getElementById(obj),"").width;
- return(parseInt(obj.replace(/px/,'')));
- }else{
- return(0);
- }
+ /* Get Footer height for ViewPort height calculation */
+ if(document.getElementById('ObjectListViewport_TD_Footer' + list_id)){
+ footer = getObjectHeight('ObjectListViewport_TD_Footer' + list_id);
+ }else{
+ footer = 0
}
- /* Return integer value of style attribute height for specified ID */
- function getObjectHeight(obj){
- if(document.getElementById(obj)){
- obj = getComputedStyle(document.getElementById(obj),"").height;
- return(parseInt(obj.replace(/px/,'')));
- }else{
- return(0);
- }
+ /* Calculate the new visible entry part height. */
+ calc = (viewport - ( header + footer ));
+ document.getElementById('ObjectListViewport_Entry_Cover' + list_id).style.height = calc;
+
+ /* Reduce width of entry list, we need some space to
+ * display the scrollbar without breaking the layout
+ * Only required if a header is shown.
+ */
+ if(document.getElementById('ObjectListViewport_TD_Header' + list_id)){
+ viewport_w = getObjectWidth('ObjectListViewport_Table' + list_id);
+ document.getElementById('ObjectListViewport_Entry_Table' + list_id).style.width = (viewport_w - 18) + 'px';
+ document.getElementById('ObjectListViewport_Header_Table' + list_id).style.width = (viewport_w - 18) + 'px';
}
+ }
+}
+
+
+/* Return all elements of a specific class */
+function getElementsByStyleClass (className) {
+ var all = document.all ? document.all : document.getElementsByTagName('*');
+ var elements = new Array();
+ for (var e = 0; e < all.length; e++)
+ if (all[e].className == className)
+ elements[elements.length] = all[e];
+ return elements;
+}
+
+
+/* Return integer value of style attribute width for specified ID */
+function getObjectWidth(obj){
+ if(document.getElementById(obj)){
+ obj = getComputedStyle(document.getElementById(obj),"").width;
+ return(parseInt(obj.replace(/px/,'')));
+ }else{
+ return(0);
+ }
+}
+
+/* Return integer value of style attribute height for specified ID */
+function getObjectHeight(obj){
+ if(document.getElementById(obj)){
+ obj = getComputedStyle(document.getElementById(obj),"").height;
+ return(parseInt(obj.replace(/px/,'')));
+ }else{
+ return(0);
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 5619ce35e017791c78c71df0169381cd252b7294..c5f96f7a53cf41cba751f1f33518028b08947925 100644 (file)
<td class='ObjectListViewport_TD_Header' id='ObjectListViewport_TD_Header_{$OLV_List_Id}'>
<table class='ObjectListViewport_Header_Table' id='ObjectListViewport_Header_Table_{$OLV_List_Id}'>
<tr>
+ {if $OLV_Multiselect_Enabled}
+ <td class="ObjectListViewport_Header_Cell" style='width:24px;text-align:center;' >
+ <input class="ObjectListViewport_Entry_Checkbox" type="checkbox"
+ id="ObjectListViewport_Entry_Checkbox_{$OLV_List_Id}_select_all"
+ onclick='toggle_all_("^ObjectListViewport_Entry_Checkbox_{$OLV_List_Id}_.*$",
+ "ObjectListViewport_Entry_Checkbox_{$OLV_List_Id}_select_all");'
+ name="ObjectListViewportEntry_{$OLV_List_Id}_{$key}" value="1">
+ </td>
+ {/if}
{foreach from=$OLV_Header key=key item=item}
<td class='ObjectListViewport_Header_Cell' style='{$item.style}'>{$item.name}</td>
{/foreach}
<table class='ObjectListViewport_Entry_Table' id='ObjectListViewport_Entry_Table_{$OLV_List_Id}'>
{foreach from=$OLV_Entries key=key item=item}
<tr class="{$item.row.class}">
+ {if $OLV_Multiselect_Enabled}
+ <td class="ObjectListViewport_Entry_Cell" style='width:24px;text-align:center;'>
+ <input class="ObjectListViewport_Entry_Checkbox" type="checkbox"
+ id="ObjectListViewport_Entry_Checkbox_{$OLV_List_Id}_{$key}"
+ name="ObjectListViewportEntry_{$OLV_List_Id}_{$key}" value="1">
+ </td>
+ {/if}
{foreach from=$item.cols key=key2 item=item2}
<td class='ObjectListViewport_Entry_Cell' style='{$item2.style1}'>
<div style='{$item2.style2}'>