예제 #1
0
	def _bookmark(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
		template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)

		thread=None
		if(self.request.get("thread_key")):
			try:
				thread = db.get(self.request.get("thread_key"))
			except:
				thread=None

		bbs=None
		if(self.request.get("bbs_key")):
			try:
				bbs = db.get(self.request.get("bbs_key"))
			except:
				bbs=None

		app=None
		if(self.request.get("app_key")):
			try:
				app = db.get(self.request.get("app_key"))
			except:
				app=None
		
		cache=SiteAnalyzer.get_cache()
		template_values["search_thread"]=thread
		template_values["search_bbs"]=bbs
		template_values["search_app"]=app
		template_values['page_mode']="bookmark"

		Pinterest._render_page(self,template_values)
예제 #2
0
파일: Main.py 프로젝트: abars/illustbook
	def get(self):
		#移動
		if(self.request.host=="illust-book.appspot.com"):
			self.redirect(str("http://www.illustbook.net/"))
			return
	
		SetUtf8.set()

		#ホストチェック
		if SpamCheck.is_deny(self.request):
			self.response.set_status(401)
			return
		
		#メンテナンス画面
		is_maintenance=0
		if(MaintenanceCheck.is_appengine_maintenance()):
			is_maintenance=1
		
		#BBS COUNT
		cache=SiteAnalyzer.get_cache()
		bbs_n=cache["bbs_n"]
		illust_n=cache["illust_n"]
		
		#最近のタグ
		tag_list=SearchTag.get_recent_tag("search_tag")
		
		#デベロッパーオプション
		user = users.get_current_user()
		is_dev_enable=OwnerCheck.is_admin(user)

		#iPhoneモードかどうか
		is_iphone=CssDesign.is_iphone(self)

		#リダイレクト
		if(BbsConst.PINTEREST_MODE):
			if((user and OwnerCheck.is_admin(user)) or BbsConst.PINTEREST_MODE==2):
				return Pinterest.get_core(self,Pinterest.PAGE_MODE_NORMAL)

		#URL生成
		template_values = {
			'host': "./",
			'mes_bord_url': 'mes_bord',
			'new_url': 'create_new_thread',
			'bbs_n':bbs_n,
			'illust_n':illust_n,
			'tag_list':tag_list,
			'is_dev_enable':is_dev_enable,
			'is_maintenance': is_maintenance,
			'is_iphone': is_iphone,
			'user': user,
			'redirect_url': self.request.path,
			'top_page': True,
			'mode': "index"
		}

		path = '/html/index.html'
		self.response.out.write(template_select.render(path, template_values))
예제 #3
0
	def _guide(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
		template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)

		cache=SiteAnalyzer.get_cache()
		template_values["bbs_n"]=cache["bbs_n"]
		template_values["illust_n"]=cache["illust_n"]
		template_values['page_mode']="guide"
		template_values['contents']=self.request.get("contents")

		Pinterest._render_page(self,template_values)
예제 #4
0
파일: Admin.py 프로젝트: abars/illustbook
	def get(self):
		user = users.get_current_user()
		is_admin=0
		is_high_admin=0
		account="ログインしていない状態"
		if(user):
			account="アカウント"+user.email()
			is_admin=1
			if(OwnerCheck.is_admin(user)):
				is_high_admin=1

		SetUtf8.set()

		thread_query = MesThread.all().order('-create_date')
		cnt=thread_query.count(10000)

		thread_page_unit=12
		thread_page=1
		if self.request.get("page"):
			thread_page = int(self.request.get("page"))
		thread_page_list=PageGenerate.generate_page(thread_page,cnt,thread_page_unit)

		comment_page=1
		only_comment=0
		if self.request.get("comment_page"):
			comment_page = int(self.request.get("comment_page"))
			only_comment=1

		if(not only_comment):
			thread_query.filter("illust_mode =",1)
			thread=thread_query.fetch(limit=thread_page_unit,offset=(thread_page-1)*thread_page_unit)
		
			new_moper_query=MesThread.all().order("-create_date")
			new_moper_query.filter("illust_mode =",2)
			new_moper=new_moper_query.fetch(limit=12)

			entry=None
			try:
				entry_query = Entry.all().order('-create_date')
				entry_query.filter("illust_reply =",1)
				entry=entry_query.fetch(limit=thread_page_unit,offset=(thread_page-1)*thread_page_unit)
			except:
				None
		else:
			thread=None
			new_moper=None
			entry=None

		comment=None
		try:
			comment_unit=7
			comment_query = Entry.all().order('-create_date')
			comment_query.filter("del_flag =", 1)
			comment=comment_query.fetch(limit=comment_unit,offset=comment_unit*(comment_page-1))
		except:
			None

		if(not only_comment):
			new_bbs_count=SiteAnalyzer.create_graph(self,0);
			new_illust_count=SiteAnalyzer.create_graph(self,1);
			new_entry_count=SiteAnalyzer.create_graph(self,2);
			new_user_count=SiteAnalyzer.create_graph(self,3);

			today_start = datetime.datetime.today()
			week_start = today_start - datetime.timedelta(days=7)
			month1_start = today_start - datetime.timedelta(days=31)
		
			weekly=Bbs.all().filter("date >=",week_start).count(limit=10000)
			monthly=Bbs.all().filter("date >=",month1_start).count(limit=10000)
		else:
			new_bbs_count=0
			new_illust_count=0
			new_entry_count=0
			new_user_count=0
			weekly=0
			monthly=0

		if os.environ["SERVER_SOFTWARE"].find("Development")!=-1:
			new_moper=[]
			
		host_url ="./"
		template_values = {
			'host': host_url,
			'threads':thread,
			'moper_threads':new_moper,
			'entries':entry,
			'comment':comment,
			'new_bbs_count':new_bbs_count,
			'new_entry_count':new_entry_count,
			'new_illust_count':new_illust_count,
			'new_user_count':new_user_count,
			'is_admin':is_admin,
			'is_high_admin': is_high_admin,
			'account':account,
			'url_logout':users.create_logout_url("./admin"),
			'url_login':users.create_login_url("./admin"),
			'page_list':thread_page_list,
			'page_url_base':"./admin?page=",
			'page':thread_page,
			'weekly':weekly,
			'monthly':monthly,
			'comment_page':comment_page,
			'only_comment': only_comment
			}
		path = '/html/admin.html'
		render=template_select.render(path, template_values)
		self.response.out.write(render)