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