Exemple #1
0
def collectionListItem(iter, divClassName = u"thumbDiv", imgClass=u"thumbImage", tagName=u"li"):
    thumbViewScript = u"http://localhost:8803/thumb?path="
    res = ""
    for i in iter:
        res +=u'<%s class="%s">'%(tagName, divClassName+ " ui-widget-content")
        t = tagSystem.tagSystemShoveDb()
        tList = t.getTags(i)
        tagStr = u""
        '''
        for k in tList:
            tagStr += k.decode('utf8')
        '''
        tagStr = u','.join(tList)
        '''
        res += '<div class="elementTag" path=%s>'%urllib.quote(i)
        res += ','.join(tList)
        res += 'default'
        res += '</div>'
        '''
        if tagStr == u"":
            tagStr = u"input tag"
        res += u'<img class="%s" src="%s%s" path="%s"/><p class="tagEditor">%s</p><div class="placeholder"></div>'%(imgClass, 
            thumbViewScript, urllib.quote(i.encode('gbk')), i, tagStr)#first encode the str, so the browser can decode the string to local encoding
        res += u'</%s>\n'%tagName
    return res
Exemple #2
0
def main():
    dbSysInst = dbSys.dbSysSmart()
    newDbSysInst = newDbSys.dbSysSmart()
    dbNew = tagSys.tagSystemShoveDb(newDbSysInst)
    dbOld = tagSys.tagSystemShoveDb(dbSysInst, dbSupportsCnt=True)
    res = {}
    
    for i,j in dbOld.getAllTags():
        print 'find tag:',i,j
        for url in dbOld.enumObjsWithTag(i):
            print url.encode('gbk','replace'),i.encode('gbk','replace'),j
            if res.has_key(url):
                res[url].append(i)
            else:
                res[url] = [i]
            
    for i in res:
        if os.path.exists(i):
            dbNew.tag(i, list(set(res[i])))
            pass
        else:
            print i.encode('gbk','replace'), str(list(set(res[i]))).encode('gbk','replace')
Exemple #3
0
import libSys
import libs.http.queryParam
import libs.html.response
import libs.tag.tagSystemV2 as tagSystem
from desktopApp.lib.transform import *
import urllib


if __name__=='__main__':
    fields = libs.http.queryParam.queryInfo().getAllFieldStorage()
    h = libs.html.response.html()
    h.genTxtHead()
    fullPath = urllib.unquote(fields["path"][0])
    fullPath = transformDirToInternal(fullPath)
    #print fullPath
    t = tagSystem.tagSystemShoveDb()
    print '{"path":"%s","tags":"%s"}'%(fullPath, ','.join(t.getTags(fullPath)))
    h.end()