Ext.namespace("JDBS.Apps.AppClass.JDBSIM");
/**
 * 在线交流功能界面类
 */
JDBS.Apps.AppClass.JDBSIM.IMUI=function(o){
    this.app=o.app||null;//指向im app
    delete o.app;
    //传递给面板的配置参数
    var treeLoader = new Ext.tree.TreeLoader({
        preloadChildren: true,
        clearOnLoad:false,
        baseParams: null,
        url:JDBS.Apps.MainApp.HandleAjaxUrl + "&action=onlineHandler&todo=getAllUser",
        requestMethod: "GET",
        listeners:{
            beforeload:{fn:function(){
                if(this.app.stateTast){
                    this.app.stateTast.cancel();
                }
                this.body.mask("加载中...","x-mask-loading");
            },scope:this},
            load:{fn:function(){
                if (!Ext.isEmpty(this.app.userInf.username))this.app.getUStat();
                this.body.unmask();
                this.expandAll();
            },scope:this}
        }
    });
    var treeNode = new Ext.tree.AsyncTreeNode({
        text: '',
        id: 'root',
        expanded: false,
        listeners: {
            "click": function(node, e){
                e.stopEvent();
                alert(node.text);
            }
        }
    });
    /**
     * 设置在线状态
     * 改变状态时保存当前状态
     * @param {string} 节点id
     * @param {number} 状态 1 在线 2 离线 3 有消息
     */
    this.setStateByNode=function(node,index,arr){
        var onCls="JDBSIM_IconCls_UserOnLine",offCls="JDBSIM_IconCls_UserOffLine",hm="JDBSIM_IconCls_HaveMsg";
        var n=this.getNodeById(node.id),newNode;
        if(node.id.substr(0,1)=="f"){
          if(!n){
            n=this.getNodeById(node.id.replace("f","m"));
          }
        }
        if (n){

}else{
            var imapp=this.app,root,newNode;
           if (!Ext.isEmpty(imapp.userInf.username)){
                 //客服端直接添加到客户请求列表,客户端添加到临时会话
              var role=node.id.substr(0,1),root;
             switch(role){
                 case ("k"):{
                    root=this.getNodeById("customer");
                break;    
                }
                case("c"):{
                    root=this.getNodeById("cs");
                break;    
                }
                case("f"):{
                    root=this.getNodeById("stranger");
                    node.id=node.id.replace("f","m");
                    if(!root){
                      root=this.getRootNode().appendChild(
                      new Ext.tree.TreeNode({
                          text:"临时会话",
                        id:"stranger",
                        iconCls:"JDBSIM_IconCls_StrangerG",
                        leaf:false,
                        expanded:true
                      })
                      );
                      root.expand(true);
                    }
                    break;
                }
             }
              n=new Ext.tree.TreeNode(node);
              n.attributes.num=0;
                 root.appendChild(n);
           }
        }
        var nui=n.getUI(),oldcls,newcls;
        oldcls=n.attributes.online?onCls:offCls;
        n.attributes.online=node.online;
        newcls=node.online?onCls:offCls;
        var imgel=nui.getIconEl();
            if (oldcls!=newcls){
                imgel.className=imgel.className.replace(oldcls,newcls);
            }
        //------------                
        if (parseInt(node.num) > 0) {
            n.setText(n.attributes.rawtext+ "<spancolor:red;"">(" + node.num + ")</span>");
            if (!n.attributes.chatW) {
                if (node.num > (n.attributes.num||0)) {
                    //新消息
                    if (this.app.runMode == 2)
                        this.app.playSound();
                }
            }
            n.attributes.num =node.num;
        }
        else {
            n.setText(n.attributes.rawtext);
            n.attributes.num = 0;
        }
        //--------------------------
    };
    /**
     * 批量设置在线状态
     * @param {Object} 状态数组
     */
    this.setStateBatch=function(a){
        if (a.length>0){
              Ext.each(a,this.setStateByNode,this);    
        }                    
    };
    /**
     * 刷新用户列表
     * @param {Object} oc
     */
    this.refreshList=function(oc){
        this.root.reload();
    }
    var oc = {
        collapsible: true,
        loader: treeLoader,
        title: "在线交流",
        iconCls: "iconCls_east",
        rootVisible: false,
        lines: false,
        autoScroll: true,
        expanded: true,
        bbar:[],
        listeners: {
            render:function(tp){
                tp.expandAll();
            },
            click: function(node, e){
                //alert("单击事件");
            }
        },
        tools: [{
            id: 'refresh',
            on: {
                click: function(){
                    this.refreshList();
                },
                scope:this
            }
        }],
        root: treeNode
    };
    
    //bbar: [{xtype:"button",text:"设置",tooltip:"设置",iconCls:""}],
    if (this.app.runMode==1){
        oc.bbar=[{text:"查找用户",iconCls:"iconCls_searchAdd",handler:function(bnt,e){
            this.searchFriend();
        },scope:this.app}]
    }else{
        
        oc.bbar.push({
            text:"",
            iconCls:(this.app.config.sound==1)?"JDBSIM_IconCls_SoundOn":"JDBSIM_IconCls_SoundOff",
            handler:function(bnt,e){
              bnt.setIconClass(bnt.iconCls.toggle("JDBSIM_IconCls_SoundOn","JDBSIM_IconCls_SoundOff"));
              this.app.config.sound=(bnt.iconCls=="JDBSIM_IconCls_SoundOn")?1:0;
            },
            scope:this
        });
    }
    Ext.apply(oc, o);
    JDBS.Apps.AppClass.JDBSIM.IMUI.superclass.constructor.call(this, oc);
};
Ext.extend(JDBS.Apps.AppClass.JDBSIM.IMUI, Ext.tree.TreePanel, {});
/**
 * 获取消息的store
 * @param {Object} oc
 * 配置对象中需要 fields属性
 */
