[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/common/tracker Artifact.class, 1.20, 1.21 Artifa
From: |
tperdue |
Subject: |
[Gforge-commits] gforge/common/tracker Artifact.class, 1.20, 1.21 ArtifactBoxOptions.class, 1.1, 1.2 ArtifactSelectionBox.class, 1.1, 1.2 ArtifactType.class, 1.25, 1.26 |
Date: |
Wed, 06 Oct 2004 11:27:20 -0500 |
Update of /cvsroot/gforge/gforge/common/tracker
In directory db.perdue.net:/home/tperdue/share/dev.gforge.org/common/tracker
Modified Files:
Artifact.class ArtifactBoxOptions.class
ArtifactSelectionBox.class ArtifactType.class
Log Message:
Pugliese patch for cloning fields in tracker
Index: Artifact.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/tracker/Artifact.class,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- Artifact.class 5 Oct 2004 15:38:26 -0000 1.20
+++ Artifact.class 6 Oct 2004 16:27:11 -0000 1.21
@@ -281,8 +281,13 @@
}
/**
*
- * createExtraFields - extend an artifact with data input in
selection boxes with choices defined by ADMIN for a project
+ * createExtraFields - adds a row in the table used to
+ * store the id of a value for an artifact field.
+ * This function is only used for data that
+ * applies to additional fields and boxes configured by the admin.
*
+ * @param int id of the field that contains the data
+ * @return id on success / false on failure
*/
function createExtraFields($choice_id){
$this->choice_id=$choice_id;
@@ -952,8 +957,14 @@
}
/**
- * updateExtraFields - update an artifact with data input in
selection
- * boxes with choices defined by ADMIN for a project.
+ * updateExtraFields - updates the id of a value in the
+ * table used to store the id's of values for artifact fields.
+ * This function is only used for data that
+ * applies to additional fields and boxes configured by the admin.
+ *
+ * @param int id of the artifact
+ * @param int id of the field that contains the data
+ * @return true on success / false on failure
*
*/
function updateExtraFields($id,$choice_id){
@@ -976,15 +987,18 @@
/**
*
- * nullExtraFields - 0 an artifact in selection boxes with choices
defined
- * by ADMIN for a project to normalize for a transfer to an new
artifact type
+ * nullExtraFields - deletes a row in the table used to
+ * store the id's of values for artifact fields. This function
+ * applies to additional fields and boxes configured by the admin.
*
+ * @param int id of the artifact
+ * @return true on success / false on failure
*/
function nullExtraFields($artifact_id){
- $res=db_query("UPDATE artifact_extra_field_data
- SET
- artifact_id='0'
+ $res=db_query("DELETE
+ FROM
+ artifact_extra_field_data
WHERE
artifact_id='$artifact_id'");
Index: ArtifactBoxOptions.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/tracker/ArtifactBoxOptions.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ArtifactBoxOptions.class 26 Aug 2004 15:32:06 -0000 1.1
+++ ArtifactBoxOptions.class 6 Oct 2004 16:27:11 -0000 1.2
@@ -75,11 +75,13 @@
}
/**
- * create - create a new item in the database.
+ * create - create a new row in the table used to store the
+ * choices for selection boxes. This function is only used for
+ * extra fields and boxes configured by the admin
*
- * @param string Item name.
- * @param int User_id of assignee.
- * @return id on success / false on failure.
+ * @param string Name of the choice
+ * @param int Id the box that contains the choice.
+ * @return true on success / false on failure.
*/
function create($name,$id) {
@@ -108,16 +110,17 @@
return false;
}
-/*
+
//
// Now set up our internal data structures
//
if (!$this->fetchData($id)) {
return false;
}
-*/
+
}
+
/**
* fetchData - re-fetch the data for this ArtifactBoxOptions from
the database.
*
@@ -152,6 +155,15 @@
function getID() {
return $this->data_array['id'];
}
+
+ /**
+ * getBoxID - get this artifact box id.
+ *
+ * @return int The id #.
+ */
+ function getBoxID() {
+ return $this->data_array['artifact_box_id'];
+ }
/**
* getName - get the name.
@@ -164,9 +176,13 @@
/**
- * Update an ArtifactSelectionBox
+ * update - update rows in the table used to store the choices
+ * for a selection box. This function is used only for extra
+ * boxes and fields configured by the admin
*
- * @param string Name of the box.
+ * @param string Name of the choice in a box.
+ * @param int Id of the box
+ * @param int id of the row
* @return boolean success.
*/
function update($name,$boxid,$id) {
Index: ArtifactSelectionBox.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/tracker/ArtifactSelectionBox.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ArtifactSelectionBox.class 26 Aug 2004 15:32:06 -0000 1.1
+++ ArtifactSelectionBox.class 6 Oct 2004 16:27:11 -0000 1.2
@@ -77,11 +77,12 @@
}
/**
- * create - create a new item in the database.
+ * create - create a row in the table that stores box names for a
+ * a tracker. This function is only used to create rows for boxes
+ * configured by the admin.
*
- * @param string Item name.
- * @param int User_id of assignee.
- * @return id on success / false on failure.
+ * @param string Name of the box.
+ * @return true on success / false on failure.
*/
function create($name) {
global $Language;
@@ -109,17 +110,14 @@
$this->setError(db_error());
return false;
}
-
-/*
//
// Now set up our internal data structures
//
if (!$this->fetchData($id)) {
return false;
- }
-*/
- }
+ }
+ }
/**
* fetchData - re-fetch the data for this ArtifactSelectionBox
from the database.
*
@@ -127,7 +125,9 @@
* @return boolean success.
*/
function fetchData($id) {
+ $this->id=$id;
$res=db_query("SELECT * FROM artifact_group_selection_box_list
WHERE id='$id'");
+
if (!$res || db_numrows($res) < 1) {
$this->setError('ArtifactSelectionBox: Invalid Artifact
ID');
return false;
@@ -166,7 +166,10 @@
/**
- * Update an ArtifactSelectionBox
+ * update - update a row in the table used to store box names
+ * for a tracker. This function is only to update rowsf
+ * for boxes configured by
+ * the admin.
*
* @param string Name of the box.
* @return boolean success.
@@ -191,3 +194,4 @@
}
?>
+
Index: ArtifactType.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/tracker/ArtifactType.class,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ArtifactType.class 5 Oct 2004 18:30:18 -0000 1.25
+++ ArtifactType.class 6 Oct 2004 16:27:11 -0000 1.26
@@ -75,11 +75,19 @@
* @var int $box_options_res.
*/
var $box_options_res;
-
+
+ /**
+ * Options db resource ID.
+ *
+ * @var int $options_res.
+ */
var $options_res;
- var $box;
-
+ /**
+ * Choice name db resource ID.
+ *
+ * @var int $choice_name_res.
+ */
var $choice_name_res;
/**
@@ -446,7 +454,8 @@
}
/**
- * getSelectionBoxes - List of possible user built selection boxes
set up for this artifact type.
+ * getSelectionBoxes - List of possible user built selection
+ * boxes set up for this artifact type.
*
* @return database result set.
*/
@@ -461,10 +470,51 @@
return $this->selection_boxes_res;
}
+ /**
+ * getBoxName - Get a box name using the box ID
+ *
+ * @param int id of a box
+ * @return database result set.
+ */
+ function getBoxName($box_id) {
+ $this->box=$box_id;
+ if (!isset($this->selection_boxes_res)) {
+ $sql="select selection_box_name
+ FROM artifact_group_selection_box_list
+ WHERE id='".$this->box."'
+ AND group_artifact_id='".$this->getID()."'";
+ $this->selection_boxes_res=db_query($sql);
+ }
+ return $this->selection_boxes_res;
+ }
+
/**
- * getSelectionBoxOptions - List of possible admin configured
selection boxes set up for this artifact type.
+ * getBoxEntry - Get a box fields using the box ID
+ *
+ * @param int id of a box
+ * @return database result set.
+ */
+ function getBoxEntry($box_id) {
+ $this->box=$box_id;
+ if (!isset($this->selection_boxes_res)) {
+ $sql="SELECT *
+ FROM artifact_group_selection_box_list
+ WHERE id='".$this->box."'
+ ";
+ $this->selection_boxes_res=db_query($sql);
+ }
+ return $this->selection_boxes_res;
+ }
+
+
+ /**
+ * getSelectionBoxOptions - List of possible admin configured
+ * choices for a selection box. This function is used to
+ * present the boxes
+ * and choices on the main Add/Update page.
*
+ * @param int id of the selection box
* @return database result set.
*/
function getSelectionBoxOptions($box) {
@@ -478,22 +528,49 @@
}
/**
- * getBoxOptions - List of possible admin configured selection
boxes set up for this artifact type.
+ * getBoxOptions - List of possible admin configured selection
+ * choices for a single selection box. This function is used
+ * to display choices when updating.
*
* @return database result set.
*/
function getBoxOptions() {
$sql="select id,artifact_box_id,box_options_name
FROM artifact_group_selection_box_options
+ WHERE EXISTS (SELECT id FROM
artifact_group_selection_box_list
+ WHERE group_artifact_id='".$this->getID()."'
+ AND artifact_group_selection_box_list.id =
artifact_group_selection_box_options.artifact_box_id)
ORDER BY box_options_name";
$this->box_options_res=db_query($sql);
return $this->box_options_res;
}
+
/**
- * getArtifactChoices -List of choices for each admin configured
boxe.
- * @return databse result set.
+ * getBoxOptionName - List the name admin configured selection
+ * choices for a single selection box. This function is used
+ * copying choices.
+ *
+ * @return database result set.
+ */
+ function getBoxOptionName($choiceid) {
+ $this->choiceid = $choiceid;
+ $sql="select id,artifact_box_id,box_options_name
+ FROM artifact_group_selection_box_options
+ WHERE id ='".$this->choiceid."'";
+ $this->box_options_res=db_query($sql);
+ return $this->box_options_res;
+
+ }
+
+ /**
+ * getArtifactChoices - This function is used to get a list the
+ * fields in an artifact from the table of choices that is build
+ * by submiting/updating new artifacts.
+ *
+ * @param int id of the artifact.
+ * @return databse result set.
*/
function getArtifactChoices($artifact_id){
$this->choice=$artifact_id;
@@ -506,9 +583,11 @@
}
/**
- * getBoxOptionName - List of possible user built selection boxes
set up for this artifact type.
+ * getBoxOptionName - This function is used to get a name of
+ * a choice for a box.
*
- * @return database result set.
+ * @param int id of the choice.
+ * @return database result set.
*/
function getBoxOptionsName($choice_id) {
$this->choice = $choice_id;
@@ -536,6 +615,19 @@
return false;
}
db_begin();
+ db_query("DELETE FROM artifact_extra_field_data
+ WHERE EXISTS (SELECT artifact_id FROM artifact
+ WHERE group_artifact_id='".$this->getID()."'
+ AND
artifact.artifact_id=artifact_extra_field_data.artifact_id)");
+
+ db_query("DELETE FROM artifact_group_selection_box_options
+ WHERE EXISTS (SELECT id FROM
artifact_group_selection_box_list
+ WHERE group_artifact_id='".$this->getID()."'
+ AND artifact_group_selection_box_list.id =
artifact_group_selection_box_options.artifact_box_id)");
+
+ db_query ("DELETE FROM artifact_group_selection_box_list
+ WHERE group_artifact_id='".$this->getID()."'");
+
db_query("DELETE FROM artifact_canned_responses
WHERE group_artifact_id='".$this->getID()."'");
//echo '1'.db_error();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/common/tracker Artifact.class, 1.20, 1.21 ArtifactBoxOptions.class, 1.1, 1.2 ArtifactSelectionBox.class, 1.1, 1.2 ArtifactType.class, 1.25, 1.26,
tperdue <=
- Prev by Date:
[Gforge-commits] gforge/www/include html.php,1.35,1.36
- Next by Date:
[Gforge-commits] gforge/www/tracker add.php, 1.13, 1.14 browse.php, 1.14, 1.15 index.php, 1.22, 1.23 massupdate-fields.php, 1.1, 1.2 tracker.php, 1.2, 1.3 update-fields.php, 1.1, 1.2
- Previous by thread:
[Gforge-commits] gforge/www/include html.php,1.35,1.36
- Next by thread:
[Gforge-commits] gforge/www/tracker add.php, 1.13, 1.14 browse.php, 1.14, 1.15 index.php, 1.22, 1.23 massupdate-fields.php, 1.1, 1.2 tracker.php, 1.2, 1.3 update-fields.php, 1.1, 1.2
- Index(es):