Хранилища Subversion ant

Редакция

Редакция 475 | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 475 Редакция 554
1
<?php
1
<?php
2
2
3
/**
3
/**
4
 *  
4
 *  
5
 *  Codename: ant-ng - generator of sources.list for Debian and
5
 *  Codename: ant-ng - generator of sources.list for apt-distributives
6
 *  distributives, based on Debian
-
 
7
 *  http://alex-w.org.ru/p/antng/
6
 *  http://alex-w.org.ru/p/antng/
8
 *
7
 *
9
 *  Copyright (c) 2009 Alexander Wolf
8
 *  Copyright (c) 2009 Alexander Wolf
10
 *  Dual licensed under the MIT and GNU LGPL licenses.
9
 *  Dual licensed under the MIT and GNU LGPL licenses.
11
 *  http://alex-w.org.ru/p/antng/license
10
 *  http://alex-w.org.ru/p/antng/license
12
 *
11
 *
13
 */
12
 */
14
13
15
require_once dirname(__FILE__)."/init.php";
14
require_once dirname(__FILE__)."/init.php";
16
15
17
$scripts = "
16
$scripts = "
18
<script type='text/javascript'>
17
<script type='text/javascript'>
19
(function($){
18
(function($){
20
  // очищаем select
19
  // очищаем select
21
  $.fn.clearSelect = function() {
20
  $.fn.clearSelect = function() {
22
          return this.each(function(){
21
          return this.each(function(){
23
                  if(this.tagName=='SELECT') {
22
                  if(this.tagName=='SELECT') {
24
                      this.options.length = 0;
23
                      this.options.length = 0;
25
                      $(this).attr('disabled','disabled');
24
                      $(this).attr('disabled','disabled');
26
                  }
25
                  }
27
          });
26
          });
28
  }
27
  }
29
  // заполняем select
28
  // заполняем select
30
  $.fn.fillSelect = function(dataArray) {
29
  $.fn.fillSelect = function(dataArray) {
31
          return this.clearSelect().each(function(){
30
          return this.clearSelect().each(function(){
32
                  if(this.tagName=='SELECT') {
31
                  if(this.tagName=='SELECT') {
33
                          var currentSelect = this;
32
                          var currentSelect = this;
34
                          $.each(dataArray,function(index,data){
33
                          $.each(dataArray,function(index,data){
35
                                  var option = new Option(data.text,data.value);
34
                                  var option = new Option(data.text,data.value);
36
                                  if($.support.cssFloat) {
35
                                  if($.support.cssFloat) {
37
                                          currentSelect.add(option,null);
36
                                          currentSelect.add(option,null);
38
                                  } else {
37
                                  } else {
39
                                          currentSelect.add(option);
38
                                          currentSelect.add(option);
40
                                  }
39
                                  }
41
                          });
40
                          });
42
                  }
41
                  }
43
          });
42
          });
44
  }
43
  }
45
})(jQuery);
44
})(jQuery);
46
</script>
45
</script>
47
<script type='text/javascript'>
46
<script type='text/javascript'>
48
$(document).ready(function(){
47
$(document).ready(function(){
49
  // выбор дистрибутива
48
  // выбор дистрибутива
50
  function chooseDistro(){
49
  function chooseDistro(){
51
        var distValue = $('#dist').val();
50
        var distValue = $('#dist').val();
52
        var tmpSelect = $('#version');
51
        var tmpSelect = $('#version');
53
        if(distValue.length == 0) {
52
        if(distValue.length == 0) {
54
                tmpSelect.attr('disabled','disabled');
53
                tmpSelect.attr('disabled','disabled');
55
                tmpSelect.clearSelect();
54
                tmpSelect.clearSelect();
56
                chooseVersion();
55
                chooseVersion();
57
        $('#vdist').css('visibility','hidden');
56
        $('#vdist').css('visibility','hidden');
58
                $('#replist').css('display','none');           
57
                $('#replist').css('display','none');           
59
        } else {
58
        } else {
60
                $.getJSON('./request.php',{d:distValue,step:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); chooseVersion(); });
59
                $.getJSON('./request.php',{d:distValue,step:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); chooseVersion(); });
61
        $('#vdist').css('visibility','visible');
60
        $('#vdist').css('visibility','visible');
62
                $('#replist').css('display','none');           
61
                $('#replist').css('display','none');           
63
        }
62
        }
64
  };
63
  };
65
  // Выбор версии дистрибутива
64
  // Выбор версии дистрибутива
66
  function chooseVersion(){
65
  function chooseVersion(){
67
        var distValue = $('#dist').val();
66
        var distValue = $('#dist').val();
68
        var versionValue = $('#version').val();
67
        var versionValue = $('#version').val();
69
        if (distValue != 0 && versionValue != 0) {
68
        if (distValue != 0 && versionValue != 0) {
70
                $.get('./request.php',{d:distValue,v:versionValue,step:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); });
69
                $.get('./request.php',{d:distValue,v:versionValue,step:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); });
71
        $('#replist').css('visibility','visible');
70
        $('#replist').css('visibility','visible');
72
        } else {
71
        } else {
73
                $('#replist').css('display','none');
72
                $('#replist').css('display','none');
74
        }
73
        }
75
  }
74
  }
76

75

77
  $('#dist').change(chooseDistro);
76
  $('#dist').change(chooseDistro);
78
  $('#version').change(chooseVersion);
77
  $('#version').change(chooseVersion);
79

78

80
});
79
});
81
</script>
80
</script>
82
";
81
";
83
82
84
$body  = "<fieldset><legend>Дистрибутив</legend>\n";
83
$body  = "<fieldset><legend>Дистрибутив</legend>\n";
85
$body .= "<select id='dist'>\n<option value=''>Выберите дистрибутив</option>\n";
84
$body .= "<select id='dist'>\n<option value=''>Выберите дистрибутив</option>\n";
86
85
87
$query = "SELECT * FROM ".PREFIX."distribution ORDER BY dist_id ASC";
86
$query = "SELECT * FROM ".PREFIX."distribution ORDER BY dist_id ASC";
88
$rq =& $db->query($query);
87
$rq =& $db->query($query);
89
while ($rq->fetchInto($element)) {
88
while ($rq->fetchInto($element)) {
90
    $body .= "<option value='".$secure->checkInt($element["dist_id"])."'>".$secure->checkStr($element["distname"],1)."</option>\n";
89
    $body .= "<option value='".$secure->checkInt($element["dist_id"])."'>".$secure->checkStr($element["distname"],1)."</option>\n";
91
}
90
}
92
$body .= "</select></fieldset>";
91
$body .= "</select></fieldset>";
93
$body .= "<div id='vdist'>\n<fieldset>\n<legend>Версия дистрибутива</legend>\n";
92
$body .= "<div id='vdist'>\n<fieldset>\n<legend>Версия дистрибутива</legend>\n";
94
$body .= "<select id='version' disabled='disabled'><option></option>\n";
93
$body .= "<select id='version' disabled='disabled'><option></option>\n";
95
$body .= "</select></fieldset></div>\n";
94
$body .= "</select></fieldset></div>\n";
96
$body .= "<div id='replist'></div>\n";
95
$body .= "<div id='replist'></div>\n";
97
96
98
$tmpl->assign('scripts', $scripts);
97
$tmpl->assign('scripts', $scripts);
99
$tmpl->assign('body', $body);
98
$tmpl->assign('body', $body);
100
99
101
$tmpl->display('default.tpl');
100
$tmpl->display('default.tpl');
102
101
103
?>
102
?>
104
 
103