예제 #1
0
	def get(self):
		SetUtf8.set()
		
		data=""

		user = users.get_current_user()
		user_id="";
		if(user):
			user_id=user.user_id()
		
		is_iphone=CssDesign.is_iphone(self)
		is_mobile=is_iphone or CssDesign.is_tablet(self)
		app_key=ApiPerpetuation.get_app_key(self)

		host_url="http://"+MappingId.mapping_host(self.request.host)+"/";

		template_values = {
			'host': host_url,
			'user_id': user_id,
			'is_mobile': is_mobile,
			'is_iphone': is_iphone,
			'app_key': app_key
		}

		self.response.content_type = 'text/javascript'
		path = "/html/api/illustbook.js"
		self.response.out.write(template_select.render(path, template_values))
예제 #2
0
	def show_portal(self,user):
		self.redirect("./?order=chat")
		return

		is_iphone=CssDesign.is_iphone(self)
		is_tablet=CssDesign.is_tablet(self)

		show_room=Chat.get_room_object_list()
	
		is_admin=False
		if(OwnerCheck.is_admin(user)):
			is_admin=True

		#user_name=self.get_user_name(user)

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

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'is_tablet': is_tablet,
			'bookmark': bookmark,
			'redirect_url': self.request.path,
			'mode': "chat",
			'header_enable': False,
			'room_list': show_room,
			'is_admin':is_admin,
			#'user_name': user_name,
			'is_english':CssDesign.is_english(self)
		}
		path = '/html/portal.html'
		self.response.out.write(template_select.render(path, template_values))
예제 #3
0
	def _render_comment_core(req,host_url,bbs,thread,com_list_,edit_flag,bbs_key,logined,show_comment_form,is_admin,user_name,user,res_hash,show_ip):
		#レスを取得
		com_list=ShowEntry._get_response(com_list_,res_hash,thread,bbs)

		#コメントの編集を行うか
		comment_edit=req.request.get("comment_edit")

		#iPhoneかどうか
		is_iphone=CssDesign.is_iphone(req)

		#英語版かどうか
		is_english=CssDesign.is_english(req)
		
		#レンダリング
		template_values = {
			'host': host_url,
			'bbs': bbs,
			'thread': thread,
			'com_list':com_list,
			'edit_flag':edit_flag,
			'bbs_key': bbs_key,
			'logined':logined,
			'show_comment_form':show_comment_form,
			'is_admin':is_admin,
			'user_name': user_name,
			'user': user,
			'redirect_url': req.request.path,
			'comment_edit': comment_edit,
			'is_iphone': is_iphone,
			'is_english': is_english,
			'show_ip': show_ip
			}

		path = "/html/thread/thread_comment.html"
		return template_select.render(path, template_values)
예제 #4
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))
예제 #5
0
파일: EditBbs.py 프로젝트: abars/illustbook
	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))
예제 #6
0
	def get(req,mode,header_enable):
		is_iphone=CssDesign.is_iphone(req)

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'user': users.get_current_user(),
			'redirect_url': req.request.path,
			'mode': mode,
			'header_enable': header_enable
		}

		path = '/html/portal.html'
		req.response.out.write(template_select.render(path, template_values))
예제 #7
0
	def _render_page(self,template_values):
		host="http://"+MappingId.mapping_host(self.request.host)+"/";
		template_values['host']=host
		template_values['is_iphone']=CssDesign.is_iphone(self)
		template_values['is_tablet']=CssDesign.is_tablet(self)
		template_values['tag_display_n']=40
		template_values['is_maintenance']=MaintenanceCheck.is_appengine_maintenance()
		if(template_values['user']):
			template_values['login_flag']=1
		else:
			template_values['login_flag']=0
		render=template_select.render("/html/pinterest.html", template_values)
		#render=strip_spaces_between_tags(render)
		self.response.out.write(render)
