Хранилища Subversion ant

Редакция

Редакция 502 | Редакция 505 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
 
3
/**
4
 *  
5
 *  Codename: ant-ng - generator of sources.list for Debian and
6
 *  distributives, based on Debian
7
 *  http://alex-w.org.ru/p/antng/
8
 *
9
 *  Copyright (c) 2009 Alexander Wolf
10
 *  Dual licensed under the MIT and GNU LGPL licenses.
11
 *  http://alex-w.org.ru/p/antng/license
12
 *
13
 */
14
 
15
class Core {
308 alex-w 16
    protected $db       = NULL;
17
    protected $prefix   = NULL;
313 alex-w 18
    protected $secure   = NULL;    
359 alex-w 19
    protected $cookie   = NULL;
304 alex-w 20
 
463 alex-w 21
    /**
22
     * Конструктор класса Core - ядро генератора
23
     *
24
     * @author Alexander Wolf
25
     * @category Core
26
     *
27
     * @param string $database
28
     * @param string $prefix
29
     * @param object $secure
30
     * @param string $cookie
31
     */
368 alex-w 32
    public function __construct($database, $prefix, $secure, $cookie) {
308 alex-w 33
        $this->db       = $database;
34
        $this->prefix   = $prefix;
359 alex-w 35
        $this->secure   = $secure;
36
        $this->cookie   = $cookie;
307 alex-w 37
    }
38
 
463 alex-w 39
    /**
40
     * Получение данных о настройке
41
     *
42
     * @author Alexander Wolf
43
     * @category Core
44
     *
45
     * @param string $attr
46
     * @return array
47
     */
368 alex-w 48
    public function getOption($attr) {
308 alex-w 49
        $result = array();
315 alex-w 50
        $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'";
314 alex-w 51
        $rq =& $this->db->query($query);
308 alex-w 52
        if ($rq->numRows()!=0) {
53
            $rq->fetchInto($element);
54
            $result["ERR"] = 0;
55
            $result["OptValue"] = $element["optvalue"];
56
        } else {
57
            $result["ERR"] = 1;
58
            $result["ERRINFO"] = "Empty result";
59
        }
60
        return $result;
61
    }
62
 
463 alex-w 63
    /**
64
     * Установка данных о настройке
65
     *
66
     * @author Alexander Wolf
67
     * @category Core
68
     *
69
     * @param string $attr
70
     * @param string $value
71
     * @return array
72
     */
368 alex-w 73
    public function setOption($attr, $value) {
359 alex-w 74
        $result = array();
75
 
76
        if ($attr != "passwd") {
77
            $sValue = $this->secure->checkStr($value);
78
        } else {
79
            $sValue = $value;
80
        }
81
 
82
        $query = "UPDATE ".$this->prefix."settings SET optvalue='".$sValue."' WHERE opt='".$attr."'";
83
        $rq =& $this->db->query($query);
84
        if (PEAR::isError($this->db)) {
85
            $result["ERR"] = 1;
86
            $result["ERRINFO"] = $this->db->getMessage();
87
        } else {
88
            $result["ERR"] = 0;
89
        }
90
 
91
        return $result;
92
    }
93
 
463 alex-w 94
    /**
95
     * Создание настройки
96
     *
97
     * @author Alexander Wolf
98
     * @category Core
99
     *
100
     * @param string $attr
101
     * @param string $value
102
     * @return array
103
     */
368 alex-w 104
    public function addOption($attr, $value) {
359 alex-w 105
        $result = array();
106
        $sValue = $this->secure->checkStr($value);
107
 
108
        $query = "INSERT INTO ".$this->prefix."settings SET opt='".$attr."', optvalue='".$sValue."'";
109
        $rq =& $this->db->query($query);
110
        if (PEAR::isError($this->db)) {
111
            $result["ERR"] = 1;
112
            $result["ERRINFO"] = $this->db->getMessage();
113
        } else {
114
            $result["ERR"] = 0;
115
        }
116
 
117
        return $result;
118
    }
463 alex-w 119
 
120
    /**
467 alex-w 121
     * Получение и отображение списка дистрибутвов
463 alex-w 122
     *
123
     * @author Alexander Wolf
124
     * @category Core
125
     * @deprecated may be deprecated XXX
126
     *
127
     * @param string $name
128
     * @param string $heads
129
     * @param string $info
130
     * @param string $format
131
     * @return string
132
     */
393 alex-w 133
    public function showDistributionList($name, $heads = "", $info = "", $format = 'html') {
315 alex-w 134
        $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC";
317 alex-w 135
        $rq =& $this->db->query($query);
315 alex-w 136
        switch ($format) {
137
            case 'html':
394 alex-w 138
                $show  = "<fieldset><legend>".$heads."</legend>\n<select id='".$name."' name='".$name."'>\n";
390 alex-w 139
                $show .= "<option value=''>".$info."</option>\n";
315 alex-w 140
                while ($rq->fetchInto($element)) {
141
                    $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n";
142
                }
317 alex-w 143
                $show .= "</select></fieldset>";
315 alex-w 144
                break;
145
            case 'json':
317 alex-w 146
                $show = '[{value:"",text:"'.$info.'"}';                
315 alex-w 147
                while ($rq->fetchInto($element)) {
148
                    $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}';
149
                }
150
                $show .= ']';
151
                break;
504 alex-w 152
            case 'innerhtml':
153
                $show = "<select id='".$name."' name='".$name."'>\n";
154
                while ($rq->fetchInto($element)) {
155
                    $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n";
156
                }
157
                $show .= "</select>";
158
                break;
315 alex-w 159
        }
160
        return $show;
161
    }
