Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Vermeulen committed Mar 21, 2011
0 parents commit 4c08b42
Show file tree
Hide file tree
Showing 62 changed files with 7,147 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,6 @@
# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
12 changes: 12 additions & 0 deletions Products/Doormat/Extensions/Install.py
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,12 @@
from Products.CMFCore.utils import getToolByName

def install(portal):
setup_tool = getToolByName(portal, 'portal_setup')
setup_tool.runAllImportStepsFromProfile('profile-Products.Doormat:default')
return "Ran all import steps."

def uninstall(portal):
setup_tool = getToolByName(portal, 'portal_setup')
setup_tool.runAllImportStepsFromProfile('profile-Products.Doormat:uninstall')
return "Ran all uninstall steps."

97 changes: 97 additions & 0 deletions Products/Doormat/__init__.py
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,97 @@
# -*- coding: utf-8 -*-
#
# File: Doormat.py
#
# Copyright (c) 2010 by unknown <unknown>
# Generator: ArchGenXML Version 2.5
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#

__author__ = """unknown <unknown>"""
__docformat__ = 'plaintext'


# There are three ways to inject custom code here:
#
# - To set global configuration variables, create a file AppConfig.py.
# This will be imported in config.py, which in turn is imported in
# each generated class and in this file.
# - To perform custom initialisation after types have been registered,
# use the protected code section at the bottom of initialize().

import logging
logger = logging.getLogger('Doormat')
logger.debug('Installing Product')

import os
import os.path
from Globals import package_home
import Products.CMFPlone.interfaces
from Products.Archetypes import listTypes
from Products.Archetypes.atapi import *
from Products.Archetypes.utils import capitalize
from Products.CMFCore import DirectoryView
from Products.CMFCore import permissions as cmfpermissions
from Products.CMFCore import utils as cmfutils
from Products.CMFPlone.utils import ToolInit
from config import *

DirectoryView.registerDirectory('skins', product_globals)


##code-section custom-init-head #fill in your manual code here
##/code-section custom-init-head


def initialize(context):
"""initialize product (called by zope)"""
##code-section custom-init-top #fill in your manual code here
##/code-section custom-init-top

# imports packages and types for registration
import content


# Initialize portal content
all_content_types, all_constructors, all_ftis = process_types(
listTypes(PROJECTNAME),
PROJECTNAME)

cmfutils.ContentInit(
PROJECTNAME + ' Content',
content_types = all_content_types,
permission = DEFAULT_ADD_CONTENT_PERMISSION,
extra_constructors = all_constructors,
fti = all_ftis,
).initialize(context)

# Give it some extra permissions to control them on a per class limit
for i in range(0,len(all_content_types)):
klassname=all_content_types[i].__name__
if not klassname in ADD_CONTENT_PERMISSIONS:
continue

context.registerClass(meta_type = all_ftis[i]['meta_type'],
constructors= (all_constructors[i],),
permission = ADD_CONTENT_PERMISSIONS[klassname])

##code-section custom-init-bottom #fill in your manual code here
##/code-section custom-init-bottom

1 change: 1 addition & 0 deletions Products/Doormat/browser/__init__.py
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
# Make this a python package
55 changes: 55 additions & 0 deletions Products/Doormat/browser/configure.zcml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,55 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:five="http://namespaces.zope.org/five"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="Doormat">


<browser:page
for="..content.interfaces.IDoormat"
name="doormat-view"
class=".views.DoormatView"
template="doormat_view.pt"
permission="zope2.View"
/>

<browser:page
for="..content.interfaces.IDoormat"
name="doormat-view-bare"
class=".views.DoormatView"
template="doormat_bare_view.pt"
permission="zope2.View"
/>

<browser:page
for="..content.interfaces.IDoormat"
name="doormat-macros"
template="macros.pt"
permission="zope.Public"
/>

<browser:viewlet
name="doormat.footer"
manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
template="doormat_viewlet.pt"
permission="zope2.View"
layer=".interfaces.IDoormatLayer"
/>

<browser:viewlet
name="doormat.footer.bare"
manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
template="doormat_viewlet_bare.pt"
permission="zope2.View"
layer=".interfaces.IDoormatLayer"
/>

