From 48acf65bdc54229bff9199393f13f04ff602049c Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Thu, 15 Sep 2011 15:52:21 +0200 Subject: [PATCH] appy.gen: continued work on Appy-specific template. --- gen/plone25/installer.py | 21 +++----- gen/plone25/mixins/ToolMixin.py | 13 +++-- gen/plone25/skin/appy.css | 22 ++++++-- gen/plone25/skin/appy.js | 32 ++++++++++++ gen/plone25/skin/home.gif | Bin 0 -> 589 bytes gen/plone25/skin/logo.jpg | Bin 5359 -> 4364 bytes gen/plone25/skin/logout.gif | Bin 0 -> 636 bytes gen/plone25/skin/template.pt | 74 ++++++++++++++++++++++----- gen/plone25/templates/ProfileInit.py | 8 +-- gen/po.py | 2 +- 10 files changed, 135 insertions(+), 37 deletions(-) create mode 100644 gen/plone25/skin/appy.js create mode 100644 gen/plone25/skin/home.gif create mode 100644 gen/plone25/skin/logout.gif diff --git a/gen/plone25/installer.py b/gen/plone25/installer.py index c5c3a2f..19053b5 100644 --- a/gen/plone25/installer.py +++ b/gen/plone25/installer.py @@ -430,19 +430,14 @@ class PloneInstaller: def manageLanguages(self): '''Manages the languages supported by the application.''' - if self.languageSelector: - # We must install the PloneLanguageTool if not done yet - qi = self.ploneSite.portal_quickinstaller - if not qi.isProductInstalled('PloneLanguageTool'): - qi.installProduct('PloneLanguageTool') - languageTool = self.ploneSite.portal_languages - defLanguage = self.languages[0] - languageTool.manage_setLanguageSettings(defaultLanguage=defLanguage, - supportedLanguages=self.languages, setContentN=None, - setCookieN=True, setRequestN=True, setPathN=True, - setForcelanguageUrls=True, setAllowContentLanguageFallback=None, - setUseCombinedLanguageCodes=None, displayFlags=False, - startNeutral=False) + languageTool = self.ploneSite.portal_languages + defLanguage = self.languages[0] + languageTool.manage_setLanguageSettings(defaultLanguage=defLanguage, + supportedLanguages=self.languages, setContentN=None, + setCookieN=True, setRequestN=True, setPathN=True, + setForcelanguageUrls=True, setAllowContentLanguageFallback=None, + setUseCombinedLanguageCodes=None, displayFlags=False, + startNeutral=False) def finalizeInstallation(self): '''Performs some final installation steps.''' diff --git a/gen/plone25/mixins/ToolMixin.py b/gen/plone25/mixins/ToolMixin.py index 8bb89a0..eee7bea 100644 --- a/gen/plone25/mixins/ToolMixin.py +++ b/gen/plone25/mixins/ToolMixin.py @@ -791,8 +791,16 @@ class ToolMixin(BaseMixin): msg = self.translate(u'Welcome! You are now logged in.', domain='plone') logMsg = 'User "%s" has been logged in.' % login + msg = msg.encode('utf-8') self.log(logMsg) - return self.goto(rq['HTTP_REFERER'], msg.encode('utf-8')) + # Bring Managers to the config, leave others on the main page. + user = self.portal_membership.getAuthenticatedMember() + if user.has_role('Manager'): + # Bring the user to the configuration + url = self.goto(self.absolute_url(), msg) + else: + url = self.goto(rq['HTTP_REFERER'], msg) + return url def performLogout(self): '''Logs out the current user when he clicks on "disconnect".''' @@ -814,8 +822,7 @@ class ToolMixin(BaseMixin): session.invalidate() from Products.CMFPlone import transaction_note transaction_note('Logged out') - self.getProductConfig().logger.info('User "%s" has been logged out.' % \ - userId) + self.log('User "%s" has been logged out.' % userId) # Remove user from variable "loggedUsers" from appy.gen.plone25.installer import loggedUsers if loggedUsers.has_key(userId): del loggedUsers[userId] diff --git a/gen/plone25/skin/appy.css b/gen/plone25/skin/appy.css index c575df5..bd5edc9 100644 --- a/gen/plone25/skin/appy.css +++ b/gen/plone25/skin/appy.css @@ -5,7 +5,14 @@ body { a {text-decoration: none; color: #747171;} a:visited {color: #840107;} -table { font-size: 100%; border-spacing: 0px; } +table { font-size: 100%; border-spacing: 0px; border-collapse:collapse;} +input {border: 1px solid #a79e9e;} +form {margin: 0; padding: 0;} +p {margin: 0;} + +h1 {font-size: 11pt; margin:0;} +h2 {font-size: 10pt; margin:0; font-style: italic; font-weight: normal;} +h3 {font-size: 9pt; margin:0; font-weight: bold;} .main { width: 900px; @@ -16,6 +23,15 @@ table { font-size: 100%; border-spacing: 0px; } box-shadow: 3px 3px 3px #A9A9A9; } -.top { height: 80px; margin-left: 3em; vertical-align: top;} +.top { height: 75px; margin-left: 3em; vertical-align: top;} .lang { margin-right: 3px; } -.auth { background-color: grey;} +.userStrip { + background-color: #a2a2a2; + border-top: 3px solid #525252; + border-bottom: 2px solid #9b0000; + height: 30px; +} +.login { margin-top: 2px; margin-bottom: 2px; color: white;} +.buttons { margin-left: 4px; } +.content {margin: 7px 0 9px 4px;} +.message {color: #9b0000; font-style: italic; position: absolute; top: -50px; right: 5px} diff --git a/gen/plone25/skin/appy.js b/gen/plone25/skin/appy.js new file mode 100644 index 0000000..15b6391 --- /dev/null +++ b/gen/plone25/skin/appy.js @@ -0,0 +1,32 @@ +function cookiesAreEnabled() { + // Test whether cookies are enabled by attempting to set a cookie and then + // change its value + var c = "areYourCookiesEnabled=0"; + document.cookie = c; + var dc = document.cookie; + // Cookie not set? Fail + if (dc.indexOf(c) == -1) return 0; + // Change test cookie + c = "areYourCookiesEnabled=1"; + document.cookie = c; + dc = document.cookie; + // Cookie not changed? fail + if (dc.indexOf(c) == -1) return 0; + // Delete cookie + document.cookie = "areYourCookiesEnabled=; expires=Thu, 01-Jan-70 00:00:01 GMT"; + return 1; +} + +function setLoginVars() { + // Indicate if JS is enabled + document.getElementById('js_enabled').value = 1; + // Indicate if cookies are enabled + document.getElementById('cookies_enabled').value = cookiesAreEnabled(); + // Copy login and password length to alternative vars since current vars will + // be removed from the request by zope's authentication mechanism. + document.getElementById('login_name').value = document.getElementById('__ac_name').value; + password = document.getElementById('__ac_password'); + emptyPassword = document.getElementById('pwd_empty'); + if (password.value.length==0) emptyPassword.value = '1'; + else emptyPassword.value = '0'; +} diff --git a/gen/plone25/skin/home.gif b/gen/plone25/skin/home.gif new file mode 100644 index 0000000000000000000000000000000000000000..b0caa86a0fe32166ba78b9427b41f5d16f564ec0 GIT binary patch literal 589 zcmZ?wbhEHb6krfwIF`lG9-!G4B-s_D+!mtT6{_4Bra37}y*EKKC4EwQ*7Wq8X_+}w zQ}X9#7EVhqT$EF^q@r?aUe&7HhJ_XNn+rR()J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$Pc_pcdn^!Cj-c6 z)agRs>l5{m4^0|1hhm5qTo0V8m-5pUhkSaQ@0i^H)4xxaReul`j^rd9q~Plcnn)FWc~B`No&a);(Og@$st7Pl0I7 zmRGAcKU=f)&FW3h*KU2bZrii<+aGV*^?cK=r(1Tv+`8|>_PrnX9DKF^=*t5~Kkh&J z?&SF|C(ph=eeuJk8y_wM(ajH6ZhpFU>-+PU|EUcW{|P!5r6!i7rYMwWmSiZnd-?`2 zDE?$&YHn$5Yi}3i?e6IoY!xtzNlc87PfCn26KLks_6zd% zOHK6)^z+l^YvQ(d4@q`i;u;s`X3yQk>0*_TYPG~NHO0%3vx&nYc!|lGCBY6HO>CwC zsh;MMQO2REKBjC PXgE9DOq7R - + + @@ -23,7 +24,7 @@ Logo - + Language selector (links or listbox) + The user data strip + + The message strip + + + - +
The login strip -
- +
- +
a + The user login form for anonymous users + + + + User info and controls for authenticated users + + + + +
+ + + + + + + + +
+
+
+
+
+
+ + + + +
+
+
- -
-