162
 
463 alex-w 163
    /**
164
     * Получение названия дистрибутива
165
     *
166
     * @author Alexander Wolf
167
     * @category Core
168
     *
169
     * @param integer $distID
170
     * @return array
171
     */
368 alex-w 172
    public function getDistName($distID) {
315 alex-w 173
        $result = array();
174
        $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'";
175
        $rq =& $this->db->query($query);
176
        if (PEAR::isError($this->db)) {
177
            $result["ERR"] = 1;
178
            $result["ERRINFO"] = $this->db->getMessage();
179
        } else {
180
            $rq->fetchInto($element);
181
            $result["ERR"] = 0;
182
            $result["DistName"] = $this->secure->checkStr($element["distname"],1);
183
        }
184
 
185
        return $result;
186
    }
187
 
463 alex-w 188
    /**
189
     * Получение названия программы, ее версии и описания
190
     *
191
     * @author Alexander Wolf
192
     * @category Core
193
     *
194
     * @param string $attr
195
     * @return string
196
     */
383 alex-w 197
    public function getEngineAttr($attr = 'codename') {
198
        $cname = $this->getOption($attr);
382 alex-w 199
        return $this->secure->checkStr($cname["OptValue"],1);
381 alex-w 200
    }
201
 
463 alex-w 202
    /**
203
     * Получение и отображение списка версий дистрибутива
204
     *
205
     * @author Alexander Wolf
206
     * @category Core
207
     *
208
     * @param string $name
209
     * @param integer $distID
210
     * @param string $format
211
     * @return string
212
     */
368 alex-w 213
    public function showDistVersionsList($name, $distID, $format = 'html') {
316 alex-w 214
        $distname = $this->getDistName($distID);
315 alex-w 215
        $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC";
317 alex-w 216
        $rq =& $this->db->query($query);
315 alex-w 217
        switch ($format) {
218
            case 'html':
394 alex-w 219
                $show  = "<fieldset><legend>Версии ".$distname["DistName"]."</legend>\n<select id='".$name."' name='".$name."'>\n";
220
                $show .= "<option value=''>Выбери версию ".$distname["DistName"]."</option>\n";
315 alex-w 221
                while ($rq->fetchInto($element)) {
316 alex-w 222
                    $show .= "<option value='".$this->secure->checkInt($element["version_id"])."'>".$this->secure->checkStr($element["version"],1)." ".$this->secure->checkStr($element["vname"],1)."</option>\n";
315 alex-w 223
                }
317 alex-w 224
                $show .= "</select></fieldset>";
315 alex-w 225
                break;
226
            case 'json':
317 alex-w 227
                $show = '[{value:"",text:"Выбери версию '.$distname["DistName"].'"}';                
315 alex-w 228
                while ($rq->fetchInto($element)) {
316 alex-w 229
                    $show .= ',{value:"'.$this->secure->checkInt($element["version_id"]).'",text:"'.$this->secure->checkStr($element["version"],1).' '.$this->secure->checkStr($element["vname"],1).'"}';
315 alex-w 230
                }
231
                $show .= ']';
232
                break;
233
        }
234
        return $show;
235
    }
