This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  a86ce327c8c44093516d8c20b0465ce412955dc9 (commit)
       via  91da38c2c4dcdec7e49c65e1be2b93ae8b0c1dd5 (commit)
      from  6b0d7868f8b2d05e26c0c471fc5dc44109427ab7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=a86ce327c8c44093516d8c20b0465ce412955dc9

commit a86ce327c8c44093516d8c20b0465ce412955dc9
Author: Franck Villaume <[email protected]>
Date:   Sat Feb 18 18:02:35 2017 +0100

    enhance forge local cli: more help message, start trackerDump feature

diff --git a/src/bin/forge b/src/bin/forge
index 205ee55..867825b 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -4,6 +4,7 @@
  * FusionForge source control management
  *
  * Copyright 2012, Alain Peyrat
+ * Copyright 2017, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -26,10 +27,44 @@ require 
(dirname(__FILE__).'/../common/include/env.inc.php');
 require_once $gfcommon.'include/pre.php';
 
 class CliActions {
-       function help () {
+       function help($method = null) {
                $methods = join('|', get_class_methods($this));
-               echo "Usage: .../forge ($methods) [arguments...]\n" ;
-               exit (1) ;
+               switch ($method) {
+                       case 'help':
+                               echo "Use: .../forge help ($methods)\n";
+                               echo "to get detail on each command\n";
+                               break;
+                       case 'pluginActivate':
+                               echo "Use: .../forge pluginActivate 
<pluginName>\n";
+                               echo "to activate the <pluginName> plugin\n";
+                               break;
+                       case 'pluginDeactivate':
+                               echo "Use: .../forge pluginDeactivate 
<pluginName>\n";
+                               echo "to deactivate the <pluginName> plugin\n";
+                               break;
+                       case 'trackerDump':
+                               echo "Use: .../forge trackerDump <atid> 
[setup|artifacts|both] [json|raw]\n";
+                               echo "to dump a tracker from a specific 
project.\n";
+                               echo "the following functions are available:\n";
+                               echo " - setup: (default option)\n";
+                               echo "   use it to dump the full configuration 
of the tracker\n";
+                               echo " - artifacts:\n";
+                               echo "   use it to dump all the artifacts of 
the tracker\n";
+                               echo " - both:\n";
+                               echo "   use it to dump the full configuration 
of the tracker and the artifacts\n";
+//                             echo " - full:\n";
+//                             echo "   use it to dump the full configuration 
of the tracker and the artifacts + any attachements if any\n";
+                               echo "the following output formats are 
available:\n";
+                               echo " - json:\n";
+                               echo "   pretty json formated string output\n";
+                               echo " - raw: (default)\n";
+                               echo "   standard PHP array print_r format\n";
+                               break;
+                       default:
+                               echo "Usage: .../forge ($methods) 
[arguments...]\n" ;
+                               echo "Get more info use: .../forge help help\n";
+                               break;
+               }
        }
 
        function pluginActivate ($name) {
@@ -44,11 +79,72 @@ class CliActions {
                $pm = plugin_manager_get_object();
                $pm->deactivate($name);
        }
+
+       function trackerDump($atid, $params = array('setup', 'json')) {
+               $at = artifactType_get_object($atid);
+               $trackerDump = array();
+               if ($at && is_object($at) && !$at->isError()) {
+                       switch ($params[0]) {
+                               case 'full':
+                                       //TODO: how to identify files to 
retrieve and generate a zip file?
+                               case 'both':
+                                       $trackerDump['setup'] = 
$at->getSettings();
+                               case 'artifacts':
+                                       require_once 
$gfcommon.'tracker/ArtifactFactory.class.php';
+                                       $af = new ArtifactFactory($at);
+                                       if ($af && is_object($af) && 
!$at->isError()) {
+                                               $af->setup(0, '', '', 0, 
'overwrite', false, false, array(), false);
+                                               $artifacts = 
$af->getArtifacts();
+                                               foreach ($artifacts as $artf) {
+                                                       //we do not need this 
information.
+                                                       
unset($artf->ArtifactType);
+                                               }
+                                               $trackerDump['artifacts'] = 
$artifacts;
+                                       } else {
+                                               $trackerDump['error'][] = 
_('Unable to retrieve artifacts');
+                                       }
+                                       break;
+                               case 'setup':
+                                       $trackerDump['setup'] = 
$at->getSettings();
+                                       break;
+                               default:
+                                       $trackerDump['error'][] = _('Unknown 
function');
+                                       break;
+                       }
+               } else {
+                       $trackerDump['error'][] = _('Unable to get tracker 
id')._(': ').$atid;
+               }
+
+               if (isset($params[1])) {
+                       if (in_array($params[1], array('json', 'raw'))) {
+                               $format = $params[1];
+                       } else {
+                               $trackerDump['error'][] = _('Unknown format. 
Fallback to raw');
+                       }
+               } else {
+                       $format = 'raw';
+               }
+               switch ($format) {
+                       case 'json':
+                               echo json_encode($trackerDump, 
JSON_PRETTY_PRINT)."\n";
+                               break;
+                       case 'raw':
+                       default:
+                               print_r($trackerDump);
+               }
+       }
 }
 
-if (count($argv) == 3) {
+if (count($argv) >= 3) {
        $action = $argv[1];
        $name   = $argv[2];
+       if (count($argv) >= 3) {
+               $j = 0;
+               for ($i = 3; $i < count($argv); $i++) {
+                       $params[$j] = $argv[$i];
+                       $j++;
+               }
+       }
 } else {
        $action = 'help';
        $name   = '';
@@ -56,12 +152,11 @@ if (count($argv) == 3) {
 
 $ctl = new CliActions();
 if (method_exists($ctl, $action)) {
-       $ctl->$action($name);
+       if (isset($params)) {
+               $ctl->$action($name, $params);
+       } else {
+               $ctl->$action($name);
+       }
 } else {
        $ctl->help();
 }
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=91da38c2c4dcdec7e49c65e1be2b93ae8b0c1dd5

commit 91da38c2c4dcdec7e49c65e1be2b93ae8b0c1dd5
Author: Franck Villaume <[email protected]>
Date:   Sat Feb 18 16:50:44 2017 +0100

    refactor soap: move code to ArtifactType class

diff --git a/src/common/tracker/ArtifactType.class.php 
b/src/common/tracker/ArtifactType.class.php
index 4e4b790..00dfb26 100644
--- a/src/common/tracker/ArtifactType.class.php
+++ b/src/common/tracker/ArtifactType.class.php
@@ -1498,6 +1498,54 @@ class ArtifactType extends FFError {
        function getEffortUnitSet() {
                return $this->data_array['unit_set_id'];
        }
+
+       /**
+        * getSettings - Get all parameters of this tracker
+        *
+        * @return      array   all parameters into an multidimensional array
+        */
+       function getSettings() {
+               // Get list of extra fields for this artifact
+               $extrafields = array();
+               $tmpextrafields = $this->getExtraFields();
+               foreach ($tmpextrafields as $extrafield) {
+                       $aefobj = new ArtifactExtraField($this, 
$extrafield["extra_field_id"]);
+
+                       // array of available values
+                       $avtmp = $aefobj->getAvailableValues();
+                       $avs = array();
+                       for ($j=0; $j < count($avtmp); $j++) {
+                               $avs[$j]["element_id"] = 
$avtmp[$j]["element_id"];
+                               $avs[$j]["element_name"] = 
$avtmp[$j]["element_name"];
+                               $avs[$j]["status_id"] = $avtmp[$j]["status_id"];
+                       }
+
+                       $extrafields[] = array(
+                               "extra_field_id"=> $aefobj->getID(),
+                               "field_name"    => $aefobj->getName(),
+                               "field_type"    => $aefobj->getType(),
+                               "attribute1"    => $aefobj->getAttribute1(),
+                               "attribute2"    => $aefobj->getAttribute2(),
+                               "is_required"   => $aefobj->isRequired(),
+                               "alias"                 => $aefobj->getAlias(),
+                               "available_values"      => $avs,
+                               "default_selected_id" => 0              //TODO 
(not implemented yet)
+                       );
+               }
+
+               $return = array(
+                               'group_artifact_id' => 
$this->data_array['group_artifact_id'],
+                               'group_id' => $this->data_array['group_id'],
+                               'name' => $this->data_array['name'],
+                               'description' => 
$this->data_array['description'],
+                               'due_period' => $this->data_array['due_period'],
+                               'datatype' => $this->data_array['datatype'],
+                               'status_timeout' => 
$this->data_array['status_timeout'],
+                               'extra_fields' => $extrafields,
+                               'custom_status_field' => 
$this->data_array['custom_status_field']
+                       );
+               return $return;
+       }
 }
 
 // Local Variables:
diff --git a/src/www/soap/tracker/tracker.php b/src/www/soap/tracker/tracker.php
index 60156f2..b556561 100644
--- a/src/www/soap/tracker/tracker.php
+++ b/src/www/soap/tracker/tracker.php
@@ -604,45 +604,7 @@ function artifacttype_to_soap($at_arr) {
                        if ($at_arr[$i]->isError()) {
                                //skip if error
                        } else {
-                               // Get list of extra fields for this artifact
-                               $extrafields = array();
-                               $tmpextrafields = $at_arr[$i]->getExtraFields();
-                               foreach ($tmpextrafields as $extrafield) {
-                                       $aefobj = new 
ArtifactExtraField($at_arr[$i], $extrafield["extra_field_id"]);
-
-                                       // array of available values
-                                       $avtmp = $aefobj->getAvailableValues();
-                                       $avs = array();
-                                       for ($j=0; $j < count($avtmp); $j++) {
-                                               $avs[$j]["element_id"] = 
$avtmp[$j]["element_id"];
-                                               $avs[$j]["element_name"] = 
$avtmp[$j]["element_name"];
-                                               $avs[$j]["status_id"] = 
$avtmp[$j]["status_id"];
-                                       }
-
-                                       $extrafields[] = array(
-                                               "extra_field_id"=> 
$aefobj->getID(),
-                                               "field_name"    => 
$aefobj->getName(),
-                                               "field_type"    => 
$aefobj->getType(),
-                                               "attribute1"    => 
$aefobj->getAttribute1(),
-                                               "attribute2"    => 
$aefobj->getAttribute2(),
-                                               "is_required"   => 
$aefobj->isRequired(),
-                                               "alias"                 => 
$aefobj->getAlias(),
-                                               "available_values"      => $avs,
-                                               "default_selected_id" => 0      
        //TODO (not implemented yet)
-                                       );
-                               }
-
-                               $return[]=array(
-                                       'group_artifact_id' => 
$at_arr[$i]->data_array['group_artifact_id'],
-                                       'group_id' => 
$at_arr[$i]->data_array['group_id'],
-                                       'name' => 
$at_arr[$i]->data_array['name'],
-                                       'description' => 
$at_arr[$i]->data_array['description'],
-                                       'due_period' => 
$at_arr[$i]->data_array['due_period'],
-                                       'datatype' => 
$at_arr[$i]->data_array['datatype'],
-                                       'status_timeout' => 
$at_arr[$i]->data_array['status_timeout'],
-                                       'extra_fields' => $extrafields,
-                                       'custom_status_field' => 
$at_arr[$i]->data_array['custom_status_field']
-                               );
+                               $return[] = $at_arr[$i]->getSettings();
                        }
                }
        }

-----------------------------------------------------------------------

Summary of changes:
 src/bin/forge                             | 115 +++++++++++++++++++++++++++---
 src/common/tracker/ArtifactType.class.php |  48 +++++++++++++
 src/www/soap/tracker/tracker.php          |  40 +----------
 3 files changed, 154 insertions(+), 49 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to