Skip to content

Commit

Permalink
Added version management and added user defaults
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@56 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Dec 10, 2000
1 parent a91266b commit a9a0fd3
Show file tree
Hide file tree
Showing 21 changed files with 285 additions and 64 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Expand Up @@ -36,6 +36,9 @@ To Do:
* Split manage user actions into separate files
* Added several ; in core_API.php that caused errors on some servers
* Added view next/prev XYZ bugs on bug viewing page
* Added a string_display() function to prevent HTML tags from screwing up display
* Modified version to be an enum.
* Added version editing capability

12.06.2000 - 0.10.2

Expand Down
29 changes: 1 addition & 28 deletions INSTALL
Expand Up @@ -54,35 +54,8 @@ is covered in CONFIGURATION.
-------------------------------------------------------------------------------
### Upgrading ###
-------------------------------------------------------------------------------
=================
0.9.x to 0.10.x
=================

You will need to add a 'protected' field in the mantis_user_table.
This command will do the trick:

ALTER TABLE mantis_user_table ADD protected VARCHAR (3) not null

=================
0.10.2 to 0.10.3+
=================

I've added a profile table and inserted feedback into the main bug table
Run these queries:

ALTER TABLE mantis_bug_table CHANGE status status ENUM ('new','fdeedback',
'acknowledged','confirmed','assigned','resolved') DEFAULT 'new' not null;

CREATE TABLE mantis_user_profile_table (
id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL auto_increment,
user_id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL,
platform varchar(32) NOT NULL,
os varchar(32) NOT NULL,
os_build varchar(16) NOT NULL,
description text NOT NULL,
default_profile char(3) NOT NULL,
PRIMARY KEY (id)
);
See the files: UPGRADING and db_upgrade.sql

-------------------------------------------------------------------------------
### Useful links ###
Expand Down
4 changes: 4 additions & 0 deletions README
Expand Up @@ -51,6 +51,10 @@ Features:
- Projection / ETA
- Items updated since last visit indicators

The release numbering convention I'm using is major.minor.micro.
Major indicates a large change in the core package, minor a significant
amount of feature addition/modification, micro for mostly bug fixes.

I'd appreciate an email letting me know if you find this program useful.
I won't publish any information without permission, I'd just like an idea
and knowing I'm helping people will only motivate me more.
Expand Down
51 changes: 51 additions & 0 deletions UPGRADING
@@ -0,0 +1,51 @@
# -------------------------------------------------------------------------------
# Upgrading
# -------------------------------------------------------------------------------

# Here are the basic steps to upgrade the database tables
# Take a look in db_upgrade.sql as well.

# =================
# 0.10.2 to 0.11.0
# =================

# I've added a profile table and inserted feedback into the main bug table.
# Also modified version to be an enum (edit using the manage section)
# Run these queries:

ALTER TABLE mantis_bug_table CHANGE status status ENUM ('new','fdeedback',
'acknowledged','confirmed','assigned','resolved') DEFAULT 'new' not null;

CREATE TABLE mantis_user_profile_table (
id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL auto_increment,
user_id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL,
platform varchar(32) NOT NULL,
os varchar(32) NOT NULL,
os_build varchar(16) NOT NULL,
description text NOT NULL,
default_profile char(3) NOT NULL,
PRIMARY KEY (id)
);

ALTER TABLE mantis_bug_table CHANGE version version ENUM ('none') not null;

CREATE TABLE mantis_user_defaults_table (
id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL auto_increment,
user_id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL,
hide_resolved char(3) NOT NULL,
limit_view int(11) DEFAULT '0' NOT NULL,
show_last char(3) NOT NULL,
advanced_report char(3) NOT NULL,
advanced_view char(3) NOT NULL,
PRIMARY KEY (id)
);

# =================
# 0.9.x to 0.10.x
# =================

# You will need to add a 'protected' field in the mantis_user_table.
# This command will do the trick:

ALTER TABLE mantis_user_table ADD protected VARCHAR (3) not null

2 changes: 1 addition & 1 deletion account_page.php3
Expand Up @@ -38,7 +38,7 @@
<p>
<div align=center>
[ <a href="<? echo $g_account_profile_manage_page ?>">Manage Profiles</a> ]
<!-- [ <a href="<? echo $g_account_prefs_page ?>">Change Preferences</a> ] -->
[ <a href="<? echo $g_account_prefs_page ?>">Change Preferences</a> ]
</div>
<?
}
Expand Down
8 changes: 4 additions & 4 deletions bug_update_advanced_page.php3
Expand Up @@ -74,10 +74,10 @@
$row = mysql_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v2" );

$v_summary = string_unsafe( $v_summary );
$v2_description = string_unsafe( $v2_description );
$v2_steps_to_reproduce = string_unsafe( $v2_steps_to_reproduce );
$v2_additional_information = string_unsafe( $v2_additional_information );
$v_summary = string_display( $v_summary );
$v2_description = string_display( $v2_description );
$v2_steps_to_reproduce = string_display( $v2_steps_to_reproduce );
$v2_additional_information = string_display( $v2_additional_information );
$v_date_submitted = date( "m-d H:i", sql_to_unix_time( $v_date_submitted ) );
$v_last_updated = date( "m-d H:i", sql_to_unix_time( $v_last_updated ) );
?>
Expand Down
8 changes: 4 additions & 4 deletions bug_update_page.php3
Expand Up @@ -80,10 +80,10 @@
$row = mysql_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v2" );

