Хранилища Subversion ant

Редакция

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

Редакция Автор № строки Строка
43 alex-w 1
<?php
2
 
3
/**
4
 * Project:     Ant: sources.list generator
5
 * File:        modern.php
6
 *
7
 * This application is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * This application is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 *
21
 */
22
 
23
 
101 alex-w 24
require_once dirname(__FILE__)."/lib/init.php";
43 alex-w 25
 
26
$query =& $db->query("SELECT * FROM settings WHERE opt LIKE 'version'");
27
$query->fetchInto($antv, DB_FETCHMODE_ASSOC);
28
$antversion = $antv["optvalue"];
29
 
45 alex-w 30
$scripts = "
31
(function($){
32
  // очищаем select
33
  $.fn.clearSelect = function() {
34
          return this.each(function(){
35
                  if(this.tagName=='SELECT') {
36
                      this.options.length = 0;
37
                      $(this).attr('disabled','disabled');
38
                  }
39
          });
40
  }
41
  // заполняем select
42
  $.fn.fillSelect = function(dataArray) {
43
          return this.clearSelect().each(function(){
44
                  if(this.tagName=='SELECT') {
45
                          var currentSelect = this;
46
                          $.each(dataArray,function(index,data){
47
                                  var option = new Option(data.text,data.value);
48
                                  if($.support.cssFloat) {
49
                                          currentSelect.add(option,null);
50
                                  } else {
51
                                          currentSelect.add(option);
52
                                  }
53
                          });
54
                  }
55
          });
56
  }
57
})(jQuery);
58
</script>
59
<script type='text/javascript'>
60
$(document).ready(function(){
61
  // выбор дистрибутива
62
  function adjustDistro(){
63
        var distroValue = $('#distro').val();
64
        var tmpSelect = $('#distver');
65
        if(distroValue.length == 0) {
66
                tmpSelect.attr('disabled','disabled');
67
                tmpSelect.clearSelect();
68
                adjustReps();
69
                $('#replist').css('display','none');
52 alex-w 70
                $('#getfile').css('display','none');
45 alex-w 71
        } else {
72
                $.getJSON('m-process.php',{d:distroValue,status:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); adjustReps(); });
73
                $('#replist').css('display','none');
52 alex-w 74
                $('#getfile').css('display','none');
45 alex-w 75
        }
76
  };
77
  // Выбор версии дистрибутива
78
  function adjustReps(){
79
        var distroValue = $('#distro').val();
80
        var versionValue = $('#distver').val();
81
        if (distroValue != 0 && versionValue != 0) {
52 alex-w 82
                $.get('m-process.php',{d:distroValue,v:versionValue,status:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); });
83
                $.get('m-process.php',{d:distroValue,v:versionValue,status:3},function(data){ $('#getfile').css('display','block'); $('#getfile').html(data); });
55 alex-w 84
        } else {
85
                $('#replist').css('display','none');
86
                $('#getfile').css('display','none');
45 alex-w 87
        }
88
  }
43 alex-w 89
 
45 alex-w 90
  $('#distro').change(adjustDistro);
91
  $('#distver').change(adjustReps);
43 alex-w 92
 
45 alex-w 93
});
94
";
43 alex-w 95
 
96
$query =& $db->query("SELECT * FROM distribution");
97
while ($query->fetchInto($data, DB_FETCHMODE_ASSOC)) {
83 alex-w 98
        $linux .= "<option value='".$data["dist_id"]."' class='".stripslashes($data["distua"])."'>".stripslashes($data["distname"])."</option>\n";
43 alex-w 99
}
100
 
45 alex-w 101
$modern .= "<h2>Генератор sources.list</h2>";
102
$modern .= "<div class='border'>";
51 alex-w 103
$modern .= "<label>Дистрибутив</label><br>";
45 alex-w 104
$modern .= "<select id='distro'>\n<option value=''>Выбрать дистрибутив</option>\n";
105
$modern .= $linux."</select>";
106
$modern .= "</div><div class='border'>";
51 alex-w 107
$modern .= "<label>Версия дистрибутива</label><br>";
108
$modern .= "<select id='distver' disabled='disabled'><option></option>";
45 alex-w 109
$modern .= "</select></div>";
51 alex-w 110
$modern .= "<pre id='replist'></pre>";
52 alex-w 111
$modern .= "<p id='getfile'></p>";
43 alex-w 112
 
113
$smarty->assign('modern',$modern);
114
$smarty->assign('scripts',$scripts);
51 alex-w 115
$smarty->assign('antversion',$antversion);
70 alex-w 116
$smarty->assign('interface'," &bull; ".$core->getInterfacesList($_SERVER["REQUEST_URI"],$db));
83 alex-w 117
$smarty->assign('style',$core->getCSSList($db));
43 alex-w 118
 
119
$smarty->display('modern.tpl');
120
 
121
?>