var BoardAuthorizer=Class.create(); Object.extend(BoardAuthorizer.prototype, { initialize: function( //id //, titleSize //, onair //, attachSize //, attachExtensions //, readable //, writable //, repliable //, subRepliable //, warnMessage boardInfo // hash ) { this.id =boardInfo.id; this.level =boardInfo.id ? 1 : 0; this.titleSize =boardInfo.titleSize; this.onair =boardInfo.onair; this.attachSize =boardInfo.attachSize; this.attachExtensions =boardInfo.attachExtensions; this.readable =boardInfo.readable; this.writable =boardInfo.writable; this.repliable =boardInfo.repliable; this.subRepliable =boardInfo.subRepliable; this.warnMessage =boardInfo.warnMessage; this.noteMessage =boardInfo.noteMessage; this.name =boardInfo.name if (boardInfo.tabs) { var tabs=boardInfo.tabs; tabs='Àüüº¸±â,'+tabs; this.tabs =tabs.split(','); } else { this.tabs=[]; } if (boardInfo.seqs) { var seqs=boardInfo.seqs; seqs=','+seqs; this.seqs =seqs.split(','); } else { this.seqs=[]; } this.tabPos=0; this.curTabText=''; } , getTitleSize: function() { return this.titleSize; } , isOnair: function() { return this.onair=='Y' ? true : false; } , getAttachSize: function() { return this.attachSize; } , isUploadable: function(file) { var allowedExt=""; if (allowedExt=this.attachExtensions.strip()) { var ext=file.replace(/(.*\.)([0-9a-z]+)$/,'$2'); //var ext="test123".match(/\d+$/); var myre=new RegExp(",?"+ext+",?", 'i'); if (!myre.test(allowedExt)) { var msg=this.warnMessage; msg=msg.replace(/@0/, ext); msg=msg.replace(/@1/, allowedExt); alert(msg); return false; } } return true; } , isReadable: function() { return this.readable <=this.level; } , isWritable: function() { return this.writable <=this.level; } , isRepliable: function() { return this.repliable <=this.level; } , isSubRepliable: function() { return this.subRepliable <=this.level; } , getLevel: function() { return this.level; } , getTabs: function() { return this.tabs; // array } , getSeqs: function() { return this.seqs; // array } , drawTabs: function(thisName, tabBase, tab, tabPos) { var tabStr=""; tabStr +="
\n" +"
\n"; tabStr+=">"+tabs[i]+"\n"; } //alert(tabs.length+" >> "+pos); tabStr +=" \n" //+"
\n" +fragments +"\n" ; if (tabs.length>1) { jq(tabBase).html(tabStr); jq(tabBase).css('display','block'); jq('.bbstab').each(function(i, o) { //jq(this).width(110); //jq(this).height(25); jq(this).css('text-align', 'left'); }); jq('#tab-ul').tabs(pos+1); jq(tabBase).height(jq(tabBase).height()-20); } //return tabs.length>0 ? tabStr : ""; } , doTab: function(val, tabIndex) { var f=$('searchForm'); //return alert(this.getTabs()); //if (val==this.getTabs()[0]) { // f.tab.value=''; //} else { f.tab.value=val; //.replace(/&/g, '&'); //} f.tabPos.value=tabIndex; var act; act=location.pathname.replace(/\/code\d+.*$/,''); act=act.replace(/\/\d$/,''); act=act.replace(/\/regist\//, '/list/'); //alert(act); f.action=act; f.seq.value=''; f.method='post'; f.submit(); } , doTab2: function(val, tabvalue, tabIndex) { var f=$('searchForm'); //return alert(this.getTabs()); //if (val==this.getTabs()[0]) { // f.tab.value=''; //} else { f.tab.value=val; //.replace(/&/g, '&'); //} f.tabPos.value=tabIndex; var act; act=location.pathname.replace(/\/code\d+.*$/,''); act=act.replace(/\/\d$/,''); act=act.replace(/\/regist\//, '/list/'); //alert(act); f.action=act; f.seq.value=''; f.divClass.value=tabvalue; f.method='post'; f.submit(); } });