Beispiel #1
0
	def post(self,pageid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return

		contentlist = []
		contentid = self.request.get('contentid')
		nameen = self.request.get('nameen')
		nameko = self.request.get('nameko')

		if "" != contentid:
			i = Content.get_by_id(int(contentid))
			i.keyid = i.key().id()
			contentlist.append(i)
		elif "" != nameen:
			result = Content.all().filter("nameen =",nameen)
			for i in result :
				i.keyid = i.key().id()
				contentlist.append(i)
		elif "" != nameko:
			result = Content.all().filter("nameko =",nameko)
			for i in result :
				i.keyid = i.key().id()
				contentlist.append(i)

		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'contents':contentlist,
			'pageid':pageid,
		}
		self.render_to_response('page_content_search.html',context)
Beispiel #2
0
    def post(self, pageid):
        accountid = self.session.get('accountid')
        account = Account.get_by_accountid(accountid)
        if 1 != account.mod:
            return

        contentlist = []
        contentid = self.request.get('contentid')
        nameen = self.request.get('nameen')
        nameko = self.request.get('nameko')

        if "" != contentid:
            i = Content.get_by_id(int(contentid))
            i.keyid = i.key().id()
            contentlist.append(i)
        elif "" != nameen:
            result = Content.all().filter("nameen =", nameen)
            for i in result:
                i.keyid = i.key().id()
                contentlist.append(i)
        elif "" != nameko:
            result = Content.all().filter("nameko =", nameko)
            for i in result:
                i.keyid = i.key().id()
                contentlist.append(i)

        context = {
            'static_path': STATIC_PATH,
            'APP_TITLE': APP_TITLE,
            'contents': contentlist,
            'pageid': pageid,
        }
        self.render_to_response('page_content_search.html', context)
Beispiel #3
0
 def get(self):
     accountid = self.session.get('accountid')
     account = Account.get_by_accountid(accountid)
     if 1 != account.mod:
         return
     mode = self.request.get('mode')
     keytodel = self.request.get('del')
     contents = None
     if 'all' == mode:
         contents = Content.all().order('-created')
     elif 'less' == mode:
         contents = Content.all().order('-created').fetch(limit=5)
     else:
         contents = []
     contentlist = []
     for content in contents:
         content.keyid = str(content.key().id())
         contentlist.append(content)
     context = {
         'static_path': STATIC_PATH,
         'APP_TITLE': APP_TITLE,
         'size': len(contentlist),
         'keytodel': keytodel,
         'contents': contentlist
     }
     self.render_to_response('content_index.html', context)
