12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594 |
- MWF.xApplication.Forum = MWF.xApplication.Forum || {};
- MWF.xApplication.ForumDocument = MWF.xApplication.ForumDocument || {};
- MWF.require("MWF.widget.O2Identity", null,false);
- MWF.require("MWF.widget.ImageViewer", null,false);
- MWF.require("MWF.widget.ImageLazyLoader", null,false);
- //MWF.xDesktop.requireApp("Forum", "Actions.RestActions", null, false);
- MWF.xDesktop.requireApp("Forum", "Common", null, false);
- MWF.xDesktop.requireApp("Forum", "Attachment", null, false);
- MWF.xDesktop.requireApp("Forum", "lp."+MWF.language, null, false);
- MWF.xDesktop.requireApp("Forum", "Access", null, false);
- MWF.xDesktop.requireApp("Template", "Explorer", null, false);
- MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
- MWF.xDesktop.requireApp("Forum", "TopNode", null, false);
- MWF.xApplication.ForumDocument.options = {
- multitask: true,
- executable: true
- };
- MWF.xApplication.ForumDocument.Main = new Class({
- Extends: MWF.xApplication.Common.Main,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "name": "ForumDocument",
- "icon": "icon.png",
- "width": "1324",
- "height": "720",
- "isResize": true,
- "isMax": true,
- "isNew" : false,
- "isEdited" : true,
- "index" : 1,
- "replyIndex" : null,
- "viewPageNum" : 1,
- "title": MWF.xApplication.ForumDocument.LP.title
- },
- onQueryLoad: function(){
- this.lp = MWF.xApplication.Forum.LP;
- },
- onQueryClose: function(){
- if( this.userCache ){
- for( var key in this.userCache ){
- delete this.userCache[key];
- }
- }
- this.userCache;
- },
- loadApplication: function(callback){
- this.userData = layout.desktop.session.user;
- this.userName = this.userData.distinguishedName;
- this.restActions = this.actions = MWF.Actions.get("x_bbs_assemble_control"); //new MWF.xApplication.Forum.Actions.RestActions();
- this.path = "../x_component_ForumDocument/$Main/"+this.options.style+"/";
- this.selectstar = 0;
- if( this.status ){
- this.setOptions( this.status )
- }
- if( this.options.isNew && !this.options.id ){
- if( this.options.advanceId ){
- this.advanceId = this.options.advanceId;
- this.createNode();
- this.loadApplicationContent();
- }else{
- this.actions.getUUID( function( id ){
- this.advanceId = id;
- this.createNode();
- this.loadApplicationContent();
- }.bind(this))
- }
- }else{
- this.createNode();
- this.loadApplicationContent();
- }
- },
- loadController: function(callback){
- this.access = new MWF.xApplication.Forum.Access( this.restActions, this.lp );
- if(callback)callback();
- },
- createNode: function(){
- this.content.setStyle("overflow", "hidden");
- this.node = new Element("div", {
- "styles": this.css.node
- }).inject(this.content);
- },
- loadApplicationContent: function(){
- this.loadController(function(){
- this.access.login( function(){
- this.loadApplicationLayout();
- }.bind(this) )
- }.bind(this))
- },
- clearContent : function(){
- this.node.empty();
- this.pagingBarTop = null;
- this.pagingContainerTop = null;
- delete this.pagingBarTop;
- delete this.pagingContainerTop;
- },
- reload : function(oldid, appid){
- this.node.empty();
- this.pagingBarTop = null;
- this.pagingContainerTop = null;
- delete this.pagingBarTop;
- delete this.pagingContainerTop;
- this.loadApplicationLayout();
- //if( this.appCurrentList.indexOf( this > 0 ){
- // this.appCurrentList.erase(this);
- // this.appCurrentList.push(this)
- //}
- if( oldid && appid && (oldid != appid) ){
- delete this.desktop.apps[oldid];
- this.appId = appid;
- this.desktop.apps[appid] = this;
- }
- },
- loadApplicationLayout : function(){
- this.contentContainerNode = new Element("div.contentContainerNode", {
- "styles": this.css.contentContainerNode
- }).inject(this.node);
- if( this.options.id ){
- this.restActions.listSubjectPermission( this.options.id, function( permission ){
- this.permission = permission.data;
- if( this.options.isEdited ){
- this.restActions.getSubject( this.options.id , function( data ){
- this.data = data.data;
- this._loadApplicationLayout( this.data.sectionId , this.data.title );
- }.bind(this))
- }else{
- this.restActions.getSubjectView( this.options.id , function( data ){
- this.data = data.data.currentSubject;
- this.nextSubject = data.data.nextSubject;
- this.lastSubject = data.data.lastSubject;
- this._loadApplicationLayout( this.data.sectionId , this.data.title );
- }.bind(this))
- }
- }.bind(this) )
- }else{
- this._loadApplicationLayout( this.options.sectionId, this.lp.createSubject );
- }
- },
- _loadApplicationLayout : function( sectionId, title ){
- this.options.sectionId = sectionId;
- this.restActions.listSectionPermission( sectionId, function( permission ){
- this.sectionPermission = permission.data;
- this.restActions.getSection( sectionId, function( json ) {
- debugger;
- this.sectionData = json.data;
- //this.access.hasSectionAdminAuthority( this.sectionData , function( flag ){
- // this.isAdmin = flag;
- this.restActions.getCategory(this.sectionData.forumId, function (forumData) {
- this.forumData = forumData.data;
- this.createTopNode( title );
- var tail = this.inBrowser ? (MWFForum.getSystemConfigValue( MWFForum.BBS_TITLE_TAIL ) || "") : "";
- this.setTitle( title + tail );
- this.createMiddleNode();
- }.bind(this));
- //}.bind(this) );
- }.bind(this))
- }.bind(this) )
- },
- createTopNode: function( title ){
- var node = new MWF.xApplication.Forum.TopNode(this.contentContainerNode, this, this, {
- type: this.options.style
- });
- this.topNode = node;
- node.load();
- //var forumSetting = MWF.xApplication.Forum.ForumSetting[this.sectionData.forumId];
- //var forumColor = forumSetting ? forumSetting.forumColor : "";
- var topNode = this.topNode = new Element("div.topNode", {
- "styles": this.css.topNode
- }).inject(this.contentContainerNode);
- var topTitleMiddleNode = new Element("div.topTitleMiddleNode", {
- "styles": this.css.topTitleMiddleNode
- }).inject(topNode);
- var topItemTitleNode = new Element("div.topItemTitleNode", {
- "styles": this.css.topItemTitleNode,
- "text": MWFForum.getBBSName() || MWF.xApplication.Forum.LP.title
- }).inject(topTitleMiddleNode);
- topItemTitleNode.addEvent("click", function(){
- var appId = "Forum";
- if (this.desktop.apps[appId]){
- this.desktop.apps[appId].setCurrent();
- }else {
- this.desktop.openApplication(null, "Forum", { "appId": appId });
- }
- if( !this.inBrowser ){
- this.close();
- }
- }.bind(this));
- var topItemSepNode = new Element("div.topItemSepNode", {
- "styles": this.css.topItemSepNode,
- "text" : ">"
- }).inject(topTitleMiddleNode);
- var topItemTitleNode = new Element("div.topItemTitleNode", {
- "styles": this.css.topItemTitleNode,
- "text": this.sectionData.forumName
- }).inject(topTitleMiddleNode);
- topItemTitleNode.addEvent("click", function(){
- var appId = "ForumCategory"+this.forumId;
- if (this.obj.desktop.apps[appId]){
- this.obj.desktop.apps[appId].setCurrent();
- }else {
- this.obj.desktop.openApplication(null, "ForumCategory", { "categoryId" : this.forumId ,"appId": appId });
- }
- if( !this.obj.inBrowser ){
- this.obj.close();
- }
- //this.obj.close();
- }.bind({ obj: this, forumId : this.sectionData.forumId }));
- var topItemSepNode = new Element("div.topItemSepNode", {
- "styles": this.css.topItemSepNode,
- "text" : ">"
- }).inject(topTitleMiddleNode);
- var topItemTitleNode = new Element("div.topItemTitleNode", {
- "styles": this.css.topItemTitleNode,
- "text": this.sectionData.sectionName
- }).inject(topTitleMiddleNode);
- topItemTitleNode.addEvent("click", function(){
- var appId = "ForumSection"+this.sectionData.id;
- if (this.desktop.apps[appId]){
- this.desktop.apps[appId].setCurrent();
- }else {
- this.desktop.openApplication(null, "ForumSection", {
- "sectionId" : this.sectionData.id,
- "appId": appId
- });
- }
- if( !this.inBrowser ){
- this.close();
- }
- //this.close();
- }.bind(this));
- var topItemSepNode = new Element("div.topItemSepNode", {
- "styles": this.css.topItemSepNode,
- "text" : ">"
- }).inject(topTitleMiddleNode);
- var topItemTitleNode = new Element("div.topItemTitleNode", {
- "styles": this.css.topItemTitleLastNode,
- "text": this.options.isNew ? (this.lp.createSubject) : ("["+ this.data.type +"]" + this.data.title )
- }).inject(topTitleMiddleNode);
- //this.topRightTextNode = new Element("div", {
- // "styles": this.css.topRightTextNode,
- // "text": this.lp.setting
- //}).inject(this.topRightTextNode)
- },
- createMiddleNode: function(){
- this.middleNode = new Element("div.middleNode", {
- "styles": this.css.middleNode
- }).inject(this.contentContainerNode);
- this.addEvent("resize", function () {
- this.setContentSize();
- }.bind(this));
- this.setContentSize();
- this.middleNode.addEvent("selectstart", function(e){
- e.stopPropagation();
- });
- //MWF.require("MWF.widget.ScrollBar", function () {
- // this.scrollBar = new MWF.widget.ScrollBar(this.contentContainerNode, {
- // "indent": false,
- // "style": "xApp_TaskList",
- // "where": "before",
- // "distance": 30,
- // "friction": 4,
- // "axis": {"x": false, "y": true},
- // "onScroll": function (y) {
- // }
- // });
- //}.bind(this));
- debugger;
- if( this.options.isNew || this.options.isEdited ){
- this._createMiddleNode_eidt();
- }else{
- this._createMiddleNode_read();
- }
- },
- _createMiddleNode_eidt : function(){
- this.data = this.data || {};
- var _self = this;
- this.contentDiv = new Element("div.contentDiv",{"styles":this.css.contentDiv}).inject(this.middleNode);
- var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
- "<tr>" +
- " <td styles='formTableTitle' lable='title' width='10%' style='min-width:100px;'></td>" +
- " <td styles='formTableValue' item='typeCategory' width='10%'></td>" +
- " <td styles='formTableValue' item='type' width='10%'></td>" +
- " <td styles='formTableValue' item='title' width='70%'></td>" +
- "</tr><tr>" +
- " <td></td>" +
- " <td item='tipNode' colspan='3'></td>" +
- "</tr><tr>" +
- " <td styles='formTableTitle' lable='summary'></td>" +
- " <td styles='formTableValue' item='summary' colspan='3'></td>" +
- "</tr><tr item='portalImageTr' style='display:none'>" +
- " <td styles='formTableTitle' lable='picId'></td>" +
- " <td styles='formTableValue' colspan='3'><div item='picId' styles='portalImageAre' ></div></td>" +
- "</tr><tr>" +
- " <td styles='formTableTitle' lable='content'></td>" +
- " <td styles='formTableValue' item='content' colspan='3'></td>" +
- "</tr>" +
- "<tr style='display:none' item='gradeArea'>" +
- " <td styles='formTableTitle'>"+ this.lp.sectionGrade +"</td>" +
- " <td item='gradeContainer' colspan='3'></td>" +
- "</tr><tr>" +
- " <td styles='formTableTitle'>"+ this.lp.attachment +"</td>" +
- " <td item='attachment' colspan='3'></td>" +
- "</tr><tr style='display:none' item='voteArea'>" +
- " <td styles='formTableTitle'>"+ this.lp.vote +"</td>" +
- " <td item='voteContainer' colspan='3'></td>" +
- "</tr><tr>" +
- " <td styles='formTableTitle' lable=''></td>" +
- " <td colspan='3'><div item='action' style='float:left;'></div><div item='anonymousSubject' style='float:left;margin-top:25px;margin-left:20px;'></div></td>" +
- "</tr>"+
- "</table>";
- this.contentDiv.set("html", html);
- var tipNode = this.contentDiv.getElement("[item='tipNode']");
- var typeSettings = this._loadTypeSetting();
- var typeSetting = typeSettings[ this.forumData.indexListStyle ];
- if( typeSetting.image ){
- this.contentDiv.getElements("[item='portalImageTr']")[0].setStyle("display","");
- }
- var subjectTypeSelectValue;
- debugger;
- if(this.sectionData.subjectTypeList && this.sectionData.subjectTypeList.length>0){
- subjectTypeSelectValue = this.sectionData.subjectTypeList;
- }else{
- if( this.sectionData.subjectType ){
- subjectTypeSelectValue = this.sectionData.subjectType.split("|");
- }else if( this.forumData.subjectType ){
- subjectTypeSelectValue = this.forumData.subjectType.split("|");
- }else{
- subjectTypeSelectValue = this.lp.subjectTypeDefaultValue.split("|");
- }
- }
- var typeCategorySelectValue;
- if( this.sectionData.typeCategory ){
- typeCategorySelectValue = this.sectionData.typeCategory.split("|");
- }else if( this.forumData.typeCategory ){
- typeCategorySelectValue = this.forumData.typeCategory.split("|");
- }else{
- typeCategorySelectValue = this.lp.typeCategoryDefaultValue.split("|");
- }
- MWF.xDesktop.requireApp("Template", "MForm", function () {
- this.form = new MForm(this.contentDiv, this.data , {
- style: "forum",
- verifyType: "batch",
- isEdited: true,
- itemTemplate: {
- title: {text: this.lp.subject, notEmpty : true,
- onPostLoad : function(item) {
- item.tipNode = tipNode;
- }
- },
- typeCategory :{ type : "select", selectValue : typeCategorySelectValue , notEmpty : true, event : {
- change : function(item, ev){
- if( item.getValue() == this.lp.vote || item.getValue() == "投票"){
- this.contentDiv.getElements( "[item='voteArea']").setStyle("display","");
- this.loadVoteArea();
- }else{
- this.contentDiv.getElements( "[item='voteArea']").setStyle("display","none");
- }
- }.bind(this)}
- },
- type: {text: this.lp.type, type : "select", selectValue : subjectTypeSelectValue , notEmpty : true },
- summary: {text: this.lp.summary, type : "text", event : { "keyup" : function( item, ev){
- if( item.getValue().length > 70 ){
- item.setValue( item.getValue().substr( 0, 70 ) );
- }
- } } },
- picId: { text: this.lp.portalImage, type : "imageClipper",
- disable : !typeSetting.image,
- style : {
- imageStyle : this.css.portalImageNode,
- actionStyle : this.css.uploadActionNode
- },
- aspectRatio : 1.5,
- reference : this.advanceId || this.data.id,
- referenceType: "forumDocument"
- },
- anonymousSubject: { type: "checkbox",
- disable: !MWFForum.enableAnonymousSubject(),
- selectValue: ['true'],
- selectText: [this.lp.anonymousSubject]
- },
- content: {text: this.lp.content, type : "rtf", notEmpty : true, RTFConfig : {
- isSetImageMaxWidth : true,
- reference : this.advanceId || this.data.id,
- referenceType: "forumDocument"//,
- //skin : "bootstrapck" //,
- //filebrowserCurrentDocumentImage: function (e, callback) {
- // _self.selectDocImage( callback );
- //}
- }}
- }
- }, this, this.css);
- this.form.load();
- }.bind(this), true);
- if( this.data.typeCategory == this.lp.vote || this.data.typeCategory == "投票"){
- this.contentDiv.getElement( "[item='voteArea']").setStyle("display","");
- this.loadVoteArea();
- }
- if(this.sectionData.sectionGrade){
- this.contentDiv.getElements( "[item='gradeArea']").setStyle("display","");
- this.loadGradeArea();
- }
- var actionTd = this.contentDiv.getElements("[item='action']")[0];
- this.saveAction = new Element("div",{
- styles : this.css.actionNode,
- text: this.lp.saveSubject
- }).inject(actionTd);
- this.saveAction.addEvent("click",function(ev){
- this.saveSubject( ev );
- }.bind(this));
- var attachmentArea = this.contentDiv.getElements("[item='attachment']")[0];
- this.loadAttachment(attachmentArea)
- },
- _loadTypeSetting: function(){
- var path = "../x_component_Forum/$ColumnTemplate/template/setting.json";
- var templateSetting;
- MWF.xApplication.Forum.ColumnTemplate = MWF.xApplication.Forum.ColumnTemplate || {};
- if (MWF.xApplication.Forum.ColumnTemplate.Setting){
- templateSetting = MWF.xApplication.Forum.ColumnTemplate.Setting;
- }else{
- var r = new Request.JSON({
- url: path,
- secure: false,
- async: false,
- method: "get",
- noCache: false,
- onSuccess: function(responseJSON, responseText){
- templateSetting = MWF.xApplication.Forum.ColumnTemplate.Setting = responseJSON;
- }.bind(this),
- onError: function(text, error){
- alert(error + text);
- }
- });
- r.send();
- }
- return templateSetting;
- },
- loadVoteArea : function(){
- this.voteContainer = this.contentDiv.getElement("[item='voteContainer']");
- MWF.xDesktop.requireApp("ForumDocument", "Vote", function(){
- this.vote = new MWF.xApplication.ForumDocument.Vote(this.voteContainer, this, {
- isNew : this.options.isNew,
- isEdited : this.options.isEdited
- }, this.data);
- this.vote.load();
- }.bind(this), true)
- },
- loadGradeArea : function(){
- this.gradeContainer = this.contentDiv.getElement("[item='gradeContainer']");
- var content = new Element("div").inject(this.gradeContainer);
- var xingdiv = new Element("div").inject(content);
- var xingpngdiv = new Element("div",{"class":"comment_dlg_png"}).inject(xingdiv);
- var starnode;
- var _self = this;
- debugger;
- for (var tmpi=0;tmpi<5;tmpi++){
- starnode = new Element("img",{"src":_self.path+"icon/whitefiveangular.png","class":tmpi+"star comment_dlg_star"}).inject(xingpngdiv);
- starnode.store("id",tmpi);
- if(this.data.grade && this.data.grade<6){
- if(this.data.grade>tmpi){
- var starblacknode = starnode;
- while(starblacknode){
- starblacknode.set("src",_self.path+"icon/blackfiveangular.png");
- starblacknode = starblacknode.previousElementSibling;
- }
- }
- _self.selectstar = this.data.grade;
- }else{
- starnode.addEvents({
- "click": function(e){
- var idnum = this.retrieve("id");
- _self.selectstar = idnum + 1;
- var starblacknode = this;
- var starwhitenode = this.nextElementSibling;
- while(starwhitenode){
- starwhitenode.set("src",_self.path+"icon/whitefiveangular.png");
- starwhitenode = starwhitenode.nextElementSibling;
- }
- while(starblacknode){
- starblacknode.set("src",_self.path+"icon/blackfiveangular.png");
- starblacknode = starblacknode.previousElementSibling
- }
- }
- });
- }
- }
- var cleardiv = new Element("div",{"style":"clear:both"}).inject(content);
- var commentdiv = new Element("div").inject(content);
- },
- reloadAllParents : function(){
- var aid = "Forum";
- if (this.desktop.apps[aid] && this.desktop.apps[aid].reload){
- this.desktop.apps[aid].reload();
- }
- aid = "ForumCategory"+this.sectionData.forumId;
- if (this.desktop.apps[aid] && this.desktop.apps[aid].reload){
- this.desktop.apps[aid].reload();
- }
- aid = "ForumSection"+this.sectionData.id;
- if (this.desktop.apps[aid] && this.desktop.apps[aid].reload){
- this.desktop.apps[aid].reload();
- }
- },
- saveSubject : function(ev){
- var _self = this;
- var data = this.form.getResult(true, ",", true, false, true);
- if( !data ){ //校验没通过
- // 校验投票
- var typeCategory = this.form.getItem("typeCategory");
- if( typeCategory.getValue() == this.lp.vote || typeCategory.getValue() == "投票"){
- this.vote.getVoteInfor()
- }
- return;
- }
- if( data.typeCategory == this.lp.vote || data.typeCategory == "投票"){
- var voteData = this.vote.getVoteInfor();
- if( !voteData )return;
- for( var key in voteData ){
- data[key] = voteData[key];
- }
- this.confirm("warn", ev, this.lp.confirmPublishVoteDocumentTitle, this.lp.confirmPublishVoteDocumentContent, 350, 120, function(){
- _self._saveSubject( data );
- this.close();
- }, function(){
- this.close();
- });
- }else{
- this._saveSubject( data );
- }
- },
- _saveSubject : function( data ){
- debugger;
- if( this.advanceId )data.id = this.advanceId;
- data.attachmentList = this.attachment.getAttachmentIds();
- if(this.sectionData.sectionGrade && this.selectstar==0 && this.advanceId){
- MWF.xDesktop.notice("error", {x: "right", y:"top"}, this.lp.gradeNotice);
- }else{
- data.grade = this.selectstar;
- if (data) {
- data.sectionId = this.sectionData.id;
- //data.picId = this.picId || "";
- this.restActions.saveSubject(data, function (json) {
- this.notice(this.options.isNew ? this.lp.createSuccess : this.lp.updateSuccess, "success");
- this.fireEvent("postPublish");
- this.reloadAllParents();
- var oldId = "ForumDocument"+ ( this.options.isNew ? this.sectionData.id : this.data.id );
- var appId = "ForumDocument"+json.data.id;
- this.advanceId = "";
- this.setOptions({
- "id" : json.data.id,
- "appId": appId,
- "isEdited" : false,
- "isNew" : false //,
- //"index" : nextIndex
- });
- this.reload(oldId , appId );
- }.bind(this))
- }
- }
- },
- _createMiddleNode_read: function(){
- this.isReplyPublisher = this.permission.replyPublishAble; //this.access.isReplyPublisher( this.sectionData );
- this.createSidebar();
- this.createPagingBar();
- this.createToolbar_read();
- var contentConainer = new Element("div.subjectConainer",{
- "styles" : this.css.contentConainer
- }).inject( this.middleNode );
- this.subjectConainer = new Element("div.subjectConainer",{
- "styles" : this.css.subjectConainer
- }).inject( contentConainer );
- if( this.data.typeCategory == this.lp.question || this.data.typeCategory =="问题"){
- this.satisfiedReplyViewConainer = new Element("div.satisfiedReplyViewConainer",{
- "styles" : this.css.replyViewConainer
- }).inject( contentConainer );
- }
- this.replyViewConainer = new Element("div.replyViewConainer",{
- "styles" : this.css.replyViewConainer
- }).inject( contentConainer );
- this.createPagingBar();
- this.createSubject();
- if( this.data.typeCategory == this.lp.question || this.data.typeCategory =="问题") {
- if( this.data.acceptReplyId ){
- this.createSatisfiedReplyView();
- }
- }
- this.createReplyView();
- if( !this.data.stopReply && this.isReplyPublisher ){
- if( this.access.isAnonymous() ){
- this.createReplyEditor_Anonymous()
- }else{
- if( MWFForum.isReplyMuted() ){
- var d = MWFForum.muteData;
- if( d ){
- new Element("div", {
- styles: this.css.muteInfor,
- text: this.lp.muteNote + this.lp.muteInfor.replace("{unmuteDate}", d.unmuteDate).replace("{reason}", d.reason)
- }).inject( this.middleNode )
- }else{
- new Element("div", {
- styles: this.css.muteInfor,
- text: this.lp.muteNote
- }).inject( this.middleNode )
- }
- }else{
- this.createReplyEditor();
- }
- }
- }
- //this.createTurnSubjectNode();
- },
- createPagingBar: function(){
- var pagingArea = new Element("div",{
- styles : this.css.pagingArea
- }).inject(this.middleNode);
- if( this.pagingBarTop ){
- this.pagingBarBottom = pagingArea;
- }else{
- this.pagingBarTop = pagingArea;
- }
- //if( this.access.isSubjectPublisher( this.sectionData ) ){
- if( this.sectionPermission.subjectPublishAble && !MWFForum.isSubjectMuted() ){
- var createActionNode = new Element("div",{
- styles : this.css.pagingActionNode,
- text: this.lp.createSubject
- }).inject(pagingArea);
- createActionNode.addEvents(
- {
- "mouseover": function () {
- this.node.setStyles(this.obj.css.pagingActionNode_over);
- }.bind({obj: this, node: createActionNode}),
- "mouseout": function () {
- this.node.setStyles(this.obj.css.pagingActionNode);
- }.bind({obj: this, node: createActionNode}),
- "click": function () {
- if( this.access.isAnonymousDynamic() ){
- this.openLoginForm(
- function(){ this.createNewDocument(); }.bind(this)
- );
- }else{
- this.createNewDocument();
- }
- }.bind(this)
- }
- )
- }
- //var fileterNode = new Element("div",{
- // styles : this.css.fileterNode
- //}).inject(pagingArea);
- var pagingContainer = new Element("div").inject(pagingArea);
- if( this.pagingContainerTop ){
- this.pagingContainerBottom = pagingContainer;
- }else{
- this.pagingContainerTop = pagingContainer;
- }
- },
- setContentSize: function () {
- //var topSize = this.topNode ? this.topNode.getSize() : {"x": 0, "y": 0};
- var topSize = {"x": 0, "y": 0};
- var nodeSize = this.node.getSize();
- var pt = this.contentContainerNode.getStyle("padding-top").toFloat();
- var pb = this.contentContainerNode.getStyle("padding-bottom").toFloat();
- var height = nodeSize.y - topSize.y - pt - pb;
- this.contentContainerNode.setStyle("height", "" + height + "px");
- },
- recordStatus: function(){
- return {
- "sectionId" : this.options.sectionId,
- "id" : this.data ? this.data.id : "",
- "advanceId" : this.advanceId,
- "appId": ( this.data && this.data.id ) ? "ForumDocument"+this.data.id : "ForumDocument"+this.advanceId,
- "isEdited" : this.options.isEdited,
- "isNew" : this.options.isNew,
- "viewPageNum" : this.replyView ? this.replyView.getCurrentPageNum() : 1
- };
- },
- loadAttachment: function( area ){
- this.attachment = new MWF.xApplication.Forum.Attachment( area, this, this.restActions, this.lp, {
- documentId : this.advanceId || this.data.id,
- isNew : this.options.isNew,
- isEdited : this.options.isEdited,
- "size" : "min",
- onQueryUploadAttachment : function(){
- this.attachment.isQueryUploadSuccess = true;
- }.bind(this),
- onDelete : function( data ){
- //if( this.pictureData && this.pictureData.id == data.id ){
- // this.iconNode.set( "src", "" );
- // this.iconNode.setStyle("display","none");
- // this.pictureBase64 = "";
- // this.pictureData = null;
- //}
- }.bind(this)
- });
- this.attachment.isAnonymous = this.data.anonymousSubject;
- this.attachment.anonymousPerson = this.data.creatorName;
- this.attachment.anonymousName = this.data.nickName;
- this.attachment.load();
- },
- createToolbar_read : function(){
- this.toolBarReadTop = new Element("div.toolBarReadTop",{
- "styles" : this.css.toolBarReadTop
- }).inject( this.middleNode );
- this.toolBarRead = new Element("div.toolBarRead",{
- "styles" : this.css.toolBarRead
- }).inject( this.middleNode );
- this.toolbarLeft = new Element("div.toolbarLeft",{
- "styles" : this.css.toolbarLeft
- }).inject( this.toolBarRead );
- var toolbarLeftItem = new Element("div.toolbarViewItem",{
- "styles" : this.css.toolbarViewItem
- }).inject( this.toolbarLeft );
- new Element("span.toolbarLeftTextItem",{
- "styles" : this.css.toolbarLeftTextItem,
- "text" : this.lp.readed + ":"
- }).inject( toolbarLeftItem );
- new Element("span.toolbarLeftCountItem",{
- "styles" : this.css.toolbarLeftCountItem,
- "text" : this.data.viewTotal
- }).inject( toolbarLeftItem );
- new Element("div.toolbarSepItem",{
- "styles" : this.css.toolbarSepItem
- }).inject( this.toolbarLeft );
- var toolbarLeftItem = new Element("div.toolbarReplyItem",{
- "styles" : this.css.toolbarReplyItem
- }).inject( this.toolbarLeft );
- new Element("span.toolbarLeftTextItem",{
- "styles" : this.css.toolbarLeftTextItem,
- "text" : this.lp.reply + ":"
- }).inject( toolbarLeftItem );
- this.replyTotal = new Element("span.toolbarLeftCountItem",{
- "styles" : this.css.toolbarLeftCountItem,
- "text" : this.data.replyTotal
- }).inject( toolbarLeftItem );
- this.toolbarRight = new Element("div.toolbarRight",{
- "styles" : this.css.toolbarRight
- }).inject( this.toolBarRead );
- //this.createActionBar();
- if(this.data.isTopSubject){
- new Element( "div.top", {
- "styles" : this.css.toolbarZhiding,
- "title" : this.lp.setTop
- }).inject( this.toolbarRight );
- }else if( this.data.isCreamSubject ){
- new Element( "div.prime", {
- "styles" : this.css.toolbarPrime,
- "title" : (this.data.screamSetterName || "").split("@")[0]+ this.lp.at + this.data.screamSetterTime + this.lp.setPrime
- }).inject( this.toolbarRight );
- }else if( this.data.typeCategory == this.lp.vote || this.data.typeCategory == "投票"){
- new Element( "div.vote", { "styles" : this.css.toolbarVote, "title" : this.lp.vote }).inject( this.toolbarRight );
- }else if( this.data.typeCategory == this.lp.question || this.data.typeCategory =="问题"){
- new Element( "div.question", { "styles" : this.css.toolbarQuestion, "title" : this.lp.question }).inject( this.toolbarRight );
- }
- this.toolbarRightTitle = new Element("div.toolbarRightTitle",{
- "styles" : this.css.toolbarRightTitle,
- "text" : "["+ this.data.type +"]"+this.data.title
- }).inject( this.toolbarRight );
- this.toolbarRightTools = new Element("div.toolbarRightTools",{
- "styles" : this.css.toolbarRightTools
- }).inject( this.toolbarRight );
- if( this.nextSubject ){
- this.toolbarNext = new Element("div.toolbarNext",{
- "styles" : this.css.toolbarNext,
- "title" : this.lp.nextSubject + ":" + this.nextSubject.title
- }).inject( this.toolbarRightTools );
- this.toolbarNext.addEvents({
- "click" : function(){ this.gotoDocument( 1 ); }.bind(this),
- "mouseover" : function(){
- this.toolbarNext.setStyles( this.css.toolbarNext_over );
- }.bind(this),
- "mouseout" : function(){
- this.toolbarNext.setStyles( this.css.toolbarNext );
- }.bind(this)
- })
- }
- if( this.lastSubject ){
- this.toolbarPrev = new Element("div.toolbarRightTools",{
- "styles" : this.css.toolbarPrev,
- "title" : this.lp.prevSubject + ":" + this.lastSubject.title
- }).inject( this.toolbarRightTools );
- this.toolbarPrev.addEvents({
- "click" : function(){ this.gotoDocument( -1 ); }.bind(this),
- "mouseover" : function(){
- this.toolbarPrev.setStyles( this.css.toolbarPrev_over );
- }.bind(this),
- "mouseout" : function(){
- this.toolbarPrev.setStyles( this.css.toolbarPrev );
- }.bind(this)
- })
- }
- },
- adjustReplyCount: function( count ){
- this.data.replyTotal = this.data.replyTotal + count;
- this.replyTotal.set("text", this.data.replyTotal )
- },
- createNewDocument: function(){
- var _self = this;
- var appId = "ForumDocument"+this.sectionData.id;
- if (_self.desktop.apps[appId]){
- _self.desktop.apps[appId].setCurrent();
- }else {
- this.desktop.openApplication(null, "ForumDocument", {
- "sectionId": this.sectionData.id,
- "appId": appId,
- "isNew" : true,
- "isEdited" : true,
- "onPostPublish" : function(){
- //this.view.reload();
- }.bind(this)
- });
- }
- },
- edit : function(){
- var appId = "ForumDocument"+this.data.id;
- this.options.isEdited = true;
- this.reload(appId , appId );
- },
- delete : function( ev ){
- var _self = this;
- this.confirm("warn", ev, this.lp.deleteDocumentTitle, this.lp.deleteDocument, 350, 120, function(){
- _self.restActions.deleteSubject( _self.data.id, function(){
- _self.notice( _self.lp.deleteDocumentOK, "ok");
- _self.reloadAllParents();
- _self.close();
- }.bind(this) );
- this.close();
- }, function(){
- this.close();
- });
- },
- postCreateReply : function( id ){
- this.restActions.getReply( id, function( json ){
- var reply = this.replyView._createDocument( json.data );
- this.adjustReplyCount( 1 );
- var t = reply.node.getTop() - this.contentContainerNode.getCoordinates().top + this.contentContainerNode.scrollTop.toFloat();
- this.contentContainerNode.scrollTo( 0, t );
- }.bind(this))
- },
- createReply : function(){
- var form = new MWF.xApplication.ForumDocument.ReplyForm(this, {}, {
- "toMain" : true,
- onPostOk : function( id ){
- this.postCreateReply( id )
- }.bind(this)
- },{
- app : this, lp : this.lp, css : this.css, actions : this.restActions
- });
- form.mainData = this.data;
- form.create()
- },
- createActionBar : function( container ){
- var action;
- this.actionBar = new Element("div", { "styles" : this.css.actionBar, "html" : " "}).inject(container);
- //var action = new Element("div", {
- // "styles" : this.css.actionItem,
- // "text" : this.lp.createSubject
- //}).inject( this.actionBar );
- //action.setStyle("background-image" , "url("+this.path+"icon/action_new.png)");
- //action.addEvents({
- // "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- // "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- // "click" : function(){ this.createNewDocument() }.bind(this)
- //})
- if( this.permission.manageAble ){
- if( this.data.isCreamSubject ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.cancelPrime
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_cancelprime.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.cancelPrime() }.bind(this)
- })
- }else{
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.setPrime
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_prime.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.setPrime() }.bind(this)
- })
- }
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.moveto
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_moveto.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.moveTo() }.bind(this)
- });
- if( this.data.stopReply ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.unlock
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_unlock.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.unlock() }.bind(this)
- })
- }else{
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.lock
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_lock.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.lock() }.bind(this)
- })
- }
- //if( this.data.isTopSubject ){
- // action = new Element("div", {
- // "styles" : this.css.actionItem,
- // "text" : this.lp.cancelTop
- // }).inject( this.actionBar );
- // action.setStyle("background-image" , "url("+this.path+"icon/action_canceltop.png)");
- // action.addEvents({
- // "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- // "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- // "click" : function(){ this.cancelTop() }.bind(this)
- // })
- //}else{
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.setTop
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+ ( this.data.isTopSubject ? "icon/action_canceltop.png" : "icon/action_top.png")+ ")");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.setTop() }.bind(this)
- });
- //}
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.editorSetting
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_person.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.setEditPermission() }.bind(this)
- });
- }
- if( MWF.AC.isHotPictureManager() ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.setHot
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+ "icon/action_popular.png" + ")");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.setHotPicture() }.bind(this)
- });
- }
- //if( this.access.isRecommender( this.sectionData )){
- if( this.permission.recommendAble ){
- if( this.data.recommendToBBSIndex ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.cancelRecommend
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_cancelrecommend.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.cancelRecommend() }.bind(this)
- })
- }else if( this.sectionData.sectionVisible == this.lp.allPerson && this.sectionData.indexRecommendable == true ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.setRecommend
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_recommend.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.setRecommend() }.bind(this)
- })
- }
- }
- if( this.permission.manageAble || this.permission.editAble || this.data.creatorName == this.userName || MWFForum.isSubjectEditor(this.data)){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.delete
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_delete.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(ev){ this["delete"](ev) }.bind(this)
- })
- }
- if( this.data.typeCategory != this.lp.vote && this.data.typeCategory!="投票"){
- if( this.permission.manageAble || this.permission.editAble || this.data.creatorName == this.userName || MWFForum.isSubjectEditor(this.data) ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.edit
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_edit.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){ this.edit() }.bind(this)
- })
- }
- }
- if( !this.data.stopReply && !MWFForum.isReplyMuted()){
- if( this.isReplyPublisher ){
- action = new Element("div", {
- "styles" : this.css.actionItem,
- "text" : this.lp.reply
- }).inject( this.actionBar );
- action.setStyle("background-image" , "url("+this.path+"icon/action_quote.png)");
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.actionItem_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.actionItem ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){
- if( this.access.isAnonymousDynamic() ){
- this.openLoginForm( function(){ this.reload() }.bind(this) );
- }else{
- this.createReply();
- }
- }.bind(this)
- })
- }
- }
- },
- lock : function(){
- this.restActions.lock( this.data.id, function(){
- this.notice( this.lp.lockSuccess );
- this.reload();
- }.bind(this))
- },
- unlock : function(){
- this.restActions.unlock( this.data.id, function(){
- this.notice( this.lp.unlockSuccess );
- this.reload();
- }.bind(this))
- },
- setRecommend : function(){
- this.restActions.setRecommend( this.data.id, function(){
- this.notice( this.lp.setRecommendSuccess );
- this.reload();
- }.bind(this))
- },
- cancelRecommend : function(){
- this.restActions.cancelRecommend( this.data.id, function(){
- this.notice( this.lp.cancelRecommendSuccess );
- this.reload();
- }.bind(this))
- },
- setHotPicture : function(){
- MWF.xDesktop.requireApp("ForumDocument", "HotLinkForm", null, false);
- var form = new MWF.xApplication.ForumDocument.HotLinkForm(this, this.data, {
- documentId : this.data.id,
- summary : this.data.summary,
- onPostOk : function( id ){
- }.bind(this)
- },{
- app : this, lp : this.lp, css : this.css, actions : this.restActions
- });
- form.create()
- },
- setEditPermission: function(){
- var form = new MWF.xApplication.ForumDocument.EditorSettingForm(this, this.data, {
- onPostOk : function( id ){
- this.reload();
- }.bind(this)
- },{
- app : this, lp : this.lp, css : this.css, actions : this.restActions
- });
- form.create();
- },
- setTop : function(){
- var form = new MWF.xApplication.ForumDocument.TopSettingForm(this, this.data, {
- onPostOk : function( id ){
- this.reload();
- }.bind(this)
- },{
- app : this, lp : this.lp, css : this.css, actions : this.restActions
- });
- form.create();
- //this.restActions.topToSection( this.data.id, function(){
- // this.notice( this.lp.setTopSuccess )
- // this.reload();
- //}.bind(this))
- },
- cancelTop : function(){
- this.restActions.cancelTopToSection( this.data.id, function(){
- this.notice( this.lp.cancelTopSuccess );
- this.reload();
- }.bind(this))
- },
- setPrime : function(){
- this.restActions.setCream( this.data.id, function(){
- this.notice( this.lp.setPrimeSuccess );
- this.reload();
- }.bind(this))
- },
- cancelPrime : function(){
- this.restActions.cancelCream( this.data.id, function(){
- this.notice( this.lp.cancelPrimeSuccess );
- this.reload();
- }.bind(this))
- },
- createSubject : function(){
- this.subjectView = new MWF.xApplication.ForumDocument.SubjectView( this.subjectConainer, this, this, {
- templateUrl : this.path + (this.data.anonymousSubject ? "listItemAnonymousSubject.json" : "listItemSubject.json"),
- scrollEnable : false
- } );
- this.subjectView.data = this.data;
- this.subjectView.load();
- },
- moveTo : function(){
- MWF.xDesktop.requireApp("Forum", "SectionSelector", null, false);
- var selector = new MWF.xApplication.Forum.SectionSelector(this.content, {
- "count": 1,
- "title": this.lp.selectTargetSection,
- "values": [],
- "onComplete": function( array ){
- if( typeOf( array ) == "array" ){
- var sectionId = array[0].data.id;
- this.restActions.changeSection( {"subjectIds":[ this.data.id ],"sectionId" : sectionId }, function(){
- this.notice( this.lp.moveSuccess.replace("{section}", array[0].data.name ) );
- this.reload();
- }.bind(this))
- }
- }.bind(this)
- } );
- selector.load();
- },
- // openLoginForm : function( callback ){
- // //MWF.xDesktop.requireApp("Forum", "Login", null, false);
- // //var login = new MWF.xApplication.Forum.Login(this, {
- // // onPostOk : function(){ if(callback)callback() }
- // //});
- // //login.openLoginForm();
- // MWF.require("MWF.xDesktop.Authentication", null, false);
- // var authentication = new MWF.xDesktop.Authentication({
- // style : "application",
- // onPostOk : function(){ if(callback)callback() }
- // },this);
- // authentication.openLoginForm({
- // hasMask : true
- // });
- // },
- // openSignUpForm : function(callback){
- // //MWF.xDesktop.requireApp("Forum", "Login", null, false);
- // //var login = new MWF.xApplication.Forum.Login(this, {
- // // onPostOk : function(){ if(callback)callback() }
- // //});
- // //login.openSignUpForm();
- // MWF.require("MWF.xDesktop.Authentication", null, false);
- // var authentication = new MWF.xDesktop.Authentication({
- // style : "application",
- // onPostOk : function(){ if(callback)callback() }
- // },this);
- // authentication.openSignUpForm({
- // hasMask : true
- // });
- // },
- openLoginForm : function(){
- MWF.require("MWF.xDesktop.Authentication", null, false);
- var authentication = new MWF.xDesktop.Authentication({
- "style" : "flat",
- "popupStyle_password": "o2platformSignupFlat",
- onPostOk : function(){
- if(callback)callback()
- }
- },this);
- authentication.popupOptions = {
- "draggable": true,
- "closeAction": true,
- "hasMask": true,
- "relativeToApp": true,
- "width": "420",
- "height": "640"
- };
- // authentication.loadLogin(this.app.content);
- authentication.openLoginForm();
- },
- openSignUpForm : function(){
- MWF.require("MWF.xDesktop.Authentication", null, false);
- var authentication = new MWF.xDesktop.Authentication( {
- style : "flat",
- "popupStyle_password": "o2platformSignupFlat",
- onPostOk : function(){
- if(callback)callback()
- }
- }, this);
- authentication.popupOptions = {
- "draggable": true,
- "closeAction": true,
- "hasMask": true,
- "relativeToApp": true,
- "width": "420",
- "height": "640"
- };
- authentication.openSignUpForm();
- },
- gotoReply : function( index ){
- this.replyView.paging.gotoItem( index );
- },
- createSatisfiedReplyView : function( ){
- this.satisfiedReplyView = new MWF.xApplication.ForumDocument.SatisfiedReplyView( this.satisfiedReplyViewConainer, this, this, {
- templateUrl : this.path + "listItemSatisfied.json",
- scrollEnable : false
- } );
- this.satisfiedReplyView.data = this.data;
- this.satisfiedReplyView.load();
- },
- createReplyView : function( ){
- this.replyView = new MWF.xApplication.ForumDocument.ReplyView( this.replyViewConainer, this, this, {
- templateUrl : this.path + "listItemReply.json",
- scrollEnable : false,
- pagingEnable : true,
- documentKeyWord : "orderNumber",
- pagingPar : {
- currentPage : this.options.viewPageNum || 1,
- currentItem : this.options.replyIndex,
- returnText : this.lp.returnToList ,
- countPerPage : 10,
- onPostLoad : function( pagingBar ){
- if(pagingBar.nextPageNode){
- pagingBar.nextPageNode.inject( this.pagingBarBottom, "before" );
- }
- }.bind(this),
- onPageReturn : function( pagingBar ){
- var appId = "ForumSection"+this.sectionData.id;
- if (this.desktop.apps[appId]){
- this.desktop.apps[appId].setCurrent();
- }else {
- this.desktop.openApplication(null, "ForumSection", {
- "sectionId" : this.sectionData.id,
- "appId": appId
- });
- }
- this.close();
- }.bind(this)
- },
- onGotoItem : function( top ){
- debugger;
- var t = top - this.content.getTop();
- this.contentContainerNode.scrollTo( 0, t );
- }.bind(this)
- } );
- this.replyView.pagingContainerTop = this.pagingContainerTop;
- this.replyView.pagingContainerBottom = this.pagingContainerBottom;
- this.replyView.data = this.data;
- this.replyView.filterData = { "subjectId" : this.data.id };
- this.replyView.load();
- },
- createReplyEditor_Anonymous: function(){
- this.replyArea = new Element("div.replyArea",{
- "styles" : this.css.replyArea
- }).inject( this.middleNode );
- new Element("div.replyLeft",{
- "styles" : this.css.replyLeft
- }).inject( this.replyArea );
- var replyPicture = new Element("div.replyPicture",{
- "styles" : this.css.replyPicture
- }).inject( this.replyArea );
- var needloginNode = new Element("div.replyNeedLogin",{
- "styles" : this.css.replyNeedLogin
- }).inject(replyPicture);
- new Element("div.replyNeedLogin",{
- "styles" : this.css.replyNeedLoginText,
- "text" : this.lp.replyNeedLoginText
- }).inject(needloginNode);
- var loginNode = new Element("div.replyLoginAction",{
- "styles" : this.css.replyLoginAction,
- "text" : this.lp.login
- }).inject(needloginNode);
- loginNode.addEvent("click" , function(){
- this.openLoginForm(
- function(){ this.reload() }.bind(this)
- )
- }.bind(this));
- if( this.access.signUpMode != "disable" ){
- new Element("div.replyNeedLogin",{
- "styles" : this.css.replyNeedLoginText,
- "text" : "|"
- }).inject(needloginNode);
- var signupNode = new Element("div.replyLoginAction",{
- "styles" : this.css.replyLoginAction,
- "text" : this.lp.signUp
- }).inject(needloginNode);
- signupNode.addEvent("click" , function(){
- this.openSignUpForm()
- }.bind(this))
- }
- },
- createReplyEditor : function( ){
- this.replyArea = new Element("div.replyArea",{
- "styles" : this.css.replyArea
- }).inject( this.middleNode );
- this.replyEditor = new MWF.xApplication.ForumDocument.ReplyEditor( this.replyArea, this, {
- style : this.options.style,
- isNew : true,
- onPostOk : function( id ){
- this.postCreateReply( id )
- }.bind(this)
- } );
- this.replyEditor.mainData = this.data;
- this.replyEditor.load();
- },
- createTurnSubjectNode : function(){
- if( !this.lastSubject && !this.nextSubject )return;
- var turnSubjectNode = new Element("div.turnSubjectNode", {styles : this.css.turnSubjectNode}).inject( this.middleNode );
- if( this.lastSubject ){
- var lastSubjectNode = new Element( "div.lastSubjectNode", {
- styles : this.css.lastSubjectNode,
- text : this.lp.prevSubject + ":" + this.lastSubject.title
- }).inject( turnSubjectNode );
- lastSubjectNode.addEvents({
- "click" : function(){
- this.gotoDocument(-1)
- }.bind(this),
- "mouseover" : function(){ this.node.setStyles( this.obj.css.lastSubjectNode_over ) }.bind({obj :this, node : lastSubjectNode}),
- "mouseout" : function(){ this.node.setStyles( this.obj.css.lastSubjectNode ) }.bind({obj :this, node : lastSubjectNode})
- })
- }else{
- var lastSubjectNode = new Element( "div.lastSubjectNode", {
- styles : this.css.lastSubjectNoneNode
- }).inject( turnSubjectNode );
- }
- if( this.nextSubject ){
- var nextSubjectNode = new Element( "div.nextSubjectNode", {
- styles : this.css.nextSubjectNode,
- text : this.lp.nextSubject + ":" + this.nextSubject.title
- }).inject( turnSubjectNode );
- nextSubjectNode.addEvents({
- "click" : function(){
- this.gotoDocument(1)
- }.bind(this),
- "mouseover" : function(){ this.node.setStyles( this.obj.css.nextSubjectNode_over ) }.bind({obj :this, node : nextSubjectNode}),
- "mouseout" : function(){ this.node.setStyles( this.obj.css.nextSubjectNode ) }.bind({obj :this, node : nextSubjectNode})
- })
- }else{
- var nextSubjectNode = new Element( "div.nextSubjectNode", {
- styles : this.css.nextSubjectNoneNode
- }).inject( turnSubjectNode );
- }
- },
- gotoDocument : function( count ){
- if( count == 1 ){
- var documentData = this.nextSubject;
- }else{
- var documentData = this.lastSubject;
- }
- var oldId = "ForumDocument"+this.data.id;
- var appId = "ForumDocument"+documentData.id;
- if (this.desktop.apps[appId]){
- this.desktop.apps[appId].setCurrent();
- //this.close();
- }else {
- this.setOptions({
- "sectionId" : null, //this.data.sectionId,
- "id" : documentData.id,
- "appId": appId,
- "isEdited" : false,
- "isNew" : false
- });
- this.reload(oldId , appId );
- }
- },
- createSidebar: function(){
- if( this.inBrowser ){
- var crd = this.middleNode.getCoordinates();
- this.sideBar = new Element("div.sideBar", {
- styles : {
- "position" : "fixed",
- "left" : (crd.right+4)+"px",
- "bottom" : "100px",
- "width" : "50px",
- "height" : "155px",
- "padding-top" : "10px",
- "text-align" : "center",
- "background-color" : "#fff",
- "box-shadow": "0 0 4px rgba(0,0,0,0.20)"
- }
- }).inject( this.middleNode );
- window.onresize = function(){
- var crd = this.middleNode.getCoordinates();
- this.sideBar.setStyles( {
- "left" : (crd.right+4)+"px"
- })
- }.bind(this)
- }else{
- var contentCrd = this.content.getCoordinates();
- var middleNodeCrd = this.middleNode.getCoordinates();
- this.sideBar = new Element("div.sideBar", {
- styles : {
- "position" : "fixed",
- "top" : (contentCrd.top + contentCrd.height-220)+"px",
- "left" : (middleNodeCrd.right+4)+"px",
- "width" : "50px",
- "height" : "155px",
- "padding-top" : "10px",
- "text-align" : "center",
- "background-color" : "#fff",
- "box-shadow": "0 0 4px #ccc"
- }
- }).inject( this.middleNode );
- this.addEvent("moveDrop", function(){
- var contentCrd = this.content.getCoordinates();
- var middleNodeCrd = this.middleNode.getCoordinates();
- this.sideBar.setStyles( {
- "top" : (contentCrd.top + contentCrd.height-220)+"px",
- "left" : (middleNodeCrd.right+4)+"px"
- })
- }.bind(this));
- this.addEvent("resize", function(){
- var contentCrd = this.content.getCoordinates();
- var middleNodeCrd = this.middleNode.getCoordinates();
- this.sideBar.setStyles( {
- "top" : (contentCrd.top + contentCrd.height-220)+"px",
- "left" : (middleNodeCrd.right+4)+"px"
- })
- }.bind(this));
- }
- this._createSidebar();
- },
- _createSidebar: function(){
- var count = 1;
- var sidebarTop = new Element("div",{
- styles : this.css.sidebarTop,
- title: this.lp.gotoTop
- }).inject(this.sideBar);
- sidebarTop.addEvents(
- {
- "mouseover": function () {
- this.node.setStyles(this.obj.css.sidebarTop_over);
- }.bind({obj: this, node: sidebarTop}),
- "mouseout": function () {
- this.node.setStyles(this.obj.css.sidebarTop);
- }.bind({obj: this, node: sidebarTop}),
- "click": function () {
- this.contentContainerNode.scrollTo( 0, 0 );
- }.bind(this)
- }
- );
- if( this.sectionPermission.subjectPublishAble && !MWFForum.isSubjectMuted()){
- count++;
- var createActionNode = new Element("div",{
- styles : this.css.sidebarCreate,
- title: this.lp.createSubject
- }).inject(this.sideBar);
- createActionNode.addEvents(
- {
- "mouseover": function () {
- this.node.setStyles(this.obj.css.sidebarCreate_over);
- }.bind({obj: this, node: createActionNode}),
- "mouseout": function () {
- this.node.setStyles(this.obj.css.sidebarCreate);
- }.bind({obj: this, node: createActionNode}),
- "click": function () {
- if( this.access.isAnonymousDynamic() ){
- this.openLoginForm(
- function(){ this.createNewDocument(); }.bind(this)
- );
- }else{
- this.createNewDocument();
- }
- }.bind(this)
- }
- )
- }
- if( !this.data.stopReply && !MWFForum.isReplyMuted() ){
- if( this.isReplyPublisher ){
- count++;
- var action = new Element("div", {
- "styles" : this.css.sidebarReply,
- "title" : this.lp.reply
- }).inject( this.sideBar );
- action.addEvents({
- "mouseover" : function(){ this.itemNode.setStyles( this.obj.css.sidebarReply_over ) }.bind({ obj : this, itemNode : action }),
- "mouseout" : function(){ this.itemNode.setStyles( this.obj.css.sidebarReply ) }.bind({ obj : this, itemNode : action }),
- "click" : function(){
- if( this.access.isAnonymousDynamic() ){
- this.openLoginForm( function(){ this.reload() }.bind(this) );
- }else{
- this.createReply();
- }
- }.bind(this)
- })
- }
- }
- var container = new Element("div",{}).inject( this.sideBar );
- if( this.nextSubject ){
- count++;
- this.sidebarNext = new Element("div.sidebarNext",{
- "styles" : this.css.sidebarNext,
- "title" : this.lp.nextSubject + ":" + this.nextSubject.title
- }).inject( container );
- this.sidebarNext.addEvents({
- "click" : function(){ this.gotoDocument( 1 ); }.bind(this),
- "mouseover" : function(){
- this.sidebarNext.setStyles( this.css.sidebarNext_over );
- }.bind(this),
- "mouseout" : function(){
- this.sidebarNext.setStyles( this.css.sidebarNext );
- }.bind(this)
- })
- }
- if( this.lastSubject ){
- count++;
- this.sidebarPrev = new Element("div.sidebarPrev",{
- "styles" : this.css.sidebarPrev,
- "title" : this.lp.prevSubject + ":" + this.lastSubject.title
- }).inject( container );
- this.sidebarPrev.addEvents({
- "click" : function(){ this.gotoDocument( -1 ); }.bind(this),
- "mouseover" : function(){
- this.sidebarPrev.setStyles( this.css.sidebarPrev_over );
- }.bind(this),
- "mouseout" : function(){
- this.sidebarPrev.setStyles( this.css.sidebarPrev );
- }.bind(this)
- })
- }
- this.sideBar.setStyle( "height" , (count * 30 + 5 ) +"px" );
- },
- openPerson : function( userName, data ){
- MWFForum.openPersonCenter( userName, data );
- },
- createPersonNode : function( container, personName ){
- var persons = personName.split(",");
- persons.each( function(userName, i){
- var span = new Element("span", {
- "text" : userName,
- "styles" : this.css.person
- }).inject(container);
- span.addEvents( {
- mouseover : function(){ this.node.setStyles( this.obj.css.person_over )}.bind( {node:span, obj:this} ),
- mouseout : function(){ this.node.setStyles( this.obj.css.person )}.bind( {node:span, obj:this} ),
- click : function(){ this.obj.openPerson( this.userName ) }.bind( {userName:userName, obj:this} )
- });
- if( i != persons.length - 1 ){
- new Element("span", {
- "text" : ","
- }).inject(container);
- }
- }.bind(this))
- },
- getUserData : function( name, callback ){
- if( this.userCache && this.userCache[name] ){
- if( callback )callback( this.userCache[name] );
- return
- }
- if( !this.userCache )this.userCache = {};
- if( this.access.isAnonymous() ){
- var url = MWF.Actions.get("x_organization_assemble_personal").getIcon(name);
- if( url ){
- var json = { data : { icon : url } };
- this.userCache[ name ] = json;
- if( callback )callback( json );
- }else{
- var json = { data : { icon : "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif" } };
- this.userCache[ name ] = json;
- if( callback )callback( json );
- }
- //MWF.Actions.get("x_organization_assemble_control").getPersonIcon(name, function(url){
- // var json = { data : { icon : url } };
- // this.userCache[ name ] = json;
- // if( callback )callback( json );
- //}.bind(this), function(){
- // var json = { data : { icon : "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif" } };
- // this.userCache[ name ] = json;
- // if( callback )callback( json );
- //}.bind(this))
- }else{
- MWF.Actions.get("x_organization_assemble_control").getPerson( function( json ){
- if( !json.data )json.data = {};
- var url = MWF.Actions.get("x_organization_assemble_personal").getIcon(name);
- if( url ){
- if( json.data ){
- json.data.icon = url;
- this.userCache[ name ] = json;
- if( callback )callback( json );
- }
- }else{
- if( json.data ){
- json.data.icon = "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif";
- this.userCache[ name ] = json;
- if( callback )callback( json );
- }
- }
- //MWF.Actions.get("x_organization_assemble_control").getPersonIcon(name, function(url){
- // if( json.data ){
- // json.data.icon = url;
- // this.userCache[ name ] = json;
- // if( callback )callback( json );
- // }
- //}.bind(this), function(){
- // if( json.data ){
- // json.data.icon = "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif";
- // this.userCache[ name ] = json;
- // if( callback )callback( json );
- // }
- //}.bind(this));
- }.bind(this), function(){
- var json = { data : { icon : "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif" } };
- this.userCache[ name ] = json;
- if( callback )callback( json );
- }.bind(this), name, true )
- }
- }
- });
- MWF.xApplication.ForumDocument.SubjectView = new Class({
- Extends: MWF.xApplication.Template.Explorer.ComplexView,
- _createDocument: function(data, index){
- data.index = index;
- var document;
- this.getUserData( data.creatorName, function(json ){
- if( data.anonymousSubject ){
- data.userIcon = '../x_component_ForumDocument/$Main/default/icon/noavatar_big.gif';
- data.signature = "";
- }else{
- data.userIcon = json.data.icon;
- data.signature = json.data.signature;
- }
- this.actions.getUserInfor( {"userName":data.creatorName}, function( json ){
- data.subject = json.data.subjectCount;
- data.reply = json.data.replyCount;
- data.todaySubject = json.data.subjectCountToday;
- data.todayReply = json.data.replyCountToday;
- data.prime = json.data.creamCount;
- data.accessed = json.data.popularity;
- document = new MWF.xApplication.ForumDocument.SubjectDocument(this.viewNode, data, this.explorer, this, null, data.index );
- }.bind(this))
- }.bind(this) );
- return document;
- },
- getUserData : function( name, callback ){
- this.app.getUserData( name, callback );
- },
- _getCurrentPageData: function(callback, count){
- var json = {
- type: "success",
- count : 1,
- size : 1,
- data : [this.data]
- };
- if (callback)callback(json)
- },
- _removeDocument: function(documentData, all){
- this.actions.deleteSection(documentData.id, function(json){
- this.reload();
- this.app.notice(this.app.lp.deleteDocumentOK, "success");
- }.bind(this));
- },
- _create: function(){
- },
- _queryCreateViewNode: function(){
- },
- _postCreateViewNode: function( viewNode ){
- },
- _queryCreateViewHead:function(){
- },
- _postCreateViewHead: function( headNode ){
- }
- });
- MWF.xApplication.ForumDocument.SubjectDocument = new Class({
- Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
- mouseoverSubject : function(subjectNode, ev){
- //var removeNode = sectionNode.getElements("[styles='sectionRemoveNode']")[0];
- //if( removeNode )removeNode.setStyle("opacity",1)
- },
- mouseoutSubject : function(subjectNode, ev){
- //var removeNode = sectionNode.getElements("[styles='sectionRemoveNode']")[0];
- //if( removeNode )removeNode.setStyle("opacity",0)
- },
- _queryCreateDocumentNode:function( itemData ){
- },
- _postCreateDocumentNode: function( itemNode, itemData ){
- var toolbar = itemNode.getElement("[item='itemSubjectTools']");
- this.app.createActionBar(toolbar);
- debugger;
- if(this.data.grade && this.data.grade<6) {
- //itemNode.getElements("[lable='grade']")[0].set("text", this.app.lp.sectionGrade);
- var gradediv = new Element("div", {"class": "comment_dlg_png"}).inject(itemNode.getElements("[item='grade']")[0]);
- for (var tmpi = 0; tmpi < 5; tmpi++) {
- starnode = new Element("img", {
- "src": this.app.path + "icon/whitefiveangular.png",
- "class": tmpi + "star comment_dlg_star"
- }).inject(gradediv);
- starnode.store("id", tmpi);
- if (this.data.grade > tmpi) {
- var starblacknode = starnode;
- while (starblacknode) {
- starblacknode.set("src", this.app.path + "icon/blackfiveangular.png");
- starblacknode = starblacknode.previousElementSibling;
- }
- }
- //itemNode.getElements( "[item='grade']" )[0].set("text", 222);
- }
- }
- o2.require("o2.widget.ImageLazyLoader", function(){
- var loadder = new o2.widget.ImageLazyLoader(itemNode.getElement("[item='content']"), this.data.content);
- loadder.load(function(){
- this.contentLoaded = true;
- if(this.voteLoaded)this.loadImageViewer(itemNode)
- }.bind(this))
- }.bind(this));
- if( this.data.attachmentList && this.data.attachmentList.length > 0 ){
- var attachmentArea = itemNode.getElement("[item='attachment']");
- this.app.loadAttachment(attachmentArea);
- }
- if( this.data.typeCategory == this.lp.vote || this.data.typeCategory =="投票"){
- var voteArea = itemNode.getElement("[item='vote']");
- MWF.xDesktop.requireApp("ForumDocument", "Vote", function(){
- this.vote = new MWF.xApplication.ForumDocument.Vote(voteArea, this.app, {
- isNew : false,
- isEdited : false,
- onPostLoad: function () {
- this.voteLoaded = true;
- if(this.contentLoaded)this.loadImageViewer(itemNode)
- }.bind(this)
- }, this.data);
- this.vote.load();
- }.bind(this), true)
- }else{
- this.voteLoaded = true;
- if(this.contentLoaded)this.loadImageViewer(itemNode)
- }
- },
- loadImageViewer: function(node){
- var contentNote = node.getElement("[item='content']");
- var voteNode = node.getElement("[item='vote']");
- o2.require("o2.widget.ImageViewer", function(){
- var imageViewer = new o2.widget.ImageViewer(node, [contentNote, voteNode]);
- imageViewer.load();
- }.bind(this))
- },
- sendMessage : function(itemNode, ev ){
- var self = this;
- if (layout.desktop.widgets["IMIMWidget"]) {
- var IM = layout.desktop.widgets["IMIMWidget"];
- IM.getOwner(function(){
- this.openChat(ev, {
- from : self.data.creatorName
- });
- }.bind(IM));
- }
- },
- createReply : function(itemNode, ev ){
- if( this.app.access.isAnonymousDynamic() ){
- this.app.openLoginForm( function(){ this.app.reload() }.bind(this) );
- }else{
- var form = new MWF.xApplication.ForumDocument.ReplyForm(this, {}, {
- "toMain" : true,
- onPostOk : function( id ){
- this.app.postCreateReply( id );
- }.bind(this)
- });
- form.mainData = this.data;
- form.create()
- }
- }
- });
- MWF.xApplication.ForumDocument.ReplyEditor = new Class({
- Implements: [Options , Events],
- options: {
- "style": "default",
- "isNew" : true
- },
- initialize: function(node, app, options){
- this.setOptions(options);
- this.node = node;
- this.app = app;
- },
- load: function(){
- this.app.restActions.getUUID( function( id ){
- this.advanceReplyId = id;
- this._load();
- }.bind(this))
- },
- _load: function(){
- var html = "<div styles='itemNode'>" +
- " <div styles='itemLeftNode'>" +
- " <div styles='itemUserFace'>" +
- " <div styles='itemUserIcon' item='userIcon'>" +
- " </div>" +
- " </div>" +
- " <div styles='replyUserName' item='creatorName'>" +
- " </div>" +
- " </div>" +
- " <div styles='replyRightNode'>" +
- " <div styles='itemRightMidle'>" +
- " <div styles='itemBodyReply' item='content'></div>" +
- " <div styles='itemBodyReply' item='action'></div>" +
- " </div>" +
- " </div>" +
- "</div>";
- this.node.set("html", html);
- var actionTd = this.node.getElements("[item='action']")[0];
- this.saveReplyAction = new Element("div",{
- styles : this.app.css.actionNode,
- text: this.app.lp.saveReply
- }).inject(actionTd);
- this.saveReplyAction.addEvent("click",function(){
- this.saveReply();
- }.bind(this));
- MWF.xDesktop.requireApp("Template", "MForm", function () {
- this.form = new MForm(this.node, this.data || {}, {
- style: "forum",
- isEdited: true,
- itemTemplate: {
- userIcon: { className : "itemUserIcon2", type : "img", value : function(){
- if( this.app.userData.icon ){
- return "data:image/png;base64," + this.app.userData.icon
- }else{
- var src = "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif";
- this.app.getUserData( this.app.userData.distinguishedName, function(json ){
- src = json.data.icon;
- }.bind(this), function(){
- var src = "../x_component_ForumDocument/$Main/"+this.options.style+"/icon/noavatar_big.gif";
- }, false );
- return src;
- }
- }.bind(this)},
- creatorName: { type : "innerText", value : MWFForum.getDisplayName() },
- content: { type : "rtf", RTFConfig : {
- //skin : "bootstrapck",
- "resize_enabled": false,
- isSetImageMaxWidth : true,
- reference : this.advanceReplyId,
- referenceType: "forumReply",
- //uiColor : '#9AB8F3',
- //toolbarCanCollapse : true,
- toolbar : [
- { name: 'document', items : [ 'Preview' ] },
- //{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
- { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','-','RemoveFormat' ] },
- //{ name: 'paragraph', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
- { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
- { name: 'colors', items : [ 'TextColor','BGColor' ] },
- { name: 'links', items : [ 'Link','Unlink' ] },
- { name: 'insert', items : [ 'Image' ] },
- { name: 'tools', items : [ 'Maximize','-','About' ] }
- ]
- }}
- }
- }, this, this.app.css);
- this.form.load();
- }.bind(this), true);
- },
- saveReply : function(){
- var data = this.form.getResult(true, ",", true, false, true);
- if (data) {
- data.subjectId = this.mainData.id ;
- data.id = this.advanceReplyId;
- this.app.restActions.saveReply(data, function (json) {
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- } else {
- this.app.restActions.getUUID( function( id ){
- this.advanceReplyId = id;
- }.bind(this));
- this.app.notice( this.app.lp.saveReplySuccess, "ok" );
- this.form.getItem("content").setValue("");
- this.fireEvent("postOk", json.data.id);
- }
- }.bind(this))
- }
- }
- });
- MWF.xApplication.ForumDocument.ReplyForm = new Class({
- Extends: MPopupForm,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "width": "860",
- "height": "470",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : true,
- "hasTopContent" : true,
- "hasBottom": true,
- "title": MWF.xApplication.Forum.LP.replyFormTitle,
- "draggable": true,
- "closeAction": true,
- "toMain" : true
- },
- _createTableContent: function(){
- if( this.isNew ){
- this.app.restActions.getUUID( function(id){
- this.advanceReplyId = id;
- this._createTableContent_();
- }.bind(this) )
- }else{
- this._createTableContent_()
- }
- },
- _createTableContent_: function () {
- var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
- "<tr>" +
- " <td styles='formTableValue14' item='mainSubject'></td>" +
- "</tr><tr>" +
- " <td styles='formTableValue' item='mainContent'></td>" +
- "</tr><tr>" +
- " <td styles='formTableValue' item='content'></td>" +
- "</tr>"+
- "</table>";
- this.formTableArea.set("html", html);
- if( !this.options.toMain && this.parentData ){
- var mainContentEl = this.formTableArea.getElements("[item='mainContent']")[0];
- var quoteTop = new Element( "div", {styles : this.css.quoteTop} ).inject( mainContentEl );
- new Element( "div", {styles : this.css.quoteLeft} ).inject( quoteTop );
- new Element( "div", {
- styles : this.css.quoteInfor,
- text : MWFForum.getReplyCreatorName(this.parentData) + this.lp.publishAt + this.parentData.createTime
- }).inject( quoteTop );
- var quoteBottom = new Element( "div", {styles : this.css.quoteBottom} ).inject( mainContentEl );
- var text = this.parentData.contentText;
- new Element( "div", {
- styles : this.css.quoteText,
- text : text.length > 50 ? (text.substr(0, 50) + "...") : text
- }).inject( quoteBottom );
- new Element( "div", {styles : this.css.quoteRight} ).inject( quoteBottom );
- }
- MWF.xDesktop.requireApp("Template", "MForm", function () {
- this.form = new MForm(this.formTableArea, this.data, {
- style: "forum",
- isEdited: true,
- itemTemplate: {
- mainSubject: { type: "innertext", defaultValue : "RE:" + this.mainData.title },
- content: { type : "rtf", RTFConfig : {
- //skin : "bootstrapck",
- "resize_enabled": false,
- isSetImageMaxWidth : true,
- reference : this.advanceReplyId || this.data.id,
- referenceType: "forumReply",
- toolbar : [
- { name: 'document', items : [ 'Preview' ] },
- //{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
- { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','-','RemoveFormat' ] },
- //{ name: 'paragraph', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
- { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
- { name: 'colors', items : [ 'TextColor','BGColor' ] },
- { name: 'links', items : [ 'Link','Unlink' ] },
- { name: 'insert', items : [ 'Image' ] },
- { name: 'tools', items : [ 'Maximize','-','About' ] }
- ]
- }}
- }
- }, this.app, this.css);
- this.form.load();
- }.bind(this), true);
- },
- _createBottomContent: function () {
- if (this.isNew || this.isEdited) {
- this.okActionNode = new Element("div.formOkActionNode", {
- "styles": this.css.formOkActionNode,
- "text": this.app.lp.saveReply
- }).inject(this.formBottomNode);
- this.okActionNode.addEvent("click", function (e) {
- this.ok(e);
- }.bind(this));
- }
- this.cancelActionNode = new Element("div.formCancelActionNode", {
- "styles": this.css.formCancelActionNode,
- "text": this.app.lp.close
- }).inject(this.formBottomNode);
- this.cancelActionNode.addEvent("click", function (e) {
- this.cancel(e);
- }.bind(this));
- },
- ok: function (e) {
- this.fireEvent("queryOk");
- var data = this.form.getResult(true, ",", true, false, true);
- if (data) {
- this._ok(data, function (json) {
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- } else {
- if(this.formMaskNode)this.formMaskNode.destroy();
- this.formAreaNode.destroy();
- this.app.notice(this.isNew ? this.app.lp.createReplySuccess : this.app.lp.updateSuccess, "success");
- this.fireEvent("postOk", json.data.id);
- }
- }.bind(this))
- }
- },
- _ok: function (data, callback) {
- data.subjectId = this.mainData.id ;
- if( this.advanceReplyId )data.id = this.advanceReplyId;
- if( !this.options.toMain ){
- data.parentId = this.parentData.id ;
- }
- this.app.restActions.saveReply( data, function(json){
- if( callback )callback(json);
- }.bind(this));
- }
- });
- MWF.xApplication.ForumDocument.ReplyView = new Class({
- Extends: MWF.xApplication.Template.Explorer.ComplexView,
- _createDocument: function(data, index){
- data.index = index;
- return new MWF.xApplication.ForumDocument.ReplyDocument(this.viewNode, data, this.explorer, this, null, data.index );
- },
- _getCurrentPageData: function(callback, count, pageNum){
- this.clearBody();
- if(!count)count=10;
- if(!pageNum)pageNum = 1;
- if( pageNum == 1 ){
- this.app.subjectConainer.setStyle("display","block");
- if( this.app.satisfiedReplyViewConainer )this.app.satisfiedReplyViewConainer.setStyle("display","block");
- }else{
- this.app.subjectConainer.setStyle("display","none");
- if( this.app.satisfiedReplyViewConainer )this.app.satisfiedReplyViewConainer.setStyle("display","none");
- }
- //page, count, filterData, success,failure, async
- //if( !this.page ){
- // this.page = 1;
- //}else{
- // this.page ++;
- //}
- //var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
- var filter = this.filterData || {};
- this.actions.listReplyFilterPage( pageNum, count, filter, function(json){
- if( !json.data )json.data = [];
- if( !json.count )json.count=0;
- if( callback )callback(json);
- }.bind(this))
- },
- _removeDocument: function(documentData, all){
- this.actions.deleteReply( documentData.id, function(){
- this.reload();
- this.app.notice( this.lp.deleteReplySuccess, "ok")
- }.bind(this) )
- },
- _create: function(){
- },
- _queryCreateViewNode: function(){
- },
- _postCreateViewNode: function( viewNode ){
- },
- _queryCreateViewHead:function(){
- },
- _postCreateViewHead: function( headNode ){
- }
- });
- MWF.xApplication.ForumDocument.ReplyDocument = new Class({
- Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
- mouseoverSubject : function(subjectNode, ev){
- //var removeNode = sectionNode.getElements("[styles='sectionRemoveNode']")[0];
- //if( removeNode )removeNode.setStyle("opacity",1)
- },
- mouseoutSubject : function(subjectNode, ev){
- //var removeNode = sectionNode.getElements("[styles='sectionRemoveNode']")[0];
- //if( removeNode )removeNode.setStyle("opacity",0)
- },
- getUserData : function( name, callback ){
- this.app.getUserData( name, callback );
- },
- _queryCreateDocumentNode:function( itemData ){
- },
- _postCreateDocumentNode: function( itemNode, itemData ){
- var userIcon = itemNode.getElements( "[item='userIcon']" )[0];
- var signatureContainer = itemNode.getElements("[item='signatureContainer']")[0];
- this.getUserData( itemData.creatorName, function(json ){
- userIcon.src = json.data.icon;
- if( json.data.signature && json.data.signature!="" ){
- var signatureNode = signatureContainer.getElements("[item='signature']")[0];
- signatureNode.set("text", json.data.signature )
- }else{
- signatureContainer.destroy();
- }
- }.bind(this) );
- this.actions.getUserInfor( {"userName":itemData.creatorName}, function( json ){
- var d = json.data;
- itemNode.getElements( "[item='subject']" )[0].set("text", d.subjectCount);
- itemNode.getElements( "[item='reply']" )[0].set("text", d.replyCount);
- itemNode.getElements( "[item='prime']" )[0].set("text", d.creamCount);
- itemNode.getElements( "[item='todaySubject']" )[0].set("text", d.subjectCountToday);
- itemNode.getElements( "[item='todayReply']" )[0].set("text", d.replyCountToday);
- }.bind(this));
- var contentNode = itemNode.getElement( "[item='content']");
- o2.require("o2.widget.ImageLazyLoader", function(){
- var loadder = new o2.widget.ImageLazyLoader(contentNode, this.data.content);
- loadder.load(function(){
- this.loadImageViewer(contentNode);
- }.bind(this))
- }.bind(this));
- if( itemData.parentId && itemData.parentId != "" ){
- var quoteContainer = itemNode.getElements( "[item='quoteContent']" )[0];
- this.actions.getReply( itemData.parentId, function( json ){
- var data = this.parentData = json.data;
- var quoteContent = new Element("div", { "styles" : this.css.itemQuote }).inject(quoteContainer);
- var content = quoteContent.set("html", data.content).get("text");
- quoteContent.empty();
- data.contentText = content;
- new Element( "div", {styles : this.css.quoteLeftBig} ).inject( quoteContent );
- var quoteArea = new Element( "div", {styles : this.css.quoteAreaBig } ).inject( quoteContent );
- var quoteInfor = new Element( "div", {
- styles : this.css.quoteInforBig,
- text : data.orderNumber + this.lp.floor + ":" + MWFForum.getReplyCreatorName(data) + this.lp.publishAt + data.createTime
- }).inject( quoteArea );
- quoteInfor.addEvent("click", function(){
- this.obj.app.gotoReply( this.index )
- }.bind({obj : this, index : data.orderNumber || (data.index + 2) }));
- new Element( "div", {
- styles : this.css.quoteTextBig,
- text : content.length > 100 ? (content.substr(0, 100) + "...") : content
- }).inject( quoteArea );
- new Element( "div", {styles : this.css.quoteRightBig} ).inject( quoteContent );
- }.bind(this) , function( json ){
- new Element( "div" , {
- "styles" : this.css.replyBeinngDelete,
- "text" : this.lp.quoteReplyBeingDeleted
- }).inject(quoteContainer)
- }.bind(this)
- )
- }
- },
- loadImageViewer: function(node){
- o2.require("o2.widget.ImageViewer", function(){
- var imageViewer = new o2.widget.ImageViewer(node);
- imageViewer.load();
- }.bind(this))
- },
- sendMessage : function(itemNode, ev ){
- var self = this;
- if (layout.desktop.widgets["IMIMWidget"]) {
- var IM = layout.desktop.widgets["IMIMWidget"];
- IM.getOwner(function(){
- this.openChat(ev, {
- from : self.data.creatorName
- });
- }.bind(IM));
- }
- },
- createReply : function(itemNode, ev ){ // 对回复进行回复
- if( this.app.access.isAnonymousDynamic() ){
- this.app.openLoginForm( function(){ this.app.reload() }.bind(this) );
- }else{
- var form = new MWF.xApplication.ForumDocument.ReplyForm(this, {}, {
- toMain: false,
- onPostOk: function (id) {
- this.app.postCreateReply(id)
- }.bind(this)
- });
- this.data.contentText = this.node.getElements("[item='content']")[0].get("text");
- form.mainData = this.app.data;
- form.parentData = this.data;
- form.create()
- }
- },
- editReply : function(itemNode, ev ){ //编辑当前回复
- var form = new MWF.xApplication.ForumDocument.ReplyForm(this, this.data, {
- toMain : (this.data.parentId && this.data.parentId!="") ? false : true,
- onPostOk : function( id ){
- this.actions.getReply( id, function( json ){
- var content = this.node.getElements("[item='content']")[0];
- content.set( "html", json.data.content );
- }.bind(this))
- }.bind(this)
- });
- form.mainData = this.app.data;
- form.parentData = this.parentData;
- form.edit()
- },
- deleteReply : function( itemNode, ev ){
- var _self = this;
- this.app.confirm("warn", ev, this.lp.deleteReplyTitle, this.lp.deleteReplyText, 350, 120, function(){
- //_self.view._removeDocument(_self.data, false);
- _self.actions.deleteReply( _self.data.id, function(){
- if( MWFForum.getSystemConfigValue("BBS_REPLY_DELETETYPE").toLowerCase() === "recursively" ){
- _self.destroy();
- _self.app.adjustReplyCount( -1 );
- _self.view.reload();
- _self.app.notice( _self.lp.deleteReplySuccess, "ok")
- }else{
- _self.destroy();
- _self.app.adjustReplyCount( -1 );
- _self.app.notice( _self.lp.deleteReplySuccess, "ok")
- }
- }.bind(this) );
- this.close();
- }, function(){
- this.close();
- });
- },
- satisfiedAction : function(){
- this.actions.acceptReply({"id": this.data.id }, function(){
- this.app.notice( this.lp.acceptReplySuccess, "ok");
- this.app.reload();
- }.bind(this))
- }
- });
- MWF.xApplication.ForumDocument.SatisfiedReplyView = new Class({
- Extends: MWF.xApplication.ForumDocument.ReplyView,
- _createDocument: function (data, index) {
- data.index = index;
- return new MWF.xApplication.ForumDocument.SatisfiedReplyDocument(this.viewNode, data, this.explorer, this, null, data.index);
- },
- _getCurrentPageData: function(callback, count, pageNum){
- this.clearBody();
- if(!count)count=1;
- if(!pageNum)pageNum = 1;
- var filter = this.filterData || {};
- this.actions.getAcceptedReply( this.data.acceptReplyId, function(json){
- if( !json.data ){
- json.data = [];
- }else if( typeOf( json.data ) == "object" ){
- json.data = [ json.data ];
- json.count = 1;
- }
- if( !json.count )json.count=0;
- if( callback )callback(json);
- }.bind(this))
- }
- });
- MWF.xApplication.ForumDocument.SatisfiedReplyDocument = new Class({
- Extends: MWF.xApplication.ForumDocument.ReplyDocument
- });
- MWF.xApplication.ForumDocument.TopSettingForm = new Class({
- Extends: MPopupForm,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "width": "420",
- "height": "250",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : true,
- "hasTopContent" : true,
- "hasBottom": true,
- "title": MWF.xApplication.Forum.LP.topFormTitle,
- "draggable": true,
- "closeAction": true
- },
- createTopNode: function () {
- if (!this.formTopNode) {
- this.formTopNode = new Element("div.formTopNode", {
- "styles": this.css.formTopNode
- }).inject(this.formNode);
- if(this.options.hasTopIcon){
- this.formTopIconNode = new Element("div", {
- "styles": this.css.formTopIconNodeDocument
- }).inject(this.formTopNode)
- }
- this.formTopTextNode = new Element("div", {
- "styles": this.css.formTopTextNodeTopSetting,
- "text": this.options.title
- }).inject(this.formTopNode);
- if (this.options.closeAction) {
- this.formTopCloseActionNode = new Element("div", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
- this.formTopCloseActionNode.addEvent("click", function () {
- this.close()
- }.bind(this))
- }
- }
- },
- _createTableContent: function () {
- var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
- "<tr>" +
- " <td styles='formTableValue' style='font-size:14px;' lable='topType'></td>" +
- //"</tr><tr>" +
- //" <td styles='formTableValue' item='topToBBS'></td>" +
- "</tr><tr>" +
- " <td styles='formTableValue' item='topToForum'></td>" +
- "</tr><tr>" +
- " <td styles='formTableValue' item='topToSection'></td>" +
- "</tr>"+
- "</table>";
- this.formTableArea.set("html", html);
- this.topToBBS = this.data.topToBBS;
- this.topToForum = this.data.topToForum;
- this.topToSection = this.data.topToSection;
- MWF.xDesktop.requireApp("Template", "MForm", function () {
- this.form = new MForm(this.formTableArea, this.data, {
- style: "forum",
- isEdited: this.isEdited || this.isNew,
- itemTemplate: {
- topType : { text : this.lp.topType },
- //topToBBS: { type: "checkbox", selectValue : [true], selectText : [this.lp.topToBBS] },
- topToForum: { type: "checkbox", selectValue : ["true"], selectText : [this.lp.topToForum]},
- topToSection: { type: "checkbox", selectValue : ["true"], selectText : [this.lp.topToSection] }
- }
- }, this.app, this.css);
- this.form.load();
- }.bind(this), true);
- },
- _createBottomContent: function () {
- if (this.isNew || this.isEdited) {
- this.okActionNode = new Element("div.formOkActionNode", {
- "styles": this.css.formOkActionNode,
- "text": this.app.lp.ok
- }).inject(this.formBottomNode);
- this.okActionNode.addEvent("click", function (e) {
- this.ok(e);
- }.bind(this));
- }
- this.cancelActionNode = new Element("div.formCancelActionNode", {
- "styles": this.css.formCancelActionNode,
- "text": this.app.lp.close
- }).inject(this.formBottomNode);
- this.cancelActionNode.addEvent("click", function (e) {
- this.cancel(e);
- }.bind(this));
- },
- ok: function (e) {
- this.fireEvent("queryOk");
- var data = this.form.getResult(true, ",", true, false, true);
- if (data) {
- var flag = true;
- //if( data.topToBBS === true || data.topToBBS === "true" ){
- // this.actions.topToBBS( this.app.data.id , function( json ){
- // if (json.type == "error") {
- // this.app.notice(json.userMessage, "error");
- // flag = false;
- // }
- // }, function(){
- // flag = false;
- // }, false )
- //}else if( this.topToBBS === true || this.topToBBS === "true" ){
- // this.actions.cancelTopToBBS( this.app.data.id , function( json ){
- // if (json.type == "error") {
- // this.app.notice(json.userMessage, "error");
- // flag = false;
- // }
- // }, function(){
- // flag = false;
- // }, false )
- //}
- if( data.topToForum === true || data.topToForum === "true" ){
- this.actions.topToForum( this.app.data.id , function( json ){
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- flag = false;
- }
- }, function(){
- flag = false;
- }, false )
- }else if( this.topToForum === true || this.topToForum === "true" ){
- this.actions.cancelTopToForum( this.app.data.id , function( json ){
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- flag = false;
- }
- }, function(){
- flag = false;
- }, false )
- }
- if( data.topToSection === true || data.topToSection === "true" ){
- this.actions.topToSection( this.app.data.id , function( json ){
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- flag = false;
- }
- }, function(){
- flag = false;
- }, false )
- }else if( this.topToSection === true || this.topToSection === "true" ){
- this.actions.cancelTopToSection( this.app.data.id , function( json ){
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- flag = false;
- }
- }, function(){
- flag = false;
- }, false )
- }
- if( flag ){
- if(this.formMaskNode)this.formMaskNode.destroy();
- this.formAreaNode.destroy();
- this.app.notice( this.app.lp.setTopSuccess );
- this.fireEvent("postOk");
- }else{
- this.app.notice( this.app.lp.setToFail , "error");
- }
- }
- }
- });
- MWF.xApplication.ForumDocument.EditorSettingForm = new Class({
- Extends: MWF.xApplication.ForumDocument.TopSettingForm,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "width": "420",
- "height": "250",
- "hasTop": true,
- "hasIcon": false,
- "hasTopIcon" : true,
- "hasTopContent" : true,
- "hasBottom": true,
- "title": MWF.xApplication.Forum.LP.editPermissionFormTitle,
- "draggable": true,
- "closeAction": true
- },
- _createTableContent: function () {
- var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
- "<tr>" +
- " <td styles='formTableValue' item='editorList'></td>" +
- "</tr>" +
- "</table>";
- this.formTableArea.set("html", html);
- MWF.xDesktop.requireApp("Template", "MForm", function () {
- this.form = new MForm(this.formTableArea, this.data, {
- style: "forum",
- isEdited: this.isEdited || this.isNew,
- itemTemplate: {
- editorList: { type: "org", style: {height:"100px"}, count: 0 }
- }
- }, this.app, this.css);
- this.form.load();
- }.bind(this), true);
- },
- ok: function (e) {
- this.fireEvent("queryOk");
- debugger;
- var data = this.form.getResult(true, ",", true, false, true);
- if (data) {
- var flag = true;
- this.data.editorList = data.editorList.split(",");
- o2.Actions.load("x_bbs_assemble_control").SubjectInfoManagerUserAction.save( this.data , function( json ){
- if (json.type == "error") {
- this.app.notice(json.message, "error");
- flag = false;
- }
- }, function(){
- flag = false;
- }, false )
- if( flag ){
- if(this.formMaskNode)this.formMaskNode.destroy();
- this.formAreaNode.destroy();
- this.app.notice( this.app.lp.setEditorSuccess );
- this.fireEvent("postOk");
- }else{
- this.app.notice( this.app.lp.setEditorFail , "error");
- }
- }
- }
- });
|