source: ZMS/trunk/import/LgContentReport-1.0.1.metaobj.xml @ 1628

Revision 1628, 14.6 KB checked in by zmsdev, 10 months ago (diff)

applied fix for invalid xml by titles containing &

Line 
1<?xml version="1.0" encoding="utf-8"?>
2
3<dictionary>
4  <item key="key"><![CDATA[LgContentReport]]></item>
5  <item key="value" type="dictionary">
6    <dictionary>
7      <item key="__obj_attrs__" type="list">
8        <list>
9          <item type="dictionary">
10            <dictionary>
11              <item key="custom">
12                <data content_type="image/png" filename="ZMSplus.png" type="file">89504e470d0a1a0a0000000d4948445200000010000000100802000000909168360000000674524e5300ff00a300b1c39aa03e000000fe49444154789c63fcbf78230329808924d5e468603c7386741b8c8dff4310840d9783b39115b03030309c3dcb88267df62c231a17dd0fc8a210d5685cb87e264c33e0762273e176b2203b174dddaf3f7f5efe59b3ffe2e68f5fdffffef3fbc39ac29a10bca1f4f4d7f20b4f771a6b9aca08a9eebfbafef895c396b2c1f8e261c3d145061a067f99feea4bbafe65fc6da96bb5f6f00216e3eb3893c6abf7f5ac8c3c9e9ac90c0c0cc5ceb3375f9ef6ebf7267c36bcfbf8feeab3a31dbb131818183a7625dc7d75918d951d9f8618d7f4e3978eb131b06cbe3c8d8d91e5f08583c1b6098cf853eb64ee8beb8e2cfaf6e30b17074f904d5cee577d021a3001005b3185921b685ad90000000049454e44ae426082</data>
13              </item>
14              <item key="id"><![CDATA[icon]]></item>
15              <item key="mandatory" type="int">0</item>
16              <item key="multilang" type="int">0</item>
17              <item key="name"><![CDATA[Icon]]></item>
18              <item key="repetitive" type="int">0</item>
19              <item key="type"><![CDATA[resource]]></item>
20            </dictionary>
21          </item>
22          <item type="dictionary">
23            <dictionary>
24              <item key="id"><![CDATA[_records]]></item>
25              <item key="mandatory" type="int">1</item>
26              <item key="multilang" type="int">0</item>
27              <item key="name"><![CDATA[Records]]></item>
28              <item key="repetitive" type="int">0</item>
29              <item key="type"><![CDATA[list]]></item>
30            </dictionary>
31          </item>
32          <item type="dictionary">
33            <dictionary>
34              <item key="custom"><![CDATA[<dtml-comment>--// BO renderShort //--</dtml-comment>
35
36<div id="<dtml-var meta_id>">
37
38<script>
39
40/**
41 * Set interactions blocked.
42 */
43var interactionsBlocked = 0;
44function setInteractionsBlocked(blocked) {
45        if (blocked) {
46                if (interactionsBlocked == 0) {
47                        // Set wait-cursor.
48                        $(document.body).css( "cursor", "wait");
49                        // Disable form input-fields.
50                        $("div#<dtml-var meta_id> input,div#<dtml-var meta_id> select").attr("disabled","disabled");
51                }
52                interactionsBlocked += 1;
53        }
54        else {
55                if (interactionsBlocked > 0) {
56                        interactionsBlocked -= 1;
57                }
58                if (interactionsBlocked == 0) {
59                        // Reset wait-cursor.
60                        $(document.body).css( "cursor", "auto");
61                        // Enable form input-fields.
62                        $("div#<dtml-var meta_id> input,div#<dtml-var meta_id> select").removeAttr("disabled");
63                }
64        }
65}
66
67
68function setProgressbox(selector) {
69        if (typeof selector == "string") {
70                selector = $(selector);
71        }
72        selector.html(
73                        '<img src="<dtml-var MISC_ZMS>loading_16x16.gif" alt="<dtml-var "getZMILangStr('MSG_LOADING')">" title="<dtml-var "getZMILangStr('MSG_LOADING')">" border="0" align="absmiddle"/> '+
74                        '<dtml-var "getZMILangStr('MSG_LOADING')"> '
75                );
76}
77
78function writeSystemMsg(system_msg) {
79        $('span#local_msg_text').html(system_msg+" ("+(new Date())+")");
80        $('div#local_msg').show();
81        window.scrollTo(0,0);
82        window.setTimeout("$('div#local_msg').hide('slow')",5000);
83}
84
85function zmiInitPages() {
86        setInteractionsBlocked(true);
87        $.get("<dtml-var absolute_url>/{$}",{lang:zmiParams["lang"],self:1,ts:new Date()},function(result) {
88                        var html = zmiAddPages(result,false);
89                        $("#myDiv").html(html);
90                        setInteractionsBlocked(false);
91                });
92}
93
94function zmiAddPages(result, siblings) {
95        var html = "";
96        $("page",result).each(function() {
97                        var abs_url = $(this).attr("absolute_url");
98                        html += '<div id="div_'+$(this).attr("id")+'" style="padding:1px 2px 1px 8px; margin:0">';
99                        html += '<span onclick="zmiExpandObject(\''+$(this).attr("id")+'\',\''+$(this).attr("path")+'\');" style="cursor:pointer">';
100                        html += '<img src="/misc_/zms/pl.gif" title="+" border="0" align="absmiddle"/>';
101                        html += '</span>';
102                        html += '<a style="text-decoration:none;" href="'+abs_url+'/manage_main?lang=<dtml-var lang>" target="_blank" class="zmi">';
103                        html += '<img src="'+$(this).attr("display_icon")+'" title="'+$(this).attr("display_type")+'" align="absmiddle"/>';
104                        if ($(this).attr("meta_id") == "ZMS") {
105                                html += '<strong>'+$(this).attr("id").substr(0,$(this).attr("id").indexOf("_"))+'</strong>: ';
106                        }
107                        html += $(this).attr("titlealt");
108                        html += '</a>';
109                        html += '<span title="Total Node Size">&nbsp;&sum;&thinsp;'
110                        html += $(this).attr("size_str");
111                        if ( $(this).attr("bin") != "0" && $(this).attr("bin") != "?") {
112                                html += ' <span title="Binary Size">('+$(this).attr("bin_str") + ')</span>';
113                        }
114                        if ( $(this).attr("subobjects") != "1") {
115                                html += ' '+$(this).attr("subobjects")+' <dtml-var "getZMILangStr('ATTR_OBJECTS')">';
116                        }
117                        html += ' </span>'
118                        html += '<div id="div_'+$(this).attr("id")+'_children" style="'+(siblings?'display:none;':'')+'padding:1px 2px 1px 8px; margin:0">';
119                        if (siblings) {
120                                html += '</div>';
121                                html += '</div>';
122                        }
123                });
124        $("page",result).each(function() {
125                        if (!siblings) {
126                                html += '</div>';
127                                html += '</div>';
128                        }
129                });
130        return html;
131}
132
133function zmiExpandObject(id,path) {
134        var $img = $("#div_"+id+" img:first");
135        if ($img.attr("title").length==1) {
136                var $div = $("#div_"+id+"_children");
137                if ($img.attr("title")=="+") {
138                        $div.show("normal");
139                        $img.attr({src:"/misc_/zms/mi.gif",title:"-"});
140                        setProgressbox($div);
141                        setInteractionsBlocked(true);
142                        $.get("<dtml-var absolute_url>/"+path,{lang:zmiParams["lang"],ts:new Date()},function(result) {
143                                        var html = zmiAddPages(result,true);
144                                        if (html.length==0) {
145                                                $img.attr({src:"/misc_/zms/spacer.gif",title:""}).css({width:"16px",height:"16px"});
146                                        }
147                                        $div.html(html).addClass("loaded");
148                                        setInteractionsBlocked(false);
149                                });
150                }
151                else {
152                        $div.hide("normal");
153                        $img.attr({src:"/misc_/zms/pl.gif",title:"+"});
154                }
155        }
156}
157
158function zmiIndexObject() {
159        $("div#local_msg").show();
160        setProgressbox("div#local_msg_text");
161        setInteractionsBlocked(true);
162        $.get("<dtml-var absolute_url>/manage_index<dtml-var meta_id>",{lang:zmiParams["lang"]},function(result){
163                writeSystemMsg(result);
164                $("input#zmi_index_object_btn").removeAttr("disabled").show("normal");
165                zmiInitPages();
166                setInteractionsBlocked(false);
167        });
168        return false;
169}
170
171$(function(){
172        zmiInitPages();
173        <dtml-if "len(attr('_records'))==0">
174        zmiIndexObject();
175        </dtml-if>
176});
177
178</script>
179
180<div id="local_msg" style="display:none;padding:0.3em;" class="ui-state-highlight ui-corner-all">
181<span class="ui-icon ui-icon-info" style="float:left; margin-right:0.3em;"></span>
182<span id="local_msg_text"></span>
183</div>
184<div id="myDiv"></div>
185<hr size="1"/>
186<input id="zmi_index_object_btn" type="submit" value="<dtml-var "getZMILangStr('BTN_REFRESH')">" onclick="return zmiIndexObject();"/>
187
188</div><!-- #<dtml-var meta_id> -->
189
190<dtml-comment>--// EO renderShort //--</dtml-comment>]]>
191              </item>
192              <item key="id"><![CDATA[renderShort]]></item>
193              <item key="mandatory" type="int">0</item>
194              <item key="multilang" type="int">0</item>
195              <item key="name"><![CDATA[ZMI: Render short]]></item>
196              <item key="repetitive" type="int">0</item>
197              <item key="type"><![CDATA[method]]></item>
198            </dictionary>
199          </item>
200          <item type="dictionary">
201            <dictionary>
202              <item key="custom"><![CDATA[## Script (Python) "LgContentReport.onChangeObjEvt"
203##bind container=container
204##bind context=context
205##bind namespace=
206##bind script=script
207##bind subpath=traverse_subpath
208##parameters=zmscontext
209##title=py: Event: onChangeObj
210##
211# --// BO onChangeObjEvt //--
212
213request = zmscontext.REQUEST
214zmscontext.commitObj(request)
215
216# --// EO onChangeObjEvt //--
217]]>
218              </item>
219              <item key="id"><![CDATA[onChangeObjEvt]]></item>
220              <item key="mandatory" type="int">0</item>
221              <item key="multilang" type="int">0</item>
222              <item key="name"><![CDATA[Event: onChangeObj]]></item>
223              <item key="py"><![CDATA[<PythonScript at LgContentReport.onChangeObjEvt>]]></item>
224              <item key="repetitive" type="int">0</item>
225              <item key="type"><![CDATA[py]]></item>
226            </dictionary>
227          </item>
228          <item type="dictionary">
229            <dictionary>
230              <item key="custom"><![CDATA[## Script (Python) "LgContentReport.active"
231##bind container=container
232##bind context=context
233##bind namespace=
234##bind script=script
235##bind subpath=traverse_subpath
236##parameters=zmscontext
237##title=py: Active
238##
239# --// BO active //--
240
241return True
242
243# --// EO active //--
244]]>
245              </item>
246              <item key="id"><![CDATA[active]]></item>
247              <item key="mandatory" type="int">0</item>
248              <item key="multilang" type="int">0</item>
249              <item key="name"><![CDATA[Active]]></item>
250              <item key="py"><![CDATA[<PythonScript at LgContentReport.active>]]></item>
251              <item key="repetitive" type="int">0</item>
252              <item key="type"><![CDATA[py]]></item>
253            </dictionary>
254          </item>
255          <item type="dictionary">
256            <dictionary>
257              <item key="custom"><![CDATA[## Script (Python) "LgContentReport.pathhandler"
258##bind container=container
259##bind context=context
260##bind namespace=
261##bind script=script
262##bind subpath=traverse_subpath
263##parameters=zmscontext
264##title=py: PathHandler
265##
266# --// BO pathhandler //--
267
268request = container.REQUEST
269RESPONSE = request.RESPONSE
270RESPONSE.setHeader('Cache-Control','no-cache')
271
272path_ = request['path_']
273ob_ = zmscontext.getLinkObj(path_)
274xml = '<pages path_="'+path_+'">'
275root = zmscontext.getDocumentElement()
276records = zmscontext.attr('_records')
277obs = []
278if request.get('self'):
279  obs.append(ob_)
280else:
281  obs.extend(ob_.getChildNodes())
282  if ob_.meta_id == 'ZMS':
283    obs.extend(ob_.getPortalClients())
284for ob in obs:
285  ob_path = root.getRefObjPath(ob)
286  ob_item = {}
287  ob_display_type = ob.display_type(request)
288  ob_titlealt = ob.attr('titlealt')
289  if not ob_titlealt:
290    ob_titlealt = ob_display_type
291  for f in filter(lambda x: x['path']==ob_path, records):
292    ob_item = f
293  subobjects = filter(lambda x: x['path'].startswith(ob_path[:-1]),records)
294  bin = sum(map(lambda x: x['bin'],subobjects))
295  xml += '<page'
296  xml += ' id="'+ob.getHome().id+'_'+ob.id+'"'
297  xml += ' absolute_url="'+ob.absolute_url()+'"'
298  xml += ' path="'+ob_path+'"'
299  xml += ' titlealt="'+ob_titlealt.replace('&','&amp;')+'"'
300  xml += ' display_type="'+ob_display_type.replace('&','&amp;')+'"'
301  xml += ' display_icon="'+ob.display_icon(request)+'"'
302  xml += ' meta_id="'+ob.meta_id+'"'
303  xml += ' size="'+str(ob_item.get('size','?'))+'"'
304  xml += ' size_str="'+ob.getDataSizeStr(ob_item.get('size',0))+'"'
305  xml += ' bin="'+str(bin)+'"'
306  xml += ' bin_str="'+ob.getDataSizeStr(bin)+'"'
307  xml += ' subobjects="'+str(len(subobjects))+'"'
308  xml += '>'
309  xml += '</page>'
310xml += '</pages>'
311
312return zmscontext.FileFromData(xml,content_type='text/xml;charset=utf-8')
313
314# --// EO pathhandler //--
315]]>
316              </item>
317              <item key="id"><![CDATA[pathhandler]]></item>
318              <item key="mandatory" type="int">0</item>
319              <item key="multilang" type="int">0</item>
320              <item key="name"><![CDATA[PathHandler]]></item>
321              <item key="py"><![CDATA[<PythonScript at LgContentReport.pathhandler>]]></item>
322              <item key="repetitive" type="int">0</item>
323              <item key="type"><![CDATA[py]]></item>
324            </dictionary>
325          </item>
326          <item type="dictionary">
327            <dictionary>
328              <item key="custom"><![CDATA[## Script (Python) "manage_indexLgContentReport"
329##bind container=container
330##bind context=context
331##bind namespace=
332##bind script=script
333##bind subpath=traverse_subpath
334##parameters=
335##title=Index
336##
337# --// BO manage_indexLgContentReport //--
338
339def processObjects(root, self):
340  d = {}
341  path = root.getRefObjPath(self)
342  size = len(self.aq_parent.manage_exportObject(id=self.id,download=1,toxml=None,RESPONSE=None,REQUEST=request))
343  bin = 0
344  for key in self.getObjAttrs().keys():
345    obj_attr = self.getObjAttr(key)
346    if obj_attr['datatype'] in ['file','image']:
347      v = self.attr(key)
348      if v is not None:
349        bin += v.get_real_size()
350  d['path'] = path
351  d['size'] = size
352  d['bin'] = bin
353  l = [d]
354  for ob in self.objectValues(self.dGlobalAttrs.keys()):
355    l.extend(processObjects(root,ob))
356  if self.meta_id == 'ZMS':
357    for ob in self.getPortalClients():
358      l.extend(processObjects(root,ob))
359  return l
360
361request = context.REQUEST
362report = context.getSelf()
363
364root = report.getDocumentElement()
365l = processObjects(root,root)
366
367report.setObjStateModified(request)
368report.setObjProperty('_records',l)
369report.onChangeObj(request)
370
371return "Indexed %i objects"%len(l)
372
373# --// EO manage_indexLgContentReport //--
374]]>
375              </item>
376              <item key="id"><![CDATA[manage_indexLgContentReport]]></item>
377              <item key="mandatory" type="int">0</item>
378              <item key="multilang" type="int">0</item>
379              <item key="name"><![CDATA[Index]]></item>
380              <item key="repetitive" type="int">0</item>
381              <item key="type"><![CDATA[Script (Python)]]></item>
382            </dictionary>
383          </item>
384        </list>
385      </item>
386      <item key="access" type="dictionary">
387        <dictionary>
388          <item key="delete" type="list">
389            <list>
390              <item><![CDATA[ZMSAdministrator]]></item>
391            </list>
392          </item>
393          <item key="delete_custom"></item>
394          <item key="edit" type="list">
395            <list>
396              <item><![CDATA[ZMSAdministrator]]></item>
397            </list>
398          </item>
399          <item key="edit_custom"></item>
400          <item key="insert" type="list">
401            <list>
402              <item><![CDATA[ZMSAdministrator]]></item>
403            </list>
404          </item>
405          <item key="insert_custom"><![CDATA[{$}]]></item>
406        </dictionary>
407      </item>
408      <item key="enabled" type="int">1</item>
409      <item key="id"><![CDATA[LgContentReport]]></item>
410      <item key="name"><![CDATA[Content-Report]]></item>
411      <item key="package"></item>
412      <item key="revision"><![CDATA[1.0.1]]></item>
413      <item key="type"><![CDATA[ZMSObject]]></item>
414    </dictionary>
415  </item>
416</dictionary>
Note: See TracBrowser for help on using the repository browser.