Started working on multiable domain support

This commit is contained in:
jengo 2000-10-31 14:02:21 +00:00
parent ae4eb2c239
commit 7d876fc749
6 changed files with 82 additions and 27 deletions

View File

@ -31,7 +31,9 @@
$deny_login = False; $deny_login = False;
$tmpl = new Template($phpgw_info["server"]["template_dir"]); $tmpl = new Template($phpgw_info["server"]["template_dir"]);
$tmpl->set_file(array("login" => "login.tpl")); $tmpl->set_file(array("login_form" => "login.tpl",
"domain_row" => "login_domain_row.tpl"));
$tmpl->set_block("login_form","domain_row");
// When I am updating my server, I don't want people logging in a messing // When I am updating my server, I don't want people logging in a messing
// things up. // things up.
@ -112,6 +114,30 @@
} }
} }
} }
if ($phpgw_info["server"]["multiable_domains"]) {
$tmpl->set_var("lang_domain",lang("Domain"));
if ($phpgw_info["server"]["multiable_domains_use_select_box"]) {
$domains_select = '<select name="domain">';
$phpgw->db->query("select domain_id,domain_name from domains where domain_status='Active' "
. "order by domain_name");
while ($phpgw->db->next_record()) {
$domains_select .= '<option value="' . $phpgw->db->f("domain_id") . '">'
. $phpgw->db->f("domain_name") . '</option>';
}
$domains_select .= "</select>";
$tmpl->set_var("domain_input",$domains_select);
$tmpl->parse("domain_row_out","domain_row");
} else {
$tmpl->set_var("domain_input",'<input name="domain">');
$tmpl->parse("domain_row_out","domain_row");
}
} else {
$tmpl->set_var("domain_row","");
$tmpl->parse("null","domain_row");
}
$tmpl->set_var("login_url", $phpgw_info["server"]["webserver_url"] . "/login.php"); $tmpl->set_var("login_url", $phpgw_info["server"]["webserver_url"] . "/login.php");
$tmpl->set_var("website_title", $phpgw_info["server"]["site_title"]); $tmpl->set_var("website_title", $phpgw_info["server"]["site_title"]);
$tmpl->set_var("cd",check_logoutcode($cd)); $tmpl->set_var("cd",check_logoutcode($cd));
@ -122,6 +148,6 @@
$tmpl->set_var("lang_password",lang("password")); $tmpl->set_var("lang_password",lang("password"));
$tmpl->set_var("lang_login",lang("login")); $tmpl->set_var("lang_login",lang("login"));
$tmpl->parse("loginout", "login"); $tmpl->parse("loginout", "login_form");
$tmpl->p("loginout"); $tmpl->p("loginout");
?> ?>

View File

@ -10,9 +10,11 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
// NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier.
$sql = "CREATE TABLE config ( $sql = "CREATE TABLE config (
config_name varchar(25) NOT NULL, config_name varchar(255) NOT NULL,
config_value varchar(100), config_value varchar(100),
UNIQUE config_name (config_name) UNIQUE config_name (config_name)
)"; )";
@ -188,9 +190,9 @@
$db->query($sql); $db->query($sql);
$sql = "CREATE TABLE webcal_entry_user ( $sql = "CREATE TABLE webcal_entry_user (
cal_id int(11) DEFAULT '0' NOT NULL, cal_id int(11) DEFAULT '0' NOT NULL,
cal_login varchar(25) NOT NULL, cal_login varchar(25) NOT NULL,
cal_status char(1) DEFAULT 'A', cal_status char(1) DEFAULT 'A',
PRIMARY KEY (cal_id, cal_login) PRIMARY KEY (cal_id, cal_login)
)"; )";
$db->query($sql); $db->query($sql);
@ -202,24 +204,33 @@
$db->query($sql); $db->query($sql);
$sql = "CREATE TABLE newsgroups ( $sql = "CREATE TABLE newsgroups (
con int(11) NOT NULL auto_increment, con int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL, name varchar(255) NOT NULL,
messagecount int(11) NOT NULL, messagecount int(11) NOT NULL,
lastmessage int(11) NOT NULL, lastmessage int(11) NOT NULL,
active char DEFAULT 'N' NOT NULL, active char DEFAULT 'N' NOT NULL,
lastread int(11), lastread int(11),
PRIMARY KEY (con), PRIMARY KEY (con),
UNIQUE name (name) UNIQUE name (name)
)"; )";
$db->query($sql); $db->query($sql);
$sql = "CREATE TABLE lang ( $sql = "CREATE TABLE lang (
message_id varchar(150) DEFAULT '' NOT NULL, message_id varchar(150) DEFAULT '' NOT NULL,
app_name varchar(100) DEFAULT 'common' NOT NULL, app_name varchar(100) DEFAULT 'common' NOT NULL,
lang varchar(5) DEFAULT '' NOT NULL, lang varchar(5) DEFAULT '' NOT NULL,
content text NOT NULL, content text NOT NULL,
PRIMARY KEY (message_id,app_name,lang) PRIMARY KEY (message_id,app_name,lang)
)"; )";
$db->query($sql); $db->query($sql);
$sql = "create table domains (
domain_id int NOT NULL auto_increment,
domain_name varchar(255),
domain_database varchar(255),
domain_status enum('Active,Disabled'),
primary key(domain_id)
)";
$db->query($sql);
?> ?>

