Редакция 209 | Редакция 229 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 209 | Редакция 228 | ||
---|---|---|---|
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 | require_once dirname(__FILE__)."/lib/init.php"; |
24 | require_once dirname(__FILE__)."/lib/init.php"; |
25 | 25 | ||
26 | $scripts = " |
26 | $scripts = " |
27 | (function($){
|
27 | (function($){
|
28 | // очищаем select
|
28 | // очищаем select
|
29 | $.fn.clearSelect = function() {
|
29 | $.fn.clearSelect = function() {
|
30 | return this.each(function(){
|
30 | return this.each(function(){
|
31 | if(this.tagName=='SELECT') {
|
31 | if(this.tagName=='SELECT') {
|
32 | this.options.length = 0;
|
32 | this.options.length = 0;
|
33 | $(this).attr('disabled','disabled');
|
33 | $(this).attr('disabled','disabled');
|
34 | }
|
34 | }
|
35 | });
|
35 | });
|
36 | }
|
36 | }
|
37 | // заполняем select
|
37 | // заполняем select
|
38 | $.fn.fillSelect = function(dataArray) {
|
38 | $.fn.fillSelect = function(dataArray) {
|
39 | return this.clearSelect().each(function(){
|
39 | return this.clearSelect().each(function(){
|
40 | if(this.tagName=='SELECT') {
|
40 | if(this.tagName=='SELECT') {
|
41 | var currentSelect = this;
|
41 | var currentSelect = this;
|
42 | $.each(dataArray,function(index,data){
|
42 | $.each(dataArray,function(index,data){
|
43 | var option = new Option(data.text,data.value);
|
43 | var option = new Option(data.text,data.value);
|
44 | if($.support.cssFloat) {
|
44 | if($.support.cssFloat) {
|
45 | currentSelect.add(option,null);
|
45 | currentSelect.add(option,null);
|
46 | } else {
|
46 | } else {
|
47 | currentSelect.add(option);
|
47 | currentSelect.add(option);
|
48 | }
|
48 | }
|
49 | });
|
49 | });
|
50 | }
|
50 | }
|
51 | });
|
51 | });
|
52 | }
|
52 | }
|
53 | })(jQuery);
|
53 | })(jQuery);
|
54 | </script>
|
54 | </script>
|
55 | <script type='text/javascript'>
|
55 | <script type='text/javascript'>
|
56 | $(document).ready(function(){
|
56 | $(document).ready(function(){
|
57 | // выбор дистрибутива
|
57 | // выбор дистрибутива
|
58 | function adjustDistro(){
|
58 | function adjustDistro(){
|
59 | var distroValue = $('#distro').val();
|
59 | var distroValue = $('#distro').val();
|
60 | var tmpSelect = $('#distver');
|
60 | var tmpSelect = $('#distver');
|
61 | if(distroValue.length == 0) {
|
61 | if(distroValue.length == 0) {
|
62 | tmpSelect.attr('disabled','disabled');
|
62 | tmpSelect.attr('disabled','disabled');
|
63 | tmpSelect.clearSelect();
|
63 | tmpSelect.clearSelect();
|
64 | adjustReps();
|
64 | adjustReps();
|
65 | $('#replist').css('display','none');
|
65 | $('#replist').css('display','none');
|
66 | $('#getfile').css('display','none');
|
66 | $('#getfile').css('display','none');
|
- | 67 | $('#reps').css('display','none');
|
|
67 | } else {
|
68 | } else {
|
68 | $.getJSON('./m-process.php',{d:distroValue,status:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); adjustReps(); });
|
69 | $.getJSON('./m-process.php',{d:distroValue,status:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); adjustReps(); });
|
69 | $('#replist').css('display','none');
|
70 | $('#replist').css('display','none');
|
70 | $('#getfile').css('display','none');
|
71 | $('#getfile').css('display','none');
|
- | 72 | $('#reps').css('display','none');
|
|
71 | }
|
73 | }
|
72 | };
|
74 | };
|
73 | // Выбор версии дистрибутива
|
75 | // Выбор версии дистрибутива
|
74 | function adjustReps(){
|
76 | function adjustReps(){
|
75 | var distroValue = $('#distro').val();
|
77 | var distroValue = $('#distro').val();
|
76 | var versionValue = $('#distver').val();
|
78 | var versionValue = $('#distver').val();
|
77 | if (distroValue != 0 && versionValue != 0) {
|
79 | if (distroValue != 0 && versionValue != 0) {
|
78 | $.get('./m-process.php',{d:distroValue,v:versionValue,status:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); });
|
80 | $.get('./m-process.php',{d:distroValue,v:versionValue,status:2},function(data){ $('#reps').css('display','block'); $('#reps').html(data); });
|
- | 81 | } else {
|
|
- | 82 | $('#replist').css('display','none');
|
|
- | 83 | $('#getfile').css('display','none');
|
|
- | 84 | $('#reps').css('display','none');
|
|
- | 85 | }
|
|
- | 86 | }
|
|
- | 87 | // Выбор репозиториев дистрибутива
|
|
- | 88 | function adjustRepos(){
|
|
- | 89 | var distroValue = $('#distro').val();
|
|
- | 90 | var versionValue = $('#distver').val();
|
|
- | 91 | if (distroValue != 0 && versionValue != 0) {
|
|
- | 92 | var repar = $('input.repbox:checked');//.serialize();
|
|
- | 93 | repar=repar.serialize(); // fix this shit
|
|
- | 94 | $('#replist').css('display','block');
|
|
- | 95 | $('#replist').load('./m-process.php?status=3&d='+distroValue+'&v='+versionValue+'&'+repar);
|
|
79 | $.get('./m-process.php',{d:distroValue,v:versionValue,status:3},function(data){ $('#getfile').css('display','block'); $('#getfile').html(data); });
|
96 | $.get('./m-process.php',{d:distroValue,v:versionValue,status:4},function(data){ $('#getfile').css('display','block'); $('#getfile').html(data); });
|
80 | } else {
|
97 | } else {
|
81 | $('#replist').css('display','none');
|
98 | $('#replist').css('display','none');
|
82 | $('#getfile').css('display','none');
|
99 | $('#getfile').css('display','none');
|
83 | }
|
100 | }
|
84 | }
|
101 | }
|
85 | 102 | ||
86 | $('#distro').change(adjustDistro);
|
103 | $('#distro').change(adjustDistro);
|
87 | $('#distver').change(adjustReps);
|
104 | $('#distver').change(adjustReps);
|
88 | - | ||
- | 105 | $('#reps').click(adjustRepos);
|
|
89 | });
|
106 | });
|
- | 107 | ||
90 | "; |
108 | "; |
91 | 109 | ||
92 | $query =& $db->query("SELECT * FROM distribution"); |
110 | $query =& $db->query("SELECT * FROM distribution"); |
93 | while ($query->fetchInto($data, DB_FETCHMODE_ASSOC)) { |
111 | while ($query->fetchInto($data, DB_FETCHMODE_ASSOC)) { |
94 | $linux .= "<option value='".$data["dist_id"]."'>".$secure->stripStr($data["distname"])."</option>\n"; |
112 | $linux .= "<option value='".$data["dist_id"]."'>".$secure->stripStr($data["distname"])."</option>\n"; |
95 | }
|
113 | }
|
96 | 114 | ||
97 | $modern .= "<h2>Генератор sources.list</h2>"; |
115 | $modern .= "<h2>Генератор sources.list</h2>"; |
98 | $modern .= "<div class='border'>"; |
116 | $modern .= "<div class='border'>"; |
99 | $modern .= "<label>Дистрибутив</label><br>"; |
117 | $modern .= "<label>Дистрибутив</label><br>"; |
100 | $modern .= "<select id='distro'>\n<option value=''>Выбрать дистрибутив</option>\n"; |
118 | $modern .= "<select id='distro'>\n<option value=''>Выбрать дистрибутив</option>\n"; |
101 | $modern .= $linux."</select>"; |
119 | $modern .= $linux."</select>"; |
102 | $modern .= "</div><div class='border'>"; |
120 | $modern .= "</div><div class='border'>"; |
103 | $modern .= "<label>Версия дистрибутива</label><br>"; |
121 | $modern .= "<label>Версия дистрибутива</label><br>"; |
104 | $modern .= "<select id='distver' disabled='disabled'><option></option>"; |
122 | $modern .= "<select id='distver' disabled='disabled'><option></option>"; |
105 | $modern .= "</select></div>"; |
123 | $modern .= "</select></div>"; |
- | 124 | ||
- | 125 | $modern .= "<div id='cboxes'>"; |
|
- | 126 | $modern .= "<pre id='reps'></pre>"; |
|
- | 127 | $modern .= "</div>"; |
|
- | 128 | ||
106 | $modern .= "<pre id='replist'></pre>"; |
129 | $modern .= "<pre id='replist'></pre>"; |
107 | $modern .= "<p id='getfile'></p>"; |
130 | $modern .= "<p id='getfile'></p>"; |
108 | 131 | ||
109 | $smarty->assign('feedaddr',$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])); |
132 | $smarty->assign('feedaddr',$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])); |
110 | $smarty->assign('modern',$modern); |
133 | $smarty->assign('modern',$modern); |
111 | $smarty->assign('scripts',$scripts); |
134 | $smarty->assign('scripts',$scripts); |
112 | $smarty->assign('antversion',$core->getSetting('version',$db)); |
135 | $smarty->assign('antversion',$core->getSetting('version',$db)); |
113 | $smarty->assign('title',$core->getSetting('codename',$db)); |
136 | $smarty->assign('title',$core->getSetting('codename',$db)); |
114 | $smarty->assign('interface'," • <a href='./changelog.php'>Изменения</a> • ".$core->getInterfacesList($_SERVER["REQUEST_URI"],$db)); |
137 | $smarty->assign('interface'," • <a href='./changelog.php'>Изменения</a> • ".$core->getInterfacesList($_SERVER["REQUEST_URI"],$db)); |
115 | $smarty->assign('style',$core->getCSSList($db)); |
138 | $smarty->assign('style',$core->getCSSList($db)); |
116 | 139 | ||
117 | $smarty->display('modern.tpl'); |
140 | $smarty->display('modern.tpl'); |
118 | 141 | ||
119 | ?>
|
142 | ?>
|
120 | 143 |