logo       
Google Custom Search
    AddThis Social Bookmark Button

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

mantisbt/core custom_field_api.php,1.46,1.47 custom_function_api.php,1.15,1: msg#00074

Subject: mantisbt/core custom_field_api.php,1.46,1.47 custom_function_api.php,1.15,1.16 version_api.php,1.18,1.19
Update of /cvsroot/mantisbt/mantisbt/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12088/core

Modified Files:
        custom_field_api.php custom_function_api.php version_api.php 
Log Message:
- Custom functions that are used to populate possible values for a custom field 
must be prefixed by "enum_".  For example, "enum_versions".  When specifying 
the name in the custom field definition use "=versions".
- Added "released_versions" and "future_versions" enumeration custom functions.

Index: version_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/version_api.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- version_api.php     21 Jul 2004 22:05:00 -0000      1.18
+++ version_api.php     29 Jan 2005 13:56:18 -0000      1.19
@@ -257,7 +257,7 @@
 
                $t_project_version_table = config_get( 
'mantis_project_version_table' );
 
-               $query = "SELECT version, date_order
+               $query = "SELECT version, date_order, released
                                  FROM $t_project_version_table
                                  WHERE project_id='$c_project_id' 
$t_released_where
                                  ORDER BY date_order DESC";

Index: custom_function_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/custom_function_api.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- custom_function_api.php     28 Jan 2005 21:58:16 -0000      1.15
+++ custom_function_api.php     29 Jan 2005 13:56:18 -0000      1.16
@@ -243,8 +243,8 @@
        # Construct an enumeration for all versions for the current project.
        # The enumeration will be empty if current project is ALL PROJECTS.
        # Enumerations format is: "abc|lmn|xyz"
