def get(self):
     try:
         if util.checkAuth(self, False):
             values = {'context':RequestContext()}
             self.response.out.write(template.render('templates/admin/index.html',values))
     except:
         logging.error("shit seg")
Esempio n. 2
0
    def post(self):
        if util.checkAuth(self, False):
            user = users.get_current_user()
            news = self.getNewsItem(self.request)

            name = self.request.get("name")
            email = self.request.get("email")
            title = self.request.get("title")
            msg = self.request.get("msg")
            visible = sintjan.business.util.parseBool(self.request.get("visible"))

            if len(name) > 0 and len(email) > 0 and len(title) > 0 and len(msg) > 0:
                news.name = name
                news.email = email
                news.title = title
                news.msg = msg
                news.visible = visible
                news.user_id = user.user_id()

                # the put method creates a new entity if it is not stored yet, it will update it if it exists already
                news.put()
                self.redirect("/admin/news/all?status=ok", permanent=False)

            else:
                values = {"context": RequestContext(), "news": news, "error": True}

                self.response.out.write(template.render("templates/admin/newsAdd.html", values))
Esempio n. 3
0
    def post(self):
        if util.checkAuth(self, False):
            item = self.getItem(self.request)
            succeeded = False
            
            try:
                title = self.request.get('title')
                msg = self.request.get('msg')
                dateObj = datetime(int(self.request.get('year')),int(self.request.get('month')),int(self.request.get('day')))

                if len(title)>0:
                    item.title = title
                    item.msg = msg
                    item.date = dateObj
                    item.put()
                    succeeded = True
                    

            except:
                logging.error("Upsie, could not parse the date, invalid!")
                # void
                
            if not succeeded:
                values = self.getValues()
                values['item'] = item
                values['error'] = True
                self.response.out.write(template.render('templates/admin/calAdd.html',values))
            else:
                self.redirect('/admin/cal/all?status=ok', permanent=False)
Esempio n. 4
0
    def get(self):
        if util.checkAuth(self, False):
            arr = self.request.get("id").split("-")
            dateObj = datetime(int(arr[0]), int(arr[1]), int(arr[2]))

            items = db.GqlQuery("SELECT * FROM News WHERE date < :date ORDER BY date DESC LIMIT 40", date=dateObj)
            values = {"context": RequestContext(), "list": items}
            self.response.out.write(template.render("templates/admin/newsMore.html", values))
Esempio n. 5
0
    def get(self):
        if util.checkAuth(self, False):
            page = self.getPageItem(self.request)

            values = {
                "context": RequestContext(),
                "page": page,
                "blockLeft": self.getBlockLinkByRegion("left", page),
                "blockFooter": self.getBlockLinkByRegion("footer", page),
            }

            self.response.out.write(template.render("templates/admin/pageEdit.html", values))
Esempio n. 6
0
 def get(self): 
     if util.checkAuth(self, False):
         arr = self.request.get('id').split('-')
         dateObj = datetime(int(arr[0]), int(arr[1]), int(arr[2]))
         
         items = db.GqlQuery("SELECT * FROM Calendar WHERE date < :date ORDER BY date DESC LIMIT 50", date=dateObj)
         values = {'context':RequestContext(),'list':items}
         self.response.out.write(template.render('templates/admin/calMore.html',values))    
         
         
         
         
         
         
Esempio n. 7
0
    def post(self):
        if util.checkAuth(self, False):
            page = self.getPageItem(self.request)

            page.url = self.request.get("url")
            page.title = self.request.get("title")
            page.content = self.request.get("content")
            page.breadcrumb = self.request.get("breadcrumb")

            if len(page.url) > 0 and len(page.title) > 0:
                page.put()

                # Creating the left block
                name = self.request.get("blockLeft")

                if len(name) > 0:
                    blockLink = self.getBlockLinkByRegion("left", page)
                    blockLink.name = self.request.get("blockLeft")
                    blockLink.put()

                # Creating the footer block
                name = self.request.get("blockFooter")

                if len(name) > 0:
                    blockLink = self.getBlockLinkByRegion("footer", page)
                    blockLink.name = self.request.get("blockFooter")
                    blockLink.put()

                self.redirect("/admin/page/all?status=ok", permanent=False)

            else:
                values = {
                    "context": RequestContext(),
                    "page": page,
                    "blockLeft": self.getBlockLinkByRegion("left", page),
                    "blockFooter": self.getBlockLinkByRegion("footer", page),
                    "error": True,
                }

                self.response.out.write(template.render("templates/admin/pageEdit.html", values))
Esempio n. 8
0
 def get(self):
     if util.checkAuth(self, False):
         items = db.GqlQuery("SELECT * FROM Page ORDER BY url ASC LIMIT 100")
         values = {"context": RequestContext(), "list": items, "request": self.request}
         self.response.out.write(template.render("templates/admin/pageAll.html", values))
Esempio n. 9
0
 def get(self):
     if util.checkAuth(self, False):
         items = db.GqlQuery("SELECT * FROM News ORDER BY date DESC LIMIT 40")
         values = {"context": RequestContext(), "list": items}
         self.response.out.write(template.render("templates/admin/newsAll.html", values))
Esempio n. 10
0
 def get(self):
     if util.checkAuth(self, False):
         values = {"context": RequestContext(), "news": self.getNewsItem(self.request)}
         self.response.out.write(template.render("templates/admin/newsAdd.html", values))
Esempio n. 11
0
 def get(self):
     if util.checkAuth(self, False):
         items = db.GqlQuery("SELECT * FROM Calendar ORDER BY date DESC LIMIT 50")
         values = {'context':RequestContext(),'list':items}
         self.response.out.write(template.render('templates/admin/calAll.html',values))           
Esempio n. 12
0
 def get(self):
     if util.checkAuth(self, False):
         values = self.getValues()
         values['item'] = self.getItem(self.request)
         self.response.out.write(template.render('templates/admin/calAdd.html',values))