예제 #1
0
파일: executeV2.py 프로젝트: weijia/ufs
    else:
        os.startfile('"'+fullPath+'"')
        #raise "stop there"
        return "doc"

def executeAppOrOpenFile(req):
    fields = libs.http.queryParam.queryInfo().getAllFieldStorageUnicode()
    h = libs.html.response.html()
    h.genTxtHead()
    #fullPath = urllib.unquote(fields[u"path"][0])
    fullPath = fields[u"path"][0]
    if objTools.isUfsFs(fullPath):
        fullPath = objTools.getFullPathFromUfsUrl(fullPath)
    fullPath = transform.transformDirToInternal(fullPath)
    #print fullPath
    #tags = urllib.unquote(fields[u"tags"][0])
    tags = "sys.executable"
    tl = stringTools.splitWithChars(tags, configurationTools.getTagSeparator())
    t = tagSys.getTagSysObj(req.getDbSys())
    #t.tag(fullPath, tl)
    #h.write(u'{"path":"%s","tags":"%s"}'%(fullPath, (u','.join(tl))))
    res = startAppOrOpenFile(fullPath)
    if res == "app":
        t.tag(fullPath, tl)

    h.write(u'{"path":"%s","tags":"%s"}'%(fullPath, (u','.join(t.getTags(fullPath)))))
    h.end()

if __name__=='__main__':
    executeAppOrOpenFile(service.req())
예제 #2
0
파일: dbCollection.py 프로젝트: weijia/ufs
'''
import xmlrpclib
import libSys
import libs.services.servicesV2 as service


class dbCollection(object):
    '''
    classdocs
    '''

    def __init__(self, req):
        '''
        Constructor
        '''
        self.req = req
    
    def resp(self):
        #Register to folder scanner
        self.req.resp.genHead()
        monitorRpcServerUrl = 'http://localhost:8806/xmlrpc'
        proxy = xmlrpclib.ServerProxy(monitorRpcServerUrl)
        proxy.register("D:\\sys\\pidgin\\encZip", 'http://localhost:8888/xmlrpc')
        self.req.resp.write('hello world')
        self.req.resp.genEnd()
    
if __name__=='__main__':
    dbCollection(service.req()).resp()
    
    
예제 #3
0
                c = collectionBase.collectionBase(i, dbInst.getCollectionDb())
                try:
                    htmlGen.write(u"removing:"+r[i]+u"<br>")
                except:
                    pass
                l = data[i]
                if type(l) == unicode:
                    l = [l]
                c.update(l)

        
        
        
def handleImportCollectionFromJsonRequest(req):
    #Get request param: collectionId, start, cnt
    param = webUtils.paramWithDefault({u"jsonCollection":-1}, req.getQueryInfo())
    h = req.resp
    h.genHead('Upload Collections')
    if param[u"jsonCollection"] == -1:
        h.genForm('/apps/collection/collectionImporter.py',[['f','jsonCollection']])
    else:
        dbInst = dbSys.dbSysSmart()
        updateCollectionFromJson(param[u"jsonCollection"], h, dbInst)
        h.write('-------------------------------------------')
        h.write(param[u"jsonCollection"])
    h.genEnd()

    
if __name__=='__main__':
    handleImportCollectionFromJsonRequest(service.req())
예제 #4
0
        start = int(param["start"])
        cnt = int(param["cnt"])
    else:
        isTree = True
        start = 0
        cnt = None
    
    #print >>sys.stderr, "-------------", start, cnt
    
    data = jsTreeNamedItemFunc.containerListJson(p, start, cnt, isTree, req, co)

    #print data
    if data == u"":
        raise "no item, raise exception to prevent loop query"
    req.resp.write(data)
    req.resp.end()
    
    
class prosedoParam:
    def getAllFieldStorageUnicode(self):
        return {u"collectionId": u"winUfs_0_1_1290b5fcc-be54-4ae4-9613-20a24de723cf"}
    
    
class prosedoReq:
    def getQueryInfo(self):
        return prosedoParam()
    
    
if __name__=='__main__':
    jqueryListOnCollection(service.req())
    #jqueryListOnCollection(prosedoReq())
예제 #5
0
import libSys
import libs.services.servicesV2 as service
import libs.utils.webUtils as webUtils
import localLibSys
from localLibs.logSys.logSys import *


if __name__=='__main__':
    r = service.req()
    r.resp.genTxtHead()
    param = webUtils.paramWithDefault({"username":None,"passwd":None}, r.getQueryInfo())
    cl(str(param))
    cl("before calling verifyLogin")
    r.verifyLogin()
    u = r.getPrimaryUser()
    cl("primary:"+u.username)
    s = r.getSecondaryUsername()
    sec = []
    for i in s:
        sec.append(i)
    if u.username == param["username"]:
        state = "OK"
    else:
        state = "Wrong"
    r.resp.write(u'{"username":"******", "secondaryUsers":"%s", "state":"%s"}'%(u.username, u','.join(sec), state))
    r.resp.end()
예제 #6
0
파일: tagObj.py 프로젝트: weijia/ufs
import libs.tag.tagSystemInterface as tagSys
#from desktopApp.lib.transform import *
import libs.utils.transform as transform
import urllib
import libs.utils.configurationTools as configurationTools
import libs.utils.stringTools as stringTools
import libs.services.servicesV2 as service


def tagObj(req):
    fields = libs.http.queryParam.queryInfo().getAllFieldStorageUnicode()
    h = libs.html.response.html()
    h.genTxtHead()
    #fullPath = urllib.unquote(fields[u"path"][0])
    fullPath = fields[u"path"][0]
    fullPath = transform.transformDirToInternal(fullPath)
    #print fullPath
    #tags = urllib.unquote(fields[u"tags"][0])
    tags = fields[u"tags"][0]
    tl = stringTools.splitWithChars(tags, configurationTools.getTagSeparator())
    t = tagSys.getTagSysObj(req.getDbSys())
    t.tag(fullPath, tl)
    #h.write(u'{"path":"%s","tags":"%s"}'%(fullPath, (u','.join(tl))))
    
    h.write(u'{"path":"%s","tags":"%s"}'%(fullPath, (u','.join(t.getTags(fullPath)))))
    h.end()


if __name__=='__main__':
    tagObj(service.req())
예제 #7
0
    # Check if we are generating the tree.
    if param["tree"] == u"n":
        #print "false"
        isTree = False
        start = int(param["start"])
        cnt = int(param["cnt"])
    else:
        isTree = True
        start = 0
        cnt = None
    #print start, cnt
    #print >>sys.stderr, "-------------", start, cnt
    #data = "1"
    ####################################################
    # Generate JSON string for collection
    ####################################################
    data = collection2Json.containerListJson(collectionItemList, start, cnt, isTree, req, checkedItemList)
    
    #print data
    if data == u"":
        raise "no item, raise exception to prevent loop query"
    req.resp.write(data)
    req.resp.end()
    
    
    
if __name__=='__main__':
    param = {u"collectionId": u"D_0_1oldmachine_1TDDOWNLOAD", "start":"40", "cnt": "40"}
    param = None
    jqueryListOnCollection(service.req(param))