Esempio n. 1
0
    if (is_string($msg) && $msg != "") {
        $msg = "Error while submitting the Item: " . $msg;
    } else {
        $msg = "Item added/updated successfuly";
    }
    $tpl->setCurrentBlock("thanks_logged_in");
    $tpl->touchBlock("thanks_logged_in");
    $tpl->parseCurrentBlock("thanks_logged_in");
} else {
    // if the user is not logged in or does not have write access,
    // we submit the item for review
    $msg = AddSubmittedItem($_POST["item_id"], $_POST["unit_id"], $_POST["name"], $_POST["summary"], $_POST["description"], $_POST["return_value"], $_POST["see_also_list"], $_POST["parameters"], $_POST["extras"], $_POST["jvcl_info"]);
    if ($msg != "") {
        $msg = "Error while submitting the Item: " . $msg;
    }
    $unitInfos = GetUnitInfos($_POST["unit_id"]);
    if (is_string($unitInfos)) {
        if ($msg != "") {
            $msg .= "<br>";
        }
        $msg .= "Error getting Unit infos: " . $unitInfos;
    }
    $projectInfos = GetProjectInfos($unitInfos["ProjectId"]);
    if (is_string($projectInfos)) {
        if ($msg != "") {
            $msg .= "<br>";
        }
        $msg .= "Error getting project infos: " . $projectInfos;
    }
    // Send the email to notify admins a new item has been submitted, if asked to do so
    if ($projectInfos["SendNotifications"] == 1) {
Esempio n. 2
0
function GetFileContent($unitId, &$filename)
{
    // generate the unit's file
    $unitInfos = GetUnitInfos($unitId);
    $items = GetItemsInUnit($unitId);
    if (!is_array($items)) {
        die($items);
    }
    $filename = str_replace(".pas", ".dtx", $unitInfos["Name"]);
    $unitSummary = $unitInfos["Description"];
    $unitDescription = "";
    if (!(strpos($unitSummary, "\r\n") === 0)) {
        $unitDescription = substr($unitSummary, strpos($unitSummary, "\r\n") + 2);
        $unitSummary = substr($unitSummary, 0, strpos($unitSummary, "\r\n"));
    }
    $content = "";
    $content .= "##Package: " . $unitInfos["Package"] . "\r\n";
    $content .= "##Status: " . $unitInfos["Status"] . "\r\n";
    $content .= "----------------------------------------------------------------------------------------------------\r\n";
    $content .= "@@" . str_replace(".dtx", ".pas", $unitInfos["Name"]) . "\r\n";
    $content .= "Summary\r\n";
    $content .= Format($unitSummary);
    $content .= "Author\r\n";
    $content .= Format($unitInfos["Author"]);
    if ($unitDescription != "") {
        $content .= "Description\r\n";
        $content .= Format($unitDescription);
    }
    $content .= "\r\n";
    // generate for all other items
    foreach ($items as $item) {
        $content .= "----------------------------------------------------------------------------------------------------\r\n";
        $content .= "@@" . $item["Name"] . "\r\n";
        if ($item["Extras"] != "") {
            $content .= $item["Extras"] . "\r\n";
        }
        if ($item["JVCLInfo"] != "") {
            $content .= "JVCLInfo\r\n";
            $content .= Format($item["JVCLInfo"]);
        }
        if ($item["Summary"] != "") {
            $content .= "Summary\r\n";
            $content .= Format($item["Summary"]);
        }
        if ($item["Description"] != "") {
            $content .= "Description\r\n";
            $content .= Format($item["Description"]);
        }
        if ($item["Parameters"] != "") {
            $content .= "Parameters\r\n";
            $content .= Format($item["Parameters"]);
        }
        if ($item["ReturnValue"] != "") {
            $content .= "Return value\r\n";
            $content .= Format($item["ReturnValue"]);
        }
        $seeAlsoString = GetSeeAlsoString($item);
        if ($seeAlsoString != "") {
            $content .= "See Also\r\n";
            $content .= Format($seeAlsoString);
        }
        $content .= "\r\n";
    }
    return $content;
}
Esempio n. 3
0
            } elseif (is_string($infos)) {
                echo $infos;
                exit;
            } else {
                $itemInfos = $infos;
                $itemId = $itemInfos["Id"];
                $unitInfos = GetUnitInfos($itemInfos["UnitId"]);
            }
        } else {
            echo "Error, the Id or the Name of the item MUST be indicated when not editing";
            exit;
        }
    } else {
        // if we are editing without an ItemId, then we MUST have the Unit Id
        if (array_key_exists("UnitId", $_GET)) {
            $unitInfos = GetUnitInfos($_GET["UnitId"]);
        } else {
            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 (!IsPower()) {
    die(GetNotAPowerUserPage());
}
StartAccessToDB();
if (array_key_exists("Id", $_GET)) {
    $itemId = $_GET["Id"];
} else {
    $itemId = "";
}
if (is_numeric($itemId)) {
    $itemInfos = GetSubmittedItemInfos($_GET["Id"]);
    if (is_string($itemInfos)) {
        echo $itemInfos;
        exit;
    }
    $unitInfos = GetUnitInfos($itemInfos["UnitId"]);
    $originalItemId = $itemInfos["ItemId"];
} else {
    echo "Error, the Id of the item MUST be indicated.";
    exit;
}
$projectId = GetProjectIdForUnit($unitInfos["Id"]);
if (!LoggedUserHasAccessToProject($projectId)) {
    die(GetNoAccessToProjectPage($projectId));
}
$tpl = new HTML_Template_IT("./");
$tpl->loadTemplatefile("admin_review_submitted_item.tpl.html", true, true);
SetCommonLoginStatus($tpl);
SetAdminToolbar($tpl);
SetCommonFooter($tpl);
$tpl->setVariable("ITEM_ID", $itemId);