gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/www/tracker add-fields.php, NONE, 1.1 add.php, 1


From: tperdue
Subject: [Gforge-commits] gforge/www/tracker add-fields.php, NONE, 1.1 add.php, 1.11, 1.12 browse.php, 1.12, 1.13 detail.php, 1.14, 1.15 index.php, 1.20, 1.21 massupdate-fields.php, NONE, 1.1 mod-limited.php, 1.4, 1.5 mod.php, 1.16, 1.17 search-fields.php, NONE, 1.1 update-fields.php, NONE, 1.1
Date: Thu, 26 Aug 2004 10:32:10 -0500

Update of /cvsroot/gforge/gforge/www/tracker
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/www/tracker

Modified Files:
        add.php browse.php detail.php index.php mod-limited.php 
        mod.php 
Added Files:
        add-fields.php massupdate-fields.php search-fields.php 
        update-fields.php 
Log Message:
Unlimited Extra Fields for Tracker

--- NEW FILE: add-fields.php ---
<?php
/**
 * add-fields.php - extra_fields code to submit a new artifact with fields 
 * defined by admin
 *
 * Copyright 2004 (c) Anthony J. Pugliese
 *
 * @version   $Id: add-fields.php,v 1.1 2004/08/26 15:32:07 tperdue Exp $
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
 */
$result=$ath->getSelectionBoxes();
$rows=db_numrows($result);
if($result &&$rows > 0) {
        foreach($_POST as$KEY=>$post_value){
        $value_array[]=$post_value;
        }
$post_value=implode(",",$value_array);
}
$post_value=explode(",",$post_value);
        for ($i=0; $i < $rows; $i++){
        $value[$i]=$post_value[$i+4];
        $ah->createExtraFields($value[$i]);
        }
?>


Index: add.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/tracker/add.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- add.php     4 Nov 2003 20:52:51 -0000       1.11
+++ add.php     26 Aug 2004 15:32:07 -0000      1.12
@@ -15,11 +15,12 @@
 $ath->header(array 
('title'=>$Language->getText('tracker_add','submit'),'pagename'=>'tracker_add','sectionvals'=>array($ath->getName())));
 
        /*
-           Show the free-form text submitted by the project admin
+               Show the free-form text submitted by the project admin
        */
        echo $ath->getSubmitInstructions();
 
        echo '<p>
+
        <form 
action="'.$PHP_SELF.'?group_id='.$group_id.'&atid='.$ath->getID().'" 
method="post" enctype="multipart/form-data">
        <input type="hidden" name="func" value="postadd" />
        <table>
@@ -27,20 +28,46 @@
                <td 
valign="top"><strong>'.$Language->getText('tracker_add','for_project').':</strong><br
 />'.$group->getPublicName().'</td>
                <td valign="top"><input type="submit" name="submit" value="'. 
$Language->getText('general','submit').'" /></td>
        </tr>
-       <tr><td 
<valign="top"><strong>'.$Language->getText('tracker','category').': <a 
href="javascript:help_window(\'/help/tracker.php?helpname=category\')"><strong>(?)</strong></a></strong><br
 />';
+       <tr>
+               <td 
<valign="top"><strong>'.$Language->getText('tracker','category').': <a 
href="javascript:help_window(\'/help/tracker.php?helpname=category\')"><strong>(?)</strong></a></strong><br
 />';
 
                echo $ath->categoryBox('category_id');
                echo '&nbsp;<a 
href="/tracker/admin/?group_id='.$group_id.'&amp;atid='. $ath->getID() 
.'&amp;add_cat=1">('.$Language->getText('tracker','admin').')</a>';
        ?>
-       </td><td><strong><?php echo $Language->getText('tracker','item_group') 
?>: <a 
href="javascript:help_window('/help/tracker.php?helpname=group')"><strong>(?)</strong></a></strong><br
 />
+               </td>
+               <td><strong><?php echo 
$Language->getText('tracker','item_group') ?>: <a 
href="javascript:help_window('/help/tracker.php?helpname=group')"><strong>(?)</strong></a></strong><br
 />
        <?php
                echo $ath->artifactGroupBox('artifact_group_id');
                echo '&nbsp;<a 