Beispiel #4
0
	def post(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		testcode = self.request.get('testcode')
		d = json.loads(testcode)
		assert(d)
		try:
			det = Content.api_read(d['id'],d['lang'],d['tostudy'])
		except:
			det = Content.api_read(d['id'],d['lang'])
		self.redirect(self.request.url + 'input?result='+str(det))
Beispiel #5
0
 def post(self):
     accountid = self.session.get('accountid')
     account = Account.get_by_accountid(accountid)
     if 1 != account.mod:
         return
     testcode = self.request.get('testcode')
     d = json.loads(testcode)
     assert (d)
     try:
         det = Content.api_read(d['id'], d['lang'], d['tostudy'])
     except:
         det = Content.api_read(d['id'], d['lang'])
     self.redirect(self.request.url + 'input?result=' + str(det))
Beispiel #6
0
 def get(self):
     keyid = self.request.get("img_id")
     content = Content.get_by_id(int(keyid))
     if content.thumbnail:
         self.response.headers['Content-Type'] = "image/jpg"
         self.response.out.write(images.resize(content.thumbnail, 175, 84))
     else:
         self.response.out.write("no image")
Beispiel #7
0
 def get(self):
     keyid = self.request.get("img_id")
     content = Content.get_by_id(int(keyid))
     if content.photo:
         self.response.headers['Content-Type'] = "image/jpg"
         self.response.out.write(images.resize(content.photo, 484, 481))
     else:
         self.response.out.write("no image")
Beispiel #8
0
 def get(self, contentid):
     accountid = self.session.get('accountid')
     account = Account.get_by_accountid(accountid)
     if 1 != account.mod:
         return
     content = Content.get_by_id(int(contentid))
     content.delete()
     self.redirect('/content')
Beispiel #9
0
	def get(self):
		keyid = self.request.get("img_id")
		content = Content.get_by_id(int(keyid))
		if content.thumbnail:
			self.response.headers['Content-Type'] = "image/jpg"
			self.response.out.write(images.resize(content.thumbnail,175,84))
		else:
			self.response.out.write("no image")
Beispiel #10
0
	def get(self):
		keyid = self.request.get("img_id")
		content = Content.get_by_id(int(keyid))
		if content.photo:
			self.response.headers['Content-Type'] = "image/jpg"
			self.response.out.write(images.resize(content.photo,484,481))
		else:
			self.response.out.write("no image")
Beispiel #11
0
	def get(self,contentid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		content = Content.get_by_id(int(contentid))
		content.delete()
		self.redirect('/content')
Beispiel #12
0
 def get(self, keyid):
     self.response.headers['Content-Type'] = 'application/json'
     lang = self.request.get('lang')
     tostudy = self.request.get('tostudy')
     if None == tostudy:
         tostudy = ""
     ret = Content.api_read(keyid, lang, tostudy)
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(json.dumps(ret))
Beispiel #13
0
	def get(self,keyid):
		self.response.headers['Content-Type'] = 'application/json'
		lang = self.request.get('lang')
		tostudy = self.request.get('tostudy')
		if None == tostudy:
			tostudy = ""
		ret = Content.api_read(keyid,lang,tostudy)
		self.response.headers['Content-Type'] = 'application/json'
		self.response.out.write(json.dumps(ret))
Beispiel #14
0
    def get(self, pageid, contentid):
        accountid = self.session.get('accountid')
        account = Account.get_by_accountid(accountid)
        if 1 != account.mod:
            return

        page = Page.get_by_id(int(pageid))
        content = Content.get_by_id(int(contentid))
        PageContentLink.new(page, content)
        self.redirect('/page/' + pageid)
Beispiel #15
0
	def get(self,pageid,contentid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return

		page = Page.get_by_id(int(pageid))
		content = Content.get_by_id(int(contentid))
		PageContentLink.new(page,content)
		self.redirect('/page/'+pageid)
Beispiel #16
0
	def post(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		result = None
		contentid = self.request.get('contentid')
		nameen = self.request.get('nameen')

		if contentid != "":
			result = Content.get_by_id(int(contentid))
		else:
			result = Content.all().filter("nameen =",nameen)

		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'contents':result,
		}
		self.render_to_response('content_search.html',context)
Beispiel #17
0
 def post(self, contentid):  #logout
     accountid = self.session.get('accountid')
     account = Account.get_by_accountid(accountid)
     if 1 != account.mod:
         return
     content = Content.get_by_id(int(contentid))
     params = {}
     for key in self.request.arguments():
         params[key] = self.request.get(key)
     content.setter(params)
     self.redirect('/content')
Beispiel #18
0
    def post(self):
        accountid = self.session.get('accountid')
        account = Account.get_by_accountid(accountid)
        if 1 != account.mod:
            return
        result = None
        contentid = self.request.get('contentid')
        nameen = self.request.get('nameen')

        if contentid != "":
            result = Content.get_by_id(int(contentid))
        else:
            result = Content.all().filter("nameen =", nameen)

        context = {
            'static_path': STATIC_PATH,
            'APP_TITLE': APP_TITLE,
            'contents': result,
        }
        self.render_to_response('content_search.html', context)
Beispiel #19
0
	def post(self,contentid): #logout
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		content = Content.get_by_id(int(contentid))
		params = {}
		for key in self.request.arguments():
			params[key] = self.request.get(key)
		content.setter(params)
		self.redirect('/content')
Beispiel #20
0
    def get(self, pageid, contentid):
        accountid = self.session.get('accountid')
        account = Account.get_by_accountid(accountid)
        if 1 != account.mod:
            return

        p = Page.get_by_id(int(pageid))
        c = Content.get_by_id(int(contentid))
        obj = PageContentLink.get_by_key_name(
            str(p.key().id()) + "+" + str(c.key().id()))
        obj.delete()
        self.redirect("/page/" + pageid)
Beispiel #21
0
	def get(self,pageid,contentid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return

		p = Page.get_by_id(int(pageid))
		c = Content.get_by_id(int(contentid))
		obj = PageContentLink.get_by_key_name(
				str(p.key().id())+"+"+str(c.key().id()))
		obj.delete()
		self.redirect("/page/"+pageid)
Beispiel #22
0
	def post(self,pageid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		content_ = Content.new(account)
		params = {}
		for key in self.request.arguments():
			params[key] = self.request.get(key)
		content_.setter(params)
		page_ = Page.get_by_id(int(pageid))
		PageContentLink.new(page_,content_)
		self.redirect('/page/'+pageid)
Beispiel #23
0
 def post(self, pageid):
     accountid = self.session.get('accountid')
     account = Account.get_by_accountid(accountid)
     if 1 != account.mod:
         return
     content_ = Content.new(account)
     params = {}
     for key in self.request.arguments():
         params[key] = self.request.get(key)
     content_.setter(params)
     page_ = Page.get_by_id(int(pageid))
     PageContentLink.new(page_, content_)
     self.redirect('/page/' + pageid)
Beispiel #24
0
	def get(self):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		mode = self.request.get('mode')
		keytodel = self.request.get('del')
		contents = None
		if 'all' == mode:
			contents = Content.all().order('-created')
		elif 'less' == mode:
			contents = Content.all().order('-created').fetch(limit=5)
		else:
			contents = []
		contentlist = []
		for content in contents:
			content.keyid = str(content.key().id())
			contentlist.append(content)
		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'size':len(contentlist),
			'keytodel':keytodel,
			'contents':contentlist}
		self.render_to_response('content_index.html',context)
Beispiel #25
0
	def get(self,contentid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		content = Content.get_by_id(int(contentid))
		f_data = content.to_formdict()
		s_form = ContentInfoForm(f_data)
		del s_form.fields['descriptionen']
		del s_form.fields['descriptionko']
		del s_form.fields['descriptionja']
		del s_form.fields['price']
		del s_form.fields['expiration_days']
		del s_form.fields['expiration_mins']
		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'form':s_form}
		self.render_to_response('form.html',context)
Beispiel #26
0
	def get(self,keyid):
		accountid = self.session.get('accountid')
		account = Account.get_by_accountid(accountid)
		if 1 != account.mod:
			return
		content = Content.get_by_id(int(keyid))
		pagelinks = content.pages
		pagelist = []

		for pagelink in pagelinks:
			pagelink.page.keyid = pagelink.page.key().id()
			pagelink.page.story.keyid = pagelink.page.story.key().id()
			pagelist.append(pagelink.page)

		context = {'static_path': STATIC_PATH,
			'APP_TITLE' : APP_TITLE,
			'content':content,
			'pages':pagelist,
			'keyid':content.key().id()}
		self.render_to_response('content_read.html',context)
Beispiel #27
0
 def get(self, contentid):
     accountid = self.session.get('accountid')
     account = Account.get_by_accountid(accountid)
     if 1 != account.mod:
         return
     content = Content.get_by_id(int(contentid))
     f_data = content.to_formdict()
     s_form = ContentInfoForm(f_data)
     del s_form.fields['descriptionen']
     del s_form.fields['descriptionko']
     del s_form.fields['descriptionja']
     del s_form.fields['price']
     del s_form.fields['expiration_days']
     del s_form.fields['expiration_mins']
     context = {
         'static_path': STATIC_PATH,
         'APP_TITLE': APP_TITLE,
         'form': s_form
     }
     self.render_to_response('form.html', context)
Beispiel #28
0
    def get(self, keyid):
        accountid = self.session.get('accountid')
        account = Account.get_by_accountid(accountid)
        if 1 != account.mod:
            return
        content = Content.get_by_id(int(keyid))
        pagelinks = content.pages
        pagelist = []

        for pagelink in pagelinks:
            pagelink.page.keyid = pagelink.page.key().id()
            pagelink.page.story.keyid = pagelink.page.story.key().id()
            pagelist.append(pagelink.page)

        context = {
            'static_path': STATIC_PATH,
            'APP_TITLE': APP_TITLE,
            'content': content,
            'pages': pagelist,
            'keyid': content.key().id()
        }
        self.render_to_response('content_read.html', context)
Beispiel #29
0
def test_content_new():
	facebookid = "*****@*****.**"
	account = Account.get_by_facebookid(facebookid)
	content = Content.new(account)
	assert None != content
	return
Beispiel #30
0
def test_content_new():
    facebookid = "*****@*****.**"
    account = Account.get_by_facebookid(facebookid)
    content = Content.new(account)
    assert None != content
    return