JDBS.Apps.AppClass.JDBSIM.MsgStore=function(o){
    var oc={
        proxy: new Ext.data.HttpProxy({
            url:JDBS.Apps.MainApp.HandleAjaxUrl+"&action=onlineHandler&todo=getmsg",
            method: "POST"
        }), autoLoad: false,
        reader: new Ext.data.JsonReader({
            //id: "id_9dsoft",
            //totalProperty: "total",
            root: "result",
            successProperty: "success",
            remoteSort: false,
            fields:o.fields
        })
    }
    delete o.fields;
    Ext.apply(oc,o);
    JDBS.Apps.AppClass.JDBSIM.MsgStore.superclass.constructor.call(this,oc);
};
Ext.extend(JDBS.Apps.AppClass.JDBSIM.MsgStore,Ext.data.Store,{});
/**
 * 对话窗口类
 *
 * @param {Object} oc
 * uid:对方id,ut;对方类型,un:对方用户名,uonline 对方在线状态,mun:自己用户名,muid:自己id,mut:自己用户类型
 * node:点击的节点,getMsg_interval:提取消息的时间间隔 默认 5 秒
 */
JDBS.Apps.AppClass.JDBSIM.ChatWindow = function(oc){
    this.imApp=JDBS.Apps.AppClass.JDBSIM.App||null;
    this.toUID=oc.uid;//用户id
    this.toUT=oc.ut; //用户类型
    this.toU=oc.un; //用户名
    this.fromNode=oc.node||null;
    delete oc.node;
    delete oc.un;
    this.TimerId=null;
    this.mun=oc.mun;//自己用户名
    this.mid=oc.mid;
    this.mut=oc.mut;
    this.mUserInf=oc.mUserInf;//存储登录用户信息
    this.getMsg_interval=oc.getMsg_interval||5000;
    delete oc.mun;delete oc.mid;delete oc.mut;delete oc.mUserInf;
    this.fields=[{name:"sender"},{name:"sendtime"},{name:"content"},{name:"id_9dsoft"}];
    var msgstore = new JDBS.Apps.AppClass.JDBSIM.MsgStore({fields:this.fields});
    this.msgStore=msgstore;
    
    var newMsgHander=function(rs,op,suc){
        //suc=true;
        if (!this.TimerId){
            this.TimerId=new Ext.util.DelayedTask();
        }                    
        var DT=this.TimerId;
        if (suc){
            if (rs.length>0){
                //填充消息列表
                this.addMsg(rs);
                //窗口闪三次
                //去掉消息提示
                if (this.fromNode) {
                    this.fromNode.setText(this.fromNode.attributes.rawtext);
                    this.fromNode.attributes.num=0;
                    this.fromNode.attributes.chatW=true;
                }
                if (this.imApp){
                    if (this.imApp.runMode==2){
                        this.imApp.playSound();
                    }
                }
            }

}else{
            //alert("获取消息失败");
        }
        DT.delay(this.getMsg_interval,function(){this.checkMsg()},this);
    };
    /**
     * 检测新消息,通过一个store获取新消息
     */
    this.checkMsg=function(){
        this.msgStore.load({params:{tou:this.toU,tout:this.toUT,touid:this.toUID},callback:newMsgHander,scope:this});
    };
    /**
     * 发送消息
     */    
    this.addMsg=function(rs){
        this.msList.add(rs);
        //刷新列表
        var gv=this.msGrid.getView();
        gv.refresh();
        //滚动到底部
        gv.scrollToBottom();
    }
    this.closeW=function(){
        //关闭窗口
        this.close();
    };
    this.sendMsg=function(){
        var f=this.chatF,bf=this.chatF.getForm(),editor=bf.findField("content");        
        var rc=Ext.data.Record.create(this.fields),sc=editor.getValue(),stripC=Ext.util.Format.stripTags(sc);
        
        if (Ext.isEmpty(stripC.trim())){Ext.Msg.alert('提示', '消息内容不能为空!');return false;}else{
            //内容长度限制
            if(stripC.length>200){
                Ext.MessageBox.show({title:"提示",msg:"消息内容长度不能超过200个字符",icon:Ext.MessageBox.WARNING,buttons:{ok:true}});
                return false;
            }
        }
        bf.submit({
            url:JDBS.Apps.MainApp.HandleAjaxUrl+"&action=onlineHandler&todo=sendmsg",
            method:"POST",
            params:{tou:this.toU,tout:this.toUT,touid:this.toUID},
            success:function(f,a){            
            //由服务器端返回发送时间
              f.findField("content").setValue("");
              var id=a.result.data.newid,st=a.result.data.sendtime;
              var co={sender:this.mun,sendtime:st,content:sc,id_9dsoft:id};
              var r=new rc(co);
              this.addMsg(r);
            },
            failure:function(f,a){
               //发送失败
              var id=0,st=new Date();
              sc="<spancolor:red"">消息发送失败,请重试</span><br />"+sc;
              var co={sender:this.mun,sendtime:st,content:sc,id_9dsoft:id};
              var r=new rc(co);
              this.addMsg(r);
            },
            scope:this
        });
    };
    var gs=new Ext.data.SimpleStore({
        data:[],
        fields:this.fields,
        sortInfo:{field: "sendtime", direction: "ASC"}    
    });
    //gs.on("add",function(s,rs,i){alert(rs.length);});
    this.msList=gs;//消息列表store
    //消息表格
//------------------------------------------
//对话框功能按钮
var tbar=[];
(function(){
    //this=chatwindow     
    tbar.push({text:"查看交流记录",handler:function(bnt,e){
               if(this.mUserInf.usertype=="001"){
                   var mapp=JDBS.Apps.MainApp;
                  var tabid=mapp.NameRules.centerTabPre+"001001";
                      var p=mapp.West.items.items[0];                    
                    p.fireEvent("click",p.getNodeById("001001"));
               }else{
                 JDBS.Apps.OnlineServer.App.getOnlineLog({cname:this.toU,cid:this.toUID});
               };
            },scope:this,iconCls:"iconCls_menu_linelog"});
    //查看资料
    if((this.mUserInf.usertype=="001" && this.toUT=="001")||this.mUserInf.usertype=="002"){
        tbar.push({text:"查看资料",handler:function(bnt,e){
                //根据不同的登录用户调用不同的方法显示
                if (this.mUserInf.usertype=="001"){
                    JDBS.Apps.AppClass.JDBSIM.App.userPorfile({
                        uid:this.toUID.substr(1),
                        ut:'001',
                        un:this.toU
                    })
                }else{
                   JDBS.Apps.OnlineServer.App.getCustomerInf({cid:this.toUID,cname:this.toU});
                }                
            },scope:this,iconCls:"iconCls_menu_profile"});
    }
    //发送文件
    if ((this.mUserInf.usertype == '002') || (this.mUserInf.usertype== '001' && this.toUT == '002')) {
        tbar.push({
            text: "传送文件",
            handler: function(bnt, e){
                var mapp=(this.mUserInf.usertype=="002")?JDBS.Apps.OnlineServer.App:JDBS.Apps.MainApp;
                var title = "给" + (this.toUT== "001" ? '客户 ' : '客服 ') + this.toU + " 传送文件";
                //var url=JDBS.Apps.MainApp.HandleAjaxUrl+"&action=fileupload&p2=1&tout="+this.toUT+"&toun="+this.toUN;
                //发送文件
                var idpre = mapp.NameRules.sendFile;
                idpre += this.toUID +"_"+ this.toUT;
                var oq = {
                    action: "getFunc",
                    todo: "sendfile",
                    p2: 1,
                    toun: this.toU,
                    tout: this.toUT,
                    touid: this.toUID,
                    ctnId: idpre
                };
                autoLoad = {
                    method: "GET",
                    url: JDBS.Apps.MainApp.HandleAjaxUrl,
                    params: oq,
                    scripts: true,
                    nocache: true
                };
                if (this.mUserInf.usertype == "002") {
                    delete oq.action;
                    JDBS.Apps.OnlineServer.App.openInTabPanel({
                        id:idpre,
                        title:title,
                        params:oq,
                        iconCls:"iconCls_sendFile"
                    });
                }
                else {
                    JDBS.Apps.Funcs.CallServerFunc({
                        id: idpre,
                        title: title,
                        autoLoad: autoLoad,
                        iconCls: "iconCls_sendFile"
                    });
                }        
                
            },
            iconCls: "iconCls_sendFile",
            scope: this
        })
    }    
}).call(this);
    
    
//------------------------------------------
    this.msGrid=new Ext.grid.GridPanel({
            xtype: "grid",
            store:gs,
            tbar:tbar,
            columns: [{
                header: "username",
                sortable: false,
                dataIndex:"sender",
                renderer:function(value,p,record,rowIndex,colIndex,store){
                    var st=record.get("sendtime");
                    var s='<span class="JDBSIM_MsgListSender">{0}</span><span class="JDBSIM_MsgListTime">{1}</span>';
                    return String.format(s,value,Ext.util.Format.date(st,'y-m-d H:i:s'));
                }
            }],
            hideHeaders: true,
            loadMask: false,
            anchor: "100% 55%",
            viewConfig: {
                forceFit: true,
                enableRowBody: true,
                showPreview: true,
                getRowClass: function(record, rowIndex, p, store){
                    p.body = '<div class="JDBSIM_MsgListContent">' + record.get("content") + '</div>';
                    return 'x-grid3-row-expanded';
                }
            }
        });
    this.chatF=new Ext.form.FormPanel({
            anchor: "100% 45%",
            items: [{
                xtype:"htmleditor",
                enableAlignments: false,
                anchor:"100% 100%",
                hideLabel:true,
                name:"content",
                enableSourceEdit:false,
                enableLists:false
            }]
        });    
    
    var c = {        
        width: 540,
        height: 400,
        layout:"anchor",
        items: [this.msGrid,this.chatF],
        buttons:[{text:"发送",handler:this.sendMsg,scope:this,iconCls:"JDBSIM_IconCls_sendMsg"},{text:"取消",handler:this.closeW,scope:this,iconCls:"iconCls_cancel"}],
        listeners:{render:
        {fn:this.checkMsg,scope:this},"beforeclose":{fn:function(w){if(this.TimerId){
            this.TimerId.cancel();
            if (this.fromNode){
                this.fromNode.attributes.chatW=false;
            }
            }
            return true;},scope:this}},
        iconCls:"JDBSIM_IconCls_chatw",
        keys:{key:Ext.EventObject.ENTER,fn:function(){
            //alert("a");
            //this.buttons[0].fireEvent("click");
        },ctrl:false,alt:true,scope:this}        
    };
    Ext.apply(c,oc);
    Ext.QuickTips.init();
    JDBS.Apps.AppClass.JDBSIM.ChatWindow.superclass.constructor.call(this,c);
};
Ext.extend(JDBS.Apps.AppClass.JDBSIM.ChatWindow, Ext.Window, {});