236
 
463 alex-w 237
    /**
238
     * Получение и отображение списка секций основного (официального) репозитория
239
     *
240
     * @author Alexander Wolf
241
     * @category Core
242
     *
243
     * @param integer $version
244
     * @param string $format
245
     * @return string
246
     */
368 alex-w 247
    public function showBranchesList($version, $format = 'html') {
317 alex-w 248
        $query  = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'";
249
        $rq =& $this->db->query($query);
250
        $rq->fetchInto($types);
251
        $query  = "SELECT s.*,t.rtype FROM ".$this->prefix."section s ";
252
        $query .= "JOIN ".$this->prefix."sect2rep l ON s.sect_id=l.sect_id ";
253
        $query .= "JOIN ".$this->prefix."repository r ON r.rep_id=l.rep_id ";
254
        $query .= "JOIN ".$this->prefix."rtype t ON r.rtype_id=t.rtype_id ";
255
        $query .= "WHERE t.rtype_id='1' AND r.version='".$this->secure->checkInt($version)."'";
256
        $rq =& $this->db->query($query);
257
        switch ($format) {
258
            case 'html':
259
                $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n";
260
                while ($rq->fetchInto($element)) {
493 alex-w 261
                    $show .= "<div class='sections'><input type='checkbox' name='section[]' value='".$element["sect_id"]."'> ".$this->secure->checkStr($element["secname"],1)." &mdash; ".$this->secure->checkStr($element["sectinfo"],1)."</div>\n";
317 alex-w 262
                }
263
                $show .= "</fieldset>\n";
264
                break;
265
            case 'json':
266
                //TODO Доделать JSON-вывод списка секций основного репозитория
267
                break;
268
        }
318 alex-w 269
 
270
        return $show;
317 alex-w 271
    }
272
 
463 alex-w 273
    /**
274
     * Получение и отображение списка репозиториев
275
     *
276
     * @author Alexander Wolf
277
     * @category Core
278
     *
279
     * @param integer $version
280
     * @param integer $reptype
281
     * @param string $format
282
     * @return string
283
     */
368 alex-w 284
    public function showRepList($version, $reptype, $format = 'html') {
406 alex-w 285
        $query  = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='".$this->secure->checkInt($reptype)."'";
317 alex-w 286
        $rq =& $this->db->query($query);
287
        $rq->fetchInto($types);
288
        $query = "SELECT * FROM ".$this->prefix."repository WHERE version='".$this->secure->checkInt($version)."' AND rtype_id='".$this->secure->checkInt($reptype)."'";
289
        $rq =& $this->db->query($query);
290
        switch ($format) {
291
            case 'html':
292
                $show = "<fieldset><legend>".$this->secure->checkStr($types["rtype"],1)."</legend>\n";
293
                while ($rq->fetchInto($types)) {
320 alex-w 294
                    $show .= "<div class='repository'><input type='checkbox' name='repository[]' value='".$element["rep_id"]."'> ".$this->secure->checkStr($element["repname"],1)." &mdash; ".$this->secure->checkStr($element["repinfo"],1)."</div>\n";
317 alex-w 295
                }
296
                $show .= "</fieldset>\n";
297
                break;
298
            case 'json':
299
                //TODO Доделать JSON-вывод списка репозиториев
300
                break;
301
        }
318 alex-w 302
 
303
        return $show;
317 alex-w 304
    }
305
 
463 alex-w 306
    /**
307
     * Добавление поддержки нового apt-дистрибутива
308
     *
309
     * @author Alexander Wolf
310
     * @category Core
311
     *
312
     * @param string $distname
313
     * @param integer $disttype
314
     * @param string $distua
315
     * @param byte $distlogo
316
     * @return array
317
     */
368 alex-w 318
    public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) {
321 alex-w 319
        $result = array();
320
        $sDName = $this->secure->checkStr($distname);
321
        $sDType = $this->secure->checkInt($disttype);
322
        $sDUAgt = $this->secure->checkStr($distua);
323
        $sDLogo = $this->secure->checkInt($distname);
324
 
325
        $query = "INSERT INTO ".$this->prefix."distribution SET distname='".$sDName."', distua='".$sDUAgt."', disttype='".$sDType."', distlogo='".$sDLogo."'";
326
        $rq =& $this->db->query($query);
327
        if (PEAR::isError($this->db)) {
328
            $result["ERR"] = 1;
329
            $result["ERRINFO"] = $this->db->getMessage();
330
        } else {
331
            $rq->fetchInto($element);
332
            $result["ERR"] = 0;
333
        }
334
 
335
        return $result;
336
    }