href="/tracker/admin/?group_id='.$group_id.'&amp;atid='. $ath->getID() 
.'&amp;add_group=1">('.$Language->getText('tracker','admin').')</a>';
        ?>
-       </td></tr>
-       <?php 
+               </td>
+       </tr>
+       <?php
+//
+//     build input pop-up boxes for boxes and choices configured by ADMIN
+//
+       $result=$ath->getSelectionBoxes(); 
+       echo "<p>&nbsp;</p>";
+       $rows=db_numrows($result);
+       if ($result &&$rows > 0) {
+               echo '<tr>';
+               for ($i=0; $i < $rows; $i++) {
+                       $newrow= is_integer($i/2);
+                       echo 
'<td><strong>'.db_result($result,$i,'selection_box_name').'</strong><br \>';
+                       echo 
$ath->selectionBox(db_result($result,$i,'id','choice_id'));
+                       echo '&nbsp;<a 
href="/tracker/admin/?group_id='.$group_id.'&amp;atid='. $ath->getID() 
.'&amp;build_box=1">('.$Language->getText('tracker','admin').')</a>';
+               
+                       if (!$newrow) {
+                               echo '</tr><tr>';
+                       }
+               }
+       }
+       ?>
+       <?php
+ 
        if ($ath->userIsAdmin()) {
-               echo 
'<tr><td><strong>'.$Language->getText('tracker','assigned_to').': <a 
href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a></strong><br
 />';
+               echo '<tr>
+               <td><strong>'.$Language->getText('tracker','assigned_to').': <a 
href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a></strong><br
 />';
                echo $ath->technicianBox ('assigned_to');
                echo '&nbsp;<a 
href="/tracker/admin/?group_id='.$group_id.'&amp;atid='. $ath->getID() 
.'&amp;update_users=1">('.$Language->getText('tracker','admin').')</a>';
 
@@ -49,17 +76,22 @@
                echo '</td></tr>';
        }
        ?>
-       <tr><td colspan="2"><strong><?php echo 
$Language->getText('tracker','summary') ?>: <a 
href="javascript:help_window('/help/tracker.php?helpname=summary')"></strong><?php
 echo utils_requiredField(); ?><strong>(?)</strong></a><br />
+       <tr>
+               <td colspan="2"><strong><?php echo 
$Language->getText('tracker','summary') ?>: <a 
href="javascript:help_window('/help/tracker.php?helpname=summary')"></strong><?php
 echo utils_requiredField(); ?><strong>(?)</strong></a><br />
                <input type="text" name="summary" size="80" maxlength="255" />
-       </td></tr>
+               </td>
+       </tr>
 
-       <tr><td colspan="2">
+       <tr>
+               <td colspan="2">
                <strong><?php echo 
$Language->getText('tracker','detailed_description') ?>:</strong><?php echo 
notepad_button('document.forms[1].details') ?> <?php echo 
utils_requiredField(); ?>
                <p>
                <textarea name="details" rows="30" cols="79" 
wrap="soft"></textarea></p>
-       </td></tr>
+               </td>
+       </tr>
 
-       <tr><td colspan="2">
+       <tr>
+               <td colspan="2">
        <?php 
        if (!session_loggedin()) {
                echo '
@@ -73,9 +105,11 @@
                <p>&nbsp;</p>
                <h3><span style="color:red"><?php echo 
$Language->getText('tracker','security_note') ?></span></h3>
                <p>&nbsp;</p>
-       </td></tr>
+               </td>
+       </tr>
 
-       <tr><td colspan="2">
+       <tr>
+               <td colspan="2">
                <strong><?php echo $Language->getText('tracker','check_upload') 
?>:</strong> <input type="checkbox" name="add_file" value="1" />
                <a 
href="javascript:help_window('/help/tracker.php?helpname=comment')"><strong>(?)</strong></a><br
 />
                <p>
@@ -83,11 +117,13 @@
                <p>
                <strong><?php echo 
$Language->getText('tracker','file_description') ?>:</strong><br />
                <input type="text" name="file_description" size="40" 
maxlength="255" /></p>
-       </td><tr>
+               </td>
+       <tr>
 
        <tr><td colspan="2">
                <input type="submit" name="submit" value="<?php echo 
$Language->getText('general','submit')?>" />
-       </td></tr>
+               </td>
+       </tr>
 
        </table></form></p>
 

Index: browse.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/tracker/browse.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- browse.php  15 Jan 2004 15:26:03 -0000      1.12
+++ browse.php  26 Aug 2004 15:32:07 -0000      1.13
@@ -18,6 +18,8 @@
        exit_permission_denied();
 }
 