/**
 * 在线交流应用程序
 */
JDBS.Apps.AppClass.JDBSIM.App = function(){
    //私有成员区
    /**
     * 用户状态返回时处理函数
     * @param {Object} op
     * @param {Object} suc
     * @param {Object} response
     */
    var fstateHandler=function(op,suc,response){
        if (suc){
            response=Ext.util.JSON.decode(response.responseText);
            if (response.success){
                this.IMUI.setStateBatch(response.result);
            }else{
                
            }
        }else{
        }
        if(!this.stateTast){
            this.stateTast=new Ext.util.DelayedTask();
        }
        var DT=this.stateTast;
        DT.delay(this.config.interval_state,function(){this.getUStat();},this);
    };
    return {
        //运行模式,1客户端运行,2在线客服运行
        runMode:1,
        /**
         * 用户信息
         */
        userInf:{username:"",usertype:"",usercode:""},
        //好友面板
        IMUI: null,
        //右键菜单
        userListMenu:null,
        /**
         * 初始化
         * @param {Object} config
         * @param {userC} 用户配置信息 包含属性:username,usertype,usercode
         *  配置选项说明
         * container 要包含im ui的窗口,为面板的 renderTo属性配置
         */
        init:function(o,userC){
            userC=userC||{};
            this.WG.zseed=7000;
            Ext.apply(this.userInf,userC);
            o= o||{};
            this.runMode=o.runMode||1;
            o.app=this;
            delete o.runMode;
            Ext.applyIf(o,{
                renderTo:null
            });            
            this.makeUI(o);
            this.userListMenu=new Ext.menu.Menu({
                items:[
                 {
                     hideOnClick:true
                    ,text:"查看资料"
                 }
                 ,{
                     hideOnClick:true
                    ,text:"交流记录"
                 }
                 ,{
                     hideOnClick:true
                    ,text:"删除好友"                    
                 }
                 ,{
                     hideOnClick:true
                    ,text:"开始对话"
                 }
                
                ]
            });
            /*
            this.userInf.username=JDBS.Apps.MainApp.UserInfo.username;
            this.userInf.usertype="001";
            */
        },
        /**
         * 窗口组
         */
        WG: new Ext.WindowGroup(),
        /**
         * 获取好友状态(包括在线状态、消息状态)
         */
        getUStat:function(){
            //return false;//for test
            Ext.Ajax.request(
               {
               url:JDBS.Apps.MainApp.HandleAjaxUrl+"&action=onlineHandler&todo=getstate",
               callback:fstateHandler,
               scope:this,
               method:"GET"
               });
        },
        /**
         * 刷新用户状态的任务对象
         * @param {Object} o
         */
        stateTast:null,
        /**
         * 获取对话窗口id
         * @param {Object} o
         */
        getWId:function(o){
            var wPre="chatWindow";
            return wPre+"_"+o.ut+"_"+o.uid;
        },
        /**
         * 打开一个对话窗口
         * @param {Object} o
         * ut(用户类型)-un(用户名)-uid(用户id)
         * 2008年8月7日 14时41分15秒 只打开一个对话框窗口
         */
        createCW:function(o){
            var wid=this.getWId(o),
            wt="与{0}&nbsp;{1}&nbsp;</b>对话",
            sw=[];
            switch(o.uid.substr(0,1)){
                case "f":{
                    wt=String.format(wt,"好友",o.un);
                    break;
                }
                case "c":{
                    if (this.WG.get(wid)){this.WG.bringToFront(wid);return false;};
                    wt=String.format(wt,"客服",o.un);
                    if (this.config.oneSerW){
                    sw=this.WG.getBy(function(w){if (w.id.indexOf("_c")>-1){return true;}});
                    if (sw.length>0){
                        Ext.Msg.show(
                        {title:"提示",
                        msg:"您已打开一个与客服交流的窗口,不能同时与多名客服交流",
                        buttons:{ok:true},icon:Ext.Msg.WARNING,fn:function(){
                            window.aaa=sw;
                            window.aaab=this.WG;
                          this.WG.bringToFront(sw[0].id);
                        },scope:this});
                        return false;
                    }}
                    break;
                }
                case "k":{
                    wt=String.format(wt,"客户",o.un);
                    break;
                }
                case "m":{
                    wt=String.format(wt,"用户",o.un);
                    break;
                }
            }            
            if(this.WG.get(wid)){            
                this.WG.bringToFront(wid);
            }else{
                
                                
                Ext.apply(o,{id:wid,title:wt,manager:this.WG});
                var w=new JDBS.Apps.AppClass.JDBSIM.ChatWindow(o);
                w.show();
            };                                    
        },
        //生成ui,返回一个面板
        makeUI:function(o){
            var imui = new JDBS.Apps.AppClass.JDBSIM.IMUI(o);
            this.IMUI = imui;
            //事件处理
            var dbH = function(node, e){
                //双击打开对话窗口,节点属性 type
                if (!Ext.isEmpty(node.attributes.type)){                    
                    var o ={
                        un: node.attributes.rawtext,
                        ut: node.attributes.type,
                        uid:node.id,
                        mun:this.userInf.username,
                        mUserInf:this.userInf,
                        getMsg_interval:this.config.interval_msg,
                        node:node                
                    };
                    this.createCW(o);
                }
            }            
            //定义ui的事件处理
            imui.on("dblclick",dbH, this); //双击事件
            imui.on("render",function(tp){
                /*
                var bnt=Ext.get(tp.getBottomToolbar().items.items[0].id);
                bnt.on({
                    "click":{
                        fn:function(bnt,e){
                           this.set();
                        },
                        scope:this
                    }
                });*/
            },this)
                        
        },
        //配置信息
        config:{
             interval_state:5000
            ,interval_msg:5000
            ,sound:1 //是否声音通知
            ,oneSerW:true //是否仅限制同时只能与一个客服对话
        },
        //即时交流工具参数设置
        //配置信息永久保存在cookie中
        set:function(){
            var setValues={
                //刷新消息状态时间间隔
                interval_state:parseInt(Cookies.get("im_interval_state")||"30000")/1000,
                //获取消息时间间隔
                interval_getMsg:parseInt(Cookies.get("im_interval_msg")||"30000")/1000
            };
           var form=new Ext.FormPanel({
             defaults:{
                 xtype:"numberfield",
                maxValue:180,
                minValue:30,
                width:50                
             },
             plain:false,
             baseCls:"x-plain",
             items:[{
                 fieldLabel:"刷新在线状态间隔(秒)",
                name:"is"
                ,value:setValues.interval_state,
                labelWidth:150
             },
             {
                 fieldLabel:"获取对话时间间隔(秒)",
                name:"im",
                value:setValues.interval_getMsg,
                labelWidth:150
             }
             ],
             buttons:[
             {text:"保存",
              handler:function(bnt,e){
                  
              }
             },
             {text:"取消",
             handler:function(bnt,e){}}
             ]
           });
           var win=new Ext.Window({
               title: "在线交流参数设置",
               items: [form],
               layout: "fit",
               autoHeight:false,
               autoWidth:false,
            plain:false,
            width:250,
            height:140,
            bodyStyle: "padding-top:10px"
           });
           win.show();
        },
        //查看用户资料 需要的参数 {uid:"",ut:'',un:''}
        userPorfile:function(o){
            var title="用户 "+o.un+" 的资料",
                    mapp=JDBS.Apps.MainApp,
                    id=mapp.NameRules.friendProfile+o.uid+"_"+o.ut;
                    var q={
                        id_9dsoft:o.uid,
                        action:"getfunc",
                        todo:"PublicProfile",
                        ctnid:id
                    };
                    JDBS.Apps.Funcs.CallServerFunc({
                        id:id,
                        title:title,
                        iconCls:"iconCls_menu_profile",
                        autoLoad:{
                            url:JDBS.Apps.MainApp.HandleAjaxUrl,
                            scripts:true,
                            nocache:true,
                            params:q,
                            method:"GET"
                        }
                    });            
        },
        searchFriend:function(){
            
            var title="查找添加好友",
            mapp=JDBS.Apps.MainApp,
            id=mapp.NameRules.searchFriend;
            var q={
                action:"getfunc",
                todo:"searchFriend",
                ctnid:id
            };
            JDBS.Apps.Funcs.CallServerFunc({
                        id:id,
                        title:title,
                        iconCls:"iconCls_search",
                        autoLoad:{
                            url:JDBS.Apps.MainApp.HandleAjaxUrl,
                            scripts:true,
                            nocache:true,
                            params:q,
                            method:"GET"
                        }
                    });            
        },
        //播放声音 o
        //{s:1,t:2} s:声音类型 1:新消息通知 t:播放次数
        playSound:function(o){
          if (this.config.sound==0) return false;
          o = o ||{};
          Ext.applyIf(o,{s:1,t:1});
          var sound;
          switch (o.s){
           case 1:{
                 sound=Ext.fly("JDBSIM_NewMsgAlert").dom;
               break;
           }
          }
          if (Ext.isIE) {    
              sound.volume = 0;
            sound.loop=o.t;
              sound.src = sound.src;
          }
        }    
        }
    }