337
 
463 alex-w 338
    /**
339
     * Добавление поддержки новой версии apt-дистрибутива
340
     *
341
     * @author Alexander Wolf
342
     * @category Core
343
     *
344
     * @param integer $distID
345
     * @param integer $version
346
     * @param string $vname
347
     * @param integer $vcodename
348
     * @return array
349
     */
368 alex-w 350
    public function addDistVersion($distID, $version, $vname = "", $vcodename = "") {
356 alex-w 351
        $result = array();
463 alex-w 352
        $sDistID    = $this->secure->checkInt($distID);
356 alex-w 353
        $sDVersion  = $this->secure->checkStr($version);
354
        $sDVName    = $this->secure->checkStr($vname);
355
        $sDVCName   = $this->secure->checkInt($vcodename);
356
 
357
        $query = "INSERT INTO ".$this->prefix."version SET dist_id='".$sDistID."', vname='".$sDVName."', version='".$sDVersion."', vcodename='".$sDVCName."'";
358
        $rq =& $this->db->query($query);
359
        if (PEAR::isError($this->db)) {
360
            $result["ERR"] = 1;
361
            $result["ERRINFO"] = $this->db->getMessage();
362
        } else {
363
            $rq->fetchInto($element);
364
            $result["ERR"] = 0;
365
        }
366
 
367
        return $result;
368
    }
358 alex-w 369
 
463 alex-w 370
    /**
371
     * Отображение типа дистрибутива
372
     *
373
     * @author Alexander Wolf
374
     * @category Core
375
     *
376
     * @param string $name
377
     * @param byte $type
378
     * @return string
379
     */
368 alex-w 380
    public function showDistTypeForm($name = "dtype",$type = 0) {
329 alex-w 381
        $query = "SELECT * FROM ".$this->prefix."dtype";
382
        $rq =& $this->db->query($query);
383
        $show = "<select name='".$name."' id='".$name."'>\n";
384
        while ($rq->fetchInto($element)) {
347 alex-w 385
            if ($element["type_id"] == $type) {
386
                $show .= "<option value='".$element["type_id"]."' selected>".$this->secure->checkStr($element["type"],1)."</option>\n";
329 alex-w 387
            } else {
347 alex-w 388
                $show .= "<option value='".$element["type_id"]."'>".$this->secure->checkStr($element["type"],1)."</option>\n";
329 alex-w 389
            }
390
        }
391
        $show .= "</select>";
392
 
393
        return $show;
394
    }
395
 
463 alex-w 396
    /**
397
     * Отображение формы создания и редактирования apt-дистрибутива
398
     *
399
     * @author Alexander Wolf
400
     * @category Core
401
     *
402
     * @param integer $distID
403
     * @return string
404
     */
368 alex-w 405
    public function showDistributionForm($distID = 0) {
329 alex-w 406
        $sDistID = $this->secure->checkInt($distID);
407
        if ($sDistID != 0) {
408
            // Режим редактирования
409
            $query = "SELECT * FROM ".$this->prefix."distribution WHERE dist_id='".$sDistID."'";
410
            $rq =& $this->db->query($query);
411
            $rq->fetchInto($element);
412
        }
413
 
414
        if ($element["distlogo"] == 1) {
380 alex-w 415
            $image = "<img src='./img/d/".$this->secure->checkStr($element["distua"],1).".png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива ".$this->secure->checkStr($element["distname"],1)."' title='Логотип дистрибутива ".$this->secure->checkStr($element["distname"],1)."'>";
329 alex-w 416
        } else {
380 alex-w 417
            $image = "<img src='./img/d/empty-logo.png' width='32' height='32' id='adm-dist-logo' alt='Логотип дистрибутива' title='Логотип дистрибутива не загружен'>";
329 alex-w 418
        }
419
 
420
        $show  = "<fieldset><legend>Дистрибутив</legend>\n";
350 alex-w 421
        $show .= "<div class='inputbox'><label for='dname'>Название дистрибутива:</label> <input type='text' name='dname' id='dname' value='".$this->secure->checkStr($element["distname"],1)."'></div>\n";
422
        $show .= "<div class='inputbox'><label for='dua'>UA дистрибутива:</label> <input type='text' name='dua' id='dua' value='".$this->secure->checkStr($element["distua"],1)."'></div>\n";
423
        $show .= "<div class='inputbox'><label for='dtype'>Тип дистрибутива:</label> ".$this->showDistTypeForm("dtype",$element["dtype_id"])."</div>\n";
348 alex-w 424
        $show .= "<div class='inputbox'><table><tr><td class='td-name'>Логотип дистрибутива:</td>\n";
329 alex-w 425
        $show .= "<td>".$image."</td>\n<td><input type='file' name='distlogo'></td>\n</tr></table>\n</div>\n";
350 alex-w 426
        $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n";
329 alex-w 427
 
428
        return $show;
429
    }
