db_rollback();
return false;
} else {
- db_query("INSERT INTO artifact_extra_field_elements(extra_field_id,element_name,status_id)
+//
+// Must insert some default statuses for each artifact
+//
+ $reso=db_query("INSERT INTO artifact_extra_field_elements(extra_field_id,element_name,status_id)
values ('$id','Open','1')");
- echo db_error();
- db_query("INSERT INTO artifact_extra_field_elements(extra_field_id,element_name,status_id)
+ if (!$reso) {
+ echo db_error();
+ } else {
+ $resoid=db_insertid($reso,'artifact_extra_field_elements','element_id');
+ db_query("INSERT INTO artifact_extra_field_data(artifact_id,field_data,extra_field_id)
+ SELECT artifact_id,$resoid,$id FROM artifact
+ WHERE group_artifact_id='".$this->ArtifactType->getID()."'
+ AND status_id=1");
+ }
+ $resc=db_query("INSERT INTO artifact_extra_field_elements(extra_field_id,element_name,status_id)
values ('$id','Closed','2')");
+ if (!$resc) {
+ echo db_error();
+ } else {
+ $rescid=db_insertid($resc,'artifact_extra_field_elements','element_id');
+ db_query("INSERT INTO artifact_extra_field_data(artifact_id,field_data,extra_field_id)
+ SELECT artifact_id,$rescid,$id FROM artifact
+ WHERE group_artifact_id='".$this->ArtifactType->getID()."'
+ AND status_id != 1");
+ }
+ }
+ } elseif (strstr(ARTIFACT_EXTRAFIELD_FILTER_INT,$field_type) !== false) {
+//
+// Must insert some default 100 rows for the data table so None queries will work right
+//
+ $resdefault=db_query("INSERT INTO artifact_extra_field_data(artifact_id,field_data,extra_field_id)
+ SELECT artifact_id,100,$id FROM artifact WHERE group_artifact_id='".$this->ArtifactType->getID()."'");
+ if (!$resdefault) {
echo db_error();
}
}
return $this->extra_fields["$filter"];
}
+ /**
+ * cloneFieldsFrom - clone all the fields and elements from another tracker
+ *
+ * @return boolean true/false on success
+ */
+ function cloneFieldsFrom($clone_tracker_id) {
+ global $sys_template_group;
+ $g =& group_get_object($sys_template_group);
+ if (!$g || !is_object($g)) {
+ $this->setError('Could Not Get Template Group');
+ return false;
+ } elseif ($g->isError()) {
+ $this->setError('Template Group Error '.$g->getErrorMessage());
+ return false;
+ }
+ $at =& new ArtifactType($g,$clone_tracker_id);
+ if (!$at || !is_object($at)) {
+ $this->setError('Could Not Get Tracker To Clone');
+ return false;
+ } elseif ($at->isError()) {
+ $this->setError('Clone Tracker Error '.$at->getErrorMessage());
+ return false;
+ }
+ $efs =& $at->getExtraFields();
+
+
+ //
+ // Iterate list of extra fields
+ //
+ db_begin();
+ foreach ($efs as $ef) {
+ //new field in this tracker
+ $nef = new ArtifactExtraField($this);
+ if (!$nef->create( addslashes(util_unconvert_htmlspecialchars($ef['field_name'])), $ef['field_type'], $ef['attribute1'], $ef['attribute2'], $ef['is_required'])) {
+ db_rollback();
+ $this->setError('Error Creating New Extra Field: '.$nef->getErrorMessage());
+ return false;
+ }
+ //
+ // Iterate the elements
+ //
+ $resel=db_query("SELECT * FROM artifact_extra_field_elements WHERE extra_field_id='".$ef['extra_field_id']."'");
+ while ($el =& db_fetch_array($resel)) {
+ //new element
+ $nel = new ArtifactExtraFieldElement($nef);
+ if (!$nel->create( addslashes(util_unconvert_htmlspecialchars($el['element_name'])), $el['status_id'] )) {
+ db_rollback();
+ $this->setError('Error Creating New Extra Field Element: '.$nel->getErrorMessage());
+ return false;
+ }
+ }
+ }
+ db_commit();
+ return true;
+
+ }
+
/**
* getExtraFieldName - Get a box name using the box ID
*
--- /dev/null
+INSERT INTO groups (group_name, is_public, status, unix_group_name, short_description, register_time) VALUES
+('Template Project',1,'P','template','Project to house templates used to build other projects', extract(EPOCH FROM now()));
$sys_news_group={newsadmin_groupid};
$sys_stats_group={statsadmin_groupid};
$sys_peer_rating_group={peerrating_groupid};
+$sys_template_group={template_project};
$default_trove_cat={default_trove_cat};
// JPGRAPH Package
$sys_news_group=3;
$sys_stats_group=2;
$sys_peer_rating_group=4;
+$sys_template_group=5;
$default_trove_cat=18;
// JPGRAPH Package
tracker_add for_project For project
tracker_add submit Submit
tracker_add title Submit Tracker Item
+tracker_admin choose_tracker Choose the template tracker to clone. The site administrator will have to set up trackers with default values and set permissions properly so you can access them.
+tracker_admin clone_warning WARNING!!! Cloning this tracker will duplicate all the fields and all the elements from those fields into this tracker. There is nothing to prevent you from cloning multiple times or making a huge mess. You have been warned!
+tracker_admin add_artifact_types New Tracker
+tracker_admin update_artifact_types Update Settings
+tracker_admin manage_extrafield Manage Custom Fields
+tracker_admin clone_tracker Clone Tracker
+tracker_admin add_canned Add Canned Responses
+tracker_admin delete Delete Tracker
+tracker_admin add_artifact_types
+tracker_admin add_artifact_types
tracker_admin permanently_delete_info Permanently delete this tracker.
tracker_admin deleted Successfully Deleted.
tracker_admin delete_warning You are about to permanently and irretrievably delete this tracker and all its contents!
tracker_admin delete_extrafieldwarning You are about to permanently and irretrievably delete this custom field and all its contents!
tracker_admin sure I'm Sure.
tracker_admin really_sure I'm Really Sure.
-tracker_admin delete Delete.
+tracker_admin delete Delete
tracker_admin add_canned_responses Add/Update Canned Responses
tracker_admin add_canned_responses_info Create/Change generic response messages for the tracker
tracker_admin add_categories Add/Update Categories
include ('form-addcanned.php');
+ } elseif ($clone_tracker) {
+
+ include ('form-clonetracker.php');
+
} elseif ($uploadtemplate) {
include ('form-uploadtemplate.php');
}
}
+ //
+ // Clone a tracker's elements to this tracker
+ //
+ } elseif ($clone_tracker) {
+
+ if (!$clone_id) {
+ exit_missing_param();
+ }
+ if (!$ath->cloneFieldsFrom($clone_id)) {
+ exit_error('Error','Error cloning fields: '.$ath->getErrorMessage());
+ } else {
+ $feedback .= 'Successfully Cloned Tracker Fields ';
+ $clone_tracker='';
+ }
+
//
// Update a tracker
//
}
function adminHeader($params) {
- global $Language;
+ global $Language,$HTML;
echo $this->header($params);
-// $group_id= $this->Group->getID();
-// echo '<strong>'.$Language->getText('tracker_artifacttype','admin_functions').': <a href="/tracker/admin/?group_id='.$group_id.'">'.$Language->getText('tracker_artifacttype','add_artifact_types').'</a>';
-// echo ' | <a href="/tracker/admin/?group_id='.$group_id.'&atid='. $this->getID() .'">'.$Language->getText('tracker_artifacttype','edit_options').': '. $this->getName() .'</a></strong>';
+ $group_id= $this->Group->getID();
+
+ $links_arr[]='/tracker/admin/?group_id='.$group_id;
+ $title_arr[]=$Language->getText('tracker_admin','add_artifact_types');
+
+ $links_arr[]='/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&update_type=1';
+ $title_arr[]=$Language->getText('tracker_admin','update_artifact_types');
+
+ $links_arr[]='/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&add_extrafield=1';
+ $title_arr[]=$Language->getText('tracker_admin','manage_extrafield');
+
+ $links_arr[]='/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&clone_tracker=1';
+ $title_arr[]=$Language->getText('tracker_admin','clone_tracker');
+
+ $links_arr[]='/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&add_canned=1';
+ $title_arr[]=$Language->getText('tracker_admin','add_canned');
+
+ $links_arr[]='/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&delete=1';
+ $title_arr[]=$Language->getText('tracker_admin','delete');
+
+ echo $HTML->printSubMenu($title_arr,$links_arr);
+ }
+
+ function adminFooter($params) {
+ echo $this->footer($params);
}
function renderExtraFields($selected=array(),$show_100=false,$text_100='none',$show_any=false,$text_any='Any',$filter='',$status_show_100=false,$mode='') {