Ejemplo n.º 1
0
	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))
Ejemplo n.º 2
0
	def _text_search(self,search,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)

		search_api="search_tag"
		unit=BbsConst.PINTEREST_PAGE_UNIT

		thread_list=SearchThread.search(search,page,unit,BbsConst.SEARCH_THREAD_INDEX_NAME)
		if(thread_list!=None):
			thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
			search_api_error=False
		else:
			search_api_error=True

		if(search=="empty"):
			thread_list=None

		if(search_api_error):
			#例外が起きた場合はTagSearchの結果を使う場合がある
			thread_list=Pinterest.get_tag_image(self,search,page,unit)["thread_list"]
			if(thread_list):
				search_api_error=False

		today=datetime.date.today()
		ranking_month_list=Pinterest._get_ranking_month_list(today,CssDesign.is_english(self))

		template_values['thread_list']=thread_list
		template_values['next_query']="search="+urllib.quote_plus(str(search))
		template_values['tag_list']=SearchTag.get_recent_tag(search_api)
		template_values['page_mode']="search"
		template_values['illust_enable']=True
		template_values['search']=search
		template_values['search_api_error']=search_api_error
		template_values['top_page']=True
		template_values['ranking_month_list']=ranking_month_list
		template_values['month_query']=""

		if(search=="empty"):
			order="new"
			Pinterest._update_event_list(self,template_values,order,contents_only)
			Pinterest._update_room_list(self,template_values,order,contents_only)
			Pinterest._update_tweet_list(self,template_values,order,contents_only)
			template_values["bbs_list"]=ApiFeed.feed_get_bbs_list(self,"hot",0,8)

		Pinterest._render_page(self,template_values)
Ejemplo n.º 3
0
	def _index(self,user,user_id,page,request_page_mode,redirect_api,contents_only):
		unit=BbsConst.PINTEREST_PAGE_UNIT

		order="new"
		if(self.request.get("order")):
			order=self.request.get("order")

		month_query=""
		if(self.request.get("query")):
			month_query=self.request.get("query")

		search_api="search_tag"
		ranking_month_list=[]
		search_api_error=False

		if(order=="monthly"):
			if(month_query):
				today=datetime.datetime.strptime(month_query,"%Y-%m-%d")
			else:
				today=datetime.date.today()

			ranking_month_list=Pinterest._get_ranking_month_list(today,CssDesign.is_english(self))
			thread_list=ApiFeed.feed_get_ranking_thread_list(month_query,page,unit)

			if(thread_list!=None):
				thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
				search_api_error=False
			else:
				search_api_error=True
		else:
			if(order=="lecture"):
				search_str="tag = 講座 OR category = 講座"
				no_reduct=False	#日付における重み付けを外すか
				thread_list=SearchThread.search(search_str,page,unit,BbsConst.SEARCH_THREAD_INDEX_NAME,no_reduct)
				if(thread_list!=None):
					thread_list=ApiObject.create_thread_object_list(self,thread_list,"search")
					search_api_error=False
				else:
					search_api_error=True
			else:
				if(order=="chat"):
					thread_list=None
				else:
					thread_list=ApiFeed.feed_get_thread_list(self,order,(page-1)*unit,unit)
		
		bbs_list=None
		if(order=="hot" and not contents_only):
			bbs_list=ApiFeed.feed_get_bbs_list(self,"hot",0,8)

		recent_tag=None
		if(order=="hot" and not contents_only):
			recent_tag=SearchTag.get_recent_tag(search_api)

		my_color_bookmark=None
		if(user):
			my_color_bookmark=ApiObject.get_bookmark_of_user_id(user.user_id())

		mute_bbs_list=[]
		mute_user_list=[]
		if(my_color_bookmark):
			mute_bbs_list=my_color_bookmark.get_mute_bbs_list()
			mute_user_list=my_color_bookmark.get_mute_user_list()

		template_values=Pinterest.initialize_template_value(self,user,user_id,page,request_page_mode,redirect_api,contents_only)
		template_values['thread_list']=thread_list
		template_values['next_query']="order="+order+"&query="+month_query
		template_values['tag_list']=recent_tag
		template_values['top_page']=True
		template_values['order']=order
		template_values['page_mode']="index"
		template_values['illust_enable']=True
		template_values['bbs_list']=bbs_list
		template_values['ranking_month_list']=ranking_month_list
		template_values['month_query']=month_query
		template_values['search_api_error']=search_api_error

		template_values['bookmark']=my_color_bookmark
		template_values['mute_bbs_list']=mute_bbs_list
		template_values['mute_user_list']=mute_user_list

		Pinterest._update_event_list(self,template_values,order,contents_only)
		Pinterest._update_room_list(self,template_values,order,contents_only)
		Pinterest._update_tweet_list(self,template_values,order,contents_only)
		
		template_values['is_admin']=OwnerCheck.is_admin(user)

		Pinterest._render_page(self,template_values)