Beispiel #1
0
	def _get_query(order,event_id):
		query=db.Query(MesThread,keys_only=True)
		if(order=="bookmark"):
			query.order("-bookmark_count")
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_ILLUST)
		if(order=="new"):
			query.order("-create_date")
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_ILLUST)
		if(order=="applause"):
			query.order("-applause")
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_ILLUST)
		if(order=="moper"):
			query.order("-create_date")
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_MOPER)
		if(order=="2010" or order=="2011" or order=="2012" or order=="2013"):
			date=datetime.date(int(order)+1,1,1)
			query.order("-create_date")
			query.filter("create_date <",date)
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_ILLUST)
		if(order=="event"):
			if(not event_id):
				event_list=EventList.get_event_list()
				if(event_list):
					event_id=event_list[0].id
				else:
					event_id="no_event_opened"
				query.order("-create_date")
			else:
				query.order("-applause")
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_ILLUST)
			query.filter("event_id =",event_id)
		if(not order):
			query.order("-create_date")
			query.filter("illust_mode =",BbsConst.ILLUSTMODE_ILLUST)
		return query
Beispiel #2
0
	def _update_event_list(self,template_values,order,contents_only):
		event_list=None
		all_event_list=None
		old_event_list=None
		now_event=None
		
		now_event_start_date=""
		now_event_end_date=""

		if(order=="event" and not contents_only):
			event_list=EventList.get_event_list()
			all_event_list=EventList.get_all_event_list()
			old_event_list=EventList.get_old_event_list()
			if(self.request.get("event_id")):
				now_event=EventList.get_event(self.request.get("event_id"))
				now_event_start_date=now_event.start_date.replace(tzinfo=UTC()).astimezone(JST()).strftime('%Y/%m/%d')
				now_event_end_date=now_event.end_date.replace(tzinfo=UTC()).astimezone(JST()).strftime('%Y/%m/%d')

		event_thread_list=None
		if(order=="new" and not contents_only):
			event_list=EventList.get_event_list()
			if(event_list):
				now_event=event_list[0]
				event_thread_list=ApiFeed.feed_get_thread_list(self,"event",0,8)

		if(now_event_start_date==""):
			start_day=datetime.datetime.today()
			if(event_list):
				start_day=event_list[0].end_date
			now_event_start_date=start_day.replace(tzinfo=UTC()).astimezone(JST()).strftime('%Y/%m/%d')
			now_event_end_date=(start_day+datetime.timedelta(days=BbsConst.EVENT_MAX_DAYS)).replace(tzinfo=UTC()).astimezone(JST()).strftime('%Y/%m/%d')

		template_values['event_list']=event_list
		template_values['all_event_list']=all_event_list
		template_values['old_event_list']=old_event_list
		template_values['now_event']=now_event
		template_values['now_event_start_date']=now_event_start_date
		template_values['now_event_end_date']=now_event_end_date
		template_values['is_old_event']=EventList.is_old_event(now_event)
		template_values['event_thread_list']=event_thread_list