-       # To use this in a custom field type "=versions_enum" in the possible 
values field.
-       function custom_function_default_versions_enum() {
+       # To use this in a custom field type "=versions" in the possible values 
field.
+       function custom_function_default_enum_versions() {
                $t_versions = version_get_all_rows( 
helper_get_current_project() );
 
                $t_enum = array();
@@ -258,11 +258,51 @@
        }
 
        # --------------------
+       # Construct an enumeration for released versions for the current 
project.
+       # The enumeration will be empty if current project is ALL PROJECTS.
+       # Enumerations format is: "abc|lmn|xyz"
+       # To use this in a custom field type "=released_versions" in the 
possible values field.
+       function custom_function_default_enum_released_versions() {
+               $t_versions = version_get_all_rows( 
helper_get_current_project() );
+
+               $t_enum = array();
+               foreach( $t_versions as $t_version ) {
+                       if ( $t_version['released'] == 1 ) {
+                               $t_enum[] = $t_version['version'];
+                       }
+               }
+
+               $t_possible_values = implode( '|', $t_enum );
+
+               return $t_possible_values;
+       }
+
+       # --------------------
+       # Construct an enumeration for released versions for the current 
project.
+       # The enumeration will be empty if current project is ALL PROJECTS.
+       # Enumerations format is: "abc|lmn|xyz"
+       # To use this in a custom field type "=future_versions" in the possible 
values field.
+       function custom_function_default_enum_future_versions() {
+               $t_versions = version_get_all_rows( 
helper_get_current_project() );
+
+               $t_enum = array();
+               foreach( $t_versions as $t_version ) {
+                       if ( $t_version['released'] == 0 ) {
+                               $t_enum[] = $t_version['version'];
+                       }
+               }
+
+               $t_possible_values = implode( '|', $t_enum );
+
+               return $t_possible_values;
+       }
+
+       # --------------------
        # Construct an enumeration for all categories for the current project.
        # The enumeration will be empty if current project is ALL PROJECTS.
        # Enumerations format is: "abc|lmn|xyz"
-       # To use this in a custom field type "=categories_enum" in the possible 
values field.
-       function custom_function_default_categories_enum() {
+       # To use this in a custom field type "=categories" in the possible 
values field.
+       function custom_function_default_enum_categories() {
                $t_categories = category_get_all_rows( 
helper_get_current_project() );
 
                $t_enum = array();
@@ -274,4 +314,4 @@
 
                return $t_possible_values;
        }
-?>
+?>
\ No newline at end of file

Index: custom_field_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/custom_field_api.php,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- custom_field_api.php        25 Jan 2005 12:44:12 -0000      1.46
+++ custom_field_api.php        29 Jan 2005 13:56:17 -0000      1.47
@@ -235,7 +235,7 @@
        function custom_field_create( $p_name ) {
                $c_name = db_prepare_string( trim( $p_name ) );
 
-               if ( is_blank( $p_name ) ) {                    
+               if ( is_blank( $p_name ) ) {
                        trigger_error( ERROR_EMPTY_FIELD, ERROR );
                }
 
@@ -286,7 +286,7 @@
                if ( $c_advanced == true && ( $c_require_report == true || 
$c_require_update ) ) {
                        trigger_error( ERROR_CUSTOM_FIELD_INVALID_DEFINITION, 
ERROR );
                }
-               
+
 
                if ( !custom_field_is_name_unique( $c_name, $c_field_id ) ) {
                        trigger_error( ERROR_CUSTOM_FIELD_NAME_NOT_UNIQUE, 
ERROR );
@@ -778,7 +778,7 @@
                                                ON  p.field_id=s.field_id AND 
s.bug_id='$c_bug_id'
                                        WHERE   p.project_id = '$c_project_id'
                                        ORDER BY p.sequence ASC, f.name ASC";
-                                       
+
                        $result = db_query( $query );
 
                        $t_row_count = db_num_rows( $result );
@@ -880,7 +880,7 @@
                $t_possible_values = $p_possible_values;
 
                if ( !is_blank( $t_possible_values ) && ( $t_possible_values[0] 
== '=' ) ) {
-                       $t_possible_values = helper_call_custom_function( 
substr( $t_possible_values, 1 ), array() );
+                       $t_possible_values = helper_call_custom_function( 
'enum_' . substr( $t_possible_values, 1 ), array() );
                }
 
                return $t_possible_values;
@@ -911,7 +911,7 @@
                if ( CUSTOM_FIELD_TYPE_ENUM == $row['type'] ||
                         CUSTOM_FIELD_TYPE_CHECKBOX == $row['type'] ||
                         CUSTOM_FIELD_TYPE_LIST == $row['type'] ||
-                        CUSTOM_FIELD_TYPE_MULTILIST == $row['type'] 
+                        CUSTOM_FIELD_TYPE_MULTILIST == $row['type']
                        ) {
                        $t_possible_values = 
custom_field_prepare_possible_values( $row['possible_values'] );
 
@@ -924,7 +924,7 @@
                        $t_where = '';
                        $t_from = $t_custom_field_string_table;
                        if ( ALL_PROJECTS != $p_project_id ) {
-                               $t_where = " AND $t_mantis_bug_table.id = 
$t_custom_field_string_table.bug_id AND 
+                               $t_where = " AND $t_mantis_bug_table.id = 
$t_custom_field_string_table.bug_id AND
                                                        
$t_mantis_bug_table.project_id = '$p_project_id'";
                                $t_from = $t_from . ", $t_mantis_bug_table";
                        }
@@ -1118,21 +1118,21 @@
                case CUSTOM_FIELD_TYPE_MULTILIST:
                        $t_values = explode( '|', 
custom_field_prepare_possible_values( $p_field_def['possible_values'] ) );
                        $t_list_size = $t_possible_values_count = count( 
$t_values );
-                               
+
                        if ( $t_possible_values_count > 5 ) {
                                $t_list_size = 5;
                        }
-                       
+
                        if ( $p_field_def['type'] == CUSTOM_FIELD_TYPE_ENUM ) {
                                $t_list_size = 0;       # for enums the size is 0
                        }
-                       
-                       if ( $p_field_def['type'] == 
CUSTOM_FIELD_TYPE_MULTILIST ) {     
+
+                       if ( $p_field_def['type'] == 
CUSTOM_FIELD_TYPE_MULTILIST ) {
                                echo '<select name="custom_field_' . $t_id . 
'[]" size="' . $t_list_size . '" multiple>';
                        } else {
                                echo '<select name="custom_field_' . $t_id . '" 
size="' . $t_list_size . '">';
                        }
-                       
+
                        $t_selected_values = explode( '|', 
$t_custom_field_value );
                        foreach( $t_values as $t_option ) {
                                if( in_array( $t_option, $t_selected_values ) ) 
{
@@ -1171,7 +1171,7 @@
 
        # --------------------
        # Prepare a string containing a custom field value for display
-       # $p_def                contains the definition of the custom field 
+       # $p_def                contains the definition of the custom field
        # $p_field_id   contains the id of the field
        # $p_bug_id             contains the bug id to display the custom field 
value for
        # NOTE: This probably belongs in the string_api.php
@@ -1189,12 +1189,12 @@
                                break;
                        default:
                                return string_display_links( 
$t_custom_field_value );
-               }       
+               }
        }
 
        # --------------------
        # Print a custom field value for display
-       # $p_def                contains the definition of the custom field 
+       # $p_def                contains the definition of the custom field
        # $p_field_id   contains the id of the field
        # $p_bug_id             contains the bug id to display the custom field 
value for
        # NOTE: This probably belongs in the print_api.php
@@ -1220,8 +1220,8 @@
                                break;
                        default:
                                return $p_value;
-               }       
+               }
                return $p_value;
        }
-       
+
 ?>



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>