+       include 'search-fields.php';
+
 $af = new ArtifactFactory($ath);
 if (!$af || !is_object($af)) {
        exit_error('Error','Could Not Get Factory');
@@ -35,6 +37,7 @@
 $_changed_from=$af->changed_from;
 
 $art_arr =& $af->getArtifacts();
+
 if (!$art_arr && $af->isError()) {
        exit_error('Error',$af->getErrorMessage());
 }
@@ -109,13 +112,12 @@
 $changed_name_arr[]=$Language->getText('tracker_browse','month1');
 
 $changed_arr=array();
-$changed_arr[]= 0x7fffffff;     // Any
-$changed_arr[]= 3600 * 24;     // 24 hour
+$changed_arr[]= 0x7fffffff;     // Any
+$changed_arr[]= 3600 * 24;      // 24 hour
 $changed_arr[]= 3600 * 24 * 7; // 1 week
 $changed_arr[]= 3600 * 24 * 14;// 2 week
 $changed_arr[]= 3600 * 24 * 30;// 1 month
 
-
 //
 //     Show the new pop-up boxes to select assigned to, status, etc
 //
@@ -130,8 +132,36 @@
        '<td><span 
style="font-size:smaller">'.$Language->getText('tracker','category').':&nbsp;<a 
href="javascript:help_window(\'/help/tracker.php?helpname=category\')"><strong>(?)</strong></a><br
 />'. $ath->categoryBox 
('_category',$_category,$Language->getText('tracker','category_any')) 
.'</span></td>'.
        '<td><span 
style="font-size:smaller">'.$Language->getText('tracker','group').':&nbsp;<a 
href="javascript:help_window(\'/help/tracker.php?helpname=group\')"><strong>(?)</strong></a><br
 />'. $ath->artifactGroupBox 
('_group',$_group,$Language->getText('tracker','group_any')) .'</span></td>' .
        '<td><span 
style="font-size:smaller">'.$Language->getText('tracker','changed').':&nbsp;<a 
href="javascript:help_window(\'/help/tracker.php?helpname=changed\')"><strong>(?)</strong></a><br
 />'. 
html_build_select_box_from_arrays($changed_arr,$changed_name_arr,'_changed_from',$_changed_from,false)
 .'</span></td>
-       </tr>
-       <tr>
+       </tr>';
+
+/**
+ *
+ *  Build pop-up boxes for BROWSE boxes and choices configured by ADMIN
+ *
+ */
+echo '<tr>';
+       $result=$ath->getSelectionBoxes();
+       $rows=db_numrows($result);
+       $select_arr[]=array();
+       if ($result &&$rows > 0) {
+               echo '<tr>';
+               for ($i=0; $i < $rows; $i++) {
+                       $newrow=is_integer(($i+1)/5);
+                       echo '<td><span 
style="font-size:smaller">'.db_result($result,$i,'selection_box_name').'</span></br
 \>';
+                       if ($source=='custom') {
+                               $choice= $value[$i];
+                       } else {
+                               $choice='xzxz';
+                       }
+                       echo 
$ath->selectionBox(db_result($result,$i,'id'),$choice,$Language->getText('tracker_admin_build_boxes','status_any'));
+                       echo '</td>';
+                       if ($newrow) {
+                               echo'</tr><tr>';
+                       }
+               }
+       }
+       echo '</tr>';
+       echo '<tr>
                <td align="right"><span 
style="font-size:smaller">'.$Language->getText('tracker_browse','sort_by').':&nbsp;<a
 
href="javascript:help_window(\'/help/tracker.php?helpname=sort_by\')"><strong>(?)</strong></a></span></td>'.
                '<td><span style="font-size:smaller">'. 
                
html_build_select_box_from_arrays($order_arr,$order_name_arr,'_sort_col',$_sort_col,false)
 .'</td>'.
@@ -139,14 +169,60 @@
                '<td><span style="font-size:smaller"><input type="submit" 
name="submit" value="'.$Language->getText('general','browse').'" /></td>
        </tr>
        </form></table>';
-
-/*
-       Show the free-form text submitted by the project admin
-*/
+/**
+ *
+ *     Show the free-form text submitted by the project admin
+ */
 echo $ath->getBrowseInstructions();
 
 if ($art_arr && count($art_arr) > 0) {
 
+       if ($source=='custom') {
+       //
+       // validate that any admin configured extra fields meet its selection 
criteria
+
+               $result=$ath->getSelectionBoxes();
+               $artrows=count($art_arr);
+               $rows=db_numrows($result);
+               $matches=0;
+               if ($result &&$rows && $artrows > 0) {
+                       for ($i=0; $i < $artrows; $i++){
+                               $resultc = 
$ath->getArtifactChoices($art_arr[$i]->getID());
+                               $browserows = db_numrows($resultc);
+                               for ($j=0; $j < $browserows; $j++) {
+                                       if ((db_result($resultc,$j,'choice_id') 
== $value[$j])|| $value[$j]=='100'){
+                                               $matches=$matches+1;
+                                       }
+                               }
+                               if ($rows > $browserows && $matches == 
$browserows) {
+                                       for ($k = $browserows; $k < $rows; 
$k++){
+                                               if 
((db_result($resultc,$k,'choice_id') == $value[$k]) || $value[$k] == '100') {
+                                                       $matches = $matches+1;
+                                               }
+                                       }
+                               }
+                               if ($matches!==$rows){
+                                       $remove_arr[]=$i;
+                                       $matches=0;     
+                               }
+                               $matches=0;     
+                       }
+                       //
+                       // remove the unselected rows from $art_arr
+                       //
+                       $remove_rows=count($remove_arr);
+                       if ($remove_rows > 0) {
+                               for ($k=0; $k < $remove_rows; $k++) {
+                       
+                                       //   remove $art_arr entries not 
selected and reindex with array_values() - since unset will remove the index as 
a key
+                                       // 
+                                       $entry=$remove_arr[$k];
+                                       unset ($art_arr[$entry]);
+                               }
+                               $art_arr=array_values($art_arr);
+                       }
+               }               
+       }
        if ($set=='custom') {
                $set .= 
'&_assigned_to='.$_assigned_to.'&_status='.$_status.'&_category='.$_category.'&_group='.$_group.'&_sort_col='.$_sort_col.'&_sort_ord='.$_sort_ord;
        }
@@ -166,6 +242,8 @@
                <input type="hidden" name="func" value="massupdate">';
        }
 
+
+
        echo $GLOBALS['HTML']->listTableTop ($title_arr);
 
        $then=(time()-$ath->getDuePeriod());
@@ -223,7 +301,6 @@
                }
                echo '</td></tr>';
        }
