diff --git a/etemplate/inc/class.boetemplate.inc.php b/etemplate/inc/class.boetemplate.inc.php index 66b2079a52..463703ca09 100644 --- a/etemplate/inc/class.boetemplate.inc.php +++ b/etemplate/inc/class.boetemplate.inc.php @@ -43,7 +43,7 @@ 'html' => 'Html', // Raw html in $content[$cell['name']] 'file' => 'FileUpload', // show an input type='file', set the local name as ${name}_path 'vbox' => 'VBox', // a (vertical) box to contain widgets in rows, size = # of rows - 'hbox' => 'HBox' // a (horizontal) box to contain widgets in cols, size = # of cols + 'hbox' => 'HBox' // a (horizontal) box to contain widgets in cols, size = # of cols ); /*! @function boetemplate @@ -106,6 +106,10 @@ */ function expand_name($name,$c,$row,$c_='',$row_='',$cont='') { + if (strstr($name,'$') === False) + { + return $name; + } if (!$cont) { $cont = array(); @@ -564,10 +568,22 @@ */ function read($name,$template='default',$lang='default',$group=0,$version='',$load_via='') { - if (is_array($name) && empty($name['name']) || empty($name)) + if (is_array($name)) { + $pname = &$name['name']; + } + else + { + $pname = &$name; + } + if (empty($pname)) { return False; } + $parent = is_array($load_via) ? $load_via['name'] : $load_via; + if (strstr($pname,'.') === False && !empty($parent)) + { + $pname = $parent . '.' . $pname; + } if (!$this->read_from_cache($name,$template,$lang,$group,$version)) { if (!soetemplate::read($name,$template,$lang,$group,$version)) diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 6eb50cd10e..ee4b2ebdac 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -165,21 +165,6 @@ case 'vbox': case 'hbox': $cell['cell_tpl'] = '.vbox'; - if ($cell['size'] < 2) - { - $cell['size'] = 2; - } - for ($n = 1; $n <= $cell['size']; ++$n) // create new rows - { - if (!isset($cell[$n]) || !is_array($cell[$n])) - { - $cell[$n] = $this->etemplate->empty_cell(); - } - } - while (isset($cell[$n])) // unset not longer used rows - { - unset($cell[$n++]); - } break; } $content[$col.$row] = $cell; @@ -251,7 +236,30 @@ $row = 1; $col = 0; while (isset($content[$name = $this->etemplate->num2chrs($col) . $row])) { - $row_data[$this->etemplate->num2chrs($col++)] = $content[$name]; + $cell = &$content[$name]; + switch ($cell['type']) + { + case 'vbox': + case 'hbox': + if ($cell['size'] < 2) + { + $cell['size'] = 2; + } + for ($n = 1; $n <= $cell['size']; ++$n) // create new rows + { + if (!isset($cell[$n]) || !is_array($cell[$n])) + { + $cell[$n] = $this->etemplate->empty_cell(); + } + } + while (isset($cell[$n])) // unset not longer used rows + { + unset($cell[$n++]); + } + break; + } + $row_data[$this->etemplate->num2chrs($col++)] = $cell; + if (!isset($content[$name = $this->etemplate->num2chrs($col) . $row])) // try new row { if ($col > $cols) diff --git a/etemplate/inc/class.html.inc.php b/etemplate/inc/class.html.inc.php index deb04d48f9..f40913d46d 100644 --- a/etemplate/inc/class.html.inc.php +++ b/etemplate/inc/class.html.inc.php @@ -173,6 +173,7 @@ class html $vars = implode('&',$v); } list($url,$v) = explode('?',$url); // url may contain additional vars + if ($url == '') $url = '/index.php'; if ($v) $vars .= ($vars ? '&' : '') . $v; @@ -274,7 +275,12 @@ class html { if (!strstr($url,'/') && count(explode('.',$url)) == 3) $url = "/index.php?menuaction=$url"; - + + if (is_array($url)) + { + $vars = $url; + $url = '/index.php'; + } return ''.$content.''; } diff --git a/etemplate/inc/class.soetemplate.inc.php b/etemplate/inc/class.soetemplate.inc.php index 119459f5fd..d3a559cc7c 100644 --- a/etemplate/inc/class.soetemplate.inc.php +++ b/etemplate/inc/class.soetemplate.inc.php @@ -707,7 +707,10 @@ $solangfile = CreateObject('developer_tools.solangfile'); $langarr = $solangfile->load_app($app,$lang); - + if (!is_array($langarr)) + { + $langarr = array(); + } $to_trans = $this->getToTranslateApp($app); if (is_array($additional)) { @@ -721,13 +724,12 @@ unset($to_trans['']); for ($new = $n = 0; list($message_id,$content) = each($to_trans); ++$n) { - if (!isset($langarr[$content]) && !isset($langarr[$message_id])) - { // caused by not lowercased-message_id's - $langarr[$message_id] = $langarr[$content]; - unset($langarr[$content]); - } if (!isset($langarr[$message_id])) { + if (isset($langarr[$content])) // caused by not lowercased-message_id's + { + unset($langarr[$content]); + } $langarr[$message_id] = array( 'message_id' => $message_id, 'app_name' => $app, diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 6f85d9f356..5f01a94e09 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -58,6 +58,20 @@ $this->stable = $a <= 0 && $b <= 9 && $c <= 14; } + /*! + @function header + @abstract Abstracts a html-header call + @discussion In other UI's than html this needs to call the methode, defined by menuaction or + @discussion open a browser-window for any other links. + */ + function header($vars='') + { + Header('Location: ' . $this->html->link(is_array($vars) ? '/index.php' : $vars, + is_array($vars) ? $vars : '')); + + $GLOBALS['phpgw']->common->phpgw_exit(); + } + /*! @function exec @abstract Generats a Dialog from an eTemplate - abstract the UI-layer @@ -204,7 +218,7 @@ } $result = count($vals) == 1 ? $val != '' : $val == $check_val; if ($not) $result = !$result; - echo "
check_disabled: '".($not?'!':'')."$disabled' = '$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = ".($result?'True':'False')."
\n"; + //echo "check_disabled: '".($not?'!':'')."$disabled' = '$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = ".($result?'True':'False')."
\n"; return $result; } @@ -339,6 +353,10 @@ $row_data[".$col"] .= $this->html->formatOptions($cell['align'],'ALIGN'); list(,$cl) = explode(',',$cell['span']); $cl = isset($this->class_conf[$cl]) ? $this->class_conf[$cl] : $cl; + if (strstr($cl,'$') !== False) + { + $cl = $this->expand_name($cl,$c,$r,'','',$content); + } $row_data[".$col"] .= $this->html->formatOptions($cl,'CLASS'); } $rows[$row] = $row_data; @@ -449,15 +467,17 @@ list($type,$sub_type) = explode('-',$cell['type']); switch ($type) { - case 'label': // size: [[b]old][[i]talic] + case 'label': // size: [[b]old][[i]talic][,link] if (is_array($value)) break; + list($style,$extra_link) = explode(',',$cell['size']); $value = strlen($value) > 1 && !$cell['no_lang'] ? lang($value) : $value; - if ($value != '' && strstr($cell['size'],'b')) $value = $this->html->bold($value); - if ($value != '' && strstr($cell['size'],'i')) $value = $this->html->italic($value); + if ($value != '' && strstr($style,'b')) $value = $this->html->bold($value); + if ($value != '' && strstr($style,'i')) $value = $this->html->italic($value); $html .= $value; break; case 'html': + $extra_link = $cell['size']; $html .= $value; break; case 'int': // size: [min][,[max][,len]] @@ -663,7 +683,8 @@ $image = $value != '' ? $value : $name; $image = $this->html->image(substr($this->name,0,strpos($this->name,'.')), $image,strlen($label) > 1 && !$cell['no_lang'] ? lang($label) : $label,'BORDER="0"'); - $html .= $cell['size'] == '' ? $image : $this->html->a_href($image,$cell['size']); + $html .= $image; + $extra_link = $cell['size']; $extra_label = False; break; case 'file': @@ -703,7 +724,10 @@ } if ($box_anz > 1) // a single cell is NOT placed into a table { - $html = "\n\n\n\n".$this->html->table($rows)."\n\n\n\n"; + $html = "\n\n\n\n". + $this->html->table($rows,$this->html->formatOptions($cell['size'],',CELLPADDING,CELLSPACING'). + ($cell['align'] ? ' WIDTH="100%"' : '')). // alignment only works if table has full width + "\n\n\n\n"; } break; default: @@ -742,6 +766,14 @@ $html = ' '; } } + if ($extra_link) + { + if ($extra_link[0] == '@') + { + $extra_link = $this->get_array($content,substr($extra_link,1)); + } + return $this->html->a_href($html,$extra_link,'',$help != '' ? 'TITLE="'.lang($help).'"' : ''); + } return $html; } diff --git a/etemplate/inc/class.xul_io.inc.php b/etemplate/inc/class.xul_io.inc.php index 7474781bb6..162461ba8b 100644 --- a/etemplate/inc/class.xul_io.inc.php +++ b/etemplate/inc/class.xul_io.inc.php @@ -121,22 +121,13 @@ } } - function cell2widget($cell,&$spanned,$etempl,&$root,$embeded_too=True) + function cell2widget($cell,&$spanned,$etempl,&$root,&$embeded_too) { $type = $cell['type']; if (is_array($type)) { list(,$type) = each($type); } - if ($type == 'template' && $cell['name'][0] != '@' && $embeded_too) - { - $embeded = new etemplate(); - if ($embeded->read($embeded->expand_name($cell['name'],0,0),'default','default',0,'',$etempl->as_array())) - { - $this->etempl2grid($embeded,&$root,$embeded_too); - } - unset($embeded); - } if (substr($type,0,6) == 'select') { $type = $cell['size'] > 1 ? 'select-multi' : 'select'; @@ -168,7 +159,11 @@ { case 'nextmatch': $embeded = new etemplate($cell['size'],$etempl->as_array()); - $this->etempl2grid($embeded,&$root,$embeded_too); + if ($embeded_too) + { + $this->etempl2grid($embeded,&$root,$embeded_too); + } + $cell['size'] = $embeded->name; unset($embeded); break; case 'tabbox': @@ -183,7 +178,10 @@ $child->add_node($tab); $embeded = new etemplate($names[$n],$etempl->as_array()); - $this->etempl2grid($embeded,&$root,$embeded_too); + if ($embeded_too) + { + $this->etempl2grid($embeded,&$root,$embeded_too); + } $grid = new xmlnode('grid'); $grid->set_attribute('id',$embeded->name); $child2->add_node($grid); @@ -205,12 +203,26 @@ break; case 'vbox': case 'hbox': - for ($n = 1; $n <= $cell['size']; ++$n) + list($anz,$options) = split(',',$cell['size'],2); + for ($n = 1; $n <= $anz; ++$n) { $widget->add_node($this->cell2widget($cell[$n],$no_span,$etempl,$root,$embeded_too)); unset($cell[$n]); } - unset($cell['size']); + $cell['size'] = $options; + break; + + case 'grid': + if ($cell['name'][0] != '@' && $embeded_too) + { + $embeded = new etemplate(); + if ($embeded->read($name=$embeded->expand_name($cell['name'],0,0),'default','default',0,'',$etempl->as_array())) + { + $this->etempl2grid($embeded,&$root,$embeded_too); + } + $cell['name'] = $embeded->name; + unset($embeded); + } break; } while (list($attr,$val) = each($cell)) @@ -240,8 +252,21 @@ return $widget; } - function etempl2grid($etempl,&$root,$embeded_too=True) + function etempl2grid($etempl,&$root,&$embeded_too) { + if (is_array($embeded_too)) + { + if (isset($embeded_too[$etempl->name])) + { + return; // allready embeded + } + } + else + { + $embeded_too = array(); + } + $embeded_too[$etempl->name] = True; + $xul_grid = new xmlnode('grid'); $xul_grid->set_attribute('id',$etempl->name); $xul_grid->set_attribute('template',$etempl->template); @@ -304,7 +329,8 @@ $xul_overlay = new xmlnode('overlay'); - $this->etempl2grid($etempl,&$xul_overlay); + $embeded_too = True; + $this->etempl2grid($etempl,&$xul_overlay,$embeded_too); $doc->add_root($xul_overlay); $xml = $doc->export_xml(); @@ -337,7 +363,7 @@ else { $pcell = &$box[$node_level-1]; - $pcell[++$pcell['size']] = $cell; + $pcell[++$pcell['anz']] = $cell; } } @@ -506,7 +532,10 @@ } else { - $this->add_cell($etempl,$box[$node['level']],&$box,&$col,$node['level']); + $cell = &$box[$node['level']]; + $cell['size'] = $cell['anz'] . ($cell['size'] != '' ? ','.$cell['size'] : ''); + unset($cell['anz']); + $this->add_cell($etempl,$cell,&$box,&$col,$node['level']); unset($box[$node['level']]); } break; diff --git a/etemplate/setup/etemplates.inc.php b/etemplate/setup/etemplates.inc.php index c98b675828..f321c45291 100644 --- a/etemplate/setup/etemplates.inc.php +++ b/etemplate/setup/etemplates.inc.php @@ -1,13 +1,17 @@ 'etemplate.editor.buttons','template' => '','lang' => '','group' => '0','version' => '0.9.13.004','data' => 'a:2:{i:0;a:0:{}i:1;a:10:{s:1:\"A\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:4:\"Read\";s:4:\"name\";s:4:\"read\";s:4:\"help\";s:49:\"read eTemplate from database (for the keys above)\";}s:1:\"B\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:14:\"Show (no save)\";s:4:\"name\";s:4:\"show\";s:4:\"help\";s:61:\"shows/displays eTemplate for testing, does NOT save it before\";}s:1:\"C\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:11:\"Show Values\";s:4:\"name\";s:6:\"values\";s:4:\"help\";s:65:\"shows / allows you to enter values into the eTemplate for testing\";}s:1:\"D\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:4:\"Save\";s:4:\"name\";s:4:\"save\";s:4:\"help\";s:77:\"save the eTemplate under the above keys (name, ...), change them for a SaveAs\";}s:1:\"E\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:4:\"Edit\";s:4:\"name\";s:4:\"edit\";s:4:\"help\";s:30:\"edit the eTemplate spez. above\";}s:1:\"F\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:6:\"Delete\";s:4:\"name\";s:6:\"delete\";s:4:\"help\";s:33:\"deletes the eTemplate spez. above\";}s:1:\"G\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:10:\"Dump4Setup\";s:4:\"name\";s:4:\"dump\";s:4:\"help\";s:88:\"writes a \'etemplates.inc.php\' file (for application in Name) in the setup-dir of the app\";}s:1:\"H\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:14:\"Write Langfile\";s:4:\"name\";s:8:\"langfile\";s:4:\"help\";s:85:\"creates an english (\'en\') langfile from label and helptexts (for application in Name)\";}s:1:\"I\";a:1:{s:4:\"type\";s:5:\"label\";}s:1:\"J\";a:5:{s:4:\"type\";s:4:\"text\";s:4:\"size\";s:2:\"20\";s:5:\"label\";s:46:\"Width, Height, Border, class, Spacing, Padding\";s:4:\"name\";s:4:\"size\";s:4:\"help\";s:93:\"width, height, border-line-thickness, CSS-class name, Celspacing, Cellpadding (for TABLE tag)\";}}}','size' => '','style' => '','modified' => '1034517479',); + $templ_data[] = array('name' => 'etemplate.tab_widget.test','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:5:{i:0;a:1:{s:1:\"A\";s:3:\"250\";}i:1;a:2:{s:1:\"A\";a:4:{s:4:\"type\";s:4:\"text\";s:5:\"label\";s:7:\"Surname\";s:4:\"name\";s:7:\"surname\";s:4:\"help\";s:7:\"Surname\";}s:1:\"B\";a:4:{s:4:\"type\";s:4:\"text\";s:5:\"label\";s:10:\"Familyname\";s:4:\"name\";s:10:\"familyname\";s:4:\"help\";s:10:\"Familyname\";}}i:2;a:2:{s:1:\"A\";a:5:{s:4:\"type\";s:3:\"tab\";s:4:\"span\";s:3:\"all\";s:5:\"label\";s:16:\"Privat|Work|Note\";s:4:\"name\";s:16:\"privat|work|note\";s:4:\"help\";s:42:\"privat address|work address|free note-text\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}}i:3;a:2:{s:1:\"A\";a:2:{s:4:\"type\";s:5:\"label\";s:4:\"span\";s:3:\"all\";}s:1:\"B\";a:1:{s:4:\"type\";s:5:\"label\";}}i:4;a:2:{s:1:\"A\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:4:\"Save\";s:4:\"name\";s:4:\"save\";s:4:\"help\";s:12:\"Save changes\";}s:1:\"B\";a:4:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:6:\"Cancel\";s:4:\"name\";s:6:\"cancel\";s:4:\"help\";s:26:\"Cancel, discarding changes\";}}}','size' => '','style' => '','modified' => '1033814007',); $templ_data[] = array('name' => 'etemplate.editor.col_header','template' => '','lang' => '','group' => '0','version' => '0.9.13.003','data' => 'a:2:{i:0;a:4:{s:1:\"A\";s:2:\"5%\";s:1:\"B\";s:2:\"5%\";s:1:\"C\";s:3:\"50%\";s:1:\"D\";s:3:\"40%\";}i:1;a:6:{s:1:\"A\";a:5:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:1:\"+\";s:7:\"no_lang\";s:1:\"1\";s:4:\"name\";s:13:\"insert_col[0]\";s:4:\"help\";s:33:\"insert new column in front of all\";}s:1:\"B\";a:5:{s:4:\"type\";s:6:\"button\";s:5:\"label\";s:3:\">|<\";s:7:\"no_lang\";s:1:\"1\";s:4:\"name\";s:17:\"exchange_col[$c_]\";s:4:\"help\";s:25:\"exchange this two columns\";}s:1:\"C\";a:5:{s:4:\"type\";s:5:\"label\";s:4:\"size\";s:1:\"b\";s:7:\"no_lang\";s:1:\"1\";s:5:\"align\";s:6:\"center\";s:4:\"name\";s:4:\".col\";}s:1:\"D\";a:6:{s:4:\"type\";s:4:\"text\";s:4:\"size\";s:1:\"5\";s:5:\"label\";s:14:\"Width, Disable\";s:5:\"align\";s:5:\"right\";s:4:\"name\";s:12:\"width[$col_]\";s:4:\"help\";s:122:\"width of col (in % or pixel), disable col: [! = not]soinfolog.readIdArray(action='$action',action_id='$action_id')
\n"; $action2app = array( - 'addr' => 'addressbook', - 'proj' => 'projects', - 'event' => 'calendar' + 'addr' => 'addressbook', + 'addressbook' => 'addressbook', + 'proj' => 'projects', + 'projects' => 'projects', + 'event' => 'calendar', + 'calendar' => 'calendar' ); - if ($action != '' && $action2app[$action] != '') + if ($action != '' && isset($action2app[$action])) { $links = $this->links->get_links($action2app[$action],$action_id); - $ids = array(); - while (list($nul,$link) = each($links)) + $total = count($links); + if ($start > $total) { - $ids[''.$link['id']] = 0; + $start = 0; + } + $ids = array(); + while (list($n,$link) = each($links) && + $n < $start+$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) + { + if ($n >= $start) + { + $ids[''.$link['id']] = 0; + } } //echo "soinfolog.readIdArray($action,$action_id) ids ="; _debug_array($ids); return $ids; } if ($order) { - $ordermethod = 'order by ' . $order . ' ' . $sort; + $ordermethod = 'ORDER BY ' . $order . ' ' . $sort; } else { - $ordermethod = 'order by info_datemodified desc'; // newest first + $ordermethod = 'ORDER BY info_datemodified DESC'; // newest first } $filtermethod = $this->aclFilter($filter); $filtermethod .= $this->statusFilter($filter); @@ -297,6 +309,7 @@ { $filtermethod .= " AND info_cat='$cat_id' "; } + /* not longer used switch ($action) { case 'addr': $filtermethod .= " AND info_addr_id=$action_id "; @@ -306,10 +319,11 @@ case 'event': $filtermethod .= " AND info_event_id=$action_id "; break; } + */ if ($query) // we search in _from, _subject and _des for $query { $sql_query = "AND (info_from like '%$query%' OR info_subject ". - "like '%$query%' OR info_des like '%$query%') "; + "LIKE '%$query%' OR info_des LIKE '%$query%') "; } $pid = 'AND info_id_parent='.($action == 'sp' ? $action_id : 0); @@ -327,8 +341,8 @@ { $start = 0; } - $this->db->limit_query("SELECT info_id,info_id_parent FROM phpgw_infolog WHERE $filtermethod $pid $sql_query $ordermethod",$start,__LINE__,__FILE__); - + $this->db->limit_query($sql="SELECT info_id,info_id_parent FROM phpgw_infolog WHERE $filtermethod $pid $sql_query $ordermethod",$start,__LINE__,__FILE__); + $ids = array( ); while ($this->db->next_record()) { diff --git a/infolog/inc/class.uiinfolog.inc.php b/infolog/inc/class.uiinfolog.inc.php index e8cd98f8c7..756b3e27c8 100644 --- a/infolog/inc/class.uiinfolog.inc.php +++ b/infolog/inc/class.uiinfolog.inc.php @@ -17,14 +17,15 @@ { var $public_functions = array ( - 'get_list' => True, + //'get_list' => True, 'index' => True, 'edit' => True, 'delete' => True, 'get_file' => True, 'add_file' => True, 'admin' => True, - 'preferences' => True + 'preferences' => True, + 'writeLangFile' => True ); var $icons; @@ -71,14 +72,292 @@ $this->messages = array( 'edit' => 'InfoLog - Edit', 'add' => 'InfoLog - New', - 'add_sub' => 'InfoLog - New Subproject' + 'add_sub' => 'InfoLog - New Subproject', + 'sp' => '- Subprojects from', + 're' => 'Re:' ); - $this->html = CreateObject('etemplate.html'); - $this->categories = CreateObject('phpgwapi.categories'); - $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); + //$this->html = CreateObject('etemplate.html'); + //$this->categories = CreateObject('phpgwapi.categories'); + //$this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); $this->link = CreateObject('infolog.uilink'); $this->tmpl = CreateObject('etemplate.etemplate'); + $this->html = &$this->tmpl->html; + } + + function get_info($id,&$readonlys,$action='',$action_id='') + { + $info = $this->bo->read($id); + $info['anzSubs'] = $this->bo->anzSubs($id); + $info += $this->formatInfo($info,$action,$action_id); + + $readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT); + $readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE); + $readonlys["sp[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_ADD); + $readonlys["view[$id]"] = $info['anzSubs'] < 1; + $readonlys['view[0]'] = True; // no parent + + return $info; + } + + function get_rows($query,&$rows,&$readonlys) + { + //echo "
uiinfolog.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]')
\n"; + + $ids = $this->bo->readIdArray($query['order'],$query['sort'],$query['filter'],$query['cat_id'], + $query['search'],$query['action'],$query['action_id'],$query['ordermethod'], + $query['start'],$total); + + if (!is_array($ids)) + { + $ids = array( ); + } + $rows = array( $total ); + $readonlys = array(); + while (list($id,$parent) = each($ids)) + { + $rows[] = $this->get_info($id,$readonlys,$query['action'],$query['action_id']); + } + //echo "readonlys = "; _debug_array($readonlys); + reset($rows); + + return $total; + } + + function delete($values=0,$referer='') + { + $info_id = is_array($values) ? $values['info_id'] : $values; + $referer = is_array($values) ? $values['referer'] : $referer; + + if (is_array($values) || $info_id <= 0) + { + if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE)) + { + $this->bo->delete($info_id); + } + return $referer ? $this->tmpl->header($referer) : $this->index(); + } + $readonlys = $values = array(); + $values['main'][1] = $this->get_info($info_id,&$readonlys['main']); + + $this->tmpl->read('infolog.delete'); + + $values['main']['no_actions'] = True; + $persist['info_id'] = $info_id; + $persist['referer'] = $referer; + + $this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist); + } + + function index($values = 0,$action='',$action_id='',$referer=0) + { + $referer = is_array($values) ? $values['referer'] : $referer; + if (!is_array($values)) + { + $values = array('nm' => $GLOBALS['phpgw']->session->appsession('session_data','infolog')); + } + $action = $action ? $action : $values['nm']['action']; + $action_id = $action_id ? $action_id : $values['nm']['action_id']; + + if ($values['add'] || $values['cancel'] || isset($values['nm']['rows']) || isset($values['main'])) + { + $data = $values['nm']; + unset($data['rows']); + $GLOBALS['phpgw']->session->appsession('session_data','infolog',$data); + + if ($values['add']) + { + list($type) = each($values['add']); + return $this->edit(0,$values['nm']['action'],$values['nm']['action_id'],$type,$referer); + } + else + { + list($action,$action_id) = isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']); + list($action_id) = @each($action_id); + //echo "
infolog::index: action='$action', id='$action_id'
\n"; + switch($action) + { + case 'edit': + return $this->edit($action_id,'','','',$referer); + case 'delete': + return $this->delete($action_id,$referer); + case 'sp': + return $this->edit(0,$action,$action_id,'',$referer); + case 'view': + $value = array(); + $action = 'sp'; + break; + default: + $value = array(); + $action = ''; + $action_id = 0; + break; + } + } + } + switch ($action) + { + case 'sp': + if (!$this->bo->read($action_id)) + { + $action = ''; + $action_id = 0; + break; + } + $values['main'][1] = $this->get_info($action_id,&$readonlys['main']); + $values['appheader'] = $this->messages['sp']; + break; + } + $readonlys['cancel'] = $action != 'sp'; + + $this->tmpl->read('infolog.index'); + + $values['nm']['options-filter'] = $this->filters; + $values['nm']['get_rows'] = 'infolog.uiinfolog.get_rows'; + $values['nm']['no_filter2'] = True; + $persist['nm']['action'] = $values['nm']['action'] = $action; + $persist['nm']['action_id'] = $values['nm']['action_id'] = $action_id; + $persist['referer'] = $referer; + + $GLOBALS['phpgw']->session->appsession('session_data','infolog',$values['nm']); + + $this->tmpl->exec('infolog.uiinfolog.index',$values,'',$readonlys,$persist); + } + + /*! + @function edit + @syntax edit( $content=0,$action='',$action_id=0,$type='' ) + @author ralfbecker + @abstract Edit/Create an InfoLog Entry + @param $content Content from the eTemplate Exec call or info_id on inital call + @param $action Name of an app of 'sp' for a infolog-sub + @param $action_id Id of app-entry to which a link is created + @param $type Type of log-entry: note,todo,task + */ + function edit($content = 0,$action = '',$action_id=0,$type='',$referer='') + { + $referer = is_array($content) ? $content['referer'] : $referer; + + if (is_array($values) || $info_id < 0) + { + if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE)) + { + $this->bo->delete($info_id); + } + return $referer ? $this->tmpl->header($referer) : $this->index(); + } + if (is_array($content)) + { + $info_id = $content['info_id']; + $action = $content['action']; + $action_id = $content['action_id']; + + if ($content['save'] || $content['delete'] || $content['cancel']) + { + if ($content['save'] && (!$info_id || $this->bo->check_access($info_id,PHPGW_ACL_EDIT))) + { + $this->bo->write($content); + + if (!$info_id && is_array($content['link_to']['to_id'])) + { + $this->link->link('infolog',$this->bo->so->data['info_id'],$content['link_to']['to_id']); + } + } + elseif ($content['delete'] && $info_id > 0) + { + return $this->delete($info_id,$referer); // checks ACL first + } + return $referer ? $this->tmpl->header($referer) : $this->index(); + } + } + else + { + //echo "uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'
\n"; + $action = $action ? $action : get_var('action', array('POST','GET')); + $action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET')); + $info_id = $content ? $content : get_var('info_id', array('POST','GET')); + $type = $type ? $type : get_var('type', array('POST','GET')); + $referer = ''.$referer != '' ? $referer : get_var('HTTP_REFERER','SERVER'); + //echo "uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'
\n"; + + if (!isset($this->bo->enums['type'][$type])) + { + $type = 'note'; + } + $this->bo->read( $action == 'sp' && $action_id > 0 ? $action_id : $info_id ); + $content = $this->bo->so->data; + + if ($action_id && $action == 'sp') // new SubProject + { + if (!$this->bo->check_access($action_id,PHPGW_ACL_ADD)) + { + return $referer ? $this->tmpl->header($referer) : $this->index(); + } + $parent = $this->bo->so->data; + $content['info_id'] = $info_id = 0; + $content['info_owner'] = $GLOBALS['phpgw_info']['user']['account_id']; + $content['info_id_parent'] = $parent['info_id']; + /* + if ($parent['info_type']=='task' && $parent['info_status']=='offer') + { + $content['info_type'] = 'confirm'; // confirmation to parent + $content['info_responsible'] = $parent['info_owner']; + } + */ + $content['info_status'] = 'ongoing'; + $content['info_confirm'] = 'not'; + $content['info_subject']=lang($this->messages['re']).' '.$parent['info_subject']; + $content['info_des'] = ''; + $content['info_lastmodified'] = ''; + } + else + { + if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT)) + { + return $referer ? $this->tmpl->header($referer) : $this->index(); + } + } + $content['links'] = $content['link_to'] = array( + 'to_id' => $info_id, + 'to_app' => 'infolog' + ); + switch ($action) + { + case 'sp': + break; + case 'addressbook': + case 'projects': + case 'calendar': + $this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id); + case 'new': + $content['info_type'] = $type; + break; + default: + $action = ''; + break; + } + if (!isset($this->bo->enums['type'][$content['info_type']])) + { + $content['info_type'] = 'note'; + } + } + $readonlys['delete'] = $action != ''; + $content['appheader'] = $this->messages[$action ? ($action == 'sp' ? 'add_sub' : 'add') : 'edit']; + + //echo "uiinfolog.edit(info_id=$info_id,mode=$mode) content = "; _debug_array($content);
+ $this->tmpl->read('infolog.edit');
+ $this->tmpl->exec('infolog.uiinfolog.edit',$content,array(
+ 'info_type' => $this->bo->enums['type'],
+ 'info_pri' => $this->bo->enums['priority'],
+ 'info_confirm' => $this->bo->enums['confirm'],
+ 'info_status' => $this->bo->status[$content['info_type']]
+ ),$readonlys,array(
+ 'info_id' => $info_id,
+ 'info_id_parent' => $content['info_id_parent'],
+ 'action' => $action,
+ 'action_id' => $action_id,
+ 'referer' => $referer
+ ));
}
function menuaction($action = 'get_list',$app='infolog')
@@ -131,7 +410,7 @@
$css_class = $info['info_pri'].($done ? '_done' : '');
$subject = "";
-
+/*
if (($action_id != ($proj_id = $info['info_proj_id']) || $action != 'proj') &&
$proj = $this->bo->readProj($proj_id))
{
@@ -184,7 +463,7 @@
'action_id' => $event_id
)
));
- }
+ } */
if (($from = $info['info_from']) && (!$addr || !strstr($addr,$from)))
{
if ($addr || $event) $subject .= ' uiinfolog.edit(info_id=$info_id,mode=$mode) content = "; _debug_array($content);
- $this->tmpl->read('infolog.edit');
- $this->tmpl->exec('infolog.uiinfolog.edit',$content,array(
- 'info_type' => $this->bo->enums['type'],
- 'info_pri' => $this->bo->enums['priority'],
- 'info_confirm' => $this->bo->enums['confirm'],
- 'info_status' => $this->bo->status[$content['info_type']]
- ),$readonlys,array(
- 'info_id' => $info_id,
- 'action' => $action,
- 'action_id' => $action_id
- ));
- }
-
function old_edit( )
{
global $action,$info_id,$save,$add,$query_addr,$query_project;
@@ -1154,7 +1304,7 @@
$GLOBALS['phpgw']->template->fp('phpgw_body','info_edit');
}
- function delete( $id=0 )
+ function old_delete( $id=0 )
{
global $info_id,$confirm,$to_del;
//echo " delete(id=$id): info_id='$info_id', confirm='$confirm', to_del='$to_del'
';
@@ -232,7 +511,7 @@
{
$owner = "$owner";
}
-
+/*
// add the links to the files which corrospond to this entry
$attachments = $this->bo->list_attached($info['info_id']);
while (list($name,$comment) = @each($attachments))
@@ -245,7 +524,7 @@
),'target=_blank');
if ($comment) $links .= ' (' . $comment . ')';
}
-
+*/
return array(
'type' => $this->icon('type',$info['info_type']),
'status' => $this->icon('status',$info['info_status']),
@@ -695,135 +974,6 @@
$GLOBALS['phpgw']->template->fp('phpgw_body','info_add_file');
}
- function index()
- {
- $this->get_list();
- }
-
- /*!
- @function edit
- @syntax edit( $content=0,$action='',$action_id=0,$type='' )
- @author ralfbecker
- @abstract Edit/Create an InfoLog Entry
- @param $content Content from the eTemplate Exec call or info_id on inital call
- @param $action Name of an app of 'sp' for a infolog-sub
- @param $action_id Id of app-entry to which a link is created
- @param $type Type of log-entry: note,todo,task
- */
- function edit($content = 0,$action = '',$action_id=0,$type='')
- {
- if (is_array($content))
- {
- $info_id = $content['info_id'];
- $action = $content['action'];
- $action_id = $content['action_id'];
-
- if ($content['save'] || $content['delete'] || $content['cancel'])
- {
- if ($content['save'] && (!$info_id || $this->bo->check_access($info_id,PHPGW_ACL_EDIT)))
- {
- $this->bo->write($content);
-
- if (!$info_id && is_array($content['link_to']['to_id']))
- {
- $this->link->link('infolog',$this->bo->so->data['info_id'],$content['link_to']['to_id']);
- }
- }
- elseif ($content['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
- {
- return $this->delete($info_id);
- }
- return $this->index();
- }
- }
- else
- {
- $action = $action ? $action : get_var('action', array('POST','GET'));
- $action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET'));
- $info_id = $content ? $content : get_var('info_id', array('POST','GET'));
- $type = $type ? $type : get_var('type', array('POST','GET'));
- if (!isset($this->bo->enums['type'][$type]))
- {
- $type = 'note';
- }
- $this->bo->read( $info_id );
- $content = $this->bo->so->data;
-
- if ($info_id && $action == 'sp') // new SubProject
- {
- if (!$this->bo->check_access($info_id,PHPGW_ACL_ADD))
- {
- return $this->index();
- Header('Location: ' . $this->html->link($referer));
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
- $parent = $this->bo->so->data;
- $content['info_id'] = $info_id = 0;
- $content['info_owner'] = $GLOBALS['phpgw_info']['user']['account_id'];
- $content['info_id_parent'] = $parent['info_id'];
- /*
- if ($parent['info_type']=='task' && $parent['info_status']=='offer')
- {
- $content['info_type'] = 'confirm'; // confirmation to parent
- $content['info_responsible'] = $parent['info_owner'];
- }
- */
- $content['info_status'] = 'ongoing';
- $content['info_confirm'] = 'not';
- $content['info_subject']=lang('Re:').' '.$parent['info_subject'];
- $content['info_des'] = '';
- $content['info_lastmodified'] = '';
- }
- else
- {
- if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
- {
- return $this->index();
- Header('Location: ' . $this->html->link($referer));
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
- }
- $content['links'] = $content['link_to'] = array(
- 'to_id' => $info_id,
- 'to_app' => 'infolog'
- );
- switch ($action)
- {
- case 'sp':
- break;
- case 'addressbook':
- case 'projects':
- case 'calendar':
- $this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
- case 'new':
- $content['info_type'] = $type;
- break;
- default:
- $action = '';
- break;
- }
- if (!isset($this->bo->enums['type'][$content['info_type']]))
- {
- $content['info_type'] = 'note';
- }
- }
- $readonlys['delete'] = $action != '';
- $content['appheader'] = $this->messages[$action ? ($action == 'sp' ? 'add_sub' : 'add') : 'edit'];
-
- //echo "