Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/README.txt
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/README.txt	(revision 2645)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/README.txt	(revision 2646)
@@ -54,3 +54,126 @@
 
 -*- extra stuff goes here -*-
+The GSpreadsheet content type
+===============================
 
+In this section we are tesing the GSpreadsheet content type by performing
+basic operations like adding, updadating and deleting GSpreadsheet content
+items.
+
+Adding a new GSpreadsheet content item
+--------------------------------
+
+We use the 'Add new' menu to add a new content item.
+
+    >>> browser.getLink('Add new').click()
+
+Then we select the type of item we want to add. In this case we select
+'GSpreadsheet' and click the 'Add' button to get to the add form.
+
+    >>> browser.getControl('GSpreadsheet').click()
+    >>> browser.getControl(name='form.button.Add').click()
+    >>> 'GSpreadsheet' in browser.contents
+    True
+
+Now we fill the form and submit it.
+
+    >>> browser.getControl(name='title').value = 'GSpreadsheet Sample'
+    >>> browser.getControl('Save').click()
+    >>> 'Changes saved' in browser.contents
+    True
+
+And we are done! We added a new 'GSpreadsheet' content item to the portal.
+
+Updating an existing GSpreadsheet content item
+---------------------------------------
+
+Let's click on the 'edit' tab and update the object attribute values.
+
+    >>> browser.getLink('Edit').click()
+    >>> browser.getControl(name='title').value = 'New GSpreadsheet Sample'
+    >>> browser.getControl('Save').click()
+
+We check that the changes were applied.
+
+    >>> 'Changes saved' in browser.contents
+    True
+    >>> 'New GSpreadsheet Sample' in browser.contents
+    True
+
+Removing a/an GSpreadsheet content item
+--------------------------------
+
+If we go to the home page, we can see a tab with the 'New GSpreadsheet
+Sample' title in the global navigation tabs.
+
+    >>> browser.open(portal_url)
+    >>> 'New GSpreadsheet Sample' in browser.contents
+    True
+
+Now we are going to delete the 'New GSpreadsheet Sample' object. First we
+go to the contents tab and select the 'New GSpreadsheet Sample' for
+deletion.
+
+    >>> browser.getLink('Contents').click()
+    >>> browser.getControl('New GSpreadsheet Sample').click()
+
+We click on the 'Delete' button.
+
+    >>> browser.getControl('Delete').click()
+    >>> 'Item(s) deleted' in browser.contents
+    True
+
+So, if we go back to the home page, there is no longer a 'New GSpreadsheet
+Sample' tab.
+
+    >>> browser.open(portal_url)
+    >>> 'New GSpreadsheet Sample' in browser.contents
+    False
+
+Adding a new GSpreadsheet content item as contributor
+------------------------------------------------
+
+Not only site managers are allowed to add GSpreadsheet content items, but
+also site contributors.
+
+Let's logout and then login as 'contributor', a portal member that has the
+contributor role assigned.
+
+    >>> browser.getLink('Log out').click()
+    >>> browser.open(portal_url)
+    >>> browser.getControl(name='__ac_name').value = 'contributor'
+    >>> browser.getControl(name='__ac_password').value = default_password
+    >>> browser.getControl(name='submit').click()
+    >>> browser.open(portal_url)
+
+We use the 'Add new' menu to add a new content item.
+
+    >>> browser.getLink('Add new').click()
+
+We select 'GSpreadsheet' and click the 'Add' button to get to the add form.
+
+    >>> browser.getControl('GSpreadsheet').click()
+    >>> browser.getControl(name='form.button.Add').click()
+    >>> 'GSpreadsheet' in browser.contents
+    True
+
+Now we fill the form and submit it.
+
+    >>> browser.getControl(name='title').value = 'GSpreadsheet Sample'
+    >>> browser.getControl('Save').click()
+    >>> 'Changes saved' in browser.contents
+    True
+
+Done! We added a new GSpreadsheet content item logged in as contributor.
+
+Finally, let's login back as manager.
+
+    >>> browser.getLink('Log out').click()
+    >>> browser.open(portal_url)
+    >>> browser.getControl(name='__ac_name').value = portal_owner
+    >>> browser.getControl(name='__ac_password').value = default_password
+    >>> browser.getControl(name='submit').click()
+    >>> browser.open(portal_url)
+
+
+
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/config.py
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/config.py	(revision 2645)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/config.py	(revision 2646)
@@ -6,3 +6,4 @@
 ADD_PERMISSIONS = {
     # -*- extra stuff goes here -*-
+    'GSpreadsheet': 'quintagroup.gdocs.spreadsheet: Add GSpreadsheet',
 }
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/configure.zcml
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/configure.zcml	(revision 2645)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/configure.zcml	(revision 2646)
@@ -7,4 +7,14 @@
   
   <!-- -*- extra stuff goes here -*- -->