예제 #8
0
	def get(self):
		user = users.get_current_user()
		user_name=ShowEntry.get_user_name(user)

		bbs_list=[]

		if(user):
			user_id=user.user_id()
			
			bookmark_bbs_list=ApiBookmark.bookmark_get_bbs_list(self,user_id)
			rental_bbs_list=ApiUser.user_get_bbs_list(self,user_id)
			
			if(rental_bbs_list):
				bbs_list.extend(rental_bbs_list)
			if(bookmark_bbs_list):
				bbs_list.extend(bookmark_bbs_list)

			sample_bbs={
			"title":"サンプルお絵描き掲示板",
			"key":MappingId.mapping("sample")
			}
			bbs_list.append(sample_bbs)

		temp_key=self.request.get("temp_key")

		args=None
		if(temp_key):
			temp=db.get(temp_key)
			if(temp.args):
				args=temp.args

		target_bbs=self.get_target_bbs(args);
		if(target_bbs):
			bbs_list=target_bbs

		template_values={
		'host':"./",
		'is_iphone':CssDesign.is_iphone(self),
		'is_tablet':CssDesign.is_tablet(self),
		'is_english':CssDesign.is_english(self),
		'temp_key':temp_key,
		'redirect_url':self.request.path+"?temp_key="+temp_key,
		'user':user,
		'bbs_list':bbs_list,
		'args':args,
		'user_name':user_name
		}
		render=template_select.render("/html/upload_temp.html", template_values)
		self.response.out.write(render)
예제 #9
0
	def get(self):
		is_iphone=CssDesign.is_iphone(self)

		page=1
		page_unit=20
		if(self.request.get("page")):
			page=int(self.request.get("page"))
		
		rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME)
		ranking_mode=self.request.get("mode")
		
		ranking_id_list=rank.user_id_ranking_list[(page-1)*page_unit:page*page_unit]
		ranking_list=[]
		for user_id in ranking_id_list:
			obj=ApiObject.get_bookmark_of_user_id(user_id)
			if(obj):
				if(obj.disable_rankwatch):
					ranking_list.append(None)
					continue
				obj=ApiObject.create_user_object(self,obj)
				ranking_list.append(obj)

		user = users.get_current_user()
		user_rank=0
		if(user):
			rank=Ranking.get_by_key_name(BbsConst.THREAD_RANKING_KEY_NAME)
			if(rank):
				user_rank=rank.get_user_rank(user.user_id())

		template_values = {
			'host': "./",
			'is_iphone': is_iphone,
			'user': user,
			'user_rank': user_rank,
			'redirect_url': self.request.path,
			'mode': "ranking",
			'header_enable': False,
			'ranking_list': ranking_list,
			'ranking_mode': ranking_mode,
			'page': page,
			'page_unit': page_unit
		}

		path = '/html/portal.html'
		self.response.out.write(template_select.render(path, template_values))
예제 #10
0
	def get(self):
		host_url="http://"+MappingId.mapping_host(self.request.host)+"/"
		bbs_key=self.request.get("bbs_key")
		thread_key=self.request.get("thread_key")

		try:
			bbs = db.get(self.request.get("bbs_key"))
			thread = db.get(self.request.get("thread_key"))
		except:
			bbs = None
			thread = None
		
		if(bbs==None or thread==None):
			self.response.out.write(Alert.alert_msg("スレッドが見つかりません。",self.request.host))
			return
		
		image=thread.image_key#db.get(thread.image);
		width=400
		height=400
		if(image.width):
			width=image.width
		if(image.height):
			height=image.height
		if(self.request.get("width")):
			width=self.request.get("width")
		if(self.request.get("height")):
			height=self.request.get("height")
		
		if(CssDesign.is_iphone(self)==1):
			if(width>=300):
				height=300*height/width
				width=300
		
		template_values = {
		'host': host_url,
		'bbs': bbs,
		'bbs_key': bbs_key,
		'thread': thread,
		'thread_key': thread_key,
		'width': width,
		'height': height
		}		  
		path = '/html/moper/moper_embedded.htm'
		self.response.out.write(template_select.render(path, template_values))
