Changeset 1428
- Timestamp:
- 09/16/08 18:31:09 (2 months ago)
- Files:
-
- PleiadesEntity/trunk/content/Feature.py (modified) (2 diffs)
- PleiadesEntity/trunk/content/Place.py (modified) (4 diffs)
- PleiadesEntity/trunk/profiles/default/types/Place.xml (modified) (1 diff)
- PleiadesEntity/trunk/skins/PleiadesEntity/place_contents.pt (modified) (1 diff)
- PleiadesEntity/trunk/skins/PleiadesEntity/place_view.pt (modified) (1 diff)
- PleiadesEntity/trunk/skins/PleiadesEntity/pleiades_featurelisting.pt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
PleiadesEntity/trunk/content/Feature.py
r1401 r1428 29 29 from Products.CMFCore import permissions 30 30 from Products.PleiadesEntity.time import TimePeriodCmp 31 from Products.PleiadesEntity.content.interfaces import ILocation 31 32 ##/code-section module-header 32 33 … … 146 147 return sorted(result, cmp=TimePeriodCmp(self)) 147 148 149 security.declareProtected(permissions.View, 'getLocations') 150 def getLocations(self): 151 for o in self.getRefs('hasLocation'): 152 if interfaces.ILocation.providedBy(o): 153 yield o 154 148 155 149 156 registerType(Feature, PROJECTNAME) PleiadesEntity/trunk/content/Place.py
r1418 r1428 89 89 90 90 ##code-section class-header #fill in your manual code here 91 schema["features"].widget.visible = {"edit": "visible", "view": "invisible"} 91 92 ##/code-section class-header 92 93 … … 97 98 """ 98 99 """ 100 t = self.getField('title').get(self) 101 if t: 102 return t 103 if not t: 104 return self.get_title() 105 106 security.declareProtected(permissions.View, 'get_title') 107 def get_title(self): 99 108 titles = [] 100 109 types = [] … … 110 119 else: 111 120 return '/'.join([t for t in titles if t]) 112 121 113 122 security.declareProtected(permissions.View, 'getTimePeriods') 114 123 def getTimePeriods(self): … … 148 157 security.declareProtected(permissions.View, 'getFeatures') 149 158 def getFeatures(self): 150 for o in self.getRefs('hasFeature'):159 for o in self.getRefs('hasFeature'): 151 160 if interfaces.IFeature.providedBy(o): 152 161 yield o 153 162 163 security.declareProtected(permissions.View, 'featuresByLocation') 164 def featuresByLocation(self): 165 """ 166 """ 167 d = {} 168 for f in self.getFeatures(): 169 for l in f.getLocations(): 170 lid = l.getId() 171 if lid not in d: 172 d[lid] = dict( 173 url=l.absolute_url(), 174 title=l.pretty_title_or_id(), 175 features=[] 176 ) 177 d[lid]['features'].append( 178 dict(title=f.pretty_title_or_id(), url=f.absolute_url()) 179 ) 180 return d 154 181 155 182 PleiadesEntity/trunk/profiles/default/types/Place.xml
r1394 r1428 16 16 </property> 17 17 <property name="allow_discussion">False</property> 18 <property name="default_view"> base_view</property>18 <property name="default_view">place_view</property> 19 19 <property name="view_methods"> 20 <element value="place_view"/> 20 21 <element value="base_view"/> 21 22 </property> PleiadesEntity/trunk/skins/PleiadesEntity/place_contents.pt
r1356 r1428 4 4 xmlns:metal="http://xml.zope.org/namespaces/metal" 5 5 xmlns:i18n="http://xml.zope.org/namespaces/i18n" 6 lang="en" 6 7 i18n:domain="plone" 7 8 > 8 <head>9 <title />10 </head>11 9 12 <body> 13 <metal:placecontents_macro metal:define-macro="placecontents"> 14 <div id="pleiades-placecontents"> 15 <div id="pleiades-secondaryreferences" 16 tal:define="global metatype string:Feature"> 17 <label><span>Features</span>:</label> 18 <tal:helpcontext tal:define="global helpcontext metatype"> 19 <p metal:use-macro="here/pleiades_helplink/macros/helplink">helpful link</p> 20 </tal:helpcontext> 21 <p metal:use-macro="here/pleiades_featurelisting/macros/contentlisting">name content</p> 22 </div> 23 </div> 24 </metal:placecontents_macro> 25 </body> 10 <body> 11 <metal:placecontents_macro metal:define-macro="placecontents"> 12 <div id="pleiades-placecontents"> 13 <div 14 id="pleiades-features" 15 tal:define="global metatype string:Feature" 16 > 17 <label><span>Features</span>:</label> 18 <tal:helpcontext tal:define="global helpcontext metatype"> 19 <p metal:use-macro="here/pleiades_helplink/macros/helplink"> 20 helpful link 21 </p> 22 </tal:helpcontext> 23 <p metal:use-macro="here/pleiades_featurelisting/macros/contentlisting"> 24 features 25 </p> 26 </div> 27 </div> 28 </metal:placecontents_macro> 29 </body> 26 30 </html> PleiadesEntity/trunk/skins/PleiadesEntity/place_view.pt
r1383 r1428 1 <html xmlns="http://www.w3.org/1999/xhtml" 2 xmlns:tal="http://xml.zope.org/namespaces/tal" 3 xmlns:metal="http://xml.zope.org/namespaces/metal" 4 xmlns:i18n="http://xml.zope.org/namespaces/i18n" 5 i18n:domain="plone"> 6 <head> 7 <title></title> 8 <head> 9 <metal:block metal:define-macro="js"> 10 <script type="text/javascript" src="/ol/lib/OpenLayers.js"></script> 11 <script type="text/javascript" src="ol.js" 12 tal:attributes="src string:${context/absolute_url}/ol.js"></script> 13 </metal:block> 14 </head> 15 </head> 16 17 <body> 1 <html 2 xmlns="http://www.w3.org/1999/xhtml" 3 xmlns:tal="http://xml.zope.org/namespaces/tal" 4 xmlns:metal="http://xml.zope.org/namespaces/metal" 5 xmlns:i18n="http://xml.zope.org/namespaces/i18n" 6 lang="en" 7 metal:use-macro="here/main_template/macros/master" 8 i18n:domain="plone" 9 > 18 10 11 <metal:javascript fill-slot="javascript_head_slot"> 12 <script type="text/javascript" src="/ol/lib/OpenLayers.js"></script> 13 <script 14 type="text/javascript" 15 src="ol.js" 16 tal:attributes="src string:${context/absolute_url}/ol.js" 17 > 18 </script> 19 </metal:javascript> 19 20 20 <metal:body_macro 21 metal:define-macro="body" 22 > 21 <body> 22 <metal:main fill-slot="main"> 23 <tal:main-macro 24 metal:define-macro="main" 25 tal:define=" 26 kssClassesView context/@@kss_field_decorator_view; 27 getKssClasses nocall:kssClassesView/getKssClassesInlineEditable; 28 templateId template/getId; 29 text here/getContent;" 30 > 23 31 24 <div style="margin-bottom:1em;"> 25 <div id="mapzonebox" 26 tal:define="query_results python:context.portal_catalog.searchResults({'path':{'query':'/'.join(context.restrictedTraverse('../..').getPhysicalPath()),'depth':2}, 'portal_type':'MapContext'})" 27 tal:condition="python:len(query_results) > 0" 28 > 29 <div id="mappish" style="float:right;width:200px;border:none;"> 30 <div id="map" style="float:right;width:200px;height:300px;border:solid gray 1px;background-color:#cccccc;"></div> 31 <div id="gelink" style="float:right;"><span class="link-external"><a href="nwlink">Open in Google Earth</a></span></div> 32 </div> 33 <script 34 tal:on-error="string:// error: context could not be adapted" 35 tal:define="mapcontext python:query_results[0].getObject(); 36 feature_json string:${context/json}; 37 map_json string:${mapcontext/json};" 38 defer="defer" 39 type="text/javascript" 40 tal:content="python:''' 41 var map = eval('(%s)'); 42 var feature = eval('(%s)'); 43 if (feature.center != null) 44 { 45 mapFeature(map, feature, 1/500000); 46 } 47 ''' % (map_json, feature_json)" 48 > 49 </script> 32 <div tal:replace="structure provider:plone.abovecontenttitle" /> 50 33 51 </div> 52 53 <div 54 tal:define="portal python:here.portal_url.getPortalObject(); 55 field_macro field_macro | here/widgets/field/macros/view;" 56 tal:repeat="field python:here.Schema().filterFields(isMetadata=0)" 57 > 58 <tal:if_visible 59 define="mode string:view; 60 visState python:field.widget.isVisible(here, mode); 61 visCondition python:field.widget.testCondition(here, portal, template);" 62 condition="python:visState == 'visible' and visCondition" 63 > 64 <metal:use_field 65 use-macro="field_macro" 66 /> 67 </tal:if_visible> 68 </div> 34 <h1 class="documentFirstHeading"> 35 <metal:field use-macro="python:context.widget('title', mode='view')"> 36 Title 37 </metal:field> 38 </h1> 69 39 70 <div> 71 <label><span>Alternate representations</span></label>: 72 <ul> 73 <!--li class="repr-georss"><a rel="alternate" href="georss">GeoRSS</a></li--> 74 <li class="repr-kml"> 75 <a tal:attributes="href string:${context/absolute_url}/kml">KML</a> 76 </li> 77 </ul> 78 </div> 79 80 <hr style="display: block; clear: right; visibility: hidden;"/> 40 <div tal:replace="structure provider:plone.belowcontenttitle" /> 81 41 82 </div> 83 84 </metal:body_macro> 42 <p class="documentDescription"> 43 <metal:field 44 use-macro="python:context.widget('description', mode='view')" 45 > 46 Description 47 </metal:field> 48 </p> 85 49 86 <metal:label_macro define-macro="label"> 87 <p metal:use-macro="here/pleiades_helpedlabel/macros/helpedlabel">helpful label</p> 88 </metal:label_macro> 89 <metal:folderlisting_macro define-macro="folderlisting"><!-- do nothing: suppresses default folderlisting behaviors --></metal:folderlisting_macro> 50 <p class="field"> 51 <label><span>Modern Location</span>:</label> 52 <metal:field 53 use-macro="python:context.widget('modernLocation', mode='view')" 54 > 55 Description 56 </metal:field> 57 </p> 90 58 59 <div class="field" id="pleiades-features"> 60 <label><span>Features</span>:</label> 61 <p 62 metal:use-macro="context/pleiades_featurelisting/macros/contentlisting" 63 > 64 features 65 </p> 66 </div> 91 67 92 </body> 93 </html> 68 <div tal:replace="structure provider:plone.abovecontentbody" /> 94 69 70 <p 71 tal:condition="python: not text and is_editable" 72 i18n:translate="no_body_text" 73 class="discreet" 74 > 75 This item does not have any body text, click the edit tab to change it. 76 </p> 77 78 <metal:field use-macro="python:context.widget('content', mode='view')"> 79 Body text 80 </metal:field> 81 82 <div metal:use-macro="here/document_relateditems/macros/relatedItems"> 83 show related items if they exist 84 </div> 85 86 <div tal:replace="structure provider:plone.belowcontentbody" /> 87 88 </tal:main-macro> 89 </metal:main> 90 </body> 91 92 </html> 93 PleiadesEntity/trunk/skins/PleiadesEntity/pleiades_featurelisting.pt
r1360 r1428 1 <html xmlns="http://www.w3.org/1999/xhtml" 2 xmlns:tal="http://xml.zope.org/namespaces/tal" 3 xmlns:metal="http://xml.zope.org/namespaces/metal" 4 xmlns:i18n="http://xml.zope.org/namespaces/i18n" 5 i18n:domain="plone"> 6 <head><title></title></head> 7 <body> 8 9 <metal:namecontentlisting_macro define-macro="contentlisting"> 10 <tal:chunk 11 tal:define="folderContents python:context.getFeatures();" 12 > 13 <ul tal:condition="folderContents"> 14 <li tal:repeat="item folderContents"> 15 <tal:definition 16 tal:define="item_title_or_id item/pretty_title_or_id; 17 item_url item/getURL|item/absolute_url;" 18 > 19 <a href="" 20 tal:attributes="href item_url" 21 tal:content="item_title_or_id" 22 >stuff 23 </a> 24 </tal:definition> 25 </li> 26 </ul> 27 <p tal:condition="not:folderContents">none</p> 28 </tal:chunk> 29 </metal:namecontentlisting_macro> 30 </body> 1 <html 2 xmlns="http://www.w3.org/1999/xhtml" 3 xmlns:tal="http://xml.zope.org/namespaces/tal" 4 xmlns:metal="http://xml.zope.org/namespaces/metal" 5 xmlns:i18n="http://xml.zope.org/namespaces/i18n" 6 lang="en" 7 i18n:domain="plone" 8 > 9 10 <body> 11 <metal:namecontentlisting_macro define-macro="contentlisting"> 12 <tal:chunk tal:define="locations python:context.featuresByLocation().values()"> 13 <ul tal:condition="locations"> 14 <li tal:repeat="location locations"> 15 <a 16 tal:repeat="feature location/features" 17 tal:attributes="href feature/url" 18 tal:content="feature/title"> 19 Feature 20 </a> 21 @ 22 <a 23 tal:attributes="href location/url" 24 tal:content="location/title"> 25 Location 26 </a> 27 </li> 28 </ul> 29 <p tal:condition="not:locations">none</p> 30 </tal:chunk> 31 </metal:namecontentlisting_macro> 32 </body> 31 33 </html> 32