-
        echo $GLOBALS['HTML']->listTableBottom();
        /*
                Mass Update Code
@@ -260,24 +337,43 @@
                                </strong><br />'. $ath->categoryBox 
('category_id','xzxz',$Language->getText('tracker_browse','no_change')) .'</td>
                        <td><strong>'.$Language->getText('tracker','group').': 
<a 
href="javascript:help_window(\'/help/tracker.php?helpname=group\')"><strong>(?)</strong></a></strong>
                                <br />'. $ath->artifactGroupBox 
('artifact_group_id','xzxz',$Language->getText('tracker_browse','no_change')) 
.'</td>
-                       </tr>
+                       </tr>';
 
-                       <tr>
+
+               //
+               //      build input pop-up boxes for boxes and choices 
configured by ADMIN
+               //
+               $result=$ath->getSelectionBoxes();
+               echo "<p>&nbsp;</p>";
+               $rows=db_numrows($result);
+               if ($result &&$rows > 0) {
+                       echo '<tr>';
+                       for ($i=0; $i < $rows; $i++) {
+                               $newrow= is_integer($i/2);
+                               echo 
'<td><strong>'.db_result($result,$i,'selection_box_name').'</strong><br \>';
+                               echo 
$ath->selectionBox(db_result($result,$i,'id'),'xzxz',$Language->getText('tracker_browse','no_change'));
+               
+                               if (!$newrow) {
+                                       echo '</tr><tr>';
+                               }
+                       }
+               }
+               echo   '<tr>
                        
<td><strong>'.$Language->getText('tracker','priority').': <a 
href="javascript:help_window(\'/help/tracker.php?helpname=priority\')"><strong>(?)</strong></a>
                                </strong><br />';
-                       echo build_priority_select_box ('priority', '100', 
true);
-                       echo '</td><td>';
-                       if ($ath->useResolution()) {
-                               echo '
+               echo build_priority_select_box ('priority', '100', true);
+               echo '</td><td>';
+               if ($ath->useResolution()) {
+                       echo '
                                
<strong>'.$Language->getText('tracker_browse','resolution').': <a 
href="javascript:help_window(\'/help/tracker.php?helpname=resolution\')"><strong>(?)</strong></a>
                                        </strong><br />';
-                               echo 
$ath->resolutionBox('resolution_id','xzxz',true,$Language->getText('tracker_browse','no_change'));
-                       } else {
-                               echo '&nbsp;
+                       echo 
$ath->resolutionBox('resolution_id','xzxz',true,$Language->getText('tracker_browse','no_change'));
+               } else {
+                       echo '&nbsp;
                                <input type="hidden" name="resolution_id" 
value="100">';
-                       }
+               }
 
-                       echo '</td>
+               echo '</td>
                        </tr>
 
                        <tr>

Index: detail.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/tracker/detail.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- detail.php  20 Jul 2004 15:56:35 -0000      1.14
+++ detail.php  26 Aug 2004 15:32:07 -0000      1.15
@@ -55,6 +55,34 @@
                        <td><strong><?php echo 
$Language->getText('tracker','status') ?>:</strong><br /><?php echo 
$ah->getStatusName(); ?></td>
                </tr>
 
+       <?php
+//
+//     build input pop-up boxes for boxes and choices configured by ADMIN
+//
+       $result=$ath->getSelectionBoxes();
+       $resultc=$ath->getArtifactChoices($ah->getID()); 
+       echo "<p>&nbsp;</p>";
+       $rows=db_numrows($result);
+       $origrows=db_numrows($resultc); 
+       if ($result &&$rows > 0) {
+               echo '<tr>';
+               for ($i=0; $i < $rows; $i++) {
+                       $newrow= is_integer($i/2);
+                       
+                       echo 
'<td><strong>'.db_result($result,$i,'selection_box_name').'</strong><br \>';
+                       
$resulto=$ath->getBoxOptionsName(db_result($resultc,$i,'choice_id'));
+                       
+                       if (($i < $origrows) && 
(db_result($resultc,$i,'choice_id') !== '100')) {
+                               echo db_result($resulto,'0','box_options_name');
+                       }else{
+                               echo 'None';
+                       }
+                       if (!$newrow) {
+                               echo '</tr><tr>';
+                       }
+               }
+       }
+       ?>
                <tr><td colspan="2"><strong><?php echo 
$Language->getText('tracker','summary') ?>:</strong><br /><?php echo 
$ah->getSummary(); ?></td></tr>
 
                <form action="<?php echo $PHP_SELF; ?>?group_id=<?php echo 
$group_id; ?>&atid=<?php echo $ath->getID(); ?>" METHOD="POST">

Index: index.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/tracker/index.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- index.php   10 Jul 2004 18:17:13 -0000      1.20
+++ index.php   26 Aug 2004 15:32:07 -0000      1.21
@@ -45,6 +45,7 @@
        //      Create the ArtifactType object
        //
        $ath = new ArtifactTypeHtml($group,$atid);
+
        if (!$ath || !is_object($ath)) {
                exit_error('Error','ArtifactType could not be created');
        }
@@ -55,7 +56,7 @@
        switch ($func) {
 
                case 'add' : {
-                       include 'add.php';
+                       include ('add.php');
                        break;
                }
                case 'postadd' : {
@@ -79,6 +80,11 @@
                                        
exit_error('ERROR',$ah->getErrorMessage());
                                } else {
                                        //
+                                       // Include extra fields configured by 
ADMIN
+                                       //
+                                       include ('add-fields.php');
+
+                                       //
                                        //      Attach file to this Artifact.
                                        //
                                        if ($add_file) {
@@ -115,7 +121,6 @@
                                } else if ($ah->isError()) {
                                        $feedback .= ' ID: 
'.$artifact_id_list[$i].'::'.$ah->getErrorMessage();
                                } else {
-
                                        $_priority=(($priority != 100) ? 
$priority : $ah->getPriority());
                                        $_status_id=(($status_id != 100) ? 
$status_id : $ah->getStatusID());
                                        $_category_id=(($category_id != 100) ? 
$category_id : $ah->getCategoryID());
@@ -128,16 +133,23 @@
 
                                        if 
(!$ah->update($_priority,$_status_id,$_category_id,$_artifact_group_id,$_resolution_id,$_assigned_to,$_summary,$canned_response,'',$artifact_type_id))
 {
                                                $was_error=true;
-                                               $feedback .= ' ID: 
'.$artifact_id_list[$i].'::'.$ah->getErrorMessage();
                                        }
 
+                       include('massupdate-fields.php');
+                                       if (($was_error==true) && 
($changect==0) && ($transferct==0)) {
+                                               $feedback .= ' ID: 
'.$artifact_id_list[$i].'::'.$ah->getErrorMessage();
+                                       }else {
+                                               $was_error=false;
+                                       }
                                }
                                unset($ah);
-                       }
+                       
+                       
                        if (!$was_error) {
                                $feedback = 
$Language->getText('tracker','updated_successful');
                        }
-                       include 'browse.php';
+                       }
+                       include ('browse.php');
                        break;
                }
                case 'postmod' : {
@@ -217,10 +229,18 @@
                                //
                                //      Show just one feedback entry if no 
errors
                                //
-                               if (!$was_error) {
+                               include ('update-fields.php');
+                               if (!$was_error ||  $changect>0 || 
$transferct>0) {
                                        $feedback = 
$Language->getText('general','update_successful');
+                               if ($ath->getID()!==$new_artfact_type_id){
+                                       if 
(!$ah->nullExtraFields($artifact_id)){
+//TODO ERROR HERE???
+//
+                                       }
                                }
-                               include 'browse.php';
+                               
+                               }
+                               include ('browse.php');
                        }
                        break;
                }
@@ -238,7 +258,7 @@
                        } else {
                                if ($ah->addMessage($details,$user_email,true)) 
{
                                        
$feedback=$Language->getText('tracker','comment_added');
-                                       include 'browse.php';
+                                       include ('browse.php');
                                } else {
                                        //some kind of error in creation
                                        exit_error('ERROR',$feedback);
@@ -255,6 +275,7 @@
                        } else {
                                $ah->setMonitor();
                                $feedback=$ah->getErrorMessage();
+
                                include 'browse.php';
                        }
                        break;

--- NEW FILE: massupdate-fields.php ---
<?php
/**
 * massupdate-fields.php - code to handle mass updating admin defined fields 
for * artifacts   
 *
 * Copyright 2004 (c) Anthony J. Pugliese
 *
 * @version   $Id: massupdate-fields.php,v 1.1 2004/08/26 15:32:07 tperdue Exp $
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
 */