예제 #11
0
	def get(self):
		host_url=MappingId.mapping_host_with_scheme(self.request)+"/"
		bbs_key=self.request.get("bbs_key")
		thread_key=self.request.get("thread_key")
		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			 bbs=None
		if(bbs==None):
			Alert.alert_msg_with_write(self,"ブックが見つかりません。")
			return

		ipad=CssDesign.is_tablet(self)
		iphone=CssDesign.is_iphone(self)
		if(ipad or iphone):
			Alert.alert_msg_with_write(self,"iPhoneやiPadでは動画お絵かきツールは使用できません。")
			return

		draw_time=0
		summary=""
		author=""
		title=""

		if(thread_key!=""):
			try:
				thread=db.get(thread_key)
			except:
				thread=None
			if(thread==None):
				Alert.alert_msg_with_write(self,"スレッドが見つかりません。")
				return
			draw_time=thread.draw_time

			summary=ReeditEscape.escape(thread.summary)
			author=ReeditEscape.escape(thread.author)
			title=ReeditEscape.escape(thread.title)

		canvas_url=self.request.get("canvas_url");
		if(canvas_url!=""):
			canvas_url=host_url+"moper_load?id="+canvas_url
			
		force=0
		canvas_width=400
		canvas_height=400
		if(self.request.get("canvas_width")):
			canvas_width=self.request.get("canvas_width")
		if(self.request.get("canvas_height")):
			canvas_height=self.request.get("canvas_height")
		if(self.request.get("force")):
			force=self.request.get("force")
		
		template_values = {
		'host': host_url,
		'bbs': bbs,
		'thread_key': thread_key,
		'bbs_key': bbs_key,
		'canvas_url': canvas_url,
		'canvas_width': canvas_width,
		'canvas_height': canvas_height,
		'force': force,
		'draw_time': draw_time,
		'summary': summary,
		'author': author,
		'title': title
		}
		path = '/html/tools/draw_window_moper.htm'
		self.response.out.write(template_select.render(path, template_values))
예제 #12
0
파일: Alert.py 프로젝트: abars/illustbook
	def alert_msg_with_write(req,msg):
		is_iphone=CssDesign.is_iphone(req)
		is_english=CssDesign.is_english(req)
		host_url=MappingId.mapping_host_with_scheme(req.request)+"/";
		req.response.out.write(Alert._alert_msg_core(msg,host_url,is_iphone,is_english))
예제 #13
0
    def get(self):
        SetUtf8.set()

        page_name = ""
        mode = "access"
        if self.request.get("mode"):
            mode = self.request.get("mode")

        bbs = None

        user = None
        if page_name == "":
            try:
                bbs = db.get(self.request.get("bbs_key"))
            except:
                bbs = None
            if bbs == None:
                Alert.alert_msg_notfound(self)
                return

            user = users.get_current_user()
            if user:
                if bbs.user_id != user.user_id():
                    user = None

            page_name = bbs.bbs_name

        if self.request.get("start_date"):
            start_date = self.request.get("start_date")
            if not self.validate_date(start_date):
                Alert.alert_msg_with_write(self, "日付指定は0000-00-00形式である必要があります。")
                return
        else:
            start_date = str(datetime.date.today() + datetime.timedelta(days=-31))

        if self.request.get("end_date"):
            end_date = self.request.get("end_date")
            if not self.validate_date(end_date):
                Alert.alert_msg_with_write(self, "日付指定は0000-00-00形式である必要があります。")
                return
        else:
            end_date = str(datetime.date.today() + datetime.timedelta(days=-1))

        start_day = datetime.datetime.strptime(start_date, "%Y-%m-%d")
        end_day = datetime.datetime.strptime(end_date, "%Y-%m-%d")
        if start_day > end_day:
            Alert.alert_msg_with_write(self, "終了日よりも開始日の方が大きくなっています。")
            return

        bbs_id = bbs.short
        is_admin = OwnerCheck.is_admin(user)
        if is_admin:
            if self.request.get("bbs_id"):
                bbs_id = self.request.get("bbs_id")
                if bbs.short != bbs_id:
                    page_name = bbs_id

        page_list = None
        ref_list = None
        keyword_list = None
        access_list = None

        show_analyze = False
        if user or bbs.short == "sample":
            show_analyze = True

        if show_analyze:
            try:
                result = self.get_analytics(mode, bbs_id, start_date, end_date)
            except:
                time.sleep(1)
                try:
                    result = self.get_analytics(mode, bbs_id, start_date, end_date)
                except:
                    Alert.alert_msg_with_write(self, "Analytics APIへのアクセスに失敗しました。リロードして下さい")
                    logging.error("failed analytics api")
                    return

            if mode == "page":
                page_list = result
            if mode == "ref":
                ref_list = result
            if mode == "keyword":
                keyword_list = result
            if mode == "access":
                access_list = result

        quota_error = mode == "access" and not access_list

        redirect_api = (
            "analyze?start_date="
            + start_date
            + "&end_date="
            + end_date
            + "&bbs_id="
            + bbs_id
            + "&bbs_key="
            + str(bbs.key())
            + "&"
        )

        host_url = "./"
        template_values = {
            "host": host_url,
            "mode": mode,
            "redirect_api": redirect_api,
            "quota_error": quota_error,
            "bbs": bbs,
            "bbs_id": bbs_id,
            "page_name": page_name,
            "is_admin": is_admin,
            "user": user,
            "show_analyze": show_analyze,
            "ref_list": ref_list,
            "page_list": page_list,
            "keyword_list": keyword_list,
            "access_list": access_list,
            "start_date": start_date,
            "end_date": end_date,
            "is_iphone": CssDesign.is_iphone(self),
            "is_tablet": CssDesign.is_tablet(self),
            "is_english": CssDesign.is_english(self),
            "redirect_url": self.request.path,
        }
        path = "/html/analyze.html"
        self.response.out.write(template_select.render(path, template_values))
