Редакция 361 |
Редакция 364 |
К новейшей редакции |
Авторство |
Сравнить с предыдущей |
Последнее изменение |
Открыть журнал
| Скачать
| RSS
<?php
/**
*
* Codename: ant-ng - generator of sources.list for Debian and
* distributives, based on Debian
* http://alex-w.org.ru/p/antng/
*
* Copyright (c) 2009 Alexander Wolf
* Dual licensed under the MIT and GNU LGPL licenses.
* http://alex-w.org.ru/p/antng/license
*
*/
require_once dirname(__FILE__)."/init.php";
$scripts = "
<script type='text/javascript'>
(function($){
// очищаем select
$.fn.clearSelect = function() {
return this.each(function(){
if(this.tagName=='SELECT') {
this.options.length = 0;
$(this).attr('disabled','disabled');
}
});
}
// заполняем select
$.fn.fillSelect = function(dataArray) {
return this.clearSelect.each(function(){
if(this.tagName=='SELECT') {
var currentSelect = this;
$.each(dataArray,function(index,data) {
var option = new Option(data.text,data.value);
if($.support.cssFloat) {
currentSelect.add(option,null);
} else {
currentSelect.add(option);
}
});
}
});
}
})(jQuery);
</script>
<script type='text/javascript'>
$(document).ready(function(){
// выбор дистрибутива
function chooseDist() {
var distValue = $('#dist').val();
var tmpSelect = $('#version');
if(distValue.length == 0) {
tmpSelect.attr('disabled','disabled');
tmpSelect.clearSelect();
chooseVersion();
} else {
$.getJSON('./request.php',{d:distValue,status:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); chooseVersion(); });
}
};
// выбор версии дистрибутива
function chooseVersion() {
var distValue = $('#dist').val();
var versValue = $('#version').val();
if(distValue != 0 && versValue !=0 ) {
$.get('./request.php',{d:distValue,v:versValue,status:2},function(data){ chooseReps(); });
}
};
});
</script>
";
$smarty->assign('scripts', $scripts);
$smarty->display('default.tpl');
?>