Esempio n. 1
0
	def get_app_list(is_portal):
		hot_app_list=None
		hot_plugin_list=None
		hot_css_list=None
		new_app_list=None
		if(is_portal):
			hot_app_list=AppCode.all().filter("is_public =",1).filter("mode =",BbsConst.APP_MODE_APP).order("-bookmark_count").fetch(limit=10,offset=0)
			hot_plugin_list=AppCode.all().filter("is_public =",1).filter("mode =",BbsConst.APP_MODE_PLUGIN).order("-bookmark_count").fetch(limit=10,offset=0)
			hot_css_list=AppCode.all().filter("is_public =",1).filter("mode =",BbsConst.APP_MODE_CSS).order("-bookmark_count").fetch(limit=10,offset=0)
			new_app_list=AppCode.all().filter("is_public =",1).order("-public_date").fetch(limit=10,offset=0)
		return {"hot_app":hot_app_list,"hot_plugin":hot_plugin_list,"hot_css":hot_css_list,"new_app":new_app_list};
Esempio n. 2
0
	def check_id_available(main,app_id):
		if(app_id=="" or MappingId.key_format_check(app_id)):
			main.response.out.write(Alert.alert_msg("アプリIDは半角英数である必要があります。",main.request.host))
			return False
		query=AppCode.all().filter("app_id =",app_id)
		if(query.count()==0):
			return True
		main.response.out.write(Alert.alert_msg("このアプリIDは既に使われています。",main.request.host))
		return False
Esempio n. 3
0
	def get(self):
		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			Alert.alert_msg_with_write(self,"掲示板の編集画面のURLが変更されています。掲示板からログインし、デザインの編集ボタンをクリックして下さい。")
			return

		user = users.get_current_user()
		is_admin=0
		if(user and OwnerCheck.is_admin(user)):
			is_admin=1
		if(bbs.short!="sample" and OwnerCheck.check(bbs,user) and not is_admin):
			Alert.alert_msg_with_write(self,"デザインの編集の権限がありません。")
			return

		error_str=""
		if self.request.get("error_str"):
			error_str=self.request.get("error_str")
		
		is_css_enable=OwnerCheck.is_admin(user)
		
		my_app_list=None
		if(user):
			my_app_list=AppCode.all().filter("user_id =",user.user_id()).filter("mode =",2).fetch(limit=100,offset=0)
		
		tab="all"
		if(self.request.get("tab")):
			tab=self.request.get("tab")

		bbs_css=None
		try:
			bbs_css=bbs.css
		except:
			bbs_css=None

		template_values = {
			'host': './',
			'bbs': bbs,
			'error_str': error_str,
			'is_css_enable': is_css_enable,
			'is_admin': is_admin,
			'is_iphone': CssDesign.is_iphone(self),
			'is_tablet': CssDesign.is_tablet(self),
			'my_app_list': my_app_list,
			'user': user,
			'tab': tab,
			'redirect_url': self.request.path,
			'bbs_css': bbs_css,
			'is_english': CssDesign.is_english(self)
		}

		path = '/html/edit_bbs.html'
		self.response.out.write(template_select.render(path, template_values))
Esempio n. 4
0
 def get_app_key(req):
     app_key2 = ""
     if "Referer" in req.request.headers:
         header = req.request.headers["Referer"]
         pair_list = header.split("&")
         for pair in pair_list:
             div = pair.split("=")
             if div[0] == "app_key":
                 app_key2 = div[1]
             if div[0] == "app_id":
                 query = AppCode.all().filter("app_id =", div[1])
                 app_key2 = str(query[0].key())
     return app_key2
Esempio n. 5
0
	def ret(req,page):
		if(req.request.get("redirect")):
			tab=""
			if(req.request.get("tab")):
				tab="&tab="+req.request.get("tab")
			req.redirect(str(req.request.get("redirect")+tab))
			return
	
		user = users.get_current_user()

		my_app_list=None
		if(user):
			my_app_list=AppCode.all().filter("user_id =",user.user_id()).fetch(limit=100,offset=0)
		
		if user:
			url_log = users.create_logout_url(req.request.url)
		else:
			url_log = users.create_login_url(req.request.url)

		app_key=None
		if(req.request.get("app_key")):
			app_key=req.request.get("app_key")
		
		bbs_key=None
		if(req.request.get("bbs_key")):
			bbs_key=req.request.get("bbs_key")

		app=None
		if(app_key):
			app=db.get(app_key)

		app_code=""
		if(app):
			app_code=app.js_code
		
		css_code=""
		if(app):
			css_code=app.css_code
			if(not css_code or css_code==""):
				css_code=DevPortal.load_initial_css_code(None)

		if(app_code==""):
			if(app and app.mode==BbsConst.APP_MODE_PLUGIN):
				app_code=AppPortal.load_sample_app("feedplugin.js")
			else:
				app_code=AppPortal.load_sample_app("helloworld.js")
		if(app_code=="puzzle"):
			app_code=AppPortal.load_sample_app("15puzzle.js")
		if(app_code=="feed"):
			app_code=AppPortal.load_sample_app("feedplugin.js")

		if(page=="edit"):
			app_code=cgi.escape(app_code.encode("utf-8"))
		
		sample_code=AppPortal.load_sample_app("helloworld.js")
		sample_code=cgi.escape(sample_code.encode("utf-8"))
		sample_code_plugin=AppPortal.load_sample_app("feedplugin.js")
		sample_code_plugin=cgi.escape(sample_code_plugin.encode("utf-8"))
		sample_code_css=DevPortal.load_initial_css_code(None)
		sample_code_css=cgi.escape(sample_code_css.encode("utf-8"))
		
		logined=0
		if(user):
			logined=1

		host_url="http://"+MappingId.mapping_host(req.request.host)+"/";
		
		template_values = {
			'host': host_url,
			'my_app_list': my_app_list,
			'sample_code': sample_code,
			'sample_code_plugin': sample_code_plugin,
			'sample_code_css': sample_code_css,
			'page': page,
			'app': app,
			'app_code': app_code,
			'css_code': css_code,
			'url_log': url_log,
			'logined': logined,
			'bbs_key': bbs_key,
			'user': users.get_current_user(),
			'redirect_url': req.request.path
		}
		
		url='/html/dev.html'
		if(page=="edit"):
			url='/html/dev/dev_edit.html'
		if(page=="info"):
			url='/html/dev/dev_info.html'
		
		path = url
		req.response.out.write(template_select.render(path, template_values))
Esempio n. 6
0
	def get_app(app_id):
		app=AppCode.all().filter("app_id =",app_id)
		if(app.count()==0):
			return None
		return app[0]