<browser:resourceDirectory
name="Products.Doormat.stylesheets"
directory="stylesheets"
/>

</configure>
1 change: 1 addition & 0 deletions Products/Doormat/browser/doormat_bare_view.pt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
<div metal:use-macro="view/context/@@doormat-macros/body" />
5 changes: 5 additions & 0 deletions Products/Doormat/browser/doormat_view.pt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="row">
<div class="cell width-full position-0" >
<div metal:use-macro="view/context/@@doormat-macros/body" />
</div>
</div>
9 changes: 9 additions & 0 deletions Products/Doormat/browser/doormat_viewlet.pt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,9 @@
<tal:getDoormat
tal:define="doormat_brains python:
context.portal_catalog(portal_type='Doormat',sort_on='created')"
tal:condition="python: len(doormat_brains) > 0">
<tal:getView
tal:define="doormat_object python: doormat_brains[0].getObject()"
tal:content="structure doormat_object/@@doormat-view"
/>
</tal:getDoormat>
9 changes: 9 additions & 0 deletions Products/Doormat/browser/doormat_viewlet_bare.pt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,9 @@
<tal:getDoormat
tal:define="doormat_brains python:
context.portal_catalog(portal_type='Doormat',sort_on='created')"
tal:condition="python: len(doormat_brains) > 0">
<tal:getView
tal:define="doormat_object python: doormat_brains[0].getObject()"
tal:content="structure doormat_object/@@doormat-view-bare"
/>
</tal:getDoormat>
5 changes: 5 additions & 0 deletions Products/Doormat/browser/interfaces.py
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
from zope.interface import Interface

class IDoormatLayer(Interface):
""" Marker interface for browser layer
"""
48 changes: 48 additions & 0 deletions Products/Doormat/browser/macros.pt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,48 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
>

<div id="doormat-container"
tal:define="
doormat_data view/getDoormatData;
nr_of_cols python:len(doormat_data);
"
tal:attributes="class string:columns-${nr_of_cols}"
metal:define-macro="body">

<h2 tal:define="title view/getDoormatTitle"
tal:condition="title"
tal:content="title"
>
[Doormat title]
</h2>
<div tal:attributes="class string:doormatColumn column-${repeat/column/index}"
tal:repeat="column doormat_data">
<h3 tal:condition="column/show_title"
tal:content="column/column_title">
[Column title]
</h3>
<dl class="doormatSection" tal:repeat="section column/column_sections">
<dt class="doormatSectionHeader"
tal:condition="section/show_title"
tal:content="section/section_title">[title for section]</dt>
<dd class="doormatSectionBody" tal:repeat="link section/section_links">
<a tal:condition="python: link.get('link_url', None)"
tal:attributes="
href link/link_url;
class link/link_class;
"
tal:content="link/link_title">
[link title]
</a>
<div tal:condition="python: link.get('content', None)"
tal:replace="structure link/content">
[content]
</div>
</dd>
</dl>
</div>
</div>

</html>
43 changes: 43 additions & 0 deletions Products/Doormat/browser/stylesheets/doormat.css
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,43 @@
#doormat-container {
background:none repeat scroll 0 0 #DDDDDD;
font-size:75%;
margin:1em 0;
float: left;
width: 100%;
}
#doormat-container h2 {
margin: 0.5em 0.5em 0px 0.5em;
}
#doormat-container h3 {
margin: 0.5em 0px;
}
#doormat-container dl {
margin: 0.5em 0px;
}
#doormat-container dl dd {
margin-left: 0px;
}
#doormat-container .doormatColumn {
float: left;
margin: 0px 1em;
}

/* Make all columns equally wide */
#doormat-container.columns-2 .doormatColumn {
width: 48%;
}
#doormat-container.columns-3 .doormatColumn {
width: 31%;
}
#doormat-container.columns-4 .doormatColumn {
width: 23%;
}
#doormat-container.columns-5 .doormatColumn {
width: 18%;
}
#doormat-container.columns-6 .doormatColumn {
width: 14%;
}
#doormat-container.columns-7 .doormatColumn {
width: 12%;
}
Loading

0 comments on commit 4c08b42

Please sign in to comment.