Хранилища Subversion ant

Сравнить редакции

Не учитывать пробелы Редакция 569 → Редакция 570

/branches/ant/0.9.x/manager.php
37,6 → 37,7
$menu .= "<li><a href='".$manager."?mode=signs'>Подписи</a></li>";
$menu .= "<li><a href='".$manager."?mode=repositories'>Репозитории</a></li>";
$menu .= "<li><a href='".$manager."?mode=archs'>Архитектуры</a></li>";
$menu .= "<li><a href='".$manager."?mode=schemes'>Схемы</a></li>";
$menu .= "<li><a href='".$manager."?mode=settings'>Настройки</a></li>";
$menu .= "<li><a href='".$manager."?mode=exit'>Выход</a></li></ul>";
$menu .=" </fieldset>\n";
232,6 → 233,40
$tmpl->assign('body', $body);
$tmpl->display('manager.tpl');
break;
case 'schemes':
// Управление схемами репозиториев
$body = "<h3>Управление схемами репозиториев</h3>";
switch ($action) {
case 'view':
$body .= "<p><a href='".$manager."?mode=schemes&action=new'>Добавить новую схему репозитория</a></p>";
$body .= $core->showSchemeList("schemes", $manager, "list");
break;
case 'edit':
$body .= "<form action='".$process."' method='post'>\n";
$body .= "<input type='hidden' name='mode' value='scheme-edit'>\n";
$body .= "<input type='hidden' name='schemeID' value='".$uuid."'>\n";
$body .= $core->showSchemeForm($uuid, "Редактирование информации о схеме репозитория");
$body .= "</form>";
break;
case 'delete':
$body .= "<form action='".$process."' method='post'>\n";
$body .= "<input type='hidden' name='mode' value='scheme-delete'>\n";
$body .= "<input type='hidden' name='schemeID' value='".$uuid."'>\n";
$body .= $core->showSchemeForm($uuid, "Удаление информации о схеме репозитория");
$body .= "</form>";
break;
case 'new':
$body .= "<form action='".$process."' method='post'>\n";
$body .= "<input type='hidden' name='mode' value='scheme-add'>\n";
$body .= $core->showSchemeForm(0, "Добавление новой схемы репозитория");
$body .= "</form>";
break;
}
$tmpl->assign('header', "CPanel");
$tmpl->assign('description', "Панель управления генератором");
$tmpl->assign('body', $body);
$tmpl->display('manager.tpl');
break;
case 'repositories':
// Управление репозиториями
$body = "<h3>Управление репозиториями</h3>";
/branches/ant/0.9.x/process.php
229,6 → 229,43
}
 
break;
case 'scheme-add':
// Добавление новой схемы репозитория
$scheme = $secure->checkInt($_POST["scheme"]);
 
$r = $core->addScheme($scheme);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'scheme-edit':
// Редактирование схемы репозитория
$schemeID = $secure->checkInt($_POST["schemeID"]);
$scheme = $secure->checkStr($_POST["scheme"],1);
 
$r = $core->updateScheme($schemeID, $scheme);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
case 'scheme-delete':
// Удаление схемы репозитория
$schemeID = $secure->checkInt($_POST["schemeID"]);
 
$r = $core->dropScheme($schemeID);
if ($r["ERR"]==0) {
header("Location: ".$manager."\n\n");
} else {
echo $r["ERRINFO"];
}
 
break;
}
 
?>
/branches/ant/0.9.x/lib/core.php
921,6 → 921,154
}
 
