Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / editor / plugins / CollapsibleToolbar.js

History | View | Annotate | Download (3.57 KB)

1 9 andrej.cim
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6
7
8
if(!dojo._hasResource["dojox.editor.plugins.CollapsibleToolbar"]){
9
dojo._hasResource["dojox.editor.plugins.CollapsibleToolbar"]=true;
10
dojo.provide("dojox.editor.plugins.CollapsibleToolbar");
11
dojo.require("dijit._Widget");
12
dojo.require("dijit._Templated");
13
dojo.require("dijit._editor._Plugin");
14
dojo.requireLocalization("dojox.editor.plugins","CollapsibleToolbar",null,"ROOT,ro");
15
dojo.declare("dojox.editor.plugins._CollapsibleToolbarButton",[dijit._Widget,dijit._Templated],{templateString:"<div tabindex='0' role='button' title='${title}' class='${buttonClass}' "+"dojoAttachEvent='ondijitclick: onClick'><span class='${textClass}'>${text}</span></div>",title:"",buttonClass:"",text:"",textClass:"",onClick:function(e){
16
}});
17
dojo.declare("dojox.editor.plugins.CollapsibleToolbar",dijit._editor._Plugin,{_myWidgets:null,setEditor:function(_1){
18
this.editor=_1;
19
this._constructContainer();
20
},_constructContainer:function(){
21
var _2=dojo.i18n.getLocalization("dojox.editor.plugins","CollapsibleToolbar");
22
this._myWidgets=[];
23
var _3=dojo.create("table",{style:{width:"100%"},tabindex:-1,"class":"dojoxCollapsibleToolbarContainer"});
24
var _4=dojo.create("tbody",{tabindex:-1},_3);
25
var _5=dojo.create("tr",{tabindex:-1},_4);
26
var _6=dojo.create("td",{"class":"dojoxCollapsibleToolbarControl",tabindex:-1},_5);
27
var _7=dojo.create("td",{"class":"dojoxCollapsibleToolbarControl",tabindex:-1},_5);
28
var _8=dojo.create("td",{style:{width:"100%"},tabindex:-1},_5);
29
var m=dojo.create("span",{style:{width:"100%"},tabindex:-1},_8);
30
var _9=new dojox.editor.plugins._CollapsibleToolbarButton({buttonClass:"dojoxCollapsibleToolbarCollapse",title:_2.collapse,text:"-",textClass:"dojoxCollapsibleToolbarCollapseText"});
31
dojo.place(_9.domNode,_6);
32
var _a=new dojox.editor.plugins._CollapsibleToolbarButton({buttonClass:"dojoxCollapsibleToolbarExpand",title:_2.expand,text:"+",textClass:"dojoxCollapsibleToolbarExpandText"});
33
dojo.place(_a.domNode,_7);
34
this._myWidgets.push(_9);
35
this._myWidgets.push(_a);
36
dojo.style(_7,"display","none");
37
dojo.place(_3,this.editor.toolbar.domNode,"after");
38
dojo.place(this.editor.toolbar.domNode,m);
39
this.openTd=_6;
40
this.closeTd=_7;
41
this.menu=m;
42
this.connect(_9,"onClick","_onClose");
43
this.connect(_a,"onClick","_onOpen");
44
},_onClose:function(e){
45
if(e){
46
dojo.stopEvent(e);
47
}
48
var _b=dojo.marginBox(this.editor.domNode);
49
dojo.style(this.openTd,"display","none");
50
dojo.style(this.closeTd,"display","");
51
dojo.style(this.menu,"display","none");
52
this.editor.resize({h:_b.h});
53
if(dojo.isIE){
54
this.editor.header.className=this.editor.header.className;
55
this.editor.footer.className=this.editor.footer.className;
56
}
57
dijit.focus(this.closeTd.firstChild);
58
},_onOpen:function(e){
59
if(e){
60
dojo.stopEvent(e);
61
}
62
var _c=dojo.marginBox(this.editor.domNode);
63
dojo.style(this.closeTd,"display","none");
64
dojo.style(this.openTd,"display","");
65
dojo.style(this.menu,"display","");
66
this.editor.resize({h:_c.h});
67
if(dojo.isIE){
68
this.editor.header.className=this.editor.header.className;
69
this.editor.footer.className=this.editor.footer.className;
70
}
71
dijit.focus(this.openTd.firstChild);
72
},destroy:function(){
73
this.inherited(arguments);
74
if(this._myWidgets){
75
while(this._myWidgets.length){
76
this._myWidgets.pop().destroy();
77
}
78
delete this._myWidgets;
79
}
80
}});
81
dojo.subscribe(dijit._scopeName+".Editor.getPlugin",null,function(o){
82
if(o.plugin){
83
return;
84
}
85
var _d=o.args.name.toLowerCase();
86
if(_d==="collapsibletoolbar"){
87
o.plugin=new dojox.editor.plugins.CollapsibleToolbar({});
88
}
89
});
90
}