Exemplo n.º 1
0
function &addTimeEntry($session_ser, $projectTaskId, $week, $daysAdjust, $timeCode, $hours)
{
    continue_session($session_ser);
    $teObj = new TimeEntry();
    error_log("addTimeEntry ({$projectTaskId}, {$week}, {$daysAdjust}, {$timeCode}, {$hours})");
    return $teObj->create($projectTaskId, $week, $daysAdjust, $timeCode, $hours);
}
Exemplo n.º 2
0
function &userGetGroups($session_ser, $user_id)
{
    continue_session($session_ser);
    $user =& user_get_object($user_id);
    if (!$user) {
        return new soap_fault('3003', 'user', 'Could Not Get Users Groups', 'Could Not Get Users Groups');
    }
    return groups_to_soap($user->getGroups());
}
Exemplo n.º 3
0
function &getPublicProjectNames($session_ser)
{
    continue_session($session_ser);
    $forge = new FusionForge();
    $result = $forge->getPublicProjectNames();
    if ($forge->isError()) {
        $errMsg = 'Could Not Get Public Group Names: ' . $forge->getErrorMessage();
        return new soap_fault('2003', 'group', $errMsg, $errMsg);
    }
    return $result;
}
Exemplo n.º 4
0
/**
 * logout - Logs out a SOAP client
 *
 * @param 	string	sessionkey	The session key
 */
