Хранилища Subversion ant

Редакция

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

Редакция Автор № строки Строка
302 alex-w 1
<?php
2
 
3
/**
4
 *  
5
 *  Codename: ant-ng - generator of sources.list for Debian and
6
 *  distributives, based on Debian
303 alex-w 7
 *  http://alex-w.org.ru/p/antng/
302 alex-w 8
 *
9
 *  Copyright (c) 2009 Alexander Wolf
10
 *  Dual licensed under the MIT and GNU LGPL licenses.
303 alex-w 11
 *  http://alex-w.org.ru/p/antng/license
302 alex-w 12
 *
13
 */
14
 
304 alex-w 15
require_once dirname(__FILE__)."/init.php";
302 alex-w 16
 
361 alex-w 17
$scripts = "
18
<script type='text/javascript'>
19
(function($){
398 alex-w 20
  // очищаем select
21
  $.fn.clearSelect = function() {
22
          return this.each(function(){
23
                  if(this.tagName=='SELECT') {
24
                      this.options.length = 0;
25
                      $(this).attr('disabled','disabled');
26
                  }
27
          });
28
  }
29
  // заполняем select
30
  $.fn.fillSelect = function(dataArray) {
31
          return this.clearSelect().each(function(){
32
                  if(this.tagName=='SELECT') {
33
                          var currentSelect = this;
34
                          $.each(dataArray,function(index,data){
35
                                  var option = new Option(data.text,data.value);
36
                                  if($.support.cssFloat) {
37
                                          currentSelect.add(option,null);
38
                                  } else {
39
                                          currentSelect.add(option);
40
                                  }
41
                          });
42
                  }
43
          });
44
  }
361 alex-w 45
})(jQuery);
46
</script>
362 alex-w 47
<script type='text/javascript'>
48
$(document).ready(function(){
398 alex-w 49
  // выбор дистрибутива
50
  function chooseDistro(){
51
        var distValue = $('#dist').val();
52
        var tmpSelect = $('#version');
53
        if(distValue.length == 0) {
54
                tmpSelect.attr('disabled','disabled');
55
                tmpSelect.clearSelect();
56
                chooseVersion();
409 alex-w 57
        $('#vdist').css('visibility','hidden');
420 alex-w 58
                $('#replist').css('display','none');           
398 alex-w 59
        } else {
60
                $.getJSON('./request.php',{d:distValue,step:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); chooseVersion(); });
400 alex-w 61
        $('#vdist').css('visibility','visible');
420 alex-w 62
                $('#replist').css('display','none');           
398 alex-w 63
        }
64
  };
65
  // Выбор версии дистрибутива
66
  function chooseVersion(){
67
        var distValue = $('#dist').val();
68
        var versionValue = $('#version').val();
69
        if (distValue != 0 && versionValue != 0) {
70
                $.get('./request.php',{d:distValue,v:versionValue,step:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); });
409 alex-w 71
        $('#replist').css('visibility','visible');
398 alex-w 72
        } else {
73
                $('#replist').css('display','none');
74
        }
75
  }
76
 
77
  $('#dist').change(chooseDistro);
78
  $('#version').change(chooseVersion);
79
 
362 alex-w 80
});
81
</script>
361 alex-w 82
";
83
 
397 alex-w 84
$body  = "<fieldset><legend>Дистрибутив</legend>\n";
396 alex-w 85
$body .= "<select id='dist'>\n<option value=''>Выберите дистрибутив</option>\n";
390 alex-w 86
 
396 alex-w 87
$query = "SELECT * FROM ".PREFIX."distribution ORDER BY dist_id ASC";
88
$rq =& $db->query($query);
89
while ($rq->fetchInto($element)) {
90
    $body .= "<option value='".$secure->checkInt($element["dist_id"])."'>".$secure->checkStr($element["distname"],1)."</option>\n";
91
}
92
$body .= "</select></fieldset>";
399 alex-w 93
$body .= "<div id='vdist'>\n<fieldset>\n<legend>Версия дистрибутива</legend>\n";
94
$body .= "<select id='version' disabled='disabled'><option></option>\n";
455 alex-w 95
$body .= "</select></fieldset></div>\n";
401 alex-w 96
$body .= "<div id='replist'></div>\n";
396 alex-w 97
 
364 alex-w 98
$tmpl->assign('scripts', $scripts);
390 alex-w 99
$tmpl->assign('body', $body);
361 alex-w 100
 
364 alex-w 101
$tmpl->display('default.tpl');
331 alex-w 102
 
302 alex-w 103
?>