Beispiel #3
0
	def get(self):
		try:
			bbs=db.get(self.request.get("bbs_key"));
		except:
			bbs=None

		if(not bbs):
			Alert.alert_msg_with_write(self,"編集する掲示板が見つかりません。")
			return

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

		try:
			entry = db.get(self.request.get("entry_key"))
		except:
			entry = None

		try:
			res = db.get(self.request.get("res_key"))
		except:
			res = None

		if(not thread and not entry and not res):
			Alert.alert_msg_with_write(self,"編集する対象が見つかりません。")
			return

		user = users.get_current_user()
		
		bbs_owner=not OwnerCheck.check(bbs,user)

		thread_owner=False
		if(user):
			if(thread):
				if(user.user_id()==thread.user_id):
					thread_owner=True
			if(entry):
				if(user.user_id()==entry.user_id):
					thread_owner=True
			if(res):
				if(user.user_id()==res.user_id):
					thread_owner=True
		
		if(not bbs_owner and not thread_owner and not OwnerCheck.is_admin(user)):
			Alert.alert_msg_with_write(self,"編集する権限がありません。")
			return
		
		summary=""
		postscript=""
		category=""

		if(thread):
			summary=thread.summary
			if(thread.postscript):
				postscript=thread.postscript
			summary=ReeditEscape.escape(summary);
			postscript=ReeditEscape.escape(postscript);
			category=thread.category

		host_url="./"
		design=CssDesign.get_design_object(self,bbs,host_url,1)
		category_list=CategoryList.get_category_list(bbs)
		event_list=EventList.get_event_list()

		template_values = {
			'host': './',
			'bbs': bbs,
			'thread': thread,
			'entry': entry,
			'res': res,
			'summary': summary,
			'postscript': postscript,
			'template_path':design["template_path"],
			'css_name':design["css_name"],
			'is_iphone':design["is_iphone"],
			'is_tablet':design["is_tablet"],
			'template_base_color':design["template_base_color"],
			'user': user,
			'redirect_url': self.request.path,
			'edit_thread': True,
			'category_list': category_list,
			'event_list': event_list,
			'selecting_category': category,
			'res_entry_key': self.request.get("res_entry_key"),
			'is_english': CssDesign.is_english(self)
		}

		path = '/html/edit_thread.html'
		self.response.out.write(template_select.render(path, template_values))
Beispiel #4
0
	def get(self):
		celsys=0
		host_url="http://"+MappingId.mapping_host(self.request.host)+"/"

		bbs=None
		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			bbs=None
		if(bbs==None):
			Alert.alert_msg_with_write(self,"イラストの投稿画面のURLが変更されています。掲示板からイラストを描くボタンをクリックして下さい。")
			return
		
		ipad=CssDesign.is_tablet(self)
		iphone=CssDesign.is_iphone(self)
		if(not ipad and not iphone):
			if(self.request.get("ipad") and self.request.get("ipad")=="1"):
				ipad=1
		
		thread_key=self.request.get("thread_key")
		entry_key=self.request.get("entry_key")

		category_list=CategoryList.get_category_list(bbs)
		event_list=EventList.get_event_list()

		user = users.get_current_user()
		logined=0
		if(user):
			logined=1

		is_reply=self.request.get("reply")

		wacom2=True
		#ipad=1

		#掲示板のデザインを取得
		design=CssDesign.get_design_object(self,bbs,host_url,1)

		#英語版かどうか
		is_english=CssDesign.is_english(self)
		
		#基本情報設定
		template_values = {
		'host': host_url,
		'bbs': bbs,
		'bbs_key': self.request.get("bbs_key"),
		'thread_key': thread_key,
		'entry_key': entry_key,
		'draw_time': 0,
		'canvas_width': int(self.request.get("canvas_width")),
		'canvas_height': int(self.request.get("canvas_height")),
		'canvas_url': self.request.get("canvas_url"),
		'reply': is_reply,
		'celsys': celsys,
		'category_list': category_list,
		'is_png': 0,
		'summary': "",
		'author': "",
		'title': "",
		'ipad': ipad,
		'logined': logined,
		'template_path':design["template_path"],
		'css_name':design["css_name"],
		'is_iphone':design["is_iphone"],
		'template_base_color':design["template_base_color"],
		'version': self.request.get("version"),
		'wacom2': wacom2,
		'selecting_category': None,
		'is_english': is_english,
		'event_list': event_list
		}

		#上書き時のコメントの初期値を設定
		if(not self.get_thread_comment(template_values,thread_key,entry_key,is_reply)):
			return
		if(not self.get_entry_comment(template_values,entry_key)):
			return
		
		if(ipad or iphone):
			path = '/html/tools/draw_window_ipad.htm'
		else:
			path = '/html/draw_window_flash_lapper.html'
		
		self.response.out.write(template_select.render(path, template_values))