📄 sectionmanager.js
字号:
// for admin section manager
// x_core.js, ajax.js, main.js needed
function loadSections(){
var params = 'update=list';
var loader = new ajax.loader('SectionManager.aspx', 'POST', loadSections_onload, loadSections_onerror, params);
}
function loadSections_onload(){
var xmlDoc = this.req.responseXML;
var errInfo = getXmlElementText(xmlDoc, 'Error');
if(errInfo){
alert(errInfo);
}else{
xGetElementById('SectionList').innerHTML = getXmlElementText(xmlDoc, 'Return');
}
}
function loadSections_onerror(){
alert('加载类别列表过程中出错。');
}
function updateSection(type, value, description){
var params = 'update=' + type + '&value=' + encodeURIComponent(value);
var loader = new ajax.loader('SectionManager.aspx', 'POST', updateSection_onload, updateSection_onerror, params);
loader.description = description;
}
function updateSection_onload(){
var xmlDoc = this.req.responseXML;
var errInfo = getXmlElementText(xmlDoc, 'Error');
if(errInfo){
alert(errInfo);
}else{
if(this.description){
appendOperHistory(this.description);
}else{
clearOperHistory();
loadSections();
}
}
}
function updateSection_onerror(){
alert('更新类别信息过程中出错。');
}
function modifySection(id){
var title = prompt('请输入修改之后的标题:', '');
if(title == null){
return;
}
if(title.length == 0){
alert('类别标题不能为空。');
return;
}
updateSection('title', id + ';' + title, '类别' + id + '更改标题为“' + title + '”');
}
function sendBackSection(id){
updateSection('sequence', id, '将类别' + id + '置于最后');
}
function addSection(){
var title = xGetElementById('AddSectionTitle').value;
if(title == null){
return;
}
if(title.length == 0){
alert('类别标题不能为空。');
return;
}
updateSection('add', title, '添加类别“' + title + '”');
}
function removeSection(id){
if(!confirm('有关该类别及该类别下所有版面的数据都将被删除。确定要删除该类别吗?')){
return;
}
updateSection('remove', id, '删除类别' + id);
}
function refreshSections(){
updateSection('refresh');
}
function appendOperHistory(description){
var list = xGetElementById('OperHistory');
var list_item = document.createElement('li');
list_item.innerHTML = encodeHtml(description);
list.appendChild(list_item);
}
function clearOperHistory(){
xGetElementById('OperHistory').innerHTML = '';
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -