Exemplo n.º 1
0
 function html($record)
 {
     $projectName = $record->get("artifactKey");
     Data::$queries[1] = array("request" => "getProperties", "constantArgs" => array("path", "/artifacts/VersionedProjects:{$projectName}"), "result" => "propertySheet");
     $response = QueryManager::handleQueryNow(1);
     $version = $response->get('//property[propertyName="ec_current_version"]/value');
     $comment = $response->get('//property[propertyName="ec_current_version_comment"]/value');
     $time = DateTimeRenderer::formatText($response->get('//property[propertyName="ec_current_version_time"]/value'));
     return "{$time} [v{$version}] - {$comment}";
 }
    }
    $targetUrl = "projects.php";
    header("Location: " . $targetUrl);
}
Data::$queries[1] = array("request" => "getProperty", "constantArgs" => array("propertyName", "/projects/{$projectName}/ec_versioning_artifact"), "result" => "property");
$response = QueryManager::handleQueryNow(1);
$artifactKey = $response->get('value');
Data::$queries["getPickerVersions"] = array("request" => "findObjects", 'searchName' => 'getArtifactVersions', "numObjects" => 10000, "constantArgs" => array("sort", array("propertyName", "version", "order", "descending")), 'constantFilters' => array(array("operator", "and", "filter", array(array('propertyName' => 'groupId', 'operator' => 'equals', "operand1" => 'VersionedProjects'), array('propertyName' => 'artifactKey', 'operator' => 'equals', 'operand1' => $artifactKey)))), "queryClass" => "searchQuery", "result" => 'artifactVersion', "dataIn" => 'searchDataIn');
$response = QueryManager::handleQueryNow('getPickerVersions');
$options = array();
$i = 0;
foreach ($response->getSiblings() as $object) {
    if ($i > 0) {
        $version = $object->get("version");
        $comment = $object->get("description");
        $createTime = DateTimeRenderer::formatText($object->get("createTime"));
        if ($comment == "") {
            $comment = "No commit comment";
        }
        $options[] = $version;
        $options[] = "v{$version} [{$createTime}] - {$comment}";
    }
    $i++;
}
$versionPicker = new Selector($options);
$name = new Name(null, true);
$name->setInitialValue($projectName);
$formElements = array(ecgettext("Name:"), "projectName", $name, ecgettext("Version:"), "version", $versionPicker, ecgettext("Comment:"), "comment", new Entry());
$formArgs = array("id" => "rollbackVersionedProject", "modifyName" => "projectName", "postArgs" => array(), "elements" => $formElements);
$navigation = new NavInfo(array("section" => ecgettext("Projects"), "subsection" => ecgettext("Versioning")));
$page = new Page(ecgettext("Rollback Versioned Project"), new StdFrame($navigation), new Header(array("id" => "pageHeader", "class" => "pageHeader", "title" => ecgettext("Rollback Versioned Project"), "actions" => array(new ShortcutLink()), "actionStyle" => 3)), new SubSection(new Form($formArgs)), new SetFocus("version"), new StdFrameEnd());