430
 
358 alex-w 431
    // sourses.list
423 alex-w 432
    public function showSourcesList($distID,$versID,$sectIDs,$repIDs) {
433
       //TODO Написать генератор sources.list       
358 alex-w 434
    }
435
 
463 alex-w 436
    /**
437
     * Проверка пароля (из формы авторизации)
438
     *
439
     * @author Alexander Wolf
440
     * @category Core
441
     *
442
     * @param string $word
443
     * @return array
444
     */
368 alex-w 445
    public function checkSign($word) {
359 alex-w 446
        $result = array();
447
 
448
        $sHash = $this->secure->encryptStr($word);
449
        $pwd   = $this->getOption("passwd");
450
        if ($sHash == $pwd["OptValue"]) {
451
            $result["ERR"] = 0;
452
            $result["Location"] = "manager.php";
453
            setcookie($this->cookie, $sHash);
454
        } else {
455
            $result["ERR"] = 1;
456
            $result["ERRINFO"] = "Password not valid";
368 alex-w 457
            $result["Location"] = "manager.php?error=1";
359 alex-w 458
        }
459
 
460
        return $result;
358 alex-w 461
    }
357 alex-w 462
 
463 alex-w 463
    /**
464
     * Проверка пароля (из cookies)
465
     *
466
     * @author Alexander Wolf
467
     * @category Core
468
     *
469
     * @param string $hash
470
     * @return array
471
     */
368 alex-w 472
    public function checkCookieSign($hash) {
359 alex-w 473
        $result = array();
474
 
475
        $pwd = $this->getOption("passwd");
476
        if ($hash == $pwd["OptValue"]) {
477
            $result["ERR"] = 0;
478
        } else {
479
            $result["ERR"] = 1;
480
            $result["ERRINFO"] = "Hash not valid";
368 alex-w 481
            $result["Location"] = "manager.php";
359 alex-w 482
        }
483
 
484
        return $result;
485
    }
486
 
463 alex-w 487
    /**
488
     * Форма ввода пароля
489
     *
490
     * @author Alexander Wolf
491
     * @category Core
492
     *
493
     * @return string
494
     */
368 alex-w 495
    public function showSigninForm() {
425 alex-w 496
        $show  = "<div id='regform'>";
497
        $show .= "<form action='process.php' method='post'>\n";
368 alex-w 498
        $show .= "<fieldset><legend>Пароль</legend>\n";
499
        $show .= "<input type='hidden' name='mode' value='authorize'>\n";
427 alex-w 500
        $show .= "<input type='password' name='word' value=''>\n";
368 alex-w 501
        $show .= "<input type='submit' value=' Войти '>\n";
425 alex-w 502
        $show .= "</fieldset>\n</form></div>\n";
368 alex-w 503
 
504
        return $show;
505
    }
506
 
463 alex-w 507
    /**
508
     * Обновление пароля
509
     *
510
     * @author Alexander Wolf
511
     * @category Core
512
     *
513
     * @param string $word1
514
     * @param string $word2
515
     * @return array
516
     */
368 alex-w 517
    public function updatePassword($word1, $word2) {
359 alex-w 518
        $result = array();
519
 
520
        if ($word1 == $word2) {
521
            $sWord = $this->secure->encryptStr($word1);
522
            $r = $this->setOption("passwd", $sWord);
523
            $result = $r;
524
        } else {
525
            $result["ERR"] = 1;
526
            $result["ERRINFO"] = "Passwords is mismatch";
527
        }
528
 
529
        return $result;
530
    }
531
 
