Revision: 21005 http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21005 Author: sigurdne Date: 2010-01-30 17:03:40 +0000 (Sat, 30 Jan 2010) Log Message: ----------- Improvement: local oci8-support for testing, filter on location lookup and some new fields in helpdesk 4565:4680
Modified Paths: -------------- people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php people/sigurdne/modules/property/trunk/setup/default_records.inc.php people/sigurdne/modules/property/trunk/templates/base/tts.xsl Added Paths: ----------- people/sigurdne/modules/property/trunk/inc/class.db_oci8.inc.php Modified: people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -2011,11 +2011,6 @@ $values['location_name'] = phpgw::get_var('loc' . (count($values['location'])).'_name', 'string', 'POST'); // if not address - get the parent name as address } - if(isset($values['location']) && $values['location']) - { - phpgwapi_cache::session_set('property', 'filter_location', implode('-', $values['location'])); - } - return $values; } Modified: people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/inc/class.bolocation.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -280,13 +280,8 @@ } $filter_location = isset($data['filter_location']) ? $data['filter_location'] : ''; - if(!$filter_location) - { - $filter_location = phpgwapi_cache::session_get('property', 'filter_location'); - phpgwapi_cache::session_clear('property', 'filter_location'); - } $block_query = !!$filter_location; - $location_link = "menuaction:'property.uilocation.index',lookup:1,location_code:'{$filter_location}',block_query:'{$block_query}'"; + $location_link = "menuaction:'property.uilocation.index',lookup:1"; $config = $this->soadmin_location->read_config(''); @@ -354,6 +349,7 @@ $lookup_functions[] = array ( 'name' => 'lookup_loc' . ($i+1) . '()', + 'filter_level' => $i, 'link' => $location_link .',type_id:' . ($i+1) . ',lookup_name:' . $i, 'action' => 'Window1=window.open(strURL,"Search","width=1000,height=700,toolbar=no,scrollbars=yes,resizable=yes");' ); @@ -443,6 +439,7 @@ $lookup_functions[] = array ( 'name' => 'lookup_loc' . ($m+1) . '()', + 'filter_level' => $m, 'link' => $location_link .',lookup_tenant:1,type_id:' . $config[$j]['location_type'] . ',lookup_name:' . $i, 'action' => 'Window1=window.open(strURL,"Search","width=1600,height=700,toolbar=no,scrollbars=yes,resizable=yes");' ); @@ -583,10 +580,51 @@ if(isset($lookup_functions) && is_array($lookup_functions)) { $location['lookup_functions'] = ''; + $filter_level = 0; for ($j=0;$j<count($lookup_functions);$j++) { + if(isset( $lookup_functions[$j]['filter_level']) && $lookup_functions[$j]['filter_level'] > 0) + { + $lookup_functions[$j]['link'] .= ",block_query:block,location_code:filter"; + $_filter = array(); + for ($i=1;$i<=$lookup_functions[$j]['filter_level'];$i++) + { + $_filter[] = "document.form.loc{$i}.value"; + } + $filter_level = $lookup_functions[$j]['filter_level']; + } + else + { + $lookup_functions[$j]['link'] .= ",location_code:'{$filter_location}',block_query:'{$block_query}'"; + } + $location['lookup_functions'] .= "\t".'function ' . $lookup_functions[$j]['name'] ."\n"; $location['lookup_functions'] .= "\t".'{'."\n"; + if($filter_level) + { + $location['lookup_functions'] .= " + var block = ''; + var filter = ''; + var filter_level = {$filter_level}; + if (filter_level) + { + for(i=1;i<=filter_level;i++) + { + if(eval('document.form.loc'+i+'.value')) + { + block = true; + if(!filter) + { + filter = eval('document.form.loc'+i+'.value'); + } + else + { + filter = filter + '-' + eval('document.form.loc'+i+'.value'); + } + } + } + }"; + } $location['lookup_functions'] .= "\t\tvar oArgs = {" . $lookup_functions[$j]['link'] ."};" . "\n"; $location['lookup_functions'] .= "\t\tvar strURL = phpGWLink('index.php', oArgs);\n"; $location['lookup_functions'] .= "\t\t".$lookup_functions[$j]['action'] ."\n"; Modified: people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/inc/class.bolookup.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -108,13 +108,14 @@ if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] && $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0) { - $this->limit = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; + $limit = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; } else { - $this->limit = 15; + $limit = 15; } + $limit = $this->allrows ? 0 : $limit; $fields[0] = 'per_first_name'; $fields[1] = 'per_last_name'; $fields[2] = 'per_department'; @@ -138,7 +139,7 @@ $criteria = $addressbook->criteria_contacts(1, $category_filter, 'person', $this->query, $fields_search); $this->total_records = $addressbook->get_count_persons($criteria); - $contacts = $addressbook->get_persons($fields, $this->limit, $this->start, $this->order, $this->sort, '', $criteria); + $contacts = $addressbook->get_persons($fields, $this->start, $limit, $this->order, $this->sort, '', $criteria); $accounts = $GLOBALS['phpgw']->accounts->get_list(); $user_contacts = array(); Added: people/sigurdne/modules/property/trunk/inc/class.db_oci8.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.db_oci8.inc.php (rev 0) +++ people/sigurdne/modules/property/trunk/inc/class.db_oci8.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -0,0 +1,864 @@ +<?php + /* + * Oracle/OCI8 accessor based on Session Management for PHP3 + * + * (C) Copyright 1999-2000 Stefan Sels php...@sels.com + * + * based on db_oracle.inc by Luis Francisco Gonzalez Hernandez + * contains metadata() from db_oracle.inc 1.10 + * + * $Id$ + * + */ + + class DB_OCI8 + { + var $Debug = 0; + var $sqoe = 1; // show query on error + var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning) + + var $Host = ""; + var $Port = "1521"; + /* traditionally the full TNS name is placed in $Database; if having trouble with TNS resolution (and desiring a more legible configuration), place the host IP address in $Host and the Oracle SID in $Database as a shortcut - connect() will build a valid connection string using $full_connection_string */ + var $Database = ""; + var $User = ""; + var $Password = ""; + var $full_connection_string = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=%s)(PORT=%s)))(CONNECT_DATA=(SID=%s)))"; + + var $Link_ID = 0; + var $Query_ID = 0; + var $Record = array(); + var $Row; + var $Parse; + var $Error = ""; + var $autoCommit = 1; // Commit on successful query + var $autoCount = 1; // Count num_rows on select + + var $share_connections = false; + var $share_connection_name = ""; + // Defaults to the class name - set to another class name to share connections among different class extensions + + var $last_query_text = ""; + + var $num_rows; // Used to store the total of rows returned by a SELECT statement. + var $auto_stripslashes = false; + + /* public: constructor */ + function DB_OCI8($query = "") + { + if($query) + { + $this->query($query); + } + } + + function link_id() + { + return $this->Link_ID; + } + + function query_id() + { + return $this->Query_ID; + } + + function connect() + { + if ( 0 == $this->Link_ID ) + { + if ($this->Debug) + { + printf("<br>Connecting to $this->Database%s...<br>\n", (($this->Host) ? " ($this->Host)" : "")); + } + if($this->share_connections) + { + if(!$this->share_connection_name) + { + $this->share_connection_name = get_class($this) . "_Link_ID"; + } + else + { + $this->share_connection_name .= "_Link_ID"; + } + global ${$this->share_connection_name}; + if(${$this->share_connection_name}) + { + $this->Link_ID = ${$this->share_connection_name}; + return true; + } + } + $this->Link_ID = OCIPLogon($this->User, $this->Password, (($this->Host) ? sprintf($this->full_connection_string, $this->Host, $this->Port, $this->Database) : $this->Database), 'AL32UTF8'); + + if (!$this->Link_ID) + { + $this->connect_failed(); + return false; + } + if($this->share_connections) + { + ${$this->share_connection_name} = $this->Link_ID; + } + if ($this->Debug) + { + printf("<br>Obtained the Link_ID: $this->Link_ID<br>\n"); + } + } + } + + function connect_failed() + { + $this->Halt_On_Error = "yes"; + $this->halt(sprintf("connect ($this->User, \$Password, $this->Database%s) failed", (($this->Host) ? ", $this->Host" : ""))); + } + + function free() + { + if ($this->Parse) + { + if ($this->Debug) + { + printf("<br>Freeing the statement: $this->Parse<br>\n"); + } + $result = @OCIFreeStatement($this->Parse); + if (!$result) + { + $this->Error = OCIError($this->Link_ID); + if ($this->Debug) + { + printf("<br>Error: %s<br>", $this->Error["message"]); + } + } + } + } + + function query($Query_String) + { + $this->connect(); + $this->free(); + + $this->Parse = OCIParse($this->Link_ID, $Query_String); + if (!$this->Parse) + { + $this->Error = OCIError($this->Parse); + } + else + { + if ($this->autoCommit) + { + OCIExecute($this->Parse, OCI_COMMIT_ON_SUCCESS); + } + else + { + OCIExecute($this->Parse, OCI_DEFAULT); + } + if ($this->autoCount) + { + /* need to repeat the query to count the returned rows from a "select" statement. */ + if (eregi("SELECT", $Query_String)) + { + /* On $this->num_rows I'm storing the returned rows of the query. */ + $this->num_rows = OCIFetchStatement($this->Parse, $aux); + OCIExecute($this->Parse, OCI_DEFAULT); + } + } + $this->Error = OCIError($this->Parse); + } + + $this->Row = 0; + + if ($this->Debug) + { + printf("Debug: query = %s<br>\n", $Query_String); + } + + if ((1403 != $this->Error["code"]) and (0 != $this->Error["code"]) and $this->sqoe) + { + echo "<BR><FONT color=red><B>".$this->Error["message"]."<BR>Query :\"$Query_String\"</B></FONT>"; + } + $this->last_query_text = $Query_String; + return $this->Parse; + } + + + /** + * Execute a query with limited result set + * + * @param string $Query_String the query to be executed + * @param integer $offset row to start from + * @param integer $line the line method was called from - use __LINE__ + * @param string $file the file method was called from - use __FILE__ + * @param integer $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] + * @return integer current query id if sucesful and null if fails + */ + public function limit_query($sql, $offset = -1, $line = '', $file = '', $nrows = -1) + { + $this->connect(); + $this->free(); + + $this->Parse = OCIParse($this->Link_ID, $sql); + if (!$this->Parse) + { + $this->Error = OCIError($this->Parse); + } + + OCIExecute($this->Parse, OCI_DEFAULT); + + if ( (int) $nrows <= 0 ) + { + $nrows = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; + } + + $this->firstrows = true; + if ($this->firstrows) + { + if (strpos($sql,'/*+') !== false) + { + $sql = str_replace('/*+ ','/*+FIRST_ROWS ',$sql); + } + else + { + $sql = preg_replace('/^[ \t\n]*select/i','SELECT /*+FIRST_ROWS*/',$sql); + } + } + + // Algorithm by Tomas V V Cox, from PEAR DB oci8.php + + // Let Oracle return the name of the columns + $q_fields = "SELECT * FROM (".$sql.") WHERE NULL = NULL"; + +/* + $false = false; + if (! $stmt_arr = $this->Prepare($q_fields)) { + return $false; + } + $stmt = $stmt_arr[1]; + + + if (is_array($inputarr)) { + foreach($inputarr as $k => $v) { + if (is_array($v)) { + if (sizeof($v) == 2) // suggested by g.giu...@libero. + OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]); + else + OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]); + } else { + $len = -1; + if ($v === ' ') $len = 1; + if (isset($bindarr)) { // is prepared sql, so no need to ocibindbyname again + $bindarr[$k] = $v; + } else { // dynamic sql, so rebind every time + OCIBindByName($stmt,":$k",$inputarr[$k],$len); + + } + } + } + } + + if (!OCIExecute($stmt, OCI_DEFAULT)) { + OCIFreeStatement($stmt); + return $false; + } + + $ncols = OCINumCols($stmt); + for ( $i = 1; $i <= $ncols; $i++ ) { + $cols[] = '"'.OCIColumnName($stmt, $i).'"'; + } + +*/ + + $totalReg = OCINumcols($this->Parse); + for ($ix = 1; $ix <= $totalReg; $ix++) + { + $cols[] = strtoupper(OCIColumnname($this->Parse, $ix)); +// $colreturn = strtolower($col); + } + + + OCIFreeStatement($this->Parse); + $fields = implode(',', $cols); + if ($nrows <= 0) $nrows = 999999999999; + else $nrows += $offset; + $offset += 1; // in Oracle rownum starts at 1 + + $sql = "SELECT /*+ FIRST_ROWS */ $fields FROM". + "(SELECT rownum as adodb_rownum, $fields FROM". + " ($sql) WHERE rownum <= $nrows". + ") WHERE adodb_rownum >= $offset"; +//_debug_array($sql);die(); + return $this->query($sql); + } + + + function commit() + { + if ($this->autoCommit) { + $this->halt("Nothing to commit because AUTO COMMIT is on."); + } + return(OCICommit($this->Link_ID)); + } + + function rollback() + { + if ($this->autoCommit) + { + $this->halt("Nothing to rollback because AUTO COMMIT is on."); + } + return(OCIRollback($this->Link_ID)); + } + + /* This is requeried in some application. It emulates the mysql_insert_id() function. */ + /* Note: this function was copied from phpBB. */ + function insert_id($query_id = 0) + { + if (!$query_id) + { + $query_id = $this->Parse; + } + if ($query_id && $this->last_query_text != "") + { + if (eregi("^(INSERT{1}|^INSERT INTO{1})[[:space:]][\"]?([a-zA-Z0-9\_\-]+)[\"]?", $this->last_query_text[$query_id], $tablename)) + { + $query = "SELECT ".$tablename[2]."_id_seq.CURRVAL FROM DUAL"; + $temp_q_id = @OCIParse($this->db, $query); + @OCIExecute($temp_q_id, OCI_DEFAULT); + @OCIFetchInto($temp_q_id, $temp_result, OCI_ASSOC+OCI_RETURN_NULLS); + if ($temp_result) + { + return $temp_result["CURRVAL"]; + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + function next_record() + { + /* IF clause added to prevent a error when tried to read an empty "$this->Parse". */ + if ($this->autoCount and ($this->num_rows() == $this->Row)) + { + return 0; + } + if (0 == OCIFetchInto($this->Parse, $result, OCI_ASSOC+OCI_RETURN_NULLS)) + { + if ($this->Debug) + { + printf("<br>ID: %d, Rows: %d<br>\n", $this->Link_ID, $this->num_rows()); + } + $this->Row += 1; + + $errno = OCIError($this->Parse); + if (1403 == $errno) + { # 1043 means no more records found + $this->Error = false; + $this->disconnect(); + $stat = 0; + } + else + { + $this->Error = OCIError($this->Parse); + if ($errno && ($this->Debug)) + { + printf("<br>Error: %s, %s<br>", + $errno, + $this->Error["message"]); + } + $stat = 0; + } + } + else + { + $this->Record = array(); + $totalReg = OCINumcols($this->Parse); + for ($ix = 1; $ix <= $totalReg; $ix++) + { + $col = strtoupper(OCIColumnname($this->Parse, $ix)); + $colreturn = strtolower($col); + $this->Record[$colreturn] = + (is_object($result[$col])) ? $result[$col]->load() : $result[$col]; + if ($this->Debug) + { + echo "<b>[$col]</b>:".$result[$col]."<br>\n"; + } + } + $stat = 1; + } + + return $stat; + } + + function seek($pos) + { + $this->Row = $pos; + } + + function metadata($table, $full = false) + { + $count = 0; + $id = 0; + $res = array(); + + /* + * Due to compatibility problems with Table we changed the behavior + * of metadata(); + * depending on $full, metadata returns the following values: + * + * - full is false (default): + * $result[]: + * [0]["table"] table name + * [0]["name"] field name + * [0]["type"] field type + * [0]["len"] field length + * [0]["flags"] field flags ("NOT NULL", "INDEX") + * [0]["format"] precision and scale of number (eg. "10,2") or empty + * [0]["index"] name of index (if has one) + * [0]["chars"] number of chars (if any char-type) + * + * - full is true + * $result[]: + * ["num_fields"] number of metadata records + * [0]["table"] table name + * [0]["name"] field name + * [0]["type"] field type + * [0]["len"] field length + * [0]["flags"] field flags ("NOT NULL", "INDEX") + * [0]["format"] precision and scale of number (eg. "10,2") or empty + * [0]["index"] name of index (if has one) + * [0]["chars"] number of chars (if any char-type) + * ["meta"][field name] index of field named "field name" + * The last one is used, if you have a field name, but no index. + * Test: if (isset($result['meta']['myfield'])) {} ... + */ + + $this->connect(); + + ## This is a RIGHT OUTER JOIN: "(+)", if you want to see, what + ## this query results try the following: + ## $table = new Table; $db = new my_DB_Sql; # you have to make + ## # your own class + ## $table->show_results($db->query(see query vvvvvv)) + ## + $this->query("SELECT T.table_name,T.column_name,T.data_type,". + "T.data_length,T.data_precision,T.data_scale,T.nullable,". + "T.char_col_decl_length,I.index_name". + " FROM ALL_TAB_COLUMNS T,ALL_IND_COLUMNS I". + " WHERE T.column_name=I.column_name (+)". + " AND T.table_name=I.table_name (+)". + " AND T.table_name=UPPER('$table') ORDER BY T.column_id"); + + $i = 0; + while ($this->next_record()) + { + $res[$i]["table"] = $this->Record["table_name"]; + $res[$i]["name"] = strtolower($this->Record["column_name"]); + $res[$i]["type"] = $this->Record["data_type"]; + $res[$i]["len"] = $this->Record["data_length"]; + if ($this->Record["index_name"]) + { + $res[$i]["flags"] = "INDEX "; + } + $res[$i]["flags"] .= ( $this->Record["nullable"] == 'N') ? '' : 'NOT NULL'; + $res[$i]["format"]= (int)$this->Record["data_precision"].",". + (int)$this->Record["data_scale"]; + if ("0,0" == $res[$i]["format"]) + { + $res[$i]["format"] = ''; + } + $res[$i]["index"] = $this->Record["index_name"]; + $res[$i]["chars"] = $this->Record["char_col_decl_length"]; + if ($full) + { + $j = $res[$i]["name"]; + $res["meta"][$j] = $i; + $res["meta"][strtoupper($j)] = $i; + } + if ($full) + { + $res["meta"][$res[$i]["name"]] = $i; + } + $i++; + } + if ($full) + { + $res["num_fields"] = $i; + } +# $this->disconnect(); + return $res; + } + + + function affected_rows() + { + return OCIRowCount($this->Parse); + } + + function num_rows() + { + return $this->num_rows; + } + + function num_fields() + { + return OCINumcols($this->Parse); + } + + function nf() + { + return $this->num_rows(); + } + + function np() + { + print $this->num_rows(); + } + + function f($Name, $strip_slashes = false) + { + if( isset($this->Record[$Name]) + { + if ($strip_slashes || ($this->auto_stripslashes && ! $strip_slashes)) + { + return stripslashes($this->Record[$Name]); + } + else + { + return $this->Record[$Name]; + } + } + + return ''; + } + + function p($Name) + { + print $this->f($Name); + } + + function nextid($seqname) + { + $this->connect(); + + $Query_ID = @OCIParse($this->Link_ID, "SELECT $seqname.NEXTVAL FROM DUAL"); + + if (!...@ociexecute($Query_ID)) + { + $this->Error = @OCIError($Query_ID); + if (2289 == $this->Error["code"]) + { + $Query_ID = OCIParse($this->Link_ID, "CREATE SEQUENCE $seqname"); + if (!OCIExecute($Query_ID)) + { + $this->Error = OCIError($Query_ID); + $this->halt("<BR> nextid() function - unable to create sequence<br>".$this->Error["message"]); + } + else + { + $Query_ID = OCIParse($this->Link_ID, "SELECT $seqname.NEXTVAL FROM DUAL"); + OCIExecute($Query_ID); + } + } + } + + if (OCIFetch($Query_ID)) + { + $next_id = OCIResult($Query_ID, "NEXTVAL"); + } + else + { + $next_id = 0; + } + OCIFreeStatement($Query_ID); + return $next_id; + } + + function disconnect() + { + if ($this->Debug) + { + printf("Disconnecting...<br>\n"); + } + OCILogoff($this->Link_ID); + } + + function halt($msg) + { + if ($this->Halt_On_Error == "no") + return; + + $this->haltmsg($msg); + + if ($this->Halt_On_Error != "report") + { + die("Session halted.</body></html>"); + } + } + + function haltmsg($msg) + { + printf("<p><b>Database error:</b> %s<br>\n", $msg); + printf("<b>Oracle Error</b>: %s</p>\n", $this->Error["message"]); + } + + function lock($table, $mode = "write") + { + $this->connect(); + if ($mode == "write") + { + $Parse = OCIParse($this->Link_ID, "lock table $table in row exclusive mode"); + OCIExecute($Parse); + } else { + $result = 1; + } + return $result; + } + + function unlock() + { + return $this->query("commit"); + } + + function table_names() + { + $this->connect(); + $this->query("SELECT table_name,tablespace_name FROM user_tables"); + $i = 0; + while ($this->next_record()) + { + $info[$i]["table_name"] = $this->Record["table_name"]; + $info[$i]["tablespace_name"] = $this->Record["tablespace_name"]; + $i++; + } + return $info; + } + + function add_specialcharacters($query) + { + return str_replace("'", "''", $query); + } + + function split_specialcharacters($query) + { + return str_replace("''", "'", $query); + } + + /* This new function is needed to write a valid db dependant date string. */ + function now() + { + return "SYSDATE"; + } + + function db_addslashes($str) + { + if (!IsSet($str) || $str == '') + { + return ''; + } + return str_replace("'", "''", $str); + } + + + /** + * Prepare the VALUES component of an INSERT sql statement by guessing data types + * + * It is not a good idea to rely on the data types determined by this method if + * you are inserting numeric data into varchar/text fields, such as street numbers + * + * @param array $value_set array of values to insert into the database + * @return string the prepared sql, empty string for invalid input + */ + public function validate_insert($values) + { + if ( !is_array($values) || !count($values) ) + { + return ''; + } + + $insert_value = array(); + foreach ( $values as $value ) + { + if($value || (is_numeric($value) && $value == 0) ) + { + if ( is_numeric($value) ) + { + $insert_value[] = "'$value'"; + } + else + { + $insert_value[] = "'" . $this->db_addslashes(stripslashes($value)) . "'"; //in case slashes are already added. + } + } + else + { + $insert_value[] = 'NULL'; + } + } + return implode(",", $insert_value); + } + + /** + * Prepare the SET component of an UPDATE sql statement + * + * @param array $value_set associative array of values to update the database with + * @return string the prepared sql, empty string for invalid input + */ + public function validate_update($value_set) + { + if ( !is_array($value_set) || !count($value_set) ) + { + return ''; + } + + $value_entry = array(); + foreach ( $value_set as $field => $value ) + { + if($value || (is_numeric($value) && $value == 0) ) + { + if ( is_numeric($value) ) + { + if((strlen($value) > 1 && strpos($value,'0') === 0)) + { + $value_entry[]= "{$field}='{$value}'"; + } + else + { + $value_entry[]= "{$field}={$value}"; + } + } + else + { + $value_entry[]= "{$field}='{$value}'"; + } + } + else + { + $value_entry[]= "{$field}=NULL"; + } + } + return implode(',', $value_entry); + } + + + /** + * Get the correct date format for DATE field for a particular RDBMS + * + * @internal the string is compatiable with PHP's date() + * @return string the date format string + */ + public static function date_format() + { + static $date_format = null; + if ( is_null($date_format) ) + { + switch($GLOBALS['phpgw_info']['server']['db_type']) + { + case 'mssql': + $date_format = 'M d Y'; + break; + case 'mysql': + case 'pgsql': + case 'postgres': + default: + $date_format = 'Y-m-d'; + } + } + return $date_format; + } + + /** + * Get the correct datetime format for DATETIME field for a particular RDBMS + * + * @internal the string is compatiable with PHP's date() + * @return string the date format string + */ + public static function datetime_format() + { + static $datetime_format = null; + if ( is_null($datetime_format) ) + { + switch($GLOBALS['phpgw_info']['server']['db_type']) + { + case 'mssql': + $datetime_format = 'M d Y g:iA'; + break; + case 'mysql': + case 'pgsql': + case 'postgres': + default: + $datetime_format = 'Y-m-d G:i:s'; + } + } + return $datetime_format; + } + + /** + * Get the correct datetime format for MONEY field for a particular RDBMS + * + * @return string the formatted string + */ + public static function money_format($amount) + { + if ($GLOBALS['phpgw_info']['server']['db_type']=='mssql') + { + return "CONVERT(MONEY,'{$amount}',0)"; + } + else + { + return "'{$amount}'"; + } + } + + /** + * Finds the next ID for a record at a table + * + * @param string $table tablename in question + * @param array $key conditions + * @return int the next id + */ + public function next_id($table='',$key='') + { + $where = ''; + $condition = array(); + if(is_array($key)) + { + foreach ($key as $column => $value) + { + if($value) + { + $condition[] = $column . "='" . $value; + } + } + + if( $condition ) + { + $where='WHERE ' . implode("' AND ", $condition) . "'"; + } + } + + $this->query("SELECT max(id) as maximum FROM $table $where",__LINE__,__FILE__); + $this->next_record(); + $next_id = $this->f('maximum')+1; + return $next_id; + } + + } + + if( !class_exists("DB_Sql")) + { + class DB_Sql extends DB_OCI8 + { + function DB_Sql($query = "") + { + $this->DB_OCI8($query); + } + } + } Modified: people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -447,7 +447,7 @@ $ticket['group_id'], $this->db->db_addslashes($ticket['subject']), $ticket['cat_id'], - 'O', + $ticket['status'], $this->db->db_addslashes($ticket['details']), $ticket['location_code'], $address, Modified: people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/inc/class.uilookup.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -153,7 +153,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.addressbook'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'," @@ -406,7 +406,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.vendor'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'," @@ -632,7 +632,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.b_account'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'"; @@ -832,7 +832,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.street'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'"; @@ -1043,7 +1043,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.tenant'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'"; @@ -1244,7 +1244,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.ns3420'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'"; @@ -1758,7 +1758,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.phpgw_user'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'," @@ -1980,7 +1980,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.project_group'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'"; @@ -2179,7 +2179,7 @@ $datatable['config']['allow_allrows'] = true; $datatable['config']['base_java_url'] = "menuaction:'property.uilookup.ecodimb'," - ."second_display:'{true}'," + ."second_display:true," ."cat_id:'{$this->cat_id}'," ."query:'{$this->query}'," ."filter:'{$this->filter}'"; Modified: people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -58,6 +58,8 @@ protected $_show_finnish_date = false; var $part_of_town_id; var $status; + var $filter; + var $user_filter; public function __construct() { @@ -650,7 +652,7 @@ ( 'bgcolor' => '#5EFB6E', 'status' => lang('closed'), - 'text_edit_status' => lang('Open'), + 'text_edit_status' => isset($this->bo->config->config_data['tts_lang_open']) && $this->bo->config->config_data['tts_lang_open'] ? $this->bo->config->config_data['tts_lang_open'] : lang('Open'), 'new_status' => 'O' ); @@ -674,7 +676,7 @@ if($uicols['name'][$k] == 'status' && $ticket[$uicols['name'][$k]]=='O') { $datatable['rows']['row'][$j]['column'][$k]['name'] = $uicols['name'][$k]; - $datatable['rows']['row'][$j]['column'][$k]['value'] = lang('Open'); + $datatable['rows']['row'][$j]['column'][$k]['value'] = isset($this->bo->config->config_data['tts_lang_open']) && $this->bo->config->config_data['tts_lang_open'] ? $this->bo->config->config_data['tts_lang_open'] : lang('Open'); } else if($uicols['name'][$k] == 'status' && $ticket[$uicols['name'][$k]]=='C') { @@ -887,7 +889,7 @@ $json_row = array(); foreach( $row['column'] as $column) { - if(isset($column['format']) && $column['format']== "link" && $column['java_link']==true) + if(isset($column['format']) && $column['format']== "link" && isset($column['java_link']) && $column['java_link']==true) { $json_row[$column['name']] = "<a href='#' id='".$column['link']."' onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>"; } @@ -1008,7 +1010,7 @@ { if ($ticket['status']=='O') { - $status = lang('Open'); + $status = isset($this->bo->config->config_data['tts_lang_open']) && $this->bo->config->config_data['tts_lang_open'] ? $this->bo->config->config_data['tts_lang_open'] : lang('Open'); } else { @@ -1262,7 +1264,7 @@ 'select_action' => $GLOBALS['phpgw']->link('/index.php',$link_data), 'filter_name' => 'filter', 'filter_list' => $this->bo->filter(array('format' => 'filter', 'filter'=> $this->status_id,'default' => 'open')), - 'lang_show_all' => lang('Open'), + 'lang_show_all' => isset($this->bo->config->config_data['tts_lang_open']) && $this->bo->config->config_data['tts_lang_open'] ? $this->bo->config->config_data['tts_lang_open'] : lang('Open'), 'lang_filter_statustext' => lang('Select the filter. To show all entries select SHOW ALL'), 'lang_searchfield_statustext' => lang('Enter the search string. To show all entries, empty this field and press the SUBMIT button again'), 'lang_searchbutton_statustext' => lang('Submit the search string'), @@ -1554,6 +1556,8 @@ 'select_priority_name' => 'values[priority]', 'priority_list' => $this->bo->get_priority_list((isset($values['priority'])?$values['priority']:'')), + 'status_list' => $this->bo->get_status_list('O'), + 'form_action' => $GLOBALS['phpgw']->link('/index.php',$link_data), 'lang_subject' => lang('Subject'), 'lang_subject_statustext' => lang('Enter the subject of this ticket'), Modified: people/sigurdne/modules/property/trunk/setup/default_records.inc.php =================================================================== --- people/sigurdne/modules/property/trunk/setup/default_records.inc.php 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/setup/default_records.inc.php 2010-01-30 17:03:40 UTC (rev 21005) @@ -23,26 +23,6 @@ $GLOBALS['phpgw_setup']->oProc->next_record(); $app_id = $GLOBALS['phpgw_setup']->oProc->f('app_id'); -$GLOBALS['phpgw_setup']->oProc->query("SELECT location_id FROM phpgw_locations WHERE app_id = {$app_id} AND name != 'run'"); - -$locations = array(); -while ($GLOBALS['phpgw_setup']->oProc->next_record()) -{ - $locations[] = $GLOBALS['phpgw_setup']->oProc->f('location_id'); -} - -if(count($locations)) -{ - $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM phpgw_cust_choice WHERE location_id IN ('. implode (',',$locations) . ')'); - $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM phpgw_cust_attribute WHERE location_id IN ('. implode (',',$locations). ')'); - $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM phpgw_acl WHERE location_id IN ('. implode (',',$locations) . ')'); -} - -$GLOBALS['phpgw_setup']->oProc->query("DELETE FROM phpgw_locations WHERE app_id = {$app_id} AND name != 'run'"); - - -unset($locations); - # # phpgw_locations # Modified: people/sigurdne/modules/property/trunk/templates/base/tts.xsl =================================================================== --- people/sigurdne/modules/property/trunk/templates/base/tts.xsl 2010-01-30 17:00:26 UTC (rev 21004) +++ people/sigurdne/modules/property/trunk/templates/base/tts.xsl 2010-01-30 17:03:40 UTC (rev 21005) @@ -388,7 +388,7 @@ <!-- add --> - <xsl:template match="add"> + <xsl:template match="add" xmlns:php="http://php.net/xsl"> <xsl:choose> <xsl:when test="msgbox_data != ''"> <tr> @@ -441,98 +441,96 @@ <xsl:choose> <xsl:when test="simple !='1'"> - <tr> - <td valign="top"> - <xsl:value-of select="lang_group"/> - </td> - <td> - <xsl:call-template name="group_select"/> - </td> - </tr> - <tr> - <td valign="top"> - <xsl:value-of select="lang_assign_to"/> - </td> - <td> - <xsl:call-template name="user_id_select"/> - </td> - </tr> - <xsl:call-template name="contact_form"/> - <xsl:choose> - <xsl:when test="mailnotification != ''"> <tr> + <td valign="top"> + <xsl:value-of select="lang_group"/> + </td> <td> - <xsl:value-of select="lang_mailnotification"/> + <xsl:call-template name="group_select"/> </td> + </tr> + <tr> + <td valign="top"> + <xsl:value-of select="lang_assign_to"/> + </td> <td> - <xsl:choose> - <xsl:when test="pref_send_mail = 1"> - <input type="checkbox" name="values[send_mail]" value="1" checked="checked" onMouseout="window.status='';return true;"> - <xsl:attribute name="onMouseover"> - <xsl:text>window.status='</xsl:text> - <xsl:value-of select="lang_mailnotification_statustext"/> - <xsl:text>'; return true;</xsl:text> + <xsl:call-template name="user_id_select"/> + </td> + </tr> + <xsl:call-template name="contact_form"/> + <xsl:choose> + <xsl:when test="mailnotification != ''"> + <tr> + <td> + <xsl:value-of select="lang_mailnotification"/> + </td> + <td> + <input type="checkbox" name="values[send_mail]" value="1" > + <xsl:attribute name="title"> + <xsl:value-of select="php:function('lang', 'Choose to send mailnotification')" /> + </xsl:attribute> + <xsl:if test="pref_send_mail = '1'"> + <xsl:attribute name="checked"> + <xsl:text>checked</xsl:text> </xsl:attribute> - </input> - </xsl:when> - <xsl:otherwise> - <input type="checkbox" name="values[send_mail]" value="1" onMouseout="window.status='';return true;"> - <xsl:attribute name="onMouseover"> - <xsl:text>window.status='</xsl:text> - <xsl:value-of select="lang_mailnotification_statustext"/> - <xsl:text>'; return true;</xsl:text> - </xsl:attribute> - </input> - </xsl:otherwise> - </xsl:choose> + </xsl:if> + </input> + </td> + </tr> + </xsl:when> + </xsl:choose> + <tr> + <td valign="top"> + <xsl:value-of select="lang_priority"/> </td> + <td> + <xsl:variable name="lang_priority_statustext"><xsl:value-of select="lang_priority_statustext"/></xsl:variable> + <xsl:variable name="select_priority_name"><xsl:value-of select="select_priority_name"/></xsl:variable> + <select name="{$select_priority_name}" onMouseover="window.status='{$lang_priority_statustext}'; return true;" onMouseout="window.status='';return true;"> + <xsl:apply-templates select="priority_list"/> + </select> + </td> </tr> + <tr> + <td valign="top"> + <xsl:value-of select="php:function('lang', 'status')" /> + </td> + <td> + <select name="values[status]" > + <xsl:attribute name="title"> + <xsl:value-of select="php:function('lang', 'Set the status of the ticket')" /> + </xsl:attribute> + <xsl:apply-templates select="status_list"/> + </select> + </td> + </tr> + <xsl:choose> + <xsl:when test="show_finnish_date ='1'"> + <tr> + <td> + <xsl:value-of select="lang_finnish_date"/> + </td> + <td> + <input type="text" id="values_finnish_date" name="values[finnish_date]" size="10" value="{value_finnish_date}" readonly="readonly" onMouseout="window.status='';return true;" > + <xsl:attribute name="title"> + <xsl:value-of select="lang_finnish_date_statustext"/> + </xsl:attribute> + </input> + <img id="values_finnish_date-trigger" src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" /> + </td> + </tr> + </xsl:when> + </xsl:choose> </xsl:when> </xsl:choose> - - <tr> <td valign="top"> - <xsl:value-of select="lang_priority"/> + <xsl:value-of select="php:function('lang', 'subject')" /> </td> <td> - <xsl:variable name="lang_priority_statustext"><xsl:value-of select="lang_priority_statustext"/></xsl:variable> - <xsl:variable name="select_priority_name"><xsl:value-of select="select_priority_name"/></xsl:variable> - <select name="{$select_priority_name}" onMouseover="window.status='{$lang_priority_statustext}'; return true;" onMouseout="window.status='';return true;"> - <xsl:apply-templates select="priority_list"/> - </select> - </td> - </tr> - <xsl:choose> - <xsl:when test="show_finnish_date ='1'"> - <tr> - <td> - <xsl:value-of select="lang_finnish_date"/> - </td> - <td> - <input type="text" id="values_finnish_date" name="values[finnish_date]" size="10" value="{value_finnish_date}" readonly="readonly" onMouseout="window.status='';return true;" > - <xsl:attribute name="title"> - <xsl:value-of select="lang_finnish_date_statustext"/> - </xsl:attribute> - </input> - <img id="values_finnish_date-trigger" src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" /> - </td> - </tr> - </xsl:when> - </xsl:choose> - - </xsl:when> - </xsl:choose> - - - <tr> - <td valign="top"> - <xsl:value-of select="lang_subject"/> - </td> - <td> <input type="text" name="values[subject]" value="{value_subject}" onMouseout="window.status='';return true;"> <xsl:attribute name="title"> - <xsl:value-of select="lang_subject_statustext"/> + <xsl:value-of select="lang_subject_statustext"/> </xsl:attribute> </input> @@ -587,7 +585,7 @@ <td> <input type="submit" name="values[apply]" value="{lang_save}"> <xsl:attribute name="title"> - <xsl:value-of select="lang_save_statustext"/> + <xsl:value-of select="lang_save_statustext"/> </xsl:attribute> </input> </td> @@ -595,8 +593,8 @@ <input type="submit" name="values[cancel]" value="{lang_cancel}"> <xsl:attribute name="title"> <xsl:value-of select="lang_cancel_statustext"/> - </xsl:attribute> - </input> + </xsl:attribute> + </input> </td> </tr> </table> @@ -630,7 +628,7 @@ <td> <input type="text" name="values[extra][contact_phone]" value="{value_contact_phone}" onMouseout="window.status='';return true;"> <xsl:attribute name="title"> - <xsl:value-of select="lang_contact_phone_statustext"/> + <xsl:value-of select="lang_contact_phone_statustext"/> </xsl:attribute> </input> </td> @@ -642,7 +640,7 @@ <td> <input type="text" name="values[extra][contact_email]" value="{value_contact_email}" onMouseout="window.status='';return true;"> <xsl:attribute name="title"> - <xsl:value-of select="lang_contact_email_statustext"/> + <xsl:value-of select="lang_contact_email_statustext"/> </xsl:attribute> </input> </td> @@ -805,7 +803,7 @@ </xsl:for-each> <xsl:choose> <xsl:when test="lookup_type ='view'"> - <xsl:call-template name="location_view"/> + <xsl:call-template name="location_view"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="location_form"/> @@ -920,18 +918,18 @@ </tr> <xsl:choose> <xsl:when test="lang_takeover != ''"> - <tr> - <td valign="top"> + <tr> + <td valign="top"> <xsl:value-of select="lang_takeover"/> - </td> - <td> + </td> + <td> <input type="checkbox" name="values[takeover]" value="1"> <xsl:attribute name="title"> <xsl:value-of select="php:function('lang', 'Take over the assignment for this ticket')" /> </xsl:attribute> </input> - </td> - </tr> + </td> + </tr> </xsl:when> </xsl:choose> @@ -942,22 +940,16 @@ <xsl:value-of select="php:function('lang', 'Send e-mail')" /> </td> <td> - <xsl:choose> - <xsl:when test="pref_send_mail = 1"> - <input type="checkbox" name="values[send_mail]" value="1" checked="checked"> - <xsl:attribute name="title"> - <xsl:value-of select="php:function('lang', 'Choose to send mailnotification')" /> - </xsl:attribute> - </input> - </xsl:when> - <xsl:otherwise> - <input type="checkbox" name="values[send_mail]" value="1"> - <xsl:attribute name="title"> - <xsl:value-of select="php:function('lang', 'Choose to send mailnotification')" /> - </xsl:attribute> - </input> - </xsl:otherwise> - </xsl:choose> + <input type="checkbox" name="values[send_mail]" value="1" > + <xsl:attribute name="title"> + <xsl:value-of select="php:function('lang', 'Choose to send mailnotification')" /> + </xsl:attribute> + <xsl:if test="pref_send_mail = '1'"> + <xsl:attribute name="checked"> + <xsl:text>checked</xsl:text> + </xsl:attribute> + </xsl:if> + </input> </td> </tr> </xsl:when> @@ -977,20 +969,20 @@ </tr> <xsl:choose> <xsl:when test="value_order_id=''"> - <tr> - <td valign="top"> + <tr> + <td valign="top"> <xsl:value-of select="php:function('lang', 'status')" /> - </td> - <td> - <xsl:variable name="status_name"><xsl:value-of select="status_name"/></xsl:variable> + </td> + <td> + <xsl:variable name="status_name"><xsl:value-of select="status_name"/></xsl:variable> <select name="{$status_name}" class="forms"> <xsl:attribute name="title"> <xsl:value-of select="php:function('lang', 'Set the status of the ticket')" /> </xsl:attribute> - <xsl:apply-templates select="status_list"/> - </select> - </td> - </tr> + <xsl:apply-templates select="status_list"/> + </select> + </td> + </tr> </xsl:when> </xsl:choose> <tr> @@ -1003,19 +995,19 @@ </tr> <xsl:choose> <xsl:when test="show_finnish_date ='1'"> - <tr> - <td> + <tr> + <td> <xsl:value-of select="php:function('lang', 'finnish date')" /> - </td> - <td> - <input type="text" id="values_finnish_date" name="values[finnish_date]" size="10" value="{value_finnish_date}" readonly="readonly" onMouseout="window.status='';return true;" > - <xsl:attribute name="title"> + </td> + <td> + <input type="text" id="values_finnish_date" name="values[finnish_date]" size="10" value="{value_finnish_date}" readonly="readonly" onMouseout="window.status='';return true;" > + <xsl:attribute name="title"> <xsl:value-of select="php:function('lang', 'select the estimated date for closing the task')" /> - </xsl:attribute> - </input> - <img id="values_finnish_date-trigger" src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" /> - </td> - </tr> + </xsl:attribute> + </input> + <img id="values_finnish_date-trigger" src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" /> + </td> + </tr> </xsl:when> </xsl:choose> @@ -1097,6 +1089,7 @@ <xsl:call-template name="vendor_form"/> <xsl:call-template name="ecodimb_form"/> <xsl:call-template name="b_account_form"/> +<!-- <tr> <td> <xsl:value-of select="php:function('lang', 'order category')" /> @@ -1111,7 +1104,7 @@ </select> </td> </tr> - +--> <tr> <td valign="top"> <xsl:value-of select="php:function('lang', 'cost estimate')" /> @@ -1320,7 +1313,7 @@ <xsl:variable name="name"><xsl:value-of select="name"/></xsl:variable> <input type="submit" name="location" value="{$name}" onMouseout="window.status='';return true;"> <xsl:attribute name="title"> - <xsl:value-of select="lang_start_statustext"/> + <xsl:value-of select="lang_start_statustext"/> </xsl:attribute> </input> </form> @@ -1729,29 +1722,24 @@ <xsl:template match="priority_list"> - <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable> - <xsl:choose> - <xsl:when test="selected"> - <option value="{$id}" selected="selected"><xsl:value-of disable-output-escaping="yes" select="name"/></option> - </xsl:when> - <xsl:otherwise> - <option value="{$id}"><xsl:value-of disable-output-escaping="yes" select="name"/></option> - </xsl:otherwise> - </xsl:choose> + <option value="{id}"> + <xsl:if test="selected != 0"> + <xsl:attribute name="selected" value="selected" /> + </xsl:if> + <xsl:value-of disable-output-escaping="yes" select="name"/> + </option> </xsl:template> <xsl:template match="status_list"> - <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable> - <xsl:choose> - <xsl:when test="selected"> - <option value="{$id}" selected="selected"><xsl:value-of disable-output-escaping="yes" select="name"/></option> - </xsl:when> - <xsl:otherwise> - <option value="{$id}"><xsl:value-of disable-output-escaping="yes" select="name"/></option> - </xsl:otherwise> - </xsl:choose> + <option value="{id}"> + <xsl:if test="selected != 0"> + <xsl:attribute name="selected" value="selected" /> + </xsl:if> + <xsl:value-of disable-output-escaping="yes" select="name"/> + </option> </xsl:template> + <xsl:template match="vendor_email"> <xsl:variable name="email"><xsl:value-of select="email"/></xsl:variable> <xsl:choose> _______________________________________________ phpGroupWare-cvs mailing list phpGroupWare-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/phpgroupware-cvs