$result=$ath->getSelectionBoxes();
$resultc=$ath->getArtifactChoices($ah->getID());
$rows=db_numrows($result);
$setrows=db_numrows($resultc);
$transferct=0;
$changect=0;
if($result &&$rows > 0) {
        if(!is_array($value)){
                foreach($_POST as$KEY=>$post_value){
                $value_array[]=$post_value;
                }
                $post_value=implode(",",$value_array);
                $post_value=explode(",",$post_value);
        }
        for ($j=0; $j < $rows; $j++){
                $value[$j]=$post_value[$j+4];
                if ($j < $setrows) {
                        if ($value[$j] != 100){ 
                                if (db_result($resultc,$j,'choice_id') !== 
($value[$j])) {
                                        
                                        
$ah->updateExtraFields(db_result($resultc,$j,'id'),$value[$j]);
                                        
$old=(db_result($resultc,$j,'choice_id'));
                                        $oldnames 
=$ath->getBoxOptionsName($old);
                                        
$ah->addHistory(db_result($result,$j,'selection_box_name'),db_result($oldnames,'0','box_options_name'));
                                        $changect=$changect+1;
                                }
                        }
                        }else {
                                $ah->createExtraFields($value[$j]);
                        if ($value[$j] !=='100') {
                                $transferct=$transferct+1;
                        }
                }       
        }
}                       
?>


