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