示例#1
0
def jqueryListOnCollection(req):
    #Get request param: collectionId, start, cnt
    param = webUtils.paramWithDefault({u"collectionId":u"-1"}, req.getQueryInfo())
    #Get collection from system, collection system contains cached collections and filesystem collections.
    if not objTools.isUuid(param["collectionId"]):
        #It is not uuid://xxxx-xxx-xxx-xxx-xxxx-xxxx
        param["collectionId"] = stringTools.jsIdDecoding(param["collectionId"])
    #Output
    req.resp.genJsonHead()
    if param["collectionId"] == "-1":
        p = ufs.ufsTreeUuidItem()
    #res = path
    else:
        #p = desktopApp.lib.localTreeItem.localTreeItem(path.decode('utf8'))
        if objTools.isUfsUrl(param["collectionId"]):#try:
            p = ufsTreeItem.getUfsTreeItem(param["collectionId"], req)
            #print "after getufstreeitem"
            #res += str(p.listNamedChildren())
        else:#except ValueError:
            #No schema/protocol string. Normal dir
            p = jsTreeItemWithCollectionBackend.jsTreeItemWithCollectionBackend(param["collectionId"], None, req.getDbSys())
    #Get the checked elements in the tree
    try:
        co = collectionManager.getCollection(u"uuid://3b84d155-cc5c-428e-8009-12d5fdc68b2a", req.getDbSys()).getRange(0, None)
    except KeyError:
        co = []
    #print "before containerListJson"
    data = jsTreeNamedItemFunc.containerListJson(p, checkedItems=co)

    #print data
    if data == u"":
        raise "no item, raise exception to prevent loop query"
    req.resp.write(data)
    req.resp.end()
示例#2
0
 def get(self):
     path = self.request.get("path")#already changed to unicode
     path = jsIdEncoding(path)
     try:
         p = ufsTreeItem.getUfsTreeItem(path)
     except ValueError:
         #No schema/protocol string. Normal dir
         p = localTreeItem.localTreeItem(path)
示例#3
0
def jqueryListOnCollection(req):
    #Get request param: collectionId, start, cnt
    param = webUtils.paramWithDefault({u"collectionId":u"-1"}, req.getQueryInfo())
    #Get collection from system, collection system contains cached collections and filesystem collections.
    if not objTools.isUuid(param["collectionId"]):
        #It is not uuid://xxxx-xxx-xxx-xxx-xxxx-xxxx
        param["collectionId"] = stringTools.jsIdDecoding(param["collectionId"])
    #Output
    if gDebugFlag:
        h = libs.html.response.html()
        h.genHead('Collections')
    res = u""
    res += u'<!--'
    if param["collectionId"] == "-1":
        p = ufs.ufsTreeUuidItem()
    #res = path
    else:
        #p = desktopApp.lib.localTreeItem.localTreeItem(path.decode('utf8'))
        if objTools.isUfsUrl(param["collectionId"]):#try:
            #h.write(realUrl)
            h.setEncoding("utf8")
            p = ufsTreeItem.getUfsTreeItem(param["collectionId"], req)
            #res += str(p.listNamedChildren())
        else:#except ValueError:
            #No schema/protocol string. Normal dir
            p = jsTreeItemWithCollectionBackend.jsTreeItemWithCollectionBackend(param["collectionId"], None, req.getDbSys())
    #Get the checked elements in the tree
    try:
        co = collectionManager.getCollection(u"uuid://3b84d155-cc5c-428e-8009-12d5fdc68b2a", req.getDbSys()).getRange(0, None)
    except KeyError:
        co = []
    data = jsTreeNamedItemFunc.containerList(p, checkedItems=co)
    res +=u'-->'
    #print res,d
    if data == u"":
        raise "no item, raise exception to prevent loop query"
    res += data
    if gDebugFlag:
        h.write(res)
        h.genEnd()
    else:
        print res.encode('gbk')
示例#4
0
if __name__=='__main__':
    fields = libs.http.queryParam.queryInfo().getAllFieldStorageUnicode()
    path = fields.get("path", ["-1"])[0]
    path=jsIdEncoding(path)
    res = "Content-Type: text/html;charset=gbk\n\n"
    if gDebugFlag:
        h = libs.html.response.html()
        h.genHead('Collections')
    res += u'<!--'
    if path == "-1":
        p = winUfs.winUfsTreeItem()
    #res = path
    else:
        #p = desktopApp.lib.localTreeItem.localTreeItem(path.decode('utf8'))
        try:
            p = ufsTreeItem.getUfsTreeItem(path.decode('utf8'))
        except ValueError:
            #No schema/protocol string. Normal dir
            p = localTreeItem.localFolderTreeItem(path.decode('utf8'))
    data = jsTreeNamedItemFunc.containerList(p)
    res +=u'-->'
    #print res,d
    res += data
    if gDebugFlag:
        h.write(res)
        h.genEnd()
    else:
        print res.encode('gbk')

示例#5
0
import libSys
import libs.tree.jsTreeNamedItemFuncV3 as jsTreeNamedItemFunc
import libs.html.response
import libs.ufs.ufsTreeItem as ufsTreeItem
#import libs.ufs.winUfs as winUfs
import libs.ufs.ufs as ufs
import desktopApp.lib.localTreeItem as localTreeItem
gDebugFlag = False
    
def jsIdEncoding(s):
    '''
    This function is used to encode the item id of jstree as jstree can not manipulate id with ":" correctly
    '''
    l = s.split(u"_", 1)
    if len(l[0]) == 1:
        s = u":".join(l)
    return s

if __name__=='__main__':
    fields = libs.http.queryParam.queryInfo().getAllFieldStorageUnicode()
    path = fields.get("path", ["-1"])[0]
    path=jsIdEncoding(path)
    res = "Content-Type: text/html;charset=gbk\n\n"
    if gDebugFlag:
        h = libs.html.response.html()
        h.genHead('Collections')
    res += u'<!--'
    if path == "-1":
        p = ufs.ufsTreeUuidItem()
    #res = path