27,40 → 27,85 |
$query->fetchInto($antv, DB_FETCHMODE_ASSOC); |
$antversion = $antv["optvalue"]; |
|
$scripts = " |
(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 adjustDistro(){ |
var distroValue = $('#distro').val(); |
var tmpSelect = $('#distver'); |
if(distroValue.length == 0) { |
tmpSelect.attr('disabled','disabled'); |
tmpSelect.clearSelect(); |
adjustReps(); |
$('#replist').css('display','none'); |
} else { |
$.getJSON('m-process.php',{d:distroValue,status:1},function(data) { tmpSelect.fillSelect(data).attr('disabled',''); adjustReps(); }); |
$('#replist').css('display','none'); |
} |
}; |
// Выбор версии дистрибутива |
function adjustReps(){ |
var distroValue = $('#distro').val(); |
var versionValue = $('#distver').val(); |
if (distroValue != 0 && versionValue != 0) { |
$.get('m-process.php',{d:distroValue,v:versionValue,status:2},function(data){ $('#replist').css('display','block'); $('#replist').html(data); },'html'); |
} |
} |
|
$scripts = ' |
$(document).ready(function() { |
var options = { |
target: "#modern", |
success: showResponse |
}; |
$("#distro").ajaxForm(options); |
}); |
$('#distro').change(adjustDistro); |
$('#distver').change(adjustReps); |
|
function showResponse(responseText, statusText) { |
//$("#modern").replaceAll(responseText); |
} |
'; |
}); |
"; |
|
$linux = "<p><input type='hidden' name='step' value='1' /></p>"; |
$query =& $db->query("SELECT * FROM distribution"); |
while ($query->fetchInto($data, DB_FETCHMODE_ASSOC)) { |
$linux .= "<p><input type='radio' name='d' value='".$data["dist_id"]."' />".stripslashes($data["distname"])."</p>\n"; |
$linux .= "<option value='".$data["dist_id"]."'>".stripslashes($data["distname"])."</option>\n"; |
} |
|
$modern = "<div id='ant'><div id='modern'>"; |
$modern .= "<h2>Генератор sources.list</h2>"; |
$modern .= "<div class='border'>"; |
$modern .= "<label>Дистрибутив</label><br />"; |
$modern .= "<select id='distro'>\n<option value=''>Выбрать дистрибутив</option>\n"; |
$modern .= $linux."</select>"; |
$modern .= "</div><div class='border'>"; |
$modern .= "<label>Версия дистрибутива</label><br />"; |
$modern .= "<select id='distver' disabled='disabled'>\n"; |
$modern .= "</select></div>"; |
$modern .= "<pre id='replist'></pre></div>"; |
|
$modern .= "<h2>Выбор дистрибутива</h2>"; |
$modern .= "<form action='./m-process.php' method='post' id='distro'>"; |
$modern .= $linux; |
$modern .= "<p><input type='submit' value=' Выбрать дистрибутив '></p>"; |
$modern .= "</form>"; |
|
$modern .= "</div></div>"; |
|
$smarty->assign('modern',$modern); |
$smarty->assign('scripts',$scripts); |
$smarty->assign('antversion',$antversion); |
$smarty->assign('antversion',$antversion." • <a href='./classic.php'>Классический интерфейс</a>"); |
|
$smarty->display('modern.tpl'); |
|