function logout($session_ser)
{
    continue_session($session_ser);
    session_logout();
    return "OK";
}
Exemplo n.º 5
0
function addFile($session_ser, $group_id, $package_id, $release_id, $name, $base64_contents, $type_id, $processor_id, $release_time)
{
    continue_session($session_ser);
    $grp =& group_get_object($group_id);
    if (!$grp || !is_object($grp)) {
        return new soap_fault('', 'addFile', 'Could Not Get Group', 'Could Not Get Group');
    } elseif ($grp->isError()) {
        return new soap_fault('', 'addFile', $grp->getErrorMessage(), $grp->getErrorMessage());
    }
    $frsp =& frspackage_get_object($package_id);
    if (!$frsp || !is_object($frsp)) {
        return new soap_fault('', 'addFile', 'Could Not Get Package', 'Could Not Get Package');
    } else {
        if ($frsp->isError()) {
            return new soap_fault('', 'addFile', $frsp->getErrorMessage(), $frsp->getErrorMessage());
        }
    }
    $frsr =& frsrelease_get_object($release_id);
    if (!$frsr || !is_object($frsr)) {
        return new soap_fault('', 'addFile', 'Could Not Get Release', 'Could Not Get Release');
    } else {
        if ($frsr->isError()) {
            return new soap_fault('', 'addFile', $frsr->getErrorMessage(), $frsr->getErrorMessage());
        }
    }
    $frsf = new FRSFile($frsr);
    if (!$frsf || !is_object($frsf)) {
        return new soap_fault('', 'addFile', 'Could Not Get File', 'Could Not Get File');
    }
    $tmpname = tempnam("/tmp", "gforge_cli_frs");
    $fh = fopen($tmpname, "wb");
    if (!$fh) {
        return new soap_fault('', 'addFile', 'Could not create temporary file in directory /tmp');
    }
    fwrite($fh, base64_decode($base64_contents));
    fclose($fh);
    if (!$frsf->create($name, $tmpname, $type_id, $processor_id, $release_time)) {
        @unlink($tmpname);
        return new soap_fault('', 'addFile', $frsf->getErrorMessage(), $frsf->getErrorMessage());
    } else {
        @unlink($tmpname);
        return $frsf->getID();
    }
}
Exemplo n.º 6
0
function documentDelete($session_ser, $group_id, $doc_id)
{
    continue_session($session_ser);
    $g =& group_get_object($group_id);
    if (!$g || !is_object($g)) {
        return new soap_fault('', 'documentDelete', 'Could Not Get Group', 'Could Not Get Group');
    } elseif ($g->isError()) {
        return new soap_fault('', 'documentDelete', $g->getErrorMessage(), $g->getErrorMessage());
    }
    $d = new Document($g, $doc_id);
    if (!$d || !is_object($d)) {
        return new soap_fault('', 'documentDelete', 'Could Not Get Document', 'Could Not Get Document');
    } elseif ($d->isError()) {
        return new soap_fault('', 'documentDelete', $d->getErrorMessage(), $d->getErrorMessage());
    }
    if (!$d->delete()) {
        return new soap_fault('', 'documentDelete', $d->getErrorMessage(), $d->getErrorMessage());
    } else {
        return true;
    }
}
Exemplo n.º 7
0
function artifactUpdateView($session_ser, $group_id, $group_artifact_id, $query_id, $name, $status, $assignee, $moddaterange, $sort_col, $sort_ord, $extra_fields, $opendaterange, $closedaterange)
{
    continue_session($session_ser);
    $grp =& group_get_object($group_id);
    if (!$grp || !is_object($grp)) {
        return new soap_fault('', 'artifactUpdateView', 'Could Not Get Group', 'Could Not Get Group');
    } elseif ($grp->isError()) {
        return new soap_fault('', 'artifactCreateView', $grp->getErrorMessage(), $grp->getErrorMessage());
    }
    $at = new ArtifactType($grp, $group_artifact_id);
    if (!$at || !is_object($at)) {
        return new soap_fault('', 'artifactUpdateView', 'Could Not Get ArtifactType', 'Could Not Get ArtifactType');
    } elseif ($at->isError()) {
        return new soap_fault('', 'artifactUpdateView', $at->getErrorMessage(), $at->getErrorMessage());
    }
    //rearrange the extra fields
    $aef = $at->getExtraFields();
    $extra_fields = arrangeExtraFields($extra_fields, $aef);
    $query = new ArtifactQuery($at, $query_id);
    if (!$query || !is_object($query)) {
        return new soap_fault('', 'artifactUpdateView', 'Could Not Get ArtifactType', 'Could Not Get ArtifactType');
    } elseif ($query->isError()) {
        return new soap_fault('', 'artifactUpdateView', $query->getErrorMessage(), $query->getErrorMessage());
    }
    if (!$query->update($name, $status, $assignee, $moddaterange, $sort_col, $sort_ord, $extra_fields, $opendaterange, $closedaterange)) {
        return new soap_fault('', 'artifactUpdateView', $query->getErrorMessage(), $query->getErrorMessage());
    }
    return $query->getID();
}
Exemplo n.º 8
0
function artifactGetChangeLog($session_ser, $group_id, $group_artifact_id, $artifact_id)
{
    continue_session($session_ser);
    $grp =& group_get_object($group_id);
    if (!$grp || !is_object($grp)) {
        return new soap_fault('', 'artifactGetChangeLog', 'Could Not Get Group', 'Could Not Get Group');
    } elseif ($grp->isError()) {
        return new soap_fault('', 'artifactGetChangeLog', $grp->getErrorMessage(), $grp->getErrorMessage());
    }
    $at = new ArtifactType($grp, $group_artifact_id);
    if (!$at || !is_object($at)) {
        return new soap_fault('', 'artifactGetChangeLog', 'Could Not Get ArtifactType', 'Could Not Get ArtifactType');
    } elseif ($at->isError()) {
        return new soap_fault('', 'artifactGetChangeLog', $at->getErrorMessage(), $at->getErrorMessage());
    }
    $artifact = new Artifact($at, $artifact_id);
    if (!$artifact || !is_object($artifact)) {
        return new soap_fault('', 'artifactGetChangeLog', 'Could Not Get Artifact', 'Could Not Get Artifact');
    } elseif ($artifact->isError()) {
        return new soap_fault('', 'artifactGetChangeLog', $artifact->getErrorMessage(), $artifact->getErrorMessage());
    }
    // note that Artifact::getHistory returns a DB result handler
    $result = $artifact->getHistory();
    return artifact_history_to_soap($result, $at);
}
Exemplo n.º 9
0
function &addProjectMessage($session_ser, $group_id, $group_project_id, $project_task_id, $body)
{
    continue_session($session_ser);
    $grp =& group_get_object($group_id);
    if (!$grp || !is_object($grp)) {
        return new soap_fault('', 'addProjectMessage', 'Could Not Get Group', 'Could Not Get Group');
    } elseif ($grp->isError()) {
        return new soap_fault('', 'addProjectMessage', $grp->getErrorMessage(), $grp->getErrorMessage());
    }
    $at = new ProjectGroup($grp, $group_project_id);
    if (!$at || !is_object($at)) {
        return new soap_fault('', 'addProjectMessage', 'Could Not Get ProjectGroup', 'Could Not Get ProjectGroup');
    } elseif ($at->isError()) {
        return new soap_fault('', 'addProjectMessage', $at->getErrorMessage(), $at->getErrorMessage());
    }
    $a = new ProjectTask($at, $project_task_id);
    if (!$a || !is_object($a)) {
        return new soap_fault('', 'addProjectMessage', 'Could Not Get ProjectTask', 'Could Not Get ProjectTask');
    } elseif ($a->isError()) {
        return new soap_fault('', 'addProjectMessage', $a->getErrorMessage(), $a->getErrorMessage());
    }
    $am = new ProjectMessage($a);
    if (!$am || !is_object($am)) {
        return new soap_fault('', 'addProjectMessage', 'Could Not Get ProjectMessage', 'Could Not Get ProjectMessage');
    } elseif ($am->isError()) {
        return new soap_fault('', 'addProjectMessage', $am->getErrorMessage(), $am->getErrorMessage());
    }
    if (!$am->create($body)) {
        return new soap_fault('', 'addProjectMessage', $am->getErrorMessage(), $am->getErrorMessage());
    } else {
        return $am->getID();
    }
}