();

转载于:https://www.cnblogs.com/winner/archive/2008/11/08/1329450.html

EXTJS实现的WEBQQ可以传文件了哈相关推荐

  1. EXTJS+ASP.NET上传文件带实时进度条代码

    一,文件夹 二,upLoad.cs是继承IHttpModule的类: usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usin ...

  2. Extjs 扩展Htmleditor,支持 图片上传 文件上传 插入flash 插入多媒体 插入层 插入横线等功能...

    去年对Extjs的富文本框编辑器htmleditor做过扩展,扩展成图片上传和文件上传功能,感觉功能还是不够,原文如下: http://hi.baidu.com/jackvoilet/blog/ite ...

  3. EXTJS+JSP上传文件带进度条

    需求来源是这样的:上传一个很大的excel文件到server, server会解析这个excel, 然后一条一条的插入到数据库,整个过程要耗费很长时间,因此当用户点击上传之后,需要显示一个进度条,并且 ...

  4. Extjs 扩展Htmleditor,支持 图片上传 文件上传 插入flash 插入多媒体 插入层 插入横线等功能

    最近在做项目的时候感觉还是不完美,于是在此基础上又进行了扩展,目前CJ_StarHtmlEditor支持: 图片上传 文件上传 插入flash 插入多媒体 插入层 插入横线等功能,基本上能够满足要求了 ...

  5. php+easyui+上传文件,easyui 上传文件代码

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO ...

  6. smartupload 上传文件时 把页面编码改成gbk 解决乱码

    快来java1234 吧 smartupload 上传文件时,经常会发生因为把表单设置为 enctype="multipart/form-data"而出现的中文乱码问题,本人头疼好 ...

  7. 关于上传文件的跨域问题

    在进行新框架开发的过程中,需要自定义页面组件实现脱离表单的文件(图片)上传,考虑过wex5自带的attachmentsimple的自定义写法很难受,就改用了第三方插件webuploader来实现选择文 ...

  8. html web上传文件原理,Web上传文件的原理及实现

    本文为原创,如需转载,请注明作者和出处,谢谢! 现在有很多Web程序都有上传功能,实现上传功能的组件或框架也很多,如基于java的Commons FileUpload.还有Struts1.x和Stru ...

  9. android使用webview上传文件,Android项目中如何在webview页面中上传文件

    Android项目中如何在webview页面中上传文件 发布时间:2020-11-26 15:56:27 来源:亿速云 阅读:68 作者:Leah 本篇文章为大家展示了Android项目中如何在web ...

