function addpay(cmd) {
checkFocus();
ShowPayEditorMenu(cmd);
return;
}
function ShowPayEditorMenu(tag, params) {
var sel, selection;
var str = '', strdialog = 0, stitle = '';
var ctrlid = editorid + (params ? '_cst' + params + '_' : '_') + tag;
var opentag = '[sell]';
var closetag = '[/sell]';
var menu = $(ctrlid + '_menu');
var pos = [0, 0];
var menuwidth = 270;
var menupos = '43!';
var menutype = 'menu';
if(BROWSER.ie) {
sel = wysiwyg ? editdoc.selection.createRange() : document.selection.createRange();
pos = getCaret();
}
selection = sel ? (wysiwyg ? sel.htmlText : sel.text) : getSel();
if(selection) {
return insertText((opentag + selection + closetag), strlen(opentag), strlen(closetag), true, sel);
}
stitle = '插入付费内容';
str='请输入要付费的信息内容:
售价: 街拍币
不填写售价将以默认的10街拍币出售
您所在的用户组最大售价为10000街拍币';
menuwidth = 320;
menupos = '00';
//menutype = 'win';
var menu = document.createElement('div');
menu.id = ctrlid + '_menu';
menu.style.display = 'none';
menu.className = 'p_pof upf';
menu.style.width = menuwidth + 'px';
if(menupos == '00') {
menu.className = 'fwinmask';
s = '
| | |
| '
+ '' + stitle + '关闭' + str + ' '
+ ''
+ ' | |
| | |
';
} else {
s = '';
}
menu.innerHTML = s;
$(editorid + '_editortoolbar').appendChild(menu);
showMenu({'ctrlid':ctrlid,'mtype':menutype,'evt':'click','duration':3,'cache':0,'drag':1,'pos':menupos});
try {
if($(ctrlid + '_param_1')) {
$(ctrlid + '_param_1').focus();
}
} catch(e) {}
var objs = menu.getElementsByTagName('*');
for(var i = 0; i < objs.length; i++) {
_attachEvent(objs[i], 'keydown', function(e) {
e = e ? e : event;
obj = BROWSER.ie ? event.srcElement : e.target;
if((obj.type == 'text' && e.keyCode == 13) || (obj.type == 'textarea' && e.ctrlKey && e.keyCode == 13)) {
if($(ctrlid + '_submit') && tag != 'image') $(ctrlid + '_submit').click();
doane(e);
} else if(e.keyCode == 27) {
hideMenu();
doane(e);
}
});
}
if($(ctrlid + '_submit')) $(ctrlid + '_submit').onclick = function() {
checkFocus();
if(BROWSER.ie && wysiwyg) {
setCaret(pos[0]);
}
var mincredits = parseInt($(ctrlid + '_param_2').value);
if(mincredits > 0) {
if(mincredits>10000&&10000!=0){
showDialog('对不起,您的售价大于该用户组允许的最大值', 'error');
return;
}
opentag = '[sell=';
opentag += mincredits;
opentag += ']';
} else {
opentag = '[sell]';
}
str = $(ctrlid + '_param_1') && $(ctrlid + '_param_1').value ? $(ctrlid + '_param_1').value : (selection ? selection : '');
if(wysiwyg) {
str = preg_replace(['<', '>'], ['<', '>'], str);
str = str.replace(/\r?\n/g, '
');
}
str = opentag + str + closetag;
insertText(str, strlen(opentag), strlen(closetag), false, sel);
hideMenu('', 'win');
hideMenu();
};
}