Beispiel #1
0
function task_do_groups()
{
    global $PARAMS, $SOAP, $LOG;
    if (get_parameter($PARAMS, "help")) {
        return;
    }
    $group_id = get_working_group($PARAMS);
    $res = $SOAP->call("getProjectGroups", array("group_id" => $group_id));
    if ($error = $SOAP->getError()) {
        exit_error($error, $SOAP->faultcode);
    }
    show_output($res);
}
Beispiel #2
0
/**
 * project_do_mylist - List of projects available to the logged user
 */
function project_do_mylist()
{
    global $PARAMS, $SOAP, $LOG;
    if (get_parameter($PARAMS, "help")) {
        return;
    }
    // Fetch the user ID from the database
    $params = array("user_ids" => array($SOAP->getSessionUser()));
    $res = $SOAP->call("getUsersByName", $params);
    if ($error = $SOAP->getError()) {
        exit_error($error, $SOAP->faultcode);
    }
    $user_id = $res[0]["user_id"];
    $params = array("user_id" => $user_id);
    $res = $SOAP->call("userGetGroups", $params);
    if ($error = $SOAP->getError()) {
        exit_error($error, $SOAP->faultcode);
    }
    show_output($res);
}
Beispiel #3
0
        echo $oline . "<br>";
    }
    ob_end_flush();
    exit;
}
$q = "SELECT * FROM fnview WHERE viewid=" . ss($_REQUEST['viewid']);
$r = $NATS->DB->Query($q);
if ($NATS->DB->Num_Rows($r) <= 0) {
    $ob[] = "Invalid View " . $_REQUEST['viewid'];
    show_output();
}
$view = $NATS->DB->Fetch_Array($r);
if ($view['vpublic'] != 1) {
    if (!$session) {
        $ob[] = "Sorry not a public view";
        show_output();
    }
}
if ($view['vcolon'] > 0) {
    $colon = ":";
} else {
    $colon = "";
}
if ($view['vdashes'] > 0) {
    $dash = " -";
} else {
    $dash = "";
}
if ($view['vtimeago'] > 0) {
    $ago = true;
} else {
Beispiel #4
0
function tracker_do_technicians()
{
    global $PARAMS, $SOAP, $LOG;
    $group_artifact_id = get_parameter($PARAMS, "type", true);
    if (!$group_artifact_id || !is_numeric($group_artifact_id)) {
        exit_error("You must specify the type ID as a valid number");
    }
    $group_id = get_working_group($PARAMS);
    $cmd_params = array("group_id" => $group_id, "group_artifact_id" => $group_artifact_id);
    $res = $SOAP->call("getArtifactTechnicians", $cmd_params);
    if ($error = $SOAP->getError()) {
        $LOG->add($SOAP->responseData);
        exit_error($error, $SOAP->faultcode);
    }
    show_output($res);
}
Beispiel #5
0
function docman_do_delete()
{
    global $PARAMS, $SOAP, $LOG;
    $group_id = get_working_group($PARAMS);
    if (!($doc_id = get_parameter($PARAMS, "doc_id"))) {
        exit_error("You must specify a document id: (e.g.) --doc_id=17");
    }
    $params = array("group_id" => $group_id, "doc_id" => $doc_id);
    $res = $SOAP->call("documentDelete", $params);
    if ($error = $SOAP->getError()) {
        $LOG->add($SOAP->responseData);
        exit_error($error, $SOAP->faultcode);
    }
    show_output($res);
}
Beispiel #6
0
function show_matrix($result, $fieldnames = array())
{
    $titles = array();
    $lengths = array();
    // this is for showing multidimensional arrays
    static $recursive_id = 1;
    foreach ($result as $row) {
        foreach ($row as $colname => $value) {
            if (!isset($titles[$colname])) {
                if (!isset($fieldnames[$colname])) {
                    $titles[$colname] = $colname;
                } else {
                    $titles[$colname] = $fieldnames[$colname];
                }
            }
            if (!is_array($value)) {
                if (!isset($lengths[$colname]) || $lengths[$colname] < strlen($value) + 2) {
                    $lengths[$colname] = max(strlen($value), strlen($titles[$colname]));
                    $lengths[$colname] += 2;
                }
            } else {
                $lengths[$colname] = strlen($titles[$colname]) + 2;
            }
        }
    }
    // show the titles
    foreach ($titles as $colname => $title) {
        $length = $lengths[$colname];
        echo "+" . str_repeat("-", $length);
    }
    echo "+\n";
    foreach ($titles as $colname => $title) {
        $length = $lengths[$colname];
        echo "|" . center_text($title, $length);
    }
    echo "|\n";
    foreach ($titles as $colname => $title) {
        $length = $lengths[$colname];
        echo "+" . str_repeat("-", $length);
    }
    echo "+\n";
    $recursive_items = array();
    // now show the values
    foreach ($result as $row) {
        foreach ($row as $colname => $value) {
            // recursively show the multi dimensional array
            if (is_array($value)) {
                if (array_key_exists($colname, $fieldnames)) {
                    $rec_titles = $fieldnames[$colname];
                } else {
                    $rec_titles = array();
                }
                $recursive_items[$recursive_id] = array("titles" => $rec_titles, "values" => $value);
                // show the reference # instead
                $value = "[" . $recursive_id . "]";
                $recursive_id++;
            }
            $length = $lengths[$colname];
            if (is_array($value)) {
                continue;
            }
            echo "| " . $value . str_repeat(" ", $length - strlen($value) - 1);
        }
        echo "|\n";
    }
    // show last line
    foreach ($titles as $colname => $title) {
        $length = $lengths[$colname];
        echo "+" . str_repeat("-", $length);
    }
    echo "+\n";
    // now recursively show the multidimensional array
    foreach ($recursive_items as $id => $item) {
        echo "\n";
        echo "[" . $id . "]:\n";
        show_output($item["values"], $item["titles"]);
    }
}
Beispiel #7
0
function scm_do_info()
{
    global $PARAMS, $SOAP, $LOG;
    $scm_data = get_scm_data();
    show_output($scm_data);
}
Beispiel #8
0
function frs_do_addfile()
{
    global $PARAMS, $SOAP, $LOG;
    if (!($package_id = get_parameter($PARAMS, "package", true))) {
        exit_error("You must define a package with the --package parameter");
    }
    if (!($release_id = get_parameter($PARAMS, "release", true))) {
        exit_error("You must define a release with the --release parameter");
    }
    if (!($file = get_parameter($PARAMS, "file", true))) {
        exit_error("You must define a file with the --file parameter");
    } else {
        if (!file_exists($file)) {
            exit_error("File '{$file}' doesn't exist");
        } else {
            if (!($fh = fopen($file, "rb"))) {
                exit_error("Could not open '{$file}' for reading");
            }
        }
    }
    if (!($type_id = get_parameter($PARAMS, "type", true))) {
        $type_id = 9999;
        // 9999 = "other"
    }
    if (!($processor_id = get_parameter($PARAMS, "processor", true))) {
        $processor_id = 9999;
        // 9999 = "other"
    }
    $release_time = get_parameter($PARAMS, "date", true);
    if ($release_time) {
        if ($date_error = check_date($release_time)) {
            exit_error("The release date is invalid: " . $date_error);
        } else {
            $release_time = convert_date($release_time);
        }
    } else {
        $release_time = time();
    }
    $name = basename($file);
    $contents = fread($fh, filesize($file));
    $base64_contents = base64_encode($contents);
    fclose($fh);
    $group_id = get_working_group($PARAMS);
    $add_params = array("group_id" => $group_id, "package_id" => $package_id, "release_id" => $release_id, "name" => $name, "base64_contents" => $base64_contents, "type_id" => $type_id, "processor_id" => $processor_id, "release_time" => $release_time);
    $res = $SOAP->call("addFile", $add_params);
    if ($error = $SOAP->getError()) {
        $LOG->add($SOAP->responseData);
        exit_error($error, $SOAP->faultcode);
    }
    show_output($res);
}