Wiki source code of AppDashboard

Version 8.1 by Anamaria Stoica on 2009/10/28 12:21

Show last authors
1 {{velocity}}
2 $xwiki.jsfx.use("js/smartclient/initsc.js", true)##
3 $xwiki.jsfx.use("js/smartclient/modules/ISC_Core.js")##
4 $xwiki.jsfx.use("js/smartclient/modules/ISC_Foundation.js")##
5 $xwiki.jsfx.use("js/smartclient/modules/ISC_Containers.js")##
6 $xwiki.jsfx.use("js/smartclient/modules/ISC_Grids.js")##
7 $xwiki.jsfx.use("js/smartclient/modules/ISC_Forms.js")##
8 $xwiki.jsfx.use("js/smartclient/modules/ISC_DataBinding.js")##
9 $xwiki.jsfx.use("js/smartclient/skins/Enterprise/load_skin.js")##
10 $xwiki.ssx.use("Google+Gadget+and+OpenSocial+Integration.AppDashboard")
11 #set($oo = $doc.newObject('XWiki.StyleSheetExtension'))
12 $oo.set('code', '#HTMLWrapper table tr td { border: 0pt none; margin: 0px; padding: 0px; line-height: 0.9em; } #HTMLWrapper table { margin: 0px; } #actionmenu { z-index:300000; }')
13 $doc.save()
14 {{html}}
15 <style type="text/css">
16 #HTMLWrapper table tr td {
17 border: 0pt none;
18 margin: 0px; padding: 0px;
19 line-height: 0.9em;
20 }
21
22 #HTMLWrapper table {
23 margin: 0px;
24 }
25
26 #actionmenu {
27 z-index:300000;
28 }
29 </style>
30 <script>
31 //===========================================================================
32 // GadgetWindow class definition
33 //===========================================================================
34
35 isc.defineClass("GadgetWindow", "Window").addMethods({
36
37 autoDraw:false,
38 showShadow:false,
39
40 // enable predefined component animation
41 animateMinimize:true,
42
43 // Window is draggable with "outline" appearance by default.
44 // "target" is the solid appearance.
45 dragAppearance:"outline",
46 canDrop:true,
47
48 // customize the appearance and order of the controls in the window header
49 // (could do this in load_skin.js instead)
50 headerMembers:["minimizeButton", "headerLabel", "closeButton"],
51
52 // show either a shadow, or translucency, when dragging a gadget
53 // (could do both at the same time, but these are not visually compatible effects)
54 //showDragShadow:true,
55 dragOpacity:30,
56
57 // these settings enable the gadget to autosize its height only to fit its contents
58 // (since width is determined from the containing layout, not the gadget contents)
59 vPolicy:"none",
60 overflow:"visible",
61 bodyProperties:{overflow:"visible"}
62
63 });
64
65 //===========================================================================
66 // GadgetDashboardColumn class definition
67 //===========================================================================
68
69 isc.defineClass("GadgetDashboardColumn", "VStack").addMethods({
70
71 // leave some space between gadgets
72 membersMargin:6,
73
74 // enable predefined component animation
75 animateMembers:true,
76 animateMemberTime:750,
77
78 // enable drop handling
79 canAcceptDrop:true,
80
81 // change appearance of drag placeholder and drop indicator
82 dropLineThickness:4,
83 dropLineProperties:{backgroundColor:"lightgreen"},
84 showDragPlaceHolder:true,
85 placeHolderProperties:{border:"2px solid #8289A6"}
86
87 });
88
89
90 //===========================================================================
91 // GadgetDashboardLayout class definition
92 //===========================================================================
93
94 isc.defineClass("GadgetDashboardLayout", "HLayout").addMethods({
95 numColumns:2,
96 membersMargin:6,
97 initWidget : function () {
98 this.Super("initWidget", arguments);
99 // create multiple GadgetDashboardColumn components
100 for (var i = 0; i < this.numColumns; i++) {
101 this.addMember(isc.GadgetDashboardColumn.create({autoDraw:false, width:"*"}));
102 }
103 },
104 addGadget : function (gadget, addToTop) {
105 var fewestGadgets = 999999,
106 fewestGadgetsColumn;
107 // find the column with the fewest gadgets
108 for (var i=0; i < this.members.length; i++) {
109 var numGadgets = this.getMember(i).members.length;
110 if (numGadgets < fewestGadgets) {
111 fewestGadgets = numGadgets;
112 fewestGadgetsColumn = this.getMember(i);
113 }
114 }
115 fewestGadgetsColumn.addMember(gadget, (addToTop ? 0 : null));
116 return fewestGadgetsColumn;
117 }
118 });
119
120 </script>
121
122 <div id="HTMLWrapper">
123 <script>
124 isc.HLayout.create({
125 ID: "dashboardContainer",
126 position: "relative",
127 width: "980px",
128 height: "100%",
129 layoutMargin: 10,
130 membersMargin: 10,
131 members: [
132 isc.GadgetDashboardLayout.create({
133 ID: "dashboard",
134 autoDraw: false,
135 numColumns: 3
136 })
137 ]
138 }).draw();
139 </script>
140 </div>
141
142 <script>
143 // add 5 gadgets
144 for(var i=0; i<5; i++) {
145 // create a new Gadget
146 var newGadget = isc.GadgetWindow.create({
147 ID: "OpenSocialGadget" + i,
148 title: "OpenSocial Gadget" + i,
149 items:[
150 // simple fake Gadget contents - could put anything here
151 isc.HTMLFlow.create({
152 autoDraw:false, align:"center", layoutAlign:"center",
153 contents: "I'm a <b>OpenSocial <i>Gadget</i></b>'s content!"
154 })
155 ]
156 });
157
158 // insert the Gadget in the content area, but keep it hidden for now
159 newGadget.hide();
160 var column = dashboard.addGadget(newGadget, true);// add to top
161 newGadget.show();
162 }
163
164 </script>
165
166 {{/html}}
167 {{/velocity}}