Changeset 1135
- Timestamp:
- 06.08.2010 10:47:32 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMESS/overview/trunk/com/zms/overview/zms/overview.metaobj.xml
r1066 r1135 303 303 temp_act_char = '' 304 304 temp_chars = [] 305 temp_result = ''305 temp_result = [] 306 306 307 307 if ((item_list is not None) and (same_type(item_list, []))): … … 321 321 322 322 if (len(temp_result) > 0): 323 temp_result += '<br />'323 temp_result.append('<br />') 324 324 325 325 if (anchors): 326 temp_result += '<a href="#overview_top">nach oben</a><br /><br />'326 temp_result.append('<a href="#overview_top">nach oben</a><br /><br />') 327 327 328 temp_result += '<strong id="overview_%s">- %s -</strong><br /><br />\n'%(temp_act_char, temp_act_char)329 330 temp_result += '<a href="%s">%s</a><br />\n'%(one_item['url'], one_item['title'])328 temp_result.append('<strong id="overview_%s">- %s -</strong><br /><br />'%(temp_act_char, temp_act_char)) 329 330 temp_result.append('<a href="%s">%s</a><br />'%(one_item['url'], one_item['title'])) 331 331 332 return ( temp_result, temp_chars)332 return ('\n'.join(temp_result), temp_chars) 333 333 334 334 def renderIndexHead(char_list, alphabet = False, anchors = False): 335 temp_result = ''335 temp_result = [] 336 336 337 337 renderCell = lambda anchors, data: '<td>' + ((anchors) and ('<a href="#overview_%s">%s</a>'%(one_char, one_char)) or one_char) + '</td>' 338 338 339 339 if ((char_list is not None) and (context.operator_gettype(char_list) == context.operator_gettype([]))): 340 temp_result += '<table id="overview_top" class="ZMSTable"><tr>'340 temp_result.append('<table id="overview_top" class="ZMSTable"><tr>') 341 341 if (alphabet): 342 342 for one_index in range(ord('A'), ord('Z') + 1): 343 343 one_char = chr(one_index) 344 temp_result += renderCell(anchors and one_char in char_list, one_char)344 temp_result.append(renderCell(anchors and one_char in char_list, one_char)) 345 345 else: 346 346 for one_char in char_list: 347 temp_result += renderCell(anchors, one_char)347 temp_result.append(renderCell(anchors, one_char)) 348 348 349 temp_result += '</tr></table>'350 351 return temp_result349 temp_result.append('</tr></table>') 350 351 return '\n'.join(temp_result) 352 352 353 353 def renderTagcloud(item_list): … … 356 356 temp_min_count = None 357 357 temp_top_count = max(0, context.getObjProperty('ZMSTagcloud_keywordCount', REQUEST)) 358 temp_result = ''358 temp_result = [] 359 359 360 360 if ((item_list is not None) and (same_type(item_list, []))): … … 373 373 item_list = item_list[:temp_top_count] 374 374 375 temp_result = '<h4>%s</h4>\n'%((temp_top_count > 0) and 'Top %i Tags'%temp_top_count or 'Tagcloud') 375 # render tagcloud-div 376 temp_result.append('<div id="tagCloud_%s">'%context.getId()) 377 temp_result.append('<h4>%s</h4>'%((temp_top_count > 0) and 'Top %i Tags'%temp_top_count or 'Tagcloud')) 376 378 # render tags 377 379 item_list = context.sort_list(item_list, 'keyword') 378 380 for one_item in item_list: 379 temp_result += '<span class="tag%i">%s</span>\n'%( 380 int(7 * (len(one_item['reflist']) - temp_min_count) / ((temp_max_count == temp_min_count) and 1 or temp_max_count - temp_min_count)), one_item['keyword']) 381 382 return temp_result 381 temp_result.append('<span class="tag%i">%s</span>'%( 382 int(7 * (len(one_item['reflist']) - temp_min_count) / ((temp_max_count == temp_min_count) and 1 or temp_max_count - temp_min_count)), one_item['keyword'])) 383 384 temp_result.append('</div>') 385 # render tagcloud-items-div 386 temp_result.append('<div id="tagCloud_%s_items">'%context.getId()) 387 temp_result.append('<span>[«]</span>') 388 temp_result.append('<span>') 389 # add tag-items if request contains tag-parameter 390 temp_tag_name = REQUEST.form.get('tag', None) 391 if ((temp_tag_name is not None) and (len(temp_tag_name) > 0)): 392 item_list = context.filter_list(item_list, 'keyword', temp_tag_name, '==') 393 394 if (len(item_list) > 0): 395 item_list = item_list[0]['reflist'] 396 397 temp_result.append('<strong>%s</strong>'%temp_tag_name) 398 399 if (context.getObjProperty('ZMSTagcloud_sortLinks', REQUEST)): 400 item_list = context.sort_list(item_list, 'title') 401 402 temp_ref_list = [] 403 temp_result.append('<ul>') 404 #for one_item in [{'url' : x['url'], 'title' : unicode(x['title'], 'utf8'), 'date' : ((x['date'] != '') and DateTime(x['date']).strftime('%d.%m.%Y') or '')} for x in item_list[0]['reflist']]: 405 for one_item in item_list: 406 # filter out items with same url 407 if (not one_item['url'] in temp_ref_list): 408 temp_ref_list.append(one_item['url']) 409 temp_result.append('<li><a href="%s">%s</a>%s</li>'%(one_item['url'], one_item['title'], 410 ((one_item['date'] != '') and ' (ELLOG-Post vom %s)'%DateTime(one_item['date']).strftime('%d.%m.%Y') or ''))) 411 412 temp_result.append('</ul>') 413 414 temp_result.append('</span>') 415 temp_result.append('</div>') 416 417 return '\n'.join(temp_result) 383 418 384 419 def renderToc(item_list): 385 420 temp_base_level = (context.attr_overview_config.getObjProperty('ZMSOverviewConfig_startAtRoot', REQUEST) == True) and 1 or context.getLevel() 386 421 temp_level = 0 387 temp_result = ''422 temp_result = [] 388 423 389 424 if ((item_list is not None) and (same_type(item_list, []))): 390 425 for one_item in item_list: 391 426 temp_level = one_item['level'] - temp_base_level 392 temp_result +='<a href="%s"%s>%s</a><br />\n'%(one_item['url'], \393 (temp_level > 0) and ' style="margin-left: %iem;"'%temp_level or '', one_item['title'])394 395 return temp_result427 temp_result.append('<a href="%s"%s>%s</a><br />\n'%(one_item['url'], \ 428 (temp_level > 0) and ' style="margin-left: %iem;"'%temp_level or '', one_item['title'])) 429 430 return '\n'.join(temp_result) 396 431 397 432 ################################################################################################## … … 615 650 616 651 if (len(item_list) > 0): 617 temp_ref_list = [] 652 temp_ref_list = [] 618 653 # filter out items with same url 619 654 for one_item in [{'url' : x['url'], 'title' : unicode(x['title'], 'utf8'), 'date' : ((x['date'] != '') and DateTime(x['date']).strftime('%d.%m.%Y') or '')} for x in item_list[0]['reflist']]: … … 640 675 641 676 temp_result['tag'] = REQUEST.form['tag'] 677 642 678 temp_result['items'] = getRequestedItems(temp_overview_list, REQUEST.form['tag']) 643 679 … … 682 718 { 683 719 var temp_html = '<strong>' + data['tag'] + '</strong>\n'; 720 temp_html += '<ul>\n'; 684 721 for (var i = 0; i < data['items'].length; i++) 685 722 { … … 687 724 temp_html += (data['items'][i]['date'] != '') ? ' (ELLOG-Post vom ' + data['items'][i]['date'] + ')</li>\n' : ''; 688 725 } 726 temp_html += '</ul>'; 689 727 690 728 $tagcloud_items_obj.children('span:last-child').html(temp_html); … … 697 735 $(document).ready(function () 698 736 { 699 $('#tagCloud_<dtml-var "getId()">_items').hide(); 737 if ($('#tagCloud_<dtml-var "getId()">_items').find('span:last-child').find('li').length > 0) 738 $('#tagCloud_<dtml-var "getId()">').hide(); 739 else 740 $('#tagCloud_<dtml-var "getId()">_items').hide(); 700 741 701 742 $('#tagCloud_<dtml-var "getId()">').children('span').click(function(eventObj) … … 757 798 <item key="name"><![CDATA[Overview Library]]></item> 758 799 <item key="package"><![CDATA[com.zms.overview]]></item> 759 <item key="revision"><![CDATA[0. 4.1]]></item>800 <item key="revision"><![CDATA[0.5.0]]></item> 760 801 <item key="type"><![CDATA[ZMSLibrary]]></item> 761 802 </dictionary> … … 866 907 </script> 867 908 868 <div id="tagCloud_<dtml-var "getId()">"> 869 <dtml-var "ZMSOverviewLibrary_renderOverview()"> 870 </div> 871 <div id="tagCloud_<dtml-var "getId()">_items"> 872 <span>[«]</span> 873 <span></span> 874 </div> 909 <dtml-var "ZMSOverviewLibrary_renderOverview()"> 875 910 </dtml-if> 876 911 … … 930 965 <item key="name"><![CDATA[ZMSTagcloud]]></item> 931 966 <item key="package"><![CDATA[com.zms.overview]]></item> 932 <item key="revision"><![CDATA[0. 2.0]]></item>967 <item key="revision"><![CDATA[0.3.0]]></item> 933 968 <item key="type"><![CDATA[ZMSObject]]></item> 934 969 </dictionary> … … 1062 1097 </script> 1063 1098 1064 <div id="tagCloud_<dtml-var "getId()">"> 1065 <dtml-var "ZMSOverviewLibrary_renderOverview()"> 1066 </div> 1067 <div id="tagCloud_<dtml-var "getId()">_items"> 1068 <span>[«]</span> 1069 <span></span> 1070 </div> 1099 <dtml-var "ZMSOverviewLibrary_renderOverview()"> 1071 1100 </dtml-if> 1072 1101 … … 1126 1155 <item key="name"><![CDATA[ZMSTagcloudTeaser]]></item> 1127 1156 <item key="package"><![CDATA[com.zms.overview]]></item> 1128 <item key="revision"><![CDATA[0. 2.0]]></item>1157 <item key="revision"><![CDATA[0.3.0]]></item> 1129 1158 <item key="type"><![CDATA[ZMSTeaserElement]]></item> 1130 1159 </dictionary> … … 1239 1268 <item key="name"><![CDATA[com.zms.overview]]></item> 1240 1269 <item key="package"/> 1241 <item key="revision"><![CDATA[0. 5.1]]></item>1270 <item key="revision"><![CDATA[0.6.0]]></item> 1242 1271 <item key="type"><![CDATA[ZMSPackage]]></item> 1243 1272 </dictionary>
Note: See TracChangeset
for help on using the changeset viewer.
