Beispiel #1
0
	def GET(self, categoryid=0, pageidx=1, pagesize=8):
		if categoryid is None:
			categoryid = 0
		if pageidx is None: pageidx = 1
		else: pageidx = int(pageidx)
		if pagesize is None: pagesize = 40
		else: pagesize = int(pagesize)
		if pagesize > 100: pagesize = 40
		categorys = json.loads(appres.category().GET())
		count = json.loads(appres.count().GET(categoryid))['count']
		pagecount = count / pagesize + 1
		if count % pagesize == 0:
			pagecount = pagecount - 1
		if pagecount < pageidx:
			pageidx = 1
		resources = json.loads(appres.resourcelist().GET(categoryid, \
				pageidx, pagesize))
		return render.resourceview(
				config=config,
				menuname='/resource',
				login=islogin(), 
				mgrprivilege=mgrprivilege(),
				resourceid=None, 
				categoryid=categoryid, 
				categorys=categorys, 
				resources=resources,
				pagecount=pagecount,
				pageidx=pageidx,
				pagesize=pagesize)
Beispiel #2
0
	def GET(self, resourceid = None):
		categorys = json.loads(appres.category().GET())
		resource = None
		if resourceid:
			resource = json.loads(appres.resource().GET(resourceid))
			mylog.loginfo(resource)
		mylog.loginfo(categorys)
		return render.mgrresview(
				config=config,
				menuname = '/manage',
				curmgrtype = '/resource',
				login = islogin(), 
				mgrprivilege = mgrprivilege(), 
				categorys = categorys,
				resourceid = resourceid,
				resource = resource)