$v_summary = string_unsafe( $v_summary );
$v2_description = string_unsafe( $v2_description );
$v2_steps_to_reproduce = string_unsafe( $v2_steps_to_reproduce );
$v2_additional_information = string_unsafe( $v2_additional_information );
$v_summary = string_display( $v_summary );
$v2_description = string_display( $v2_description );
$v2_steps_to_reproduce = string_display( $v2_steps_to_reproduce );
$v2_additional_information = string_display( $v2_additional_information );
$v_date_submitted = date( "m-d H:i", sql_to_unix_time( $v_date_submitted ) );
$v_last_updated = date( "m-d H:i", sql_to_unix_time( $v_last_updated ) );
?>
Expand Down
2 changes: 1 addition & 1 deletion bugnote_inc.php
Expand Up @@ -88,7 +88,7 @@
<table width=100% align=center>
<tr>
<td bgcolor=<? echo $g_primary_color_light ?>>
<? echo string_unsafe( $v3_note ) ?>
<? echo string_display( $v3_note ) ?>
</td>
</tr>
</table>
Expand Down
10 changes: 7 additions & 3 deletions config_inc.php
Expand Up @@ -19,7 +19,7 @@

#--------------------
# file path variables
$g_path = "/mantisbt/"; # requires trailing /
$g_path = "/mantis/"; # requires trailing /
#--------------------

#--------------------
Expand Down Expand Up @@ -150,6 +150,9 @@
$g_manage_category_page = "manage_category_page".$g_php;
$g_manage_category_update = "manage_category_update".$g_php;

$g_manage_product_versions_page = "manage_product_versions_page".$g_php;
$g_manage_product_versions_update = "manage_product_versions_update".$g_php;

# news
$g_news_menu_page = "news_menu_page".$g_php;
$g_news_edit_page = "news_edit_page".$g_php;
Expand Down Expand Up @@ -201,12 +204,13 @@
$g_date_partitions = array("1 day","3 days","1 week","1 month","1 year");
#--------------------

$g_product_versions = "0.9.0,0.9.1,0.10.0,0.10.1,0.10.2,0.10.3";

#--------------------
# html table appearance variables
$g_primary_table_tags = "";
#--------------------