Appy

-

Sub appy

-

Sub sub appy

-

Hello

diff --git a/gen/plone25/templates/ProfileInit.py b/gen/plone25/templates/ProfileInit.py index 515c7eb..5bd4d25 100644 --- a/gen/plone25/templates/ProfileInit.py +++ b/gen/plone25/templates/ProfileInit.py @@ -3,14 +3,14 @@ from Products.CMFCore.utils import getToolByName # ------------------------------------------------------------------------------ def installProduct(context): - '''Installs the necessary products for running PloneMeeting.''' + '''Installs the necessary products for Appy.''' portal = context.getSite() qi = getToolByName(portal, 'portal_quickinstaller') - if not qi.isProductInstalled('Archetypes'): - qi.installProduct('Archetypes') + if not qi.isProductInstalled('PloneLanguageTool'): + qi.installProduct('PloneLanguageTool') if not qi.isProductInstalled(''): qi.installProduct('') - return "Product installed." + return " installed." # ------------------------------------------------------------------------------ def install_default(context): diff --git a/gen/po.py b/gen/po.py index faf64bd..037086d 100644 --- a/gen/po.py +++ b/gen/po.py @@ -89,7 +89,7 @@ class PoMessage: BAD_SELECT_VALUE = 'The value is not among possible values for this field.' ACTION_OK = 'The action has been successfully executed.' ACTION_KO = 'A problem occurred while executing the action.' - FRONT_PAGE_TEXT = 'Welcome to this Appy-powered Plone site.' + FRONT_PAGE_TEXT = 'Welcome to this Appy-powered site.' EMAIL_SUBJECT = '${siteTitle} - Action \\"${transitionName}\\" has been ' \ 'performed on element entitled \\"${objectTitle}\\".' EMAIL_BODY = 'You can consult this element at ${objectUrl}.'