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),')');
$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
@ -345,6 +350,23 @@ class socontacts_sql extends so_sql
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
*

View File

@ -1527,6 +1527,17 @@ $readonlys['button[vcard]'] = true;
'%' => lang('contains'),
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
$readonlys['change_photo'] = true;
$readonlys['fileas_type'] = true;

View File

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

View File

@ -1655,26 +1655,30 @@
$url = $GLOBALS['egw']->link($matches[1],$matches[2]);
$on = str_replace($matches[0],'\''.$url.'\'',$on);
}
if (preg_match_all("/form::name\\('([^']+)'\\)/",$on,$matches))
{
foreach($matches[1] as $n => $matche_name)
{
if (preg_match_all("/form::name\\('([^']+)'\\)/",$on,$matches)) {
foreach($matches[1] as $n => $matche_name) {
$matches[1][$n] = '\''.$this->form_name($cname,$matche_name).'\'';
}
$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
$on = str_replace($matches[0],'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,
// 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);
}
return $on;
}

View File

@ -118,8 +118,15 @@
$sessionData = $this->bocompose->getSessionData();
if (is_array($_GET['preset']))
{
$this->bocompose->addAttachment(array_merge($sessionData,$_GET['preset']));
$sessionData = $this->bocompose->getSessionData();
if ($_GET['preset']['file'] && is_readable($_GET['preset']['file']))
{
$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');
#_debug_array($preferences);

View File

@ -980,20 +980,23 @@
$currentPassword = $this->Password;
$currentDatabase = $this->Database;
$extra = array();
$sqls = array();
$set_charset = '';
switch ($this->Type)
{
case 'pgsql':
$meta_db = 'template1';
$sqls[] = "CREATE DATABASE $currentDatabase";
break;
case 'mysql':
$create = "CREATE DATABASE `$currentDatabase`";
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';
$extra[] = "GRANT ALL ON $currentDatabase.* TO $currentUser@localhost IDENTIFIED BY '$currentPassword'";
break;
default:
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->disconnect();
$this->query('CREATE DATABASE '.$currentDatabase.$set_charset);
foreach($extra as $sql)
foreach($sqls as $sql)
{
$this->query($sql);
$this->query($sql,__LINE__,__FILE__);
}
$this->disconnect();

View File

@ -298,7 +298,7 @@
switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi'])
{
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;
case 'drop':
$setup_info = $GLOBALS['egw_setup']->detection->get_versions($setup_info);