温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:X3BLOG 单用户1.0 build80707(ACCESS)源代码
当前文件路径:x3blogAccessBuild80707/SyCODE.Blogsite/js/manager.js

1var Manager = { 2
consts:null, 3
windows: null, 4
control: null, 5
container: null, 6
initialize: function(q){ 7
ScriptLoader.Load("js/fckeditor.js"); 8
9
var xmlhttp = new HTTPRequest(true, true, false); 10
xmlhttp.send("mysort.xml", null, function(r) { 11
window.docs.sort = r.getXML(); 12
}); 13
$id("syblog_manager_loader_text").innerHTML = "正在加载用户数据,请稍候…… "; 14
var xmlhttp1 = new HTTPRequest(true, true); 15
xmlhttp1.send("const.xml", null, function(r1) { 16
$id("syblog_manager_loader_text").innerHTML = "正在加载用户界面,请稍候…… "; 17
var xmlhttp2 = new HTTPRequest(); 18
xmlhttp2.send( 19
"ui/common/manager.xml", 20
null, 21
function(r2){ 22
this.container = document.createElement("div"); 23
this.container.className = "manager_container"; 24
var control = this.createControl(); 25
26
var frame = $id("syblog_manager_frame"); 27
28
frame.appendChild(control); 29
frame.appendChild(this.container); 30
31
this.windows = new Object(); 32
var define = r2.getXML().documentElement; 33
34
control.appendChild(this.createMenu(define.selectSingleNode("menu"))); 35
36
var ws = define.selectNodes("window"); 37
for(var i = 0;i < ws.length;i++) { 38
var wid = "$___window___" + ws[i].getAttribute("id"); 39
this.windows[wid] = document.createElement("div"); 40
with(this.windows[wid]) 41
{ 42
className = "syblog_window"; 43
44
var right_bar = document.createElement("div"); 45
right_bar.className = "syblog_window_right_bar"; 46
appendChild(right_bar); 47
48
var close_btn = document.createElement("a"); 49
close_btn.href = "#"; 50
close_btn.className = "syblog_window_close_button"; 51
close_btn.onclick = function(){ 52
this.parentNode.parentNode.style.display="none"; 53
return event.returnValue = !(event.cancelBubble = true); 54
} 55
right_bar.appendChild(close_btn); 56
57
var window_title = document.createElement("div"); 58
window_title.className = "syblog_window_title"; 59
window_title.innerHTML = '<span class="left"></span><span>{0}</span><span class="right"></span>'.format(ws[i].getAttribute("title")); 60
right_bar.appendChild(window_title); 61
$(window_title).bindDragTo(right_bar.parentNode); 62
63
var window_body = document.createElement("div"); 64
with(window_body) { 65
className = "syblog_window_body"; 66
innerHTML = '<br/>' + ws[i].text.trim(); 67
removeChild(firstChild); 68
} 69
right_bar.appendChild(window_body); 70
71
var window_footer = document.createElement("div"); 72
window_footer.className = "syblog_window_footer"; 73
window_footer.innerHTML = '<span class="left"></span><span class="right"></span>'; 74
right_bar.appendChild(window_footer); 75
76
var window_shadow = document.createElement("div"); 77
window_shadow.className = "syblog_window_shadow"; 78
window_shadow.style.width = (parseInt(ws[i].getAttribute("width")) + 2) + "px"; 79
window_shadow.style.height = (parseInt(ws[i].getAttribute("height")) + 2) + "px"; 80
window_shadow.innerHTML = "<iframe></iframe>"; 81
appendChild(window_shadow); 82
83
style.width = right_bar.style.width = window_body.style.width = ws[i].getAttribute("width") + "px"; 84
style.height = right_bar.style.height = ws[i].getAttribute("height") + "px"; 85
window_body.style.height = (parseInt(ws[i].getAttribute("height")) - 22) + "px"; 86
} 87
} 88
frame.style.display = "block"; 89
$id("syblog_manager_loader").style.display = "none"; 90
}.bind(this) 91
); 92
this.buildConstData(r1.getXML()); 93
}.bind(this)); 94
95
}, 96
buildConstData: function(constDom) { 97
this.consts = new Object(); 98
var constNodes = constDom.documentElement.selectNodes("node"); 99
for(var i = 0;i < constNodes.length;i++) { 100
this.addConst(constNodes[i]); 101
} 102
}, 103
addConst: function(cst) { 104
this.addClasss(this.consts[cst.getAttribute("id")] = [], cst.selectNodes("node")); 105
}, 106
addClasss: function(cst,clss) { 107
for(var i = 0;i < clss.length;i++) { 108
var cls = new Object(); 109
cst.push(cls); 110
this.addClass(cls,clss[i]); 111
} 112
}, 113
addClass: function(cls,clsNode) { 114
cls.id = clsNode.getAttribute("id"); 115
cls.name = clsNode.getAttribute("name"); 116
this.addClasss(cls.items = [], clsNode.selectNodes("node")); 117
}, 118
createControl: function() { 119
var control = document.createElement("div"); 120
control.className = "manager_control"; 121
var closeBtn = document.createElement("div"); 122
closeBtn.className = "manager_control_close"; 123
control.appendChild(closeBtn); 124
var btn = document.createElement("a"); 125
btn.href = "#"; 126
btn.hideFocus = true; 127
btn.onclick = function(){ 128
$id("syblog_manager_frame").style.display="none"; 129
return event.returnValue = !(event.cancelBubble = true); 130
}; 131
closeBtn.appendChild(btn); 132
return control; 133
}, 134
createMenu: function(cfg) { 135
var menu = document.createElement("div"); 136
menu.className = "manager_menu"; 137
var groups = cfg.selectNodes("group"); 138
for(var i = 0;i < groups.length;i++) { 139
var group = document.createElement("dl"); 140
141
var gtitle = document.createElement("dt"); 142
var tc = document.createElement("span"); 143
tc.innerHTML = groups[i].getAttribute("name"); 144
gtitle.appendChild(tc); 145
146
gtitle.onclick = function() { 147
toggleDl(this); 148
} 149
group.appendChild(gtitle); 150
151
var contain = document.createElement("dd"); 152
contain.appendChild(this.createMenuItem(groups[i])); 153
group.appendChild(contain); 154
155
var footer = document.createElement("dd"); 156
footer.className = "syblog_group_footer"; 157
group.appendChild(footer); 158
159
menu.appendChild(group); 160
} 161
return menu; 162
}, 163
createMenuItem:function(group) { 164
var entity = document.createElement("ul"); 165
var items = group.selectNodes("item"); 166
for(var i = 0;i < items.length;i++) { 167
var item = document.createElement("li"); 168
var btn = document.createElement("a"); 169
btn.href = "#"; 170
btn.handler = items[i].getAttribute("handler"); 171
btn.id = "$___window___" + items[i].getAttribute("mapping"); 172
btn.innerHTML = items[i].getAttribute("name"); 173
btn.onclick = function() { 174
if(Manager.open(this.id) && this.handler != null) { 175
eval(this.handler); 176
} 177
return event.returnValue = !(event.cancelBubble = true); 178
}; 179
item.appendChild(btn); 180
entity.appendChild(item); 181
} 182
return entity; 183
}, 184
open: function(maping) { 185
function queue(win) { 186
var zIdx = win.style.zIndex; 187
var wins = win.parentNode.childNodes; 188
for(var i = 0;i < wins.length;i++) { 189
if(wins[i].style.zIndex > zIdx) { 190
wins[i].style.zIndex = (win.style.zIndex = wins[i].style.zIndex) - 1; 191
} 192
} 193
win.style.zIndex = win.parentNode.childNodes.length + 1; 194
} 195
196
var win = this.windows[maping]; 197
win.style.display = "block"; 198
if(!this.container.contains(win)) { 199
this.container.appendChild(win); 200
win.onmousedown = function(){ 201
queue(this); 202
} 203
with(win.style) { 204
zIndex = this.container.childNodes.length + 1; 205
left = Math.floor(Math.max($id('syblog_body').offsetWidth - parseInt(width), 0) / 2) + "px"; 206
top = Math.floor(Math.max($id('syblog_body').offsetHeight - parseInt(height), 0) / 2) + "px"; 207
} 208
return !(event.returnValue = !(event.cancelBubble = true)); 209
} 210
else { 211
queue(win); 212
return event.returnValue = !(event.cancelBubble = true); 213
} 214
}, 215
createWriter: function() { 216
var f = $('manager_topic_writeform'); 217
f.onValidateFail = function() { 218
this.elements['publicBth'].disabled = this.elements['saveBth'].disabled = false; 219
} 220
f.editor = new FCKeditor( 'topiccontent','739','500' ) ; 221
f.editor.ToolbarSet = 'Bloger'; 222
f.editor.ReplaceTextarea(); 223
var sorts = window.docs.sort.documentElement.selectNodes("body/a[@id!='0']"); 224
var sort = $(f.elements['sort']); 225
sort.options.length = sorts.length; 226
for(var i = 0;i < sorts.length;i++) { 227
sort.options[i].text = sorts[i].text; 228
sort.options[i].value = sorts[i].getAttribute('id'); 229
} 230
with($(f.elements['class'])) { 231
var category = this.consts["category"]; 232
for(var i = 0;i < category.length;i++) { 233
options.length = category.length; 234
for(var i = 0;i < category.length;i++) { 235
options[i].value = category[i].id; 236
options[i].text = category[i].name; 237
} 238
} 239
selectedIndex = 0; 240
} 241
f.elements['class'].onchange(); 242
}, 243
associateList: func



consts:
initialize:
}