appy.gen: continued work on Appy-specific template.
This commit is contained in:
		
							parent
							
								
									b6dcc42038
								
							
						
					
					
						commit
						48acf65bdc
					
				
					 10 changed files with 135 additions and 37 deletions
				
			
		|  | @ -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.''' | ||||
|  |  | |||
|  | @ -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] | ||||
|  |  | |||
|  | @ -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} | ||||
|  |  | |||
							
								
								
									
										32
									
								
								gen/plone25/skin/appy.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								gen/plone25/skin/appy.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -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'; | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								gen/plone25/skin/home.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gen/plone25/skin/home.gif
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 589 B | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.3 KiB | 
							
								
								
									
										
											BIN
										
									
								
								gen/plone25/skin/logout.gif
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gen/plone25/skin/logout.gif
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 636 B | 
|  | @ -12,7 +12,8 @@ | |||
| 
 | ||||
| <head> | ||||
|   <title tal:content="tool/getAppName"></title> | ||||
|   <link rel="stylesheet" tal:attributes="href string:$appUrl/skyn/appy.css" type="text/css"> | ||||
|   <link rel="stylesheet" type="text/css" tal:attributes="href string:$appUrl/skyn/appy.css"/> | ||||
|   <script type="text/javascript" tal:attributes="src string:$appUrl/skyn/appy.js"></script> | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
|  | @ -23,7 +24,7 @@ | |||
|    <table width="100%"> | ||||
|     <tr valign="top"> | ||||
|      <tal:comment replace="nothing">Logo</tal:comment> | ||||
|      <td><img src="skyn/logo.jpg"/></td> | ||||
|      <td><a tal:attributes="href appUrl"><img src="skyn/logo.jpg"/></a></td> | ||||
|      <tal:comment replace="nothing">Language selector (links or listbox)</tal:comment> | ||||
|      <td align="right" | ||||
|          tal:define="appLangs app/portal_languages/listSupportedLanguages; | ||||
|  | @ -54,25 +55,72 @@ | |||
|    </table> | ||||
|   </td> | ||||
|  </tr> | ||||
|  <tal:comment replace="nothing">The login strip</tal:comment> | ||||
|  <tr class="auth"> | ||||
|  <tal:comment replace="nothing">The user data strip</tal:comment> | ||||
|  <tr> | ||||
|   <td> | ||||
|    <table witdh="100%"> | ||||
|    <table class="userStrip" width="100%"> | ||||
|     <tr> | ||||
|      <td>a  </td> | ||||
|      <td> | ||||
|       <tal:comment replace="nothing">The user login form for anonymous users</tal:comment> | ||||
|        <table align="center" tal:condition="isAnon" class="login" | ||||
|               tal:define="auth nocall:app/acl_users/credentials_cookie_auth"> | ||||
|        <tr><td> | ||||
|         <form name="loginform" method="post" | ||||
|               tal:attributes="action python: tool.absolute_url() + '/performLogin'"> | ||||
| 
 | ||||
|          <input type="hidden" name="js_enabled" id="js_enabled" value="0"/> | ||||
|          <input type="hidden" name="cookies_enabled" id="cookies_enabled" value=""/> | ||||
|          <input type="hidden" name="login_name" id="login_name" value=""/> | ||||
|          <input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/> | ||||
| 
 | ||||
|          <span>Login</span>  | ||||
|          <input type="text" size="15" name="__ac_name" id="__ac_name" value=""/>  | ||||
|          <span>Password</span>  | ||||
|          <input type="password" size="15" name="__ac_password" id="__ac_password"/> | ||||
|          <input type="submit" name="submit" onclick="setLoginVars()" | ||||
|                 tal:define="label python: _('Login');" tal:attributes="value label; alt label;"/> | ||||
|         </form> | ||||
|        </td></tr> | ||||
|       </table> | ||||
|       <tal:comment replace="nothing">User info and controls for authenticated users</tal:comment> | ||||
|       <table tal:condition="not: isAnon" class="buttons"> | ||||
|        <tr> | ||||
|         <td> | ||||
|          <!-- Go home --> | ||||
|          <a tal:attributes="href appUrl; title python: _('home')"> | ||||
|           <img src="skyn/home.gif"/> | ||||
|          </a> | ||||
|          <!-- Logout --> | ||||
|          <a tal:attributes="href python: tool.absolute_url() + '/performLogout'; | ||||
|                             title python: _('logout')"> | ||||
|           <img src="skyn/logout.gif"/> | ||||
|          </a> | ||||
|         </td> | ||||
|        </tr> | ||||
|       </table> | ||||
|      </td> | ||||
|     </tr> | ||||
|    </table> | ||||
|   </td> | ||||
|  </tr> | ||||
|  <tal:comment replace="nothing">The message strip</tal:comment> | ||||
|  <tr tal:define="msg request/portal_status_message | nothing"> | ||||
|   <td> | ||||
|    <div style="position: relative" align="right"> | ||||
|     <div tal:condition="msg" class="message" tal:content="structure msg"></div> | ||||
|    </div> | ||||
|   </td> | ||||
|  </tr> | ||||
|  <tr> | ||||
|    <td><span metal:define-slot="content"><span tal:content="isAnon"></span></span></td> | ||||
|   <td> | ||||
|     <table class="content" width="100%"> | ||||
|      <tr> | ||||
|       <td><span metal:define-slot="content"></span> | ||||
|       </td> | ||||
|      </tr>  | ||||
|     </table> | ||||
|    </td>  | ||||
|  </tr> | ||||
| </table> | ||||
| 
 | ||||
| <br/> | ||||
| <h1>Appy</h1> | ||||
| <h2>Sub appy</h2> | ||||
| <h3>Sub sub appy</h3> | ||||
| <p>Hello</p> | ||||
| </body> | ||||
| </html> | ||||
|  |  | |||
|  | @ -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('<!applicationName!>'): | ||||
|         qi.installProduct('<!applicationName!>') | ||||
|     return "Product <!applicationName!> installed." | ||||
|     return "<!applicationName!> installed." | ||||
| 
 | ||||
| # ------------------------------------------------------------------------------ | ||||
| def install_default(context): | ||||
|  |  | |||
|  | @ -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}.' | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gaetan Delannay
						Gaetan Delannay