View File

@ -11,8 +11,10 @@
/* $Id$ */ /* $Id$ */
// NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier.
$sql = "CREATE TABLE config ( $sql = "CREATE TABLE config (
config_name varchar(25) NOT NULL UNIQUE, config_name varchar(255) NOT NULL UNIQUE,
config_value varchar(100) NOT NULL config_value varchar(100) NOT NULL
)"; )";
$db->query($sql); $db->query($sql);

View File

@ -256,12 +256,12 @@
$db->query("alter table $table change $field $field int(11) NOT NULL"); $db->query("alter table $table change $field $field int(11) NOT NULL");
} }
function v0_9_2to0_9_3pre4(){ function v0_9_2to0_9_3pre5(){
global $currentver, $phpgw_info, $db; global $currentver, $phpgw_info, $db;
$didupgrade = True; $didupgrade = True;
// The 0.9.3pre1 is only temp until release // The 0.9.3pre1 is only temp until release
if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3") { if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4") {
if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") { if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") {
update_owner("addressbook","ab_owner"); update_owner("addressbook","ab_owner");
update_owner("todo","todo_owner"); update_owner("todo","todo_owner");
@ -290,10 +290,16 @@
$db->query("alter table todo add todo_id_parent int(11) DEFAULT '0' NOT NULL"); $db->query("alter table todo add todo_id_parent int(11) DEFAULT '0' NOT NULL");
$currentver = "0.9.3pre4"; $currentver = "0.9.3pre4";
} }
if ($currentver == "0.9.3pre4") {
$db->query("alter table config change config_name config_name varchar(255) NOT NULL");
$db->query("create table domains (domain_id int NOT NULL auto_increment, domain_name varchar(255),"
. "domain_database varchar(255),domain_status enum('Active,Disabled'),primary key(domain_id))");
}
echo " <tr bgcolor=\"e6e6e6\">\n"; echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from 0.9.2 to 0.9.3pre4 is completed.</td>\n"; echo " <td>Upgrade from 0.9.2 to 0.9.3pre5 is completed.</td>\n";
echo " </tr>\n"; echo " </tr>\n";
} }
} }

View File

@ -245,12 +245,12 @@
$db->query("alter table $table change $field $field int(11) NOT NULL"); $db->query("alter table $table change $field $field int(11) NOT NULL");
} }
function v0_9_2to0_9_3pre4(){ function v0_9_2to0_9_3pre5(){
global $currentver, $phpgw_info, $db; global $currentver, $phpgw_info, $db;
$didupgrade = True; $didupgrade = True;
// The 0.9.3pre1 is only temp until release // The 0.9.3pre1 is only temp until release
if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3") { if ($currentver == "0.9.2" || $currentver == "0.9.3pre1" || $currentver == "0.9.3pre2" || $currentver == "0.9.3pre3" || $currentver == "0.9.3pre4") {
if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") { if ($currentver == "0.9.2" || $currentver == "0.9.3pre1") {
update_owner("addressbook","ab_owner"); update_owner("addressbook","ab_owner");
update_owner("todo","todo_owner"); update_owner("todo","todo_owner");
@ -276,10 +276,20 @@
$currentver = "0.9.3pre3"; $currentver = "0.9.3pre3";
} }
if ($currentver == "0.9.3pre3") { if ($currentver == "0.9.3pre3") {
$db->query("alter table todo add todo_id_parent int DEFAULT 0 NOT NULL"); $db->query("alter table todo add todo_id_parent int DEFAULT 0 NOT NULL");
$currentver = "0.9.3pre4"; $currentver = "0.9.3pre4";
} }
if ($currentver == "0.9.3pre4") {
$db->query("create table temp as select * from config");
$db->query("drop table config");
$db->query("create table config config_name varchar(255) NOT NULL UNIQUE, config_value varchar(100) NOT NULL");
$db->query("insert into config select * from temp");
$db->query("drop table config");
$currentver = "0.9.3pre4";
}
echo " <tr bgcolor=\"e6e6e6\">\n"; echo " <tr bgcolor=\"e6e6e6\">\n";
echo " <td>Upgrade from 0.9.2 to $currentver is completed.</td>\n"; echo " <td>Upgrade from 0.9.2 to $currentver is completed.</td>\n";
echo " </tr>\n"; echo " </tr>\n";

View File

@ -1 +1 @@
<?php $phpgw_info["server"]["version"] = "0.9.3pre4"; ?> <?php $phpgw_info["server"]["version"] = "0.9.3pre5"; ?>