Хранилища Subversion ant

Редакция

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

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