#--------------------
# color values
$g_white_color = "#ffffff"; # white
Expand Down Expand Up @@ -238,4 +242,4 @@
#version
$g_mantis_version = "0.10.3";
#--------------------
?>
?>
34 changes: 29 additions & 5 deletions core_API.php
Expand Up @@ -133,8 +133,10 @@ function get_enum_string( $p_field_name ) {
} ### end for
}
#--------------------
function get_enum_count( $t_enum_string ) {
return count(explode(",",$t_enum_string));
# returns the number of items in a list
# default delimiter is a ,
function get_list_item_count( $t_enum_string, $p_delim_char="," ) {
return count(explode($p_delim_char,$t_enum_string));
}
#--------------------
### Used for update pages
Expand All @@ -143,7 +145,7 @@ function print_categories( $p_category="" ) {

$t_category_string = get_enum_string( "category" );
$t_str = $t_category_string.",";
$cat_count = get_enum_count($t_str)-1;
$cat_count = get_list_item_count($t_str)-1;
for ($i=0;$i<$cat_count;$i++) {
$t_s = substr( $t_str, 1, strpos($t_str, ",")-2 );
$t_str = substr( $t_str, strpos($t_str, ",")+1, strlen($t_str) );
Expand All @@ -162,7 +164,7 @@ function print_list( $p_list, $p_item="" ) {

$t_category_string = get_enum_string( $p_list );
$t_str = $t_category_string.",";
$entry_count = get_enum_count($t_str)-1;
$entry_count = get_list_item_count($t_str)-1;
for ($i=0;$i<$entry_count;$i++) {
$t_s = substr( $t_str, 1, strpos($t_str, ",")-2 );
$t_str = substr( $t_str, strpos($t_str, ",")+1, strlen($t_str) );
Expand All @@ -175,13 +177,31 @@ function print_list( $p_list, $p_item="" ) {
} ### end for
}
#--------------------
### Used for update pages
function print_list2( $p_list, $p_item="" ) {
global $g_mantis_bug_table;

$t_str = $p_list.",";
$entry_count = get_list_item_count( $t_str )-1;
for ($i=0;$i<$entry_count;$i++) {
$t_s = substr( $t_str, 0, strpos($t_str, ",") );
$t_str = substr( $t_str, strpos($t_str, ",")+1, strlen($t_str) );
if ( $p_item==$t_s ) {
PRINT "<option value=\"$t_s\" SELECTED>$t_s";
}
else {
PRINT "<option value=\"$t_s\">$t_s";
}
} ### end for
}
#--------------------
### Used in summary reports
function print_bug_enum_summary( $p_enum, $p_status="" ) {
global $g_mantis_bug_table, $g_primary_color_light, $g_primary_color_dark;

$t_enum_string = get_enum_string( $p_enum );
$t_str = $t_enum_string.",";
$enum_count = get_enum_count($t_str)-1;
$enum_count = get_list_item_count($t_str)-1;
for ($i=0;$i<$enum_count;$i++) {
$t_s = substr( $t_str, 1, strpos($t_str, ",")-2 );
$t_str = substr( $t_str, strpos($t_str, ",")+1, strlen($t_str) );
Expand Down Expand Up @@ -463,6 +483,10 @@ function string_unsafe( $p_string ) {
return stripslashes( $p_string );
}
#--------------------
function string_display( $p_string ) {
return htmlspecialchars(stripslashes( $p_string ));
}
#--------------------
function string_edit( $p_string ) {
return str_replace( "<br>", " ", stripslashes( $p_string ) );
}
Expand Down
17 changes: 16 additions & 1 deletion db_generate.sql
Expand Up @@ -26,7 +26,7 @@ CREATE TABLE mantis_bug_table (
os varchar(32) NOT NULL,
os_build varchar(16) NOT NULL,
platform varchar(32) NOT NULL,
version varchar(16) NOT NULL,
version enum ('none') NOT NULL,
build tinyint(4) DEFAULT '0' NOT NULL,
votes tinyint(4) DEFAULT '0' NOT NULL,
summary varchar(128) NOT NULL,
Expand Down Expand Up @@ -127,3 +127,18 @@ CREATE TABLE mantis_user_profile_table (
default_profile char(3) NOT NULL,
PRIMARY KEY (id)
);

#
# Table structure for table 'mantis_user_defaults_table'
#

CREATE TABLE mantis_user_defaults_table (
id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL auto_increment,
user_id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL,
hide_resolved char(3) NOT NULL,
limit_view int(11) DEFAULT '0' NOT NULL,
show_last char(3) NOT NULL,
advanced_report char(3) NOT NULL,
advanced_view char(3) NOT NULL,
PRIMARY KEY (id)
);
22 changes: 21 additions & 1 deletion db_upgrade.sql
Expand Up @@ -20,11 +20,13 @@ ALTER TABLE mantis_user_table ADD protected VARCHAR (3) not null;
# 0.10.2 to 0.10.3+
# =================

# I've added a profile table and inserted feedback into the main bug table
# inserted feedback as a status

ALTER TABLE mantis_bug_table CHANGE status status ENUM ('new','need info',
'acknowledged','confirmed','assigned','resolved') DEFAULT 'new' not null;

# New user profile tables

CREATE TABLE mantis_user_profile_table (
id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL auto_increment,
user_id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL,
Expand All @@ -35,3 +37,21 @@ CREATE TABLE mantis_user_profile_table (
default_profile char(3) NOT NULL,
PRIMARY KEY (id)
);

# Versions has been changed to be an enum(edit by hand or through the manage section

ALTER TABLE mantis_bug_table CHANGE version version ENUM ('none') not null;

# New table for default user preferences

CREATE TABLE mantis_user_defaults_table (
id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL auto_increment,
user_id int(10) unsigned zerofill DEFAULT '0000000000' NOT NULL,
hide_resolved char(3) NOT NULL,
limit_view int(11) DEFAULT '0' NOT NULL,
show_last char(3) NOT NULL,
advanced_report char(3) NOT NULL,
advanced_view char(3) NOT NULL,
PRIMARY KEY (id)
);

6 changes: 3 additions & 3 deletions main_page.php3
Expand Up @@ -47,8 +47,8 @@
for ($i=0;$i<$news_count;$i++) {
$row = mysql_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, "v" );
$v_headline = string_unsafe( $v_headline );
$v_body = string_unsafe( $v_body );
$v_headline = string_display( $v_headline );
$v_body = string_display( $v_body );
$v_date_posted = date( "m-d H:i", sql_to_unix_time( $v_date_posted ) );

## grab the username and email of the poster
Expand All @@ -67,7 +67,7 @@
<table width=75% bgcolor=<? echo $g_primary_border_color." ".$g_primary_table_tags ?>>
<tr>
<td bgcolor=<? echo $g_primary_color_dark ?>>
<b><? echo string_unsafe( $v_headline ) ?></b> -
<b><? echo $v_headline ?></b> -
<i><? echo $v_date_posted ?></i> -
<a href="mailto:<? echo $t_poster_email ?>"><? echo $t_poster_name ?></a>
</td>
Expand Down
1 change: 1 addition & 0 deletions manage_page.php3
Expand Up @@ -44,6 +44,7 @@
<div align=center>
[ <a href="<? echo $g_manage_create_user_page ?>">Create New Account</a> ]
[ <a href="<? echo $g_manage_category_page ?>">Manage Categories</a> ]
[ <a href="<? echo $g_manage_product_versions_page ?>">Manage Product Versions</a> ]
[ <a href="<? echo $g_documentation_page ?>">Documentation</a> ]
</div>

Expand Down

0 comments on commit a9a0fd3

Please sign in to comment.