Index: mod-limited.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/tracker/mod-limited.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mod-limited.php     20 Jul 2004 15:56:35 -0000      1.4
+++ mod-limited.php     26 Aug 2004 15:32:07 -0000      1.5
@@ -77,6 +77,32 @@
                </td>
        </tr>
 
+       <?php
+//
+//     build input pop-up boxes for boxes and choices configured by ADMIN
+//
+       $result=$ath->getSelectionBoxes();
+       $resultc=$ath->getArtifactChoices($ah->getID()); 
+       echo "<p>&nbsp;</p>";
+       $rows=db_numrows($result);
+       $origrows=db_numrows($resultc);
+       if ($result &&$rows > 0) {
+               echo '<tr>';
+               for ($i=0; $i < $rows; $i++) {
+                       $newrow= is_integer($i/2);
+                       echo 
'<td><strong>'.db_result($result,$i,'selection_box_name').'</strong><br \>';
+                       $resulto = 
$ath->getBoxOptionsName(db_result($resultc,$i,'choice_id'));
+                       if (($i < $origrows) && 
(db_result($resultc,$i,'choice_id') !== '100')) {
+                               echo db_result($resulto,'0','box_options_name');
+                       } else {
+                               echo 'None';
+                       }
+                       if (!$newrow) {
+                               echo '</tr><tr>';
+                       }
+               }
+       }
+       ?>
        <tr>
                <td><strong><?php echo 
