")
distribution = ( maxcount - mincount ) / 6
for tag in tagcount.keys():
size = "mediumTag"
if tag != "untagged":
if ( len(tagcount[tag]) == maxcount ):
size = "mostHugeTag"
elif ( len(tagcount[tag]) > ( mincount + ( distribution * 5 ) ) ):
size = "hugestTag"
elif ( len(tagcount[tag]) > ( mincount + ( distribution * 4 ) ) ):
size = "hugeTag"
elif ( len(tagcount[tag]) > ( mincount + ( distribution * 3 ) ) ):
size = "biggestTag"
elif ( len(tagcount[tag]) > ( mincount + ( distribution * 2 ) ) ):
size = "bigTag"
elif ( len(tagcount[tag]) > ( mincount + distribution ) ):
size = "mediumTag"
elif ( len(tagcount[tag]) > mincount ):
size = "smallTag"
elif ( len(tagcount[tag]) == mincount ):
size = "smallestTag"
tagcloud.append( "
%s\n" % ( '%s%s' % ( tagurl,tag ), size, str(len(tagcount[tag])), tag, tag ) )
tagcloud.append("
")
result = "".join(tagcloud)
return result
def cb_filelist(args):
request = args['request']
config = request.getConfiguration()
data = request.getData()
new_files = [ ]
m = re.compile(r'^%s' % config['tag_url']).match(data['url'])
if m:
#tag = re.sub("%s" % config['tag_url'],'',data['url'])
(tag,) = re.findall("%s/(\w*)" % (config['tag_url'].rstrip('/'),), data['url'])
if tag in data['entrytagmap']:
return getEntriesForTag( tag, args )
def getEntriesForTag(tag,args):
request = args['request']
config = request.getConfiguration()
data = request.getData()
new_files = []
entrymap = data['entrytagmap']
for entry_location in entrymap[tag]:
tmpentry = entries.fileentry.FileEntry(request, entry_location, data['root_datadir'])
new_files.append(( tmpentry._mtime, tmpentry ))
if new_files:
new_files.sort()
new_files.reverse()
myentries = []
for myentry in new_files:
myentries.append( myentry[1] )
return myentries