You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

111 lines
2.8 KiB

<!-- $Id: template_library.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}
<form method="post" onsubmit="return false">
<div class="form-div">
{$lang.select_library}
<select id="selLib" onchange="loadLibrary()">{$curr_template}
{html_options options=$libraries selected="$curr_library"}
</select>
</div>
<div class="main-div">
<div class="button-div ">
<textarea id="libContent" rows="20" style="font-family: Courier New; width:95%; display:block;">{$library_html|escape:html}</textarea>
<input type="button" value="{$lang.button_submit}" class="button" onclick="updateLibrary()" />
<input type="button" value="{$lang.button_restore}" class="button" onclick="restoreLibrary()" />
</div>
</div>
</form>
<script language="JavaScript">
<!--
{literal}
var currLibrary = "{$curr_library}";
var content = '';
onload = function()
{
document.getElementById('libContent').focus();
// 开始检查订单
startCheckOrder();
}
/**
* 载入库项目内容
*/
function loadLibrary()
{
curContent = document.getElementById('libContent').value;
if (content != curContent && content != '')
{
if (!confirm(save_confirm))
{
return;
}
}
selLib = document.getElementById('selLib');
currLib = selLib.options[selLib.selectedIndex].value;
Ajax.call('template.php?is_ajax=1&act=load_library', 'lib='+ currLib, loadLibraryResponse, "GET", "JSON");
}
/**
* 还原库项目内容
*/
function restoreLibrary()
{
selLib = document.getElementById('selLib');
currLib = selLib.options[selLib.selectedIndex].value;
Ajax.call('template.php?is_ajax=1&act=restore_library', "lib="+currLib, loadLibraryResponse, "GET", "JSON");
}
/**
* 处理载入的反馈信息
*/
function loadLibraryResponse(result)
{
if (result.error == 0)
{
document.getElementById('libContent').value=result.content;
}
if (result.message.length > 0)
{
alert(result.message);
}
}
/**
* 更新库项目内容
*/
function updateLibrary()
{
selLib = document.getElementById('selLib');
currLib = selLib.options[selLib.selectedIndex].value;
content = document.getElementById('libContent').value;
if (Utils.trim(content) == "")
{
alert(empty_content);
return;
}
Ajax.call('template.php?act=update_library&is_ajax=1', 'lib=' + currLib + "&html=" + encodeURIComponent(content), updateLibraryResponse, "POST", "JSON");
}
/**
* 处理更新的反馈信息
*/
function updateLibraryResponse(result)
{
if (result.message.length > 0)
{
alert(result.message);
}
}
{/literal}
//-->
</script>
{include file="pagefooter.htm"}