diff --git a/phpgwapi/inc/phpgw_categories.inc.php b/phpgwapi/inc/phpgw_categories.inc.php index 42bf5ddd81..d800dfbba3 100644 --- a/phpgwapi/inc/phpgw_categories.inc.php +++ b/phpgwapi/inc/phpgw_categories.inc.php @@ -13,78 +13,51 @@ class categories { - function read($format = "", $app_name = "", $owner = "", $cat_id = "") - { - global $phpgw_info, $phpgw; - $db2 = $phpgw->db; - - if (! isset($owner)) { - $owner = $phpgw_info["user"]["account_id"]; - } - - if (! isset($format)) { - $format = "array"; - } - - if ($format == "single") { - $db2->query("select * from categories where cat_id='$cat_id' and account_id='$owner' " - . "and app_name='" . addslashes($app_name) . "'"); - $db2->next_record(); - - $cat_info[]["id"] = $db2->f("cat_id"); - $cat_info[]["name"] = $db2->f("cat_name"); - $cat_info[]["descrption"] = $db2->f("cat_descrption"); - return $cat_info; - } - - if (! $app_name) { - $app_name = $phpgw_info["flags"]["currentapp"]; - } - if (! $account_id) { - $owner = $phpgw_info["user"]["account_id"]; - } - - $db2->query("select cat_id,cat_name,cat_description from categories where app_name='$app_name' " - . "and account_id='$owner'"); - $i = 0; - while ($db2->next_record()) { - if ($format == "array") { - $cat_list[$i]["cat_id"] = $db2->f("cat_id"); - $cat_list[$i]["cat_name"] = $db2->f("cat_name"); - $cat_list[$i]["cat_description"] = $db2->f("cat_description"); - $i++; - } - if ($format == "select") { - $cat_list .= ''; - } - } - return $cat_list; - } - - function add($owner,$app_name,$cat_name,$cat_description = "") + var $account_id; + var $app_name; + var $cats; + var $db; + + function categories($account_id,$app_name) { global $phpgw; - $db2 = $phpgw->db; + $this->account_id = $account_id; + $this->app_name = $app_name; + $this->db = $phpgw->db; - $db2->query("insert into categories (account_id,app_name,cat_name,cat_description) values ('" - . "$owner','" . addslashes($app_name) . "','" . addslashes($cat_name) . "','" - . addslashes($cat_description) . "')"); + $this->db->query("select * from phpgw_categories where cat_owner='$account_id' and app_name='" + . "$app_name'",__LINE__,__FILE__); + while ($this->db->next_record()) { + $this->cats[]["id"] = $this->db->f("cat_id"); + $this->cats[]["parent"] = $this->db->f("cat_parent"); + $this->cats[]["name"] = $this->db->f("cat_name"); + $this->cats[]["description"] = $this->db->f("cat_description"); + $this->cats[]["data"] = $this->db->f("cat_data"); + } } - function delete($owner,$app_name,$cat_name) + // Return into a select box, list or other formats + function list() { - global $phpgw; - $db2 = $phpgw->db; + + } + + function add($app_name,$cat_name,$cat_parent,$cat_description = "", $cat_data = "") + { + $this->db->query("insert into phpgw_categories (cat_parent,cat_owner,cat_appname,cat_name," + . "cat_description,cat_data) values ('$cat_parent','" . $this->account_id . "','" + . "$app_name','" . addslashes($cat_name) . "','" . addslashes($cat_description) + . "','$cat_data'",__LINE__,__FILE__); + } - $db2->query("delete from categories where account_id='$account_id' and app_name='" - . addslashes($app_name) . "' and cat_name='" . addslashes($cat_name) . "'"); + function delete($cat_id) + { + $this->db->query("delete from phpgw_categories where cat_id='$cat_id' and cat_owner='" + . $this->account_id . "'",__LINE__,__FILE__); } function edit($owner,$app_name,$cat_name,$cat_description) { - global $phpgw; - $db2 = $phpgw->db; $db2->query("update categories set cat_name='" . addslashes($cat_name) . "', cat_description='" . addslashes($cat_description) . "' where account_id='$owner' and app_name='" diff --git a/phpgwapi/templates/verdilak/images/help.gif b/phpgwapi/templates/verdilak/images/help.gif new file mode 100644 index 0000000000..ea3c9284f8 Binary files /dev/null and b/phpgwapi/templates/verdilak/images/help.gif differ diff --git a/phpgwapi/templates/verdilak/images/logout-grey.gif b/phpgwapi/templates/verdilak/images/logout-grey.gif new file mode 100644 index 0000000000..e2f921fb9f Binary files /dev/null and b/phpgwapi/templates/verdilak/images/logout-grey.gif differ diff --git a/phpgwapi/templates/verdilak/images/logout-red.gif b/phpgwapi/templates/verdilak/images/logout-red.gif new file mode 100644 index 0000000000..5bef6b80e5 Binary files /dev/null and b/phpgwapi/templates/verdilak/images/logout-red.gif differ diff --git a/phpgwapi/templates/verdilak/images/preferences-grey.gif b/phpgwapi/templates/verdilak/images/preferences-grey.gif new file mode 100644 index 0000000000..8026101754 Binary files /dev/null and b/phpgwapi/templates/verdilak/images/preferences-grey.gif differ diff --git a/phpgwapi/templates/verdilak/images/preferences-red.gif b/phpgwapi/templates/verdilak/images/preferences-red.gif new file mode 100644 index 0000000000..519d7f3873 Binary files /dev/null and b/phpgwapi/templates/verdilak/images/preferences-red.gif differ diff --git a/phpgwapi/templates/verdilak/images/welcome-grey.gif b/phpgwapi/templates/verdilak/images/welcome-grey.gif new file mode 100644 index 0000000000..46625167ba Binary files /dev/null and b/phpgwapi/templates/verdilak/images/welcome-grey.gif differ diff --git a/phpgwapi/templates/verdilak/images/welcome-red.gif b/phpgwapi/templates/verdilak/images/welcome-red.gif new file mode 100644 index 0000000000..e211b5028d Binary files /dev/null and b/phpgwapi/templates/verdilak/images/welcome-red.gif differ diff --git a/phpgwapi/templates/verdilak/navbar.inc.php b/phpgwapi/templates/verdilak/navbar.inc.php index 72fbfedf28..5ef8643dd0 100644 --- a/phpgwapi/templates/verdilak/navbar.inc.php +++ b/phpgwapi/templates/verdilak/navbar.inc.php @@ -13,7 +13,7 @@ function parse_navbar($force = False) { - global $phpgw_info, $phpgw; + global $phpgw_info, $phpgw, $PHP_SELF; $tpl = new Template($phpgw_info["server"]["template_dir"]); $tpl->set_unknowns("remove"); @@ -44,6 +44,20 @@ $tpl->set_var("logout_link",$phpgw_info["navbar"]["logout"]["url"]); $tpl->set_var("help_link",$phpgw_info["navbar"]["about"]["url"]); + $ir = $phpgw_info["server"]["webserver_url"] . "/phpgwapi/templates/verdilak/images"; + if (ereg($phpgw_info["server"]["webserver_url"] . "/index.php",$PHP_SELF)) { + $tpl->set_var("welcome_img",$ir . "/welcome-red.gif"); + } else { + $tpl->set_var("welcome_img",$ir . "/welcome-grey.gif"); + } + + if (ereg("preferences",$PHP_SELF)) { + $tpl->set_var("preferences_img",$ir . "/preferences-red.gif"); + } else { + $tpl->set_var("preferences_img",$ir . "/preferences-grey.gif"); + } + $tpl->set_var("logout_img",$ir . "/logout-grey.gif"); + /* if ($phpgw_info["server"]["showpoweredbyon"] == "top") { $tpl->set_var("powered_by",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"])); } diff --git a/phpgwapi/templates/verdilak/navbar.tpl b/phpgwapi/templates/verdilak/navbar.tpl index 3591df505f..d7ea4e4b46 100755 --- a/phpgwapi/templates/verdilak/navbar.tpl +++ b/phpgwapi/templates/verdilak/navbar.tpl @@ -6,11 +6,11 @@ {user_info} - + - + diff --git a/setup/sql/mysql_newtables.inc.php b/setup/sql/mysql_newtables.inc.php index f691523514..7281856996 100644 --- a/setup/sql/mysql_newtables.inc.php +++ b/setup/sql/mysql_newtables.inc.php @@ -262,14 +262,16 @@ )"; $phpgw_setup->db->query($sql); - $sql = "CREATE TABLE categories ( - cat_id int(9) DEFAULT '0' NOT NULL auto_increment, - account_id int(11) DEFAULT '0' NOT NULL, - app_name varchar(25) NOT NULL, - cat_name varchar(150) NOT NULL, - cat_description text NOT NULL, - PRIMARY KEY (cat_id) - )"; + $sql = "CREATE TABLE phpgw_categories ( + cat_id int(9) DEFAULT '0' NOT NULL auto_increment, + cat_parent int(9) DEFAULT '0' NOT NULL, + cat_owner int(11) DEFAULT '0' NOT NULL, + cat_appname varchar(50) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description varchar(255) NOT NULL, + cat_data text, + PRIMARY KEY (cat_id) + )"; $phpgw_setup->db->query($sql); $sql = "CREATE TABLE languages ( diff --git a/setup/sql/mysql_upgrade_beta.inc.php b/setup/sql/mysql_upgrade_beta.inc.php index 78efcc1628..e4cf3b86b1 100644 --- a/setup/sql/mysql_upgrade_beta.inc.php +++ b/setup/sql/mysql_upgrade_beta.inc.php @@ -766,6 +766,29 @@ $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.8pre5"; } + $test[] = "0.9.8pre5"; + function upgrade0_9_8pre5(){ + global $phpgw_info, $phpgw_setup; + + // Since no applications are using it yet. I am gonna drop it and create a new one. + // This is becuase I never finished the classes + $phpgw_setup->db->query("drop table categories"); + $sql = "CREATE TABLE phpgw_categories ( + cat_id int(9) DEFAULT '0' NOT NULL auto_increment, + cat_parent int(9) DEFAULT '0' NOT NULL, + cat_owner int(11) DEFAULT '0' NOT NULL, + cat_appname varchar(50) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description varchar(255) NOT NULL, + cat_data text, + PRIMARY KEY (cat_id) + )"; + $phpgw_setup->db->query($sql); + + $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.9pre1"; + } + + reset ($test); while (list ($key, $value) = each ($test)){ if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) { diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index e6a0789af6..f4602366d0 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -236,14 +236,18 @@ )"; $phpgw_setup->db->query($sql); - $sql = "CREATE TABLE categories ( - cat_id serial, - account_id int DEFAULT '0' NOT NULL, - app_name varchar(25) NOT NULL, - cat_name varchar(150) NOT NULL, - cat_description text NOT NULL - )"; + + $sql = "CREATE TABLE phpgw_categories ( + cat_id serial, + cat_parent int, + cat_owner int, + cat_appname varchar(50) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description varchar(255) NOT NULL, + cat_data text + )"; $phpgw_setup->db->query($sql); + $sql = "CREATE TABLE languages ( lang_id varchar(2) NOT NULL, diff --git a/setup/sql/pgsql_upgrade_beta.inc.php b/setup/sql/pgsql_upgrade_beta.inc.php index 47f9a77cb3..1a8397f140 100644 --- a/setup/sql/pgsql_upgrade_beta.inc.php +++ b/setup/sql/pgsql_upgrade_beta.inc.php @@ -792,6 +792,27 @@ $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.8pre5"; } + $test[] = "0.9.8pre5"; + function upgrade0_9_8pre5(){ + global $phpgw_info, $phpgw_setup; + + // Since no applications are using it yet. I am gonna drop it and create a new one. + // This is becuase I never finished the classes + $phpgw_setup->db->query("drop table categories"); + $sql = "CREATE TABLE phpgw_categories ( + cat_id serial, + cat_parent int, + cat_owner int, + cat_appname varchar(50) NOT NULL, + cat_name varchar(150) NOT NULL, + cat_description varchar(255) NOT NULL, + cat_data text + )"; + $phpgw_setup->db->query($sql); + + $phpgw_info["setup"]["currentver"]["phpgwapi"] = "0.9.9pre1"; + } + reset ($test); while (list ($key, $value) = each ($test)){ if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == $value) {