echo "Error, the Unit Id MUST be indicated when adding an item."; exit; } } } $tpl = new HTML_Template_IT("./"); if ($edit) { $tpl->loadTemplatefile("item_edit.tpl.html", true, true); } else { $tpl->loadTemplatefile("item.tpl.html", true, true); } SetCommonLoginStatus($tpl, array("UnitId" => $unitInfos["Id"])); SetCommonToolbar($tpl); SetCommonFooter($tpl); if (!$edit) { SetLastChanged($tpl, $itemInfos["userId"], $itemInfos["LastChange"]); } $tpl->setVariable("UNIT_NAME", str_replace(".dtx", ".pas", $unitInfos["Name"])); $tpl->setVariable("UNIT_ID", $unitInfos["Id"]); if (is_numeric($itemId)) { SetItemImage($tpl, $itemInfos["Name"], GetProjectIdForItem($itemId)); $tpl->setVariable("ITEM_NAME", $itemInfos["Name"]); $tpl->setVariable("ITEM_ID", $itemId); $baseclass = trim(substr($itemInfos["Name"], 0, strpos($itemInfos["Name"], "."))); if ($baseclass == "") { $baseclass = $itemInfos["Name"]; } } if (!$edit) { // Assign data to the Summary block if ($itemInfos["Summary"] != "") {
StartAccessToDB(); $tpl = new HTML_Template_IT("./"); $tpl->loadTemplatefile("browse.tpl.html", true, true); SetCommonLoginStatus($tpl); SetCommonFooter($tpl); $projectInfos = GetProjectInfos($_GET["Id"]); if (!is_array($projectInfos)) { if ($projectInfos == "") { die("Project " . $_GET["Id"] . " does not exist in the database."); } else { die($projectInfos); } exit; } SetCommonToolbar($tpl, array("ProjectId" => $projectInfos["Id"])); SetLastChanged($tpl, $projectInfos["userId"], $projectInfos["LastChange"]); $tpl->setVariable("PROJECT_ID", $projectInfos["Id"]); $tpl->setVariable("PROJECT_NAME", $projectInfos["Name"]); $tpl->setVariable("PROJECT_DESCRIPTION", EncodeString($projectInfos["Description"])); // --------------------------------------------------------------- // Decide to display units or types // --------------------------------------------------------------- if (array_key_exists("types", $_GET) && $_GET["types"] == 1) { $limits = ProcessPagesLists(GetTypesInProjectCount($_GET["Id"]), $tpl, $projectInfos["Id"]); $projectTypes = GetTypesInProject($_GET["Id"], $limits[0], $limits[1]); if (!is_array($projectTypes)) { if ($projectTypes == "") { die("Project " . $_GET["Id"] . " does not exist in the database."); } else { die($projectTypes); }
$unitInfos["Id"] = ""; $unitInfos["Name"] = "Write here a name"; $unitInfos["Description"] = "Write here a description"; $unitInfos["Package"] = ""; $unitInfos["Status"] = ""; $unitInfos["Author"] = ""; } else { die("You must at least specify the Project Id when editing"); } } $projectInfos = GetProjectInfos($unitInfos["ProjectId"]); $tpl->setVariable("PROJECT_NAME", $projectInfos["Name"]); $tpl->setVariable("PROJECT_ID", $projectInfos["Id"]); SetCommonLoginStatus($tpl, array("ProjectId" => $projectInfos["Id"])); if (!$edit) { SetLastChanged($tpl, $unitInfos["userId"], $unitInfos["LastChange"]); } $unitName = str_replace(".dtx", ".pas", $unitInfos["Name"]); $tpl->setVariable("UNIT_ID", $unitInfos["Id"]); $tpl->setVariable("UNIT_NAME", $unitName); $tpl->setVariable("UNIT_PACKAGE", $unitInfos["Package"]); $tpl->setVariable("UNIT_STATUS", $unitInfos["Status"]); $tpl->setVariable("UNIT_DESCRIPTION", EncodeString($unitInfos["Description"])); $tpl->setVariable("UNIT_AUTHOR", str_replace("\r\n", ", ", EncodeString($unitInfos["Author"]))); if ($edit) { // set the cancel block if ($unitInfos["Id"] != "") { $tpl->setCurrentBlock("cancel_unit"); // this marker MUST NOT be called UNIT_ID or the first replacement above will be reversed to "" $tpl->setVariable("CANCEL_UNIT_ID", $unitInfos["Id"]); $tpl->parseCurrentBlock("cancel_unit");