/* [Discuz!] (C)2001-2099 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: portal.js 31313 2012-08-10 03:51:03Z zhangguosheng $ */ function block_get_setting(classname, script, bid) { var x = new Ajax(); x.get('portal.php?mod=portalcp&ac=block&op=setting&bid='+bid+'&classname='+classname+'&script='+script+'&inajax=1', function(s){ ajaxinnerhtml($('tbody_setting'), s); }); } function switch_blocktab(type) { if(type == 'setting') { $('blockformsetting').style.display = ''; $('blockformdata').style.display = 'none'; $('li_setting').className = 'a'; $('li_data').className = ''; } else { $('blockformsetting').style.display = 'none'; $('blockformdata').style.display = ''; $('li_setting').className = ''; $('li_data').className = 'a'; } } function showpicedit(pre) { pre = pre ? pre : 'pic'; if($(pre+'way_remote').checked) { $(pre+'_remote').style.display = "block"; $(pre+'_upload').style.display = "none"; } else { $(pre+'_remote').style.display = "none"; $(pre+'_upload').style.display = "block"; } } function block_show_thumbsetting(classname, styleid, bid) { var x = new Ajax(); x.get('portal.php?mod=portalcp&ac=block&op=thumbsetting&classname='+classname+'&styleid='+styleid+'&bid='+bid+'&inajax=1', function(s){ ajaxinnerhtml($('tbody_thumbsetting'), s); }); } function block_showstyle(stylename) { var el_span = $('span_'+stylename); var el_value = $('value_' + stylename); if (el_value.value == '1'){ el_value.value = '0'; el_span.className = ""; } else { el_value.value = '1'; el_span.className = "a"; } } function block_pushitem(bid, itemid) { var id = $('push_id').value; var idtype = $('push_idtype').value; if(id && idtype) { var x = new Ajax(); x.get('portal.php?mod=portalcp&ac=block&op=push&&bid='+bid+'&itemid='+itemid+'&idtype='+idtype+'&id='+id+'&inajax=1', function(s){ ajaxinnerhtml($('tbody_pushcontent'), s); evalscript(s); }); } } function block_delete_item(bid, itemid, itemtype, itemfrom, from) { var msg = itemtype==1 ? '您确定要删除该数据吗?' : '您确定要屏蔽该数据吗?'; if(confirm(msg)) { var url = 'portal.php?mod=portalcp&ac=block&op=remove&bid='+bid+'&itemid='+itemid; if(itemfrom=='ajax') { var x = new Ajax(); x.get(url+'&inajax=1', function(){ if(succeedhandle_showblock) succeedhandle_showblock('', '', {'bid':bid}); showWindow('showblock', 'portal.php?mod=portalcp&ac=block&op=data&bid='+bid+'&from='+from+'&tab=data&t='+(+ new Date()), 'get', 0); }); } else { location.href = url; } } doane(); } function portal_comment_requote(cid, aid) { var x = new Ajax(); x.get('portal.php?mod=portalcp&ac=comment&op=requote&cid='+cid+'&aid='+aid+'&inajax=1', function(s){ $('message').focus(); ajaxinnerhtml($('message'), s); }); } function insertImage(text) { text = "\n[img]" + text + "[/img]\n"; insertContent('message', text); } function insertContent(target, text) { var obj = $(target); selection = document.selection; checkFocus(target); if(!isUndefined(obj.selectionStart)) { var opn = obj.selectionStart + 0; obj.value = obj.value.substr(0, obj.selectionStart) + text + obj.value.substr(obj.selectionEnd); } else if(selection && selection.createRange) { var sel = selection.createRange(); sel.text = text; sel.moveStart('character', -strlen(text)); } else { obj.value += text; } } function searchblock(from) { var value = $('searchkey').value; var targettplname = $('targettplname').value; value = BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(value) : (value ? value.replace(/#/g,'%23') : ''); var url = 'portal.php?mod=portalcp&ac=portalblock&searchkey='+value+'&from='+from; url += targettplname != '' ? '&targettplname='+targettplname+'&type=page' : '&type=block'; reloadselection(url); } function reloadselection(url) { ajaxget(url+'&t='+(+ new Date()), 'block_selection'); } function getColorPalette(colorid, id, background) { return ""; } function listblock_bypage(id, idtype) { var tpl = $('rtargettplname') ? $('rtargettplname').value : ''; var searchkey = $('rsearchkey') ? $('rsearchkey').value.replace('#', '%23') : ''; ajaxget('portal.php?mod=portalcp&ac=portalblock&op=recommend&getdata=yes&searchkey='+searchkey+'&targettplname='+tpl+'&id='+id+'&idtype='+idtype, 'itemeditarea'); } function recommenditem_check() { var sel = $('recommend_bid'); if(sel && sel.value) { document.forms['recommendform'].action = document.forms['recommendform'].action+'&bid='+sel.value; return true; } else { alert("请选择一个模块!"); return false; } } function recommenditem_byblock(bid, id, idtype) { var editarea = $('itemeditarea'); if(editarea) { var olditemeditarea = $('olditemeditarea'); ajaxinnerhtml(olditemeditarea, editarea.innerHTML); if(!$('recommendback')) { var back = document.createElement('div'); back.innerHTML = ' «返回'; var return_mods = $('return_mods') || $('return_recommend') || $('return_'); if(return_mods) { return_mods.parentNode.appendChild(back.childNodes[0]); } } if(bid) { if($('recommend_bid')) { $('recommend_bid').value = bid; } ajaxget('portal.php?mod=portalcp&ac=block&op=recommend&bid='+bid+'&id='+id+'&idtype='+idtype+'&handlekey=recommenditem', 'itemeditarea'); } else { ajaxinnerhtml(editarea, '