$Language->getText('tracker','assigned_to')?>: <a 
href="javascript:help_window('/help/tracker.php?helpname=assignee')"><strong>(?)</strong></a></strong><br
 />
                <?php
@@ -162,7 +188,7 @@
                                echo '<tr '. 
$GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
                                <td>'. 
htmlspecialchars($file_list[$i]->getName()) .'</td>
                                <td>'.  
htmlspecialchars($file_list[$i]->getDescription()) .'</td>
-        <td><a href="/tracker/download.php/'.$group_id.'/'. $ath->getID().'/'. 
$ah->getID() .'/'.$file_list[$i]->getID().'/'.$file_list[$i]->getName() 
.'">'.$Language->getText('tracker_mod','download').'</a></td>
+                               <td><a 
href="/tracker/download.php/'.$group_id.'/'. $ath->getID().'/'. $ah->getID() 
.'/'.$file_list[$i]->getID().'/'.$file_list[$i]->getName() 
.'">'.$Language->getText('tracker_mod','download').'</a></td>
                                </tr>';
                        }
 

Index: mod.php
===================================================================
RCS file: /cvsroot/gforge/gforge/www/tracker/mod.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mod.php     20 Jul 2004 15:56:35 -0000      1.16
+++ mod.php     26 Aug 2004 15:32:07 -0000      1.17
@@ -43,7 +43,9 @@
 <?php } ?>
        <form action="<?php echo $PHP_SELF; ?>?group_id=<?php echo $group_id; 
?>&atid=<?php echo $ath->getID(); ?>" METHOD="POST" 
enctype="multipart/form-data">
        <input type="hidden" name="func" value="postmod">
-       <input type="hidden" name="artifact_id" value="<?php echo $ah->getID(); 
?>">
+       <input type="hidden" name="$result[]">  
+       <input type="hidden" name="artifact_id" value="<?php echo $ah->getID();
+ ?>">
 
        <tr>
                <td><strong><?php echo 
$Language->getText('tracker','submitted_by') ?>:</strong><br /><?php echo 
$ah->getSubmittedRealName(); ?> (<tt><?php echo $ah->getSubmittedUnixName(); 
?></tt>)</td>
@@ -54,7 +56,7 @@
                $close_date = $ah->getCloseDate();
                if ($ah->getStatusID()==2 && $close_date > 1) {
                        echo '<br 
/><strong>'.$Language->getText('tracker_mod','date_closed').':</strong><br />'
-                                .date($sys_datefmt, $close_date);
+                               .date($sys_datefmt, $close_date);
                }
                ?>
                </td>
@@ -109,6 +111,39 @@
                </td>
        </tr>
 