+  <class class=".gspreadsheet.GSpreadsheet">
+    <require
+        permission="zope2.View"
+        interface="..interfaces.IGSpreadsheet"
+        />
+    <require
+        permission="cmf.ModifyPortalContent"
+        set_schema="..interfaces.IGSpreadsheet"
+        />
+  </class>
 
 </configure>
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/gspreadsheet.py
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/gspreadsheet.py	(revision 2646)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/content/gspreadsheet.py	(revision 2646)
@@ -0,0 +1,40 @@
+"""Definition of the GSpreadsheet content type
+"""
+
+from zope.interface import implements, directlyProvides
+
+from Products.Archetypes import atapi
+from Products.ATContentTypes.content import base
+from Products.ATContentTypes.content import schemata
+
+from quintagroup.gdocs.spreadsheet import spreadsheetMessageFactory as _
+from quintagroup.gdocs.spreadsheet.interfaces import IGSpreadsheet
+from quintagroup.gdocs.spreadsheet.config import PROJECTNAME
+
+GSpreadsheetSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
+
+    # -*- Your Archetypes field definitions here ... -*-
+
+))
+
+# Set storage on fields copied from ATContentTypeSchema, making sure
+# they work well with the python bridge properties.
+
+GSpreadsheetSchema['title'].storage = atapi.AnnotationStorage()
+GSpreadsheetSchema['description'].storage = atapi.AnnotationStorage()
+
+schemata.finalizeATCTSchema(GSpreadsheetSchema, moveDiscussion=False)
+
+class GSpreadsheet(base.ATCTContent):
+    """Lets you select google spreadsheet and worksheet id"""
+    implements(IGSpreadsheet)
+
+    meta_type = "GSpreadsheet"
+    schema = GSpreadsheetSchema
+
+    title = atapi.ATFieldProperty('title')
+    description = atapi.ATFieldProperty('description')
+
+    # -*- Your ATSchema to Python Property Bridges Here ... -*-
+
+atapi.registerType(GSpreadsheet, PROJECTNAME)
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/interfaces/__init__.py
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/interfaces/__init__.py	(revision 2645)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/interfaces/__init__.py	(revision 2646)
@@ -1,1 +1,3 @@
 # -*- extra stuff goes here -*-
+from gspreadsheet import IGSpreadsheet
+
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/interfaces/gspreadsheet.py
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/interfaces/gspreadsheet.py	(revision 2646)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/interfaces/gspreadsheet.py	(revision 2646)
@@ -0,0 +1,12 @@
+from zope import schema
+from zope.interface import Interface
+
+from zope.app.container.constraints import contains
+from zope.app.container.constraints import containers
+
+from quintagroup.spreadsheet import spreadsheetMessageFactory as _
+
+class IGSpreadsheet(Interface):
+    """Lets you select google spreadsheet and worksheet id"""
+
+    # -*- schema definition goes here -*-
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/factorytool.xml
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/factorytool.xml	(revision 2645)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/factorytool.xml	(revision 2646)
@@ -11,4 +11,5 @@
   <factorytypes>
     <!-- -*- extra stuff goes here -*- -->
+    <type portal_type="GSpreadsheet" />
   </factorytypes>
 </object>
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/rolemap.xml
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/rolemap.xml	(revision 2646)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/rolemap.xml	(revision 2646)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<rolemap>
+  <permissions>
+    <!-- -*- extra stuff goes here -*- -->
+    <permission name="quintagroup.gdocs.spreadsheet: Add GSpreadsheet" acquire="False">
+      <role name="Manager" />
+      <role name="Contributor" />
+    </permission>
+  </permissions>
+</rolemap>
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/types.xml
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/types.xml	(revision 2646)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/types.xml	(revision 2646)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- This file registers new types with portal_types. The types are
+     then configured with the corresponding files in types/*.xml. Note
+     that spaces are allowed in type names, but the corresponding XML file
+     uses an underscore instead. The "Factory-based Type Information with
+     dynamic views" refers to an FTI from Products.CMFDynamicViewFTI,
+     which supports Plone's "display" menu.
+  -->
+<object name="portal_types" meta_type="Plone Types Tool">
+  <!-- -*- extra stuff goes here -*- -->
+  <object name="GSpreadsheet"
+    meta_type="Factory-based Type Information with dynamic views" />
+</object>
Index: /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/types/GSpreadsheet.xml
===================================================================
--- /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/types/GSpreadsheet.xml	(revision 2646)
+++ /quintagroup.gdocs.spreadsheet/trunk/quintagroup/gdocs/spreadsheet/profiles/default/types/GSpreadsheet.xml	(revision 2646)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<object name="GSpreadsheet"
+   meta_type="Factory-based Type Information with dynamic views"
+   i18n:domain="quintagroup.gdocs.spreadsheet" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+  <property name="title" i18n:translate="">GSpreadsheet</property>
+  <property name="description"
+    i18n:translate="">Lets you select google spreadsheet and worksheet id</property>
+  <property name="content_meta_type">GSpreadsheet</property>
+  <property name="content_icon">document_icon.gif</property>
+  <property name="product">quintagroup.gdocs.spreadsheet</property>
+  <property name="factory">addGSpreadsheet</property>
+  <property name="immediate_view">atct_edit</property>
+  <property name="global_allow">True</property>
+  <property name="filter_content_types">False</property>
+  <property name="allow_discussion">True</property>
+  <property name="default_view">base_view</property>
+  <property name="view_methods">
+    <element value="base_view" />
+  </property>
+  <alias from="(Default)" to="(dynamic view)" />
+  <alias from="edit" to="atct_edit" />
+  <alias from="sharing" to="@@sharing" />
+  <alias from="view" to="(selected layout)" />
+  <action title="View" action_id="view" category="object" condition_expr=""
+    url_expr="string:${object_url}/" visible="True">
+    <permission value="View" />
+  </action>
+  <action title="Edit" action_id="edit" category="object" condition_expr=""
+    url_expr="string:${object_url}/edit" visible="True">
+    <permission value="Modify portal content" />
+  </action>
+</object>
