Exemplo n.º 1
0
def index(request):
	authorities = ez.checkauthorize(request)
	ans = {"test": "test"}
	if request.method == 'POST':
		ans = {"colums" : [],
		"rows": []}
		jsondata = request.POST
		if (jsondata["method"] == "tables"):
			showtables(ans);
		if (jsondata["method"] == "query"):
			if jsondata["query_text"] == "select_from_goods":
				cond = jsondata["qtext"]
				if authorities.have:
					if len(cond) > 0:
						cond += " and "
					cond += u" shop = '{0}'".format(authorities.shopid) 
				sql = u"select * from goods where {0} limit 10".format(cond)
				dbquery(ans, sql, jsondata.get("commit"))
			else:
				if (authorities.have) and (authorities.login != "*****@*****.**"):
					dbquery(ans, jsondata["qtext"], jsondata.get("commit"))
		if (jsondata["method"] == "queries"):
			if (authorities.have) and (authorities.login != "*****@*****.**"):
				ans = {"results" : []}
				qs = json.loads(jsondata["qtext"])
				for q in qs:
					a = {"colums" : [],
					"rows": []}
					dbquery(a, q);
					ans["results"].append(a)
	httptext = json.dumps(ans)
	response = HttpResponse(httptext, content_type="application/json")
	return response
Exemplo n.º 2
0
def welcome(request):
    authorities = ez.checkauthorize(request)
    scripts = ["welcome.js"]
    context = {"authorities"	: authorities,
                "location": "welcome",
				"scripts"		: scripts}
    return render(request, 'welcome.html', context)
Exemplo n.º 3
0
def jsontester(request):
    authorities = ez.checkauthorize(request)
    scripts = ["jsontester.js", "dbadapter.js"]
    context = {"authorities": authorities,
          "location": "home",
          "scripts": scripts}
    return render(request, 'jsontester.html', context)
Exemplo n.º 4
0
def orderlist(request):
    authorities = ez.checkauthorize(request)
    scripts = ["innerorderslist.js"]
    context = {"authorities": authorities,
          "location": "innerorders",
          "scripts": scripts}
    return render(request, 'innerorderslist.html', context)
Exemplo n.º 5
0
def index(request):
   	authorities = ez.checkauthorize(request)
   	scripts = ["gchoice.js"]
   	context = {"authorities": authorities,
   				"location"	: "choice",
   				"scripts"	: scripts}
   	return render(request, 'choice.html', context)
    #return HttpResponse(str(authorities.login), content_type="text/plain")
Exemplo n.º 6
0
def innerorder(request, uid = ""):
    authorities = ez.checkauthorize(request)
    scripts = ["innerorder.js"]
    context = {"authorities": authorities,
          "location": "innerorders",
          "orderuid" : uid,
          "scripts": scripts}
    return render(request, 'innerorder.html', context)
Exemplo n.º 7
0
def index(request):
    authorities = ez.checkauthorize(request)
    #scripts = ["index.js"]
    context = {"authorities": authorities,
    			"location": "myadmin"}
    if ((authorities.have) and (authorities.login == "*****@*****.**")):
        return render(request, 'myadmin.html', context)
    else:
        return render(request, 'necessaryauth.html', context)
Exemplo n.º 8
0
def index(request):
    authorities = ez.checkauthorize(request)
    #scripts = ["index.js"]
    context = {"authorities": authorities}
    if ((authorities.have) and (authorities.login == "*****@*****.**")):
    	context["dbup"] = runupdatedb()
    	return render(request, 'updatedb.html', context)
    else:
    	return render(request, 'necessaryauth.html', context)
Exemplo n.º 9
0
def index(request):
    authorities = ez.checkauthorize(request)
    scripts = ["lk.js"]
    context = {"authorities": authorities,
    			"location": "lk",
    			"scripts": scripts}
    if (authorities.have):
    	return render(request, 'lk.html', context)
    else:
    	return render(request, 'necessaryauth.html', context)
    #return HttpResponse(str(authorities.login), content_type="text/plain")
Exemplo n.º 10
0
def db1c_create(request):
    authorities = ez.checkauthorize(request)
    #scripts = ["index.js"]
    context = {"authorities": authorities}
    if ((authorities.have) and (authorities.login == "*****@*****.**")):
    	dbc = db1c.mainclass.db1c()
    	dbc.create_tables()
    	context["dbup"] = "complate db1c creation"
    	return render(request, 'updatedb.html', context)
    else:
    	return render(request, 'necessaryauth.html', context)
Exemplo n.º 11
0
def index(request):
	authorities = ez.checkauthorize(request)
	#scripts = ["index.js"]
	context = {"authorities": authorities,
		"location": "myadmin",
		"dbup": "loaded"}
	if ((authorities.have) and (authorities.login == "*****@*****.**")):
		parser = xml.sax.make_parser()
		parser.setContentHandler(InkscapeSvgHandler())
		parser.parse(open("d:/forsite.xml","r"))
		return render(request, 'updatedb.html', context)
	else:
		return render(request, 'necessaryauth.html', context)
Exemplo n.º 12
0
def index(request):
    #loadmysqlcredential()
    authorities = ez.checkauthorize(request)

    context = {"authorities": authorities,
                "location": "myadmin"}

    if (authorities.have):
        d = dbconnect.dbworker()
        d.doinitdb()
        t = hg.htmlgn(request)
        t.setjsrootname(request.path)
        t.append(hg.htmltext("Initialization complete!!!"))

        httptext = t.gen()
        return HttpResponse(httptext)
    else:
        return render(request, 'necessaryauth.html', context)
Exemplo n.º 13
0
def index(request):
   	authorities = ez.checkauthorize(request)
   	#scripts = ["index.js"]
   	context = {"authorities": authorities,
   				"location": "home"}
   	return render(request, 'index.html', context)
Exemplo n.º 14
0
def demo(request):
   	authorities = ez.checkauthorize(request)
   	context = {"authorities": authorities,
   				"location": "home"}
   	return render(request, 'demo.html', context)
Exemplo n.º 15
0
def index(request):
    authorities = ez.checkauthorize(request)
    context = {"authorities": authorities}
    return render(request, 'principles.html', context)
Exemplo n.º 16
0
def who_we_are(request):
    authorities = ez.checkauthorize(request)
    context = {"authorities": authorities}
    return render(request, 'who-we-are.html', context)