+       <?php
+//
+//     build input pop-up boxes for boxes and choices configured by ADMIN
+//
+       $result=$ath->getSelectionBoxes();
+       $result1=$ath->getArtifactChoices($ah->getID());
+       $rows=db_numrows($result); 
+       echo "<p>&nbsp;</p>";
+       $origrows=db_numrows($result1);
+       if ($result && $rows> 0) {
+               echo '<tr>';
+               for ($i=0; $i < $origrows; $i++) {
+                       $newrow= is_integer($i/2);
+                       echo 
'<td><strong>'.db_result($result,$i,'selection_box_name').'</strong><br \>';
+                       echo 
$ath->selectionBox(db_result($result,$i,'id'),db_result($result1,$i,'choice_id'));
+                       echo '&nbsp;<a 
href="/tracker/admin/?group_id='.$group_id.'&amp;atid='. $ath->getID() 
.'&amp;build_box=1">('.$Language->getText('tracker','admin').')</a>';
+                       if (!$newrow) {
+                       echo '</tr><tr>';
+                       }
+               }       
+               if ($rows-$origrows > 0){
+                       for ($i=$origrows; $i < $rows; $i++){
+                               $newrow= is_integer($i/2);
+                               echo 
'<td><strong>'.db_result($result,$i,'selection_box_name').'</strong><br \>';
+                               echo 
$ath->selectionBox(db_result($result,$i,'id'),db_result($result1,$i,'choice_id'));
+                               echo '&nbsp;<a 
href="/tracker/admin/?group_id='.$group_id.'&amp;atid='. $ath->getID() 
.'&amp;build_box=1">('.$Language->getText('tracker','admin').')</a>';
+                               if (!$newrow) {
+                                       echo '</tr><tr>';
+                               }
+                       }
+               }
+       }
+       ?>
        <tr>
                <td><strong><?php echo 
$Language->getText('tracker','assigned_to')?>: <a 
href="javascript:help_window('/help/tracker.php?helpname=assignee')"><strong>(?)</strong></a></strong><br
 />
                <?php

--- NEW FILE: search-fields.php ---
<?php
/**
 * search-fields.php - code to handle browsing with fields configured by admin
 *
 * Copyright 2004 (c) Anthony J. Pugliese
 *
 * @version   $Id: search-fields.php,v 1.1 2004/08/26 15:32:07 tperdue Exp $
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
 */
$result=$ath->getSelectionBoxes();
$rows=db_numrows($result);
if($result &&$rows > 0)  {
        foreach($_POST as $KEY=>$post_value){
        $value_array[]=$post_value;
        }
        if (!empty($post_value)) {
                $post_value=implode(",",$value_array);
                $post_value=explode(",",$post_value);
                $source=$post_value[0];
                if ($source == 'custom'){
                for ($i=0; $i < $rows; $i++) {
                        $value[$i]=$post_value[$i+6];
                }
                }
        
        }
}
?>


--- NEW FILE: update-fields.php ---
<?php
/**
 * update-fields.php - Code to update artifacts with fields configured by admin
 *
 * Copyright 2004 (c) Anthony J. Pugliese
 *
 * @version   $Id: update-fields.php,v 1.1 2004/08/26 15:32:07 tperdue Exp $
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
 */
$result=$ath->getSelectionBoxes();
$resultc=$ath->getArtifactChoices($ah->getID());
$rows=db_numrows($result);
$setrows=db_numrows($resultc);
$changect=0;
$transferct=0;
if($result &&$rows > 0) {
        foreach($_POST as$KEY=>$post_value) {
        $value_array[]=$post_value;
        }
$post_value=implode(",",$value_array);
}
$post_value=explode(",",$post_value);
        for ($i=0; $i < $rows; $i++) {
        $value[$i]=$post_value[$i+7];
        if ($i < $setrows) {
                if (db_result($resultc,$i,'choice_id') != $value[$i]){
                        
$ah->updateExtraFields(db_result($resultc,$i,'id'),$value[$i]);
                        $old=(db_result($resultc,$i,'choice_id'));
                        $oldnames=$ath->getBoxOptionsName($old);
                        
$ah->addHistory(db_result($result,$i,'selection_box_name'),db_result($oldnames,'0','box_options_name'));
                                
                        $changect=$changect+1;
                }       
                }else{
                        $ah->createExtraFields($value[$i]);
                if ($value[$i] !== '100') {
                        $transferct=$transferct+1;
                }
        }       
}

?>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]