merge from trunk(revision 23866:23873) to 1.4 branch

This commit is contained in:
Lars Kneschke 2007-05-16 08:54:12 +00:00
parent 4ebe8bfbe8
commit 906889e6d9
7 changed files with 64 additions and 18 deletions

View File

@ -276,6 +276,11 @@ class socontacts_sql extends so_sql
$criteria[] = $this->db->expression($this->extra_table,'(',array('contact_name'=>substr($col,1),'contact_value'=>$val),')'); $criteria[] = $this->db->expression($this->extra_table,'(',array('contact_name'=>substr($col,1),'contact_value'=>$val),')');
$search_customfields = true; $search_customfields = true;
} }
elseif($col == 'cat_id') // search in comma-sep. cat-column
{
$criteria = array_merge($criteria,$this->_cat_search($val));
unset($criteria[$col]);
}
} }
} }
if ($search_customfields) // search the custom-fields if ($search_customfields) // search the custom-fields
@ -345,6 +350,23 @@ class socontacts_sql extends so_sql
return '('.implode(' OR ',$cat_filter).')'; return '('.implode(' OR ',$cat_filter).')';
} }
/**
* fix cat_id criteria to search in comma-separated multiple cats
*
* @internal
* @param int/array $cats
* @return array of sql-strings to be OR'ed or AND'ed together
*/
function _cat_search($cats)
{
$cat_filter = array();
foreach(is_array($cats) ? $cats : array($cats) as $cat)
{
if (is_numeric($cat)) $cat_filter[] = $this->db->concat("','",cat_id,"','")." LIKE '%,$cat,%'";
}
return $cat_filter;
}
/** /**
* Change the ownership of contacts owned by a given account * Change the ownership of contacts owned by a given account
* *

View File

@ -1527,6 +1527,17 @@ $readonlys['button[vcard]'] = true;
'%' => lang('contains'), '%' => lang('contains'),
false => lang('exact'), false => lang('exact'),
); );
if ($this->customfields)
{
foreach($this->customfields as $name => $data)
{
if ($data['type'] == 'select')
{
if (!isset($content['#'.$name])) $content['#'.$name] = '';
if(!isset($data['values'][''])) $sel_options['#'.$name][''] = lang('Select one');
}
}
}
// configure edit template as search dialog // configure edit template as search dialog
$readonlys['change_photo'] = true; $readonlys['change_photo'] = true;
$readonlys['fileas_type'] = true; $readonlys['fileas_type'] = true;

View File

@ -567,7 +567,7 @@ class uiforms extends uical
} }
$vars = array( $vars = array(
'menuaction' => 'felamimail.uicompose.compose', 'menuaction' => 'felamimail.uicompose.compose',
'preset[to]' => implode(', ',$to), 'preset[to]' => $to,
'preset[subject]' => $subject, 'preset[subject]' => $subject,
'preset[body]' => $body, 'preset[body]' => $body,
'preset[name]' => 'event.ics', 'preset[name]' => 'event.ics',

View File

@ -1655,26 +1655,30 @@
$url = $GLOBALS['egw']->link($matches[1],$matches[2]); $url = $GLOBALS['egw']->link($matches[1],$matches[2]);
$on = str_replace($matches[0],'\''.$url.'\'',$on); $on = str_replace($matches[0],'\''.$url.'\'',$on);
} }
if (preg_match_all("/form::name\\('([^']+)'\\)/",$on,$matches))
{ if (preg_match_all("/form::name\\('([^']+)'\\)/",$on,$matches)) {
foreach($matches[1] as $n => $matche_name) foreach($matches[1] as $n => $matche_name) {
{
$matches[1][$n] = '\''.$this->form_name($cname,$matche_name).'\''; $matches[1][$n] = '\''.$this->form_name($cname,$matche_name).'\'';
} }
$on = str_replace($matches[0],$matches[1],$on); $on = str_replace($matches[0],$matches[1],$on);
} }
if (preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$on,$matches))
{ if (preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$on,$matches)) {
$question = lang($matches[1]).(substr($matches[1],-1) != '?' ? '?' : ''); // add ? if not there, saves extra phrase $question = lang($matches[1]).(substr($matches[1],-1) != '?' ? '?' : ''); // add ? if not there, saves extra phrase
$on = str_replace($matches[0],'confirm(\''.addslashes($question).'\')',$on); $on = str_replace($matches[0],'confirm(\''.addslashes($question).'\')',$on);
//$on = preg_replace('/confirm\(["\']{1}(.*)["\']{1}\)/','confirm(\''.addslashes($question).'\')',$on); //$on = preg_replace('/confirm\(["\']{1}(.*)["\']{1}\)/','confirm(\''.addslashes($question).'\')',$on);
} }
if (preg_match("/window.open\('(.*)','(.*)','dependent=yes,width=(.*),height=(.*),scrollbars=yes,status=(.*)'\)/",$on,$matches)) {
$on = str_replace($matches[0], "egw_openWindowCentered2('{$matches[1]}', '{$matches[2]}', '{$matches[3]}', '{$matches[4]}', '{$matches[5]}')", $on);
}
// replace xajax calls to code in widgets, with the "etemplate" handler, // replace xajax calls to code in widgets, with the "etemplate" handler,
// this allows to call widgets with the current app, otherwise everyone would need etemplate run rights // this allows to call widgets with the current app, otherwise everyone would need etemplate run rights
if (strpos($on,"xajax_doXMLHTTP('etemplate.")!==false) if (strpos($on,"xajax_doXMLHTTP('etemplate.")!==false) {
{
$on = preg_replace("/^xajax_doXMLHTTP\('etemplate\.([a-z]+_widget\.[a-zA-Z0-9_]+)\'/",'xajax_doXMLHTTP(\''.$GLOBALS['egw_info']['flags']['currentapp'].'.\\1.etemplate\'',$on); $on = preg_replace("/^xajax_doXMLHTTP\('etemplate\.([a-z]+_widget\.[a-zA-Z0-9_]+)\'/",'xajax_doXMLHTTP(\''.$GLOBALS['egw_info']['flags']['currentapp'].'.\\1.etemplate\'',$on);
} }
return $on; return $on;
} }

View File

@ -118,8 +118,15 @@
$sessionData = $this->bocompose->getSessionData(); $sessionData = $this->bocompose->getSessionData();
if (is_array($_GET['preset'])) if (is_array($_GET['preset']))
{ {
$this->bocompose->addAttachment(array_merge($sessionData,$_GET['preset'])); if ($_GET['preset']['file'] && is_readable($_GET['preset']['file']))
$sessionData = $this->bocompose->getSessionData(); {
$this->bocompose->addAttachment(array_merge($sessionData,$_GET['preset']));
$sessionData = $this->bocompose->getSessionData();
}
foreach(array('to','cc','bcc','subject','body') as $name)
{
if ($_GET['preset'][$name]) $sessionData[$name] = $_GET['preset'][$name];
}
} }
$preferences = ExecMethod('felamimail.bopreferences.getPreferences'); $preferences = ExecMethod('felamimail.bopreferences.getPreferences');
#_debug_array($preferences); #_debug_array($preferences);

View File

@ -980,20 +980,23 @@
$currentPassword = $this->Password; $currentPassword = $this->Password;
$currentDatabase = $this->Database; $currentDatabase = $this->Database;
$extra = array(); $sqls = array();
$set_charset = ''; $set_charset = '';
switch ($this->Type) switch ($this->Type)
{ {
case 'pgsql': case 'pgsql':
$meta_db = 'template1'; $meta_db = 'template1';
$sqls[] = "CREATE DATABASE $currentDatabase";
break; break;
case 'mysql': case 'mysql':
$create = "CREATE DATABASE `$currentDatabase`";
if ($charset && isset($this->Link_ID->charset2mysql[$charset]) && (float) $this->ServerInfo['version'] >= 4.1) if ($charset && isset($this->Link_ID->charset2mysql[$charset]) && (float) $this->ServerInfo['version'] >= 4.1)
{ {
$set_charset = ' DEFAULT CHARACTER SET '.$this->Link_ID->charset2mysql[$charset].';'; $create .= ' DEFAULT CHARACTER SET '.$this->Link_ID->charset2mysql[$charset].';';
} }
$sqls[] = $create;
$sqls[] = "GRANT ALL ON `$currentDatabase`.* TO $currentUser@localhost IDENTIFIED BY ".$this->quote($currentPassword);
$meta_db = 'mysql'; $meta_db = 'mysql';
$extra[] = "GRANT ALL ON $currentDatabase.* TO $currentUser@localhost IDENTIFIED BY '$currentPassword'";
break; break;
default: default:
echo "<p>db::create_database(user='$adminname',\$pw) not yet implemented for DB-type '$this->Type'</p>\n"; echo "<p>db::create_database(user='$adminname',\$pw) not yet implemented for DB-type '$this->Type'</p>\n";
@ -1006,10 +1009,9 @@
$this->Database = $meta_db; $this->Database = $meta_db;
} }
$this->disconnect(); $this->disconnect();
$this->query('CREATE DATABASE '.$currentDatabase.$set_charset); foreach($sqls as $sql)
foreach($extra as $sql)
{ {
$this->query($sql); $this->query($sql,__LINE__,__FILE__);
} }
$this->disconnect(); $this->disconnect();

View File

@ -298,7 +298,7 @@
switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi']) switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi'])
{ {
case 'dbcreate': case 'dbcreate':
$GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], $_POST['system_charset']); $GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'],'utf8'); // create all new db's with utf8
break; break;
case 'drop': case 'drop':
$setup_info = $GLOBALS['egw_setup']->detection->get_versions($setup_info); $setup_info = $GLOBALS['egw_setup']->detection->get_versions($setup_info);