Редакция 316 | Редакция 318 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 316 | Редакция 317 | ||
---|---|---|---|
Строка 41... | Строка 41... | ||
41 | }
|
41 | }
|
42 | 42 | ||
43 | // Получение и отображение списка дистрибутивов
|
43 | // Получение и отображение списка дистрибутивов
|
44 | function showDistributionList($name, $info = "", $format = 'html') { |
44 | function showDistributionList($name, $info = "", $format = 'html') { |
45 | $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
45 | $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
- | 46 | $rq =& $this->db->query($query); |
|
46 | switch ($format) { |
47 | switch ($format) { |
47 | case 'html': |
48 | case 'html': |
48 | $show = "<label for='".$name."'>".$info."</label> <select id='".$name."' name='".$name."'>\n"; |
49 | $show = "<fieldset><legend>".$info."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
49 | $rq =& $this->db->query($query); |
- | |
50 | while ($rq->fetchInto($element)) { |
50 | while ($rq->fetchInto($element)) { |
51 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
51 | $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
52 | }
|
52 | }
|
53 | $show .= "</select>"; |
53 | $show .= "</select></fieldset>"; |
54 | break; |
54 | break; |
55 | case 'json': |
55 | case 'json': |
56 | $show = '[{value:"",text:"'.$info.'"}'; |
56 | $show = '[{value:"",text:"'.$info.'"}'; |
57 | $rq =& $this->db->query($query); |
- | |
58 | while ($rq->fetchInto($element)) { |
57 | while ($rq->fetchInto($element)) { |
59 | $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
58 | $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
60 | }
|
59 | }
|
61 | $show .= ']'; |
60 | $show .= ']'; |
62 | break; |
61 | break; |
Строка 83... | Строка 82... | ||
83 | 82 | ||
84 | // Получение и отображение списка версий дистрибутива
|
83 | // Получение и отображение списка версий дистрибутива
|
85 | function showDistVersionsList($name, $distID, $format = 'html') { |
84 | function showDistVersionsList($name, $distID, $format = 'html') { |
86 | $distname = $this->getDistName($distID); |
85 | $distname = $this->getDistName($distID); |
87 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
86 | $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
- | 87 | $rq =& $this->db->query($query); |
|
88 | switch ($format) { |
88 | switch ($format) { |
89 | case 'html': |
89 | case 'html': |
90 | $show = "<label for='".$name."'>Версии ".$distname["DistName"]."</label> <select id='".$name."' name='".$name."'>\n"; |
90 | $show = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n"; |
91 | $rq =& $this->db->query($query); |
- | |
92 | while ($rq->fetchInto($element)) { |
91 | while ($rq->fetchInto($element)) { |
93 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
92 | $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n"; |
94 | }
|
93 | }
|
95 | $show .= "</select>"; |
94 | $show .= "</select></fieldset>"; |
96 | break; |
95 | break; |
97 | case 'json': |
96 | case 'json': |
98 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
97 | $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}'; |
99 | $rq =& $this->db->query($query); |
- | |
100 | while ($rq->fetchInto($element)) { |
98 | while ($rq->fetchInto($element)) { |
101 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
99 | $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}'; |
102 | }
|
100 | }
|
103 | $show .= ']'; |
101 | $show .= ']'; |
104 | break; |
102 | break; |
105 | }
|
103 | }
|
106 | return $show; |
104 | return $show; |
107 | }
|
105 | }
|
108 | 106 | ||
- | 107 | // Получение и отображение списка секций основного (официального) репозитория
|
|
- | 108 | function showBranchesList($version, $format = 'html') { |
|
- | 109 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
|
- | 110 | $rq =& $this->db->query($query); |
|
- | 111 | $rq->fetchInto($types); |
|
- | 112 | $query = "SELECT s.*,t.rtype FROM ".$this->prefix."section s "; |
|
- | 113 | $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id "; |
|
- | 114 | $query .= "JOIN ".$this->prefix."repository r ON r.rep_id=l.rep_id "; |
|
- | 115 | $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id "; |
|
- | 116 | $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."'"; |
|
- | 117 | $rq =& $this->db->query($query); |
|
- | 118 | switch ($format) { |
|
- | 119 | case 'html': |
|
- | 120 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
|
- | 121 | while ($rq->fetchInto($element)) { |
|
- | 122 | $show .= "<div class='sections'><input type='checkbox' name='section[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["sectname"])." — ".$this->secure->checkStr($element["sectinfo"])."</div>\n"; |
|
- | 123 | }
|
|
- | 124 | $show .= "</fieldset>\n"; |
|
- | 125 | break; |
|
- | 126 | case 'json': |
|
- | 127 | //TODO Доделать JSON-вывод списка секций основного репозитория
|
|
- | 128 | break; |
|
- | 129 | }
|
|
- | 130 | }
|
|
- | 131 | ||
- | 132 | // Получение и отображение списка репозиториев
|
|
- | 133 | function showRepList($version, $reptype, $format = 'html') { |
|
- | 134 | $query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
|
- | 135 | $rq =& $this->db->query($query); |
|
- | 136 | $rq->fetchInto($types); |
|
- | 137 | $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'"; |
|
- | 138 | $rq =& $this->db->query($query); |
|
- | 139 | switch ($format) { |
|
- | 140 | case 'html': |
|
- | 141 | $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n"; |
|
- | 142 | while ($rq->fetchInto($types)) { |
|
- | 143 | $show .= "<div class='repository'><input type='checkbox' name='repository[]' value='".$element["rep_id"]."'> ".$this->secure->checkStr($element["repname"])." — ".$this->secure->checkStr($element["repinfo"])."</div>\n"; |
|
- | 144 | }
|
|
- | 145 | $show .= "</fieldset>\n"; |
|
- | 146 | break; |
|
- | 147 | case 'json': |
|
- | 148 | //TODO Доделать JSON-вывод списка репозиториев
|
|
- | 149 | break; |
|
- | 150 | }
|
|
- | 151 | }
|
|
- | 152 | ||
109 | }
|
153 | }
|
110 | 154 | ||
111 | ?>
|
155 | ?>
|