504 alex-w 532
    /**
533
     * Показ формы редактирования версии дистрибутива или его списка
534
     *
535
     * @author Alexander Wolf
536
     * @category Core
537
     *
538
     * @param string $name
539
     * @param string $actor
540
     * @param integer $versionID
541
     * @return string
542
     */
543
    public function showDistVersionsEditor($name, $actor, $versionID = 0) {
497 alex-w 544
        if ($versionID == 0) {
495 alex-w 545
            $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id ORDER BY d.dist_id,v.version ASC";
546
            $rq =& $this->db->query($query);
547
            $show = "<ul>\n";
548
            while ($rq->fetchInto($element)) {
496 alex-w 549
                $show .= "<li>[<a href='".$actor."?mode=versions&action=edit&uuid=".$this->secure->checkInt($element["version_id"])."'>править</a>][<a href='".$actor."?mode=versions&action=delete&uuid=".$this->secure->checkInt($element["version_id"])."'>удалить</a>] ".$this->secure->checkStr($element["distname"],1)." ".$this->secure->checkStr($element["version"],1)." &#8220;<em>".$this->secure->checkStr($element["vname"],1)."</em>&#8221;</li>\n";
495 alex-w 550
            }
551
            $show .= "</ul>";
552
        } else {
497 alex-w 553
            $query = "SELECT * FROM ".$this->prefix."version v JOIN ".$this->prefix."distribution d ON v.dist_id=d.dist_id WHERE v.version_id='".$versionID."'";
554
            $rq =& $this->db->query($query);
555
            $rq->fetchInto($element);
556
            $show  = "<form action='".$actor."' method='post'>\n";
501 alex-w 557
            $show .= "<fieldset><legend>Редактирование описания версии дистрибутива</legend>\n";
558
            $show .= "<input type='hidden' name='mode' value='".$name."-edit'>\n";
502 alex-w 559
            $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n";
500 alex-w 560
            $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n";
561
            $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."'></div>\n";
562
            $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."'></div>\n";
563
            $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."'></div>\n";
564
            $show .= "<div class='inputbox'><input type='submit' value=' Править '></div></fieldset></form>\n";
495 alex-w 565
        }
566
        return $show;
567
    }
568
 
504 alex-w 569
    public function showDistVersionsForm($name, $actor, $versionID = 0) {
570
        $show  = "<form action='".$actor."' method='post'>";
571
        if ($versionID == 0) {
572
            $show .= "<fieldset><legend>Добавить описание новой версии дистрибутива</legend>\n";
573
            $show .= "<input type='hidden' name='mode' value='".$name."-add'>\n";
574
            $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> ".$this->showDistributionList("distname", "", "", "innerhtml") ."</div>\n";
575
            $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value=''></div>\n";
576
            $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value=''></div>\n";
577
            $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value=''></div>\n";
578
            $show .= "<div class='inputbox'><input type='submit' value=' Добавить '></div></fieldset>\n";
579
        } else {
580
            $show .= "<fieldset><legend>Удалить описание существующей версии дистрибутива</legend>\n";
581
            $show .= "<input type='hidden' name='mode' value='".$name."-delete'>\n";
582
            $show .= "<input type='hidden' name='".$name."ID' value='".$versionID."'>\n";
583
            $show .= "<div class='inputbox'><label for='distname'>Дистрибутив:</label> <input type='text' name='distname' value='".$this->secure->checkStr($element["distname"],1)."' readonly='readonly'></div>\n";
584
            $show .= "<div class='inputbox'><label for='vname'>Название версии:</label> <input type='text' name='vname' value='".$this->secure->checkStr($element["vname"],1)."' readonly='readonly'></div>\n";
585
            $show .= "<div class='inputbox'><label for='version'>Номер версии:</label> <input type='text' name='version' value='".$this->secure->checkStr($element["version"],1)."' readonly='readonly'></div>\n";
586
            $show .= "<div class='inputbox'><label for='vcodename'>Кодовое имя версии:</label> <input type='text' name='vcodename' value='".$this->secure->checkStr($element["vcodename"],1)."' readonly='readonly'></div>\n";
587
            $show .= "<div class='inputbox'><input type='submit' value=' Удалить '></div></fieldset>\n";
588
        }
589
        $show .= "</form>";
590
 
591
        return $show;
592
    }
593
 
304 alex-w 594
}
595
 
356 alex-w 596
?>