Esempio n. 1
0
    def get(self):
        greetings_query = Album.all().order('-date')
        albums = greetings_query.fetch(30)
        settings_query = album_settings.Settings.all().order('date')
        settings = settings_query.fetch(1)
        setting = settings[0] if len(settings) > 0 else {}

        if isinstance(setting, album_settings.Settings):
            webSettings = album_settings.WebSetting.all().ancestor(
                setting).fetch(1)
            webSetting = webSettings[0] if len(webSettings) > 0 else {}
        else:
            webSetting = {}

        user = users.get_current_user()
        if user:
            url = users.create_logout_url(self.request.uri)
            url_linktext = "Logout"
        else:
            url = users.create_login_url(self.request.uri)
            url_linktext = 'Login'

        template_values = {
            'albums': albums,
            'webSetting': webSetting,
            'url_log': url,
            'url_linktext': url_linktext,
            'user': user,
            'isAdmin': users.is_current_user_admin(),
            'setting': setting
        }

        template = JINJA_ENVIRONMENT.get_template('/templates/albums.html')
        self.response.write(template.render(template_values))
Esempio n. 2
0
    def get(self):
        greetings_query = Album.all().order('-date')
        albums = greetings_query.fetch(30)
        settings_query = album_settings.Settings.all().order('date')
        settings = settings_query.fetch(1)
        setting = settings[0] if len(settings) > 0 else {}
        
        if isinstance(setting, album_settings.Settings):
            webSettings = album_settings.WebSetting.all().ancestor(setting).fetch(1)
            webSetting = webSettings[0] if len(webSettings) > 0 else {}
        else:
            webSetting = {}
        
        user = users.get_current_user()
        if user:
            url = users.create_logout_url(self.request.uri)
            url_linktext = "Logout"
        else:
            url = users.create_login_url(self.request.uri)
            url_linktext = 'Login'

        template_values = {
            'albums': albums,
            'webSetting' : webSetting,
            'url_log': url,
            'url_linktext': url_linktext,
            'user': user,
            'isAdmin': users.is_current_user_admin(),
            'setting': setting
        }
        
        template = JINJA_ENVIRONMENT.get_template('/templates/albums.html')
        self.response.write(template.render(template_values))
Esempio n. 3
0
    def get(self, album_key):
        logging.info("get(...)")
        album = albums.Album.get(album_key)
        template_values = {'album': album}

        template = JINJA_ENVIRONMENT.get_template(
            '/templates/albumUpload.html')
        self.response.write(template.render(template_values))
Esempio n. 4
0
    def get(self, album_key):
        logging.info("get(...)")
        album = albums.Album.get(album_key)
        template_values = {
                           'album':album
        }

        template = JINJA_ENVIRONMENT.get_template('/templates/albumUpload.html')
        self.response.write(template.render(template_values))
Esempio n. 5
0
 def get(self):
     album = None
     album_key = self.request.get('album')
     if album_key:
         album = Album.get(album_key)
     template_values = {'album': album}
     template = JINJA_ENVIRONMENT.get_template(
         '/templates/albumsCreate.html')
     self.response.write(template.render(template_values))
Esempio n. 6
0
 def get(self):
     album = None
     album_key = self.request.get('album')
     if album_key:
         album = Album.get(album_key);
     template_values = {
         'album': album
     }
     template = JINJA_ENVIRONMENT.get_template('/templates/albumsCreate.html')
     self.response.write(template.render(template_values))
Esempio n. 7
0
 def get(self, key):
     album = None
     try:
         album = Album.get(key)
     except BadKeyError:
         self.error(404)
     if not album:
         self.error(404)
     else:
         
         pictures = Picture.all().ancestor(album)
         isAdmin = users.is_current_user_admin()
         template = JINJA_ENVIRONMENT.get_template('/templates/albumDetails.html')
         template_values = {
         'isAdmin': isAdmin,
         'album': album,
         'pictures': pictures
         }
         self.response.write(template.render(template_values))
Esempio n. 8
0
    def get(self, key):
        album = None
        try:
            album = Album.get(key)
        except BadKeyError:
            self.error(404)
        if not album:
            self.error(404)
        else:

            pictures = Picture.all().ancestor(album)
            isAdmin = users.is_current_user_admin()
            template = JINJA_ENVIRONMENT.get_template(
                '/templates/albumDetails-lightbox.html')
            template_values = {
                'isAdmin': isAdmin,
                'album': album,
                'pictures': pictures
            }
            self.response.write(template.render(template_values))
Esempio n. 9
0
    def get(self):
        greetings_query = Album.all().order('-date')
        albums = greetings_query.fetch(10)

        user = users.get_current_user()
        if user:
            url = users.create_logout_url(self.request.uri)
            url_linktext = "Logout"
        else:
            url = users.create_login_url(self.request.uri)
            url_linktext = 'Login'

        template_values = {
            'albums': albums,
            'url_log': url,
            'url_linktext': url_linktext,
            'user': user,
            'isAdmin': users.is_current_user_admin()
        }
        
        template = JINJA_ENVIRONMENT.get_template('/templates/albums.html')
        self.response.write(template.render(template_values))