最新文章

  1. 解决MySQL报错ERROR 2002 (HY000)【转】
  2. inputstream 初始化_MyBatis初始化之加载初始化
  3. ASP.NET MVC 3 RC发布
  4. python Json的一点收获,自定义序列化方法
  5. 在Eclipse里搭建Scala开发环境
  6. AI队列长度检测:使用YOLO进行图像中的对象检测
  7. js中文乱码解决方法
  8. java mina框架_Mina框架在项目中的使用(一)
  9. C# CAD批量转换为图片
  10. 全国各地电信DNS服务器地址:
  11. 论文写作中Word设置公式居中编号右对齐保姆级教程
  12. Laravel查询构造器的pluck方法第一个参数可选类型array的问题
  13. 【python爬虫】学习笔记1-爬取某网站妹子图片
  14. 干货 | 京东云托管Kubernetes集成镜像仓库并部署原生DashBoard
  15. TikTok与抖音有什么不同?为什么TikTok被称为“海外版抖音”?
  16. 腾讯云服务器发布hexo
  17. 七种常见的逻辑门真值表
  18. 谷歌时代结束 - Google中国名称已经改回
  19. 团队与协作的一些思考
  20. 华为手机日历倒计时_华为手机日历怎么设置生日和纪念日提醒?敬业签支持多方式提醒...

热门文章

  1. mysql星火_mysql的执行计划
  2. python中add函数_如何使用python中的add函数?
  3. 高性能服务器编程代码清单9-3,JRockit JVM优化清单/调优指南
  4. ipython官网_IPython Notebook快速搭建
  5. aws主机php环境搭建,亚马逊AWS上安装Nginx(Linux,CentOS环境)
  6. hector slam matlab,如何使用hector slam算法包
  7. java随机生成不重复的数组_Java生成不重复的随机数组的方法
  8. 五、cookie和web缓存
  9. 监督分类空白处也被分类了_用于半监督短文本分类的异构图注意网络
  10. 关于element-ui 中使用Notice组件(Message、MessageBox、Notification)所遇到的坑