/**
* Вывод списка схем репозиториев
*
* @author Alexander Wolf
* @category Core
*
* @param string $name
* @param string $actor
* @param string $format
* @return string
*/
public function showSchemeList($name, $actor, $format = 'list') {
switch($format) {
case 'list':
$query = "SELECT * FROM ".$this->prefix."repscheme";
$rq =& $this->db->query($query);
$show = "<ul>\n";
while ($rq->fetchInto($element)) {
$show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["scheme_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["scheme_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["scheme"],1)."</li>\n";
}
$show .= "</ul>";
break;
case 'innerhtml':
$repID = $this->secure->checkInt($actor);
$query = "SELECT * FROM ".$this->prefix."repscheme";
$rq =& $this->db->query($query);
$show = "<select name='".$name."' id='".$name."'>\n";
while ($rq->fetchInto($element)) {
if ($element["scheme_id"]==$repID) {
$show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."' selected>".$this->secure->checkStr($element["scheme"],1)."</option>\n";
} else {
$show .= "<option value='".$this->secure->checkInt($element["scheme_id"])."'>".$this->secure->checkStr($element["scheme"],1)."</option>\n";
}
}
$show .= "</select>";
break;
}
return $show;
}
 
/**
* Добавление новой схемы репозитория
*
* @author Alexander Wolf
* @category Core
*
* @param string $scheme
* @return array
*/
public function addScheme($scheme) {
$result = array();
$sScheme = $this->secure->checkStr($scheme,1);
 
$query = "INSERT INTO ".$this->prefix."repscheme SET scheme='".$sScheme."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Удаление информации о схеме репозитория
*
* @author Alexander Wolf
* @category Core
*
* @param integer $schemeID
* @return array
*/
public function dropScheme($schemeID) {
$result = array();
$sSchemeID = $this->secure->checkInt($schemeID);
 
// Удаление схемы
$query = "DELETE FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
return $result;
}
 
/**
* Обновление информации о схеме репозитория
*
* @author Alexander Wolf
* @category Core
*
* @param integer $schemeID
* @param string $info
* @return array
*/
public function updateScheme($schemeID, $info) {
$result = array();
$sSchemeID = $this->secure->checkInt($schemeID);
$sScheme = $this->secure->checkStr($info,1);
 
$query = "UPDATE ".$this->prefix."repscheme SET scheme='".$sScheme."' WHERE scheme_id='".$sSchemeID."'";
$rq =& $this->db->query($query);
if (PEAR::isError($this->db)) {
$result["ERR"] = 1;
$result["ERRINFO"] = $this->db->getMessage();
} else {
$result["ERR"] = 0;
}
 
return $result;
}
 
/**
* Вывод формы редактирования/добавления схем репозиториев
*
* @author Alexander Wolf
* @category Core
*
* @param integer $schemeID
* @param string $info
* @return string
*/
public function showSchemeForm($schemeID = 0, $info = "") {
$sSchemeID = $this->secure->checkInt($schemeID);
$sInfo = $this->secure->checkStr($info, 1);
if ($sInfo == "") {
$sInfo = "Схема репозитория";
}
if ($sSchemeID != 0) {
// Режим редактирования
$query = "SELECT * FROM ".$this->prefix."repscheme WHERE scheme_id='".$sSchemeID."'";
$rq =& $this->db->query($query);
$rq->fetchInto($element);
}
 
$show = "<fieldset><legend>".$sInfo."</legend>\n";
$show .= "<div class='inputbox'><label for='scheme'>Схема репозитория:</label> <input type='text' name='scheme' id='scheme' value='".$this->showSchemeList("scheme", $element["scheme_id"],"innerhtml")."'></div>\n";
$show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n";
 
return $show;
}
 
/**
* Показывает список подписей
*
* @author Alexander Wolf
1379,6 → 1527,7
$show .= "<div class='inputbox'><label for='rtype'>Тип репозитория:</label> ".$this->showRepType($this->secure->checkInt($element["rtype_id"]), "rtype")."</div>\n";
$show .= "<div class='inputbox'><label for='rsects'>Секции репозитория:</label> <div class='formwrapper'>".$this->showSectionsList("rsects",$sRepID,"innerhtml")."</div></div>\n";
$show .= "<div class='inputbox'><label for='rarchs'>Архитектуры:</label> <div class='formwrapper'>".$this->showArchList("rarchs",$sRepID,"innerhtml")."</div></div>\n";
$show .= "<div class='inputbox'><label for='rscheme'>Схема репозитория:</label> ".$this->showSchemeList("rscheme",$sRepID,"innerhtml")."</div>\n";
$show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div></fieldset>\n";
 
return $show;