Esempio n. 10
0
 def get(self):
     settings_query = Settings.all().order('date')
     settings = settings_query.fetch(1)
     setting = settings[0] if len(settings) > 0 else {}
     logging.info("get setting = " + str(setting))
     
     if isinstance(setting, Settings):
         webSettings = WebSetting.all().ancestor(setting).fetch(1)
         webSetting = webSettings[0] if len(webSettings) > 0 else {}
         appSettings = AppSetting.all().ancestor(setting).fetch(1)
         appSetting = appSettings[0] if len(appSettings) > 0 else {}
     else:
         webSetting = {}
         appSetting = {}
         
     template_values = {
         'setting' : setting,
         'webSetting' : webSetting,
         'appSetting' : appSetting
         }
     template = JINJA_ENVIRONMENT.get_template('/templates/settings.html')
     self.response.write(template.render(template_values))
Esempio n. 11
0
    def post(self):

        settings_query = Settings.all().order('date')
        settings = settings_query.fetch(1)
        setting = settings[0] if len(settings) > 0 else None
        if not setting:
            setting = Settings(
                parent=db.Key.from_path('Settings', 'default_setting'))
        setting.girlName = self.request.get('girlName')
        setting.boyName = self.request.get('boyName')
        setting.save()

        appSettings = AppSetting.all().ancestor(setting).fetch(1)
        appSetting = appSettings[0] if len(appSettings) > 0 else AppSetting(
            parent=setting)
        appSetting.appName = self.request.get('appName')
        appSetting.appHead = self.request.get('appHead')
        appSetting.appWelcome = self.request.get('appWelcome')
        appSetting.appCongratulation = self.request.get('appCongratulation')
        appSetting.save()

        webSettings = WebSetting.all().ancestor(setting).fetch(1)
        webSetting = webSettings[0] if len(webSettings) > 0 else WebSetting(
            parent=setting)
        webSetting.praise1 = self.request.get('praise1')
        webSetting.praise2 = self.request.get('praise2')
        webSetting.praise3 = self.request.get('praise3')
        webSetting.cover = self.request.get('cover')
        webSetting.head = self.request.get('webHead')
        webSetting.save()

        template_values = {
            'setting': setting,
            'appSetting': appSetting,
            'webSetting': webSetting,
            'updated': True
        }
        template = JINJA_ENVIRONMENT.get_template('/templates/settings.html')
        self.response.write(template.render(template_values))
Esempio n. 12
0
    def get(self):
        settings_query = Settings.all().order('date')
        settings = settings_query.fetch(1)
        setting = settings[0] if len(settings) > 0 else {}
        logging.info("get setting = " + str(setting))

        if isinstance(setting, Settings):
            webSettings = WebSetting.all().ancestor(setting).fetch(1)
            webSetting = webSettings[0] if len(webSettings) > 0 else {}
            appSettings = AppSetting.all().ancestor(setting).fetch(1)
            appSetting = appSettings[0] if len(appSettings) > 0 else {}
        else:
            webSetting = {}
            appSetting = {}

        template_values = {
            'setting': setting,
            'webSetting': webSetting,
            'appSetting': appSetting
        }
        template = JINJA_ENVIRONMENT.get_template('/templates/settings.html')
        self.response.write(template.render(template_values))
Esempio n. 13
0
 def post(self):
     
     settings_query = Settings.all().order('date')
     settings = settings_query.fetch(1)
     setting = settings[0] if len(settings) > 0 else None
     if not setting:
         setting = Settings(parent=db.Key.from_path('Settings', 'default_setting'))
     setting.girlName = self.request.get('girlName')
     setting.boyName = self.request.get('boyName')
     setting.save()
     
     appSettings = AppSetting.all().ancestor(setting).fetch(1)
     appSetting = appSettings[0] if len(appSettings) > 0 else AppSetting(parent=setting)
     appSetting.appName = self.request.get('appName')
     appSetting.appHead = self.request.get('appHead')
     appSetting.appWelcome = self.request.get('appWelcome')
     appSetting.appCongratulation = self.request.get('appCongratulation')
     appSetting.save()
     
     webSettings = WebSetting.all().ancestor(setting).fetch(1)
     webSetting = webSettings[0] if len(webSettings) > 0 else WebSetting(parent=setting)
     webSetting.praise1 = self.request.get('praise1')
     webSetting.praise2 = self.request.get('praise2')
     webSetting.praise3 = self.request.get('praise3')
     webSetting.cover = self.request.get('cover')
     webSetting.head = self.request.get('webHead')
     webSetting.save()
     
     template_values = {
         'setting' : setting,
         'appSetting' : appSetting,
         'webSetting' : webSetting,
         'updated' : True
         }
     template = JINJA_ENVIRONMENT.get_template('/templates/settings.html')
     self.response.write(template.render(template_values))
Esempio n. 14
0
 def get(self):
     template = JINJA_ENVIRONMENT.get_template("/templates/downloads.html")
     self.response.write(template.render())
Esempio n. 15
0
 def get(self):
     template = JINJA_ENVIRONMENT.get_template('/templates/downloads.html')
     self.response.write(template.render())