예제 #14
0
	def get(self):
		SetUtf8.set()

		try:
			bbs = db.get(self.request.get("bbs_key"))
		except:
			Alert.alert_msg_with_write(self,"掲示板の取得に失敗しました。")
			return

		user = users.get_current_user()
		if(OwnerCheck.check(bbs,user) and not OwnerCheck.is_admin(user)):
			Alert.alert_msg_with_write(self,"削除する権限がありません。")
			return

		user = users.get_current_user()

		page=1
		if(self.request.get("page")):
			page=int(self.request.get("page"))

		order="new"
		if(self.request.get("order")):
			order=self.request.get("order")
		
		limit=20
		offset=(page-1)*limit

		query=db.Query(MesThread,keys_only=True)
		query.filter("bbs_key =",bbs)
		if(order=="new"):
			query.order("-create_date")
		else:
			query.order("create_date")

		thread_key_list=query.fetch(offset=offset,limit=limit)
		thread_list=[]
		for thread_key in thread_key_list:
			try:
				thread_list.append(db.get(thread_key))
			except:
				continue

		deleted_count=self.request.get("deleted_count")
		category_count=self.request.get("category_count")
		link_count=self.request.get("link_count")

		if(deleted_count):
			deleted_count=int(deleted_count)
		if(category_count):
			category_count=int(category_count)
		if(link_count):
			link_count=int(link_count)

		category_list=CategoryList.get_category_list(bbs)

		template_values = {
			'host': './',
			'bbs': bbs,
			'user': user,
			'thread_list': thread_list,
			'redirect_url': self.request.path,
			'page': page,
			'order': order,
			'deleted_count': deleted_count,
			'category_count': category_count,
			'link_count': link_count,
			'is_iphone': CssDesign.is_iphone(self),
			'is_tablet': CssDesign.is_tablet(self),
			'category_list': category_list,
			'is_english': CssDesign.is_english(self)
		}

		path = '/html/edit_thread_list.html'
		self.response.out.write(template_select.render(path, template_values))
예제 #15
0
	def ret(main,mode,app_key):

		is_play=0
		if(mode=="play"):
			is_play=1

		is_run=0
		if(mode=="run"):
			is_run=1
		
		is_code=0
		if(mode=="code"):
			is_code=1

		is_plugin=0
		if(mode=="plugin"):
			is_plugin=1
		
		is_portal=1
		if(is_play or is_code or is_run or is_plugin):
			is_portal=0
		
		app_list=AppPortal.get_app_list(is_portal)
		
		app=None
		if(app_key and (is_play or is_code or is_run or is_plugin)):
			app=db.get(app_key)

		plugin_code=AppPortal.get_plugin_code(main,app_key,app)
		
		app_code=""
		if(app):
			if(app.mode==2):
				app_code=app.css_code
			else:
				app_code=app.js_code
			if(AppPortal.add_support_forum(main,app)):
				return
		if(is_code):
			app_code=cgi.escape(app_code.encode("utf-8"))

		user = users.get_current_user()
		logined=0
		if(user):
			logined=1
		if user:
			url_log = users.create_logout_url(main.request.url)
		else:
			url_log = users.create_login_url(main.request.url)

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

		template_values = {
			'host': "./",
			'hot_app_list': app_list["hot_app"],
			'hot_plugin_list': app_list["hot_plugin"],
			'hot_css_list': app_list["hot_css"],
			'new_app_list': app_list["new_app"],
			'is_play': is_play,
			'is_portal': is_portal,
			'is_code': is_code,
			'app_code': app_code,
			'app': app,
			'plugin_code': plugin_code,
			'url_log': url_log,
			'logined': logined,
			'is_iphone': is_iphone,
			'user': users.get_current_user(),
			'redirect_url': main.request.path
		}
		
		url='/html/app.html'
		if(is_run or is_plugin):
			url='/html/app/app_run.html'
		
		path = url
		main.response.out.write(template_select.render(path, template_values))
예제 #16
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))