View | Details | Raw Unified | Return to bug 43769
Collapse All | Expand All

(-)src/README_SITEMAP_REFACTORING.txt (+30 lines)
Line 0 Link Here
1
THIS IS WORK IN PROGRESS. DON'T USE IT FOR ANYTHING OTHER THAN PLAYING.
2
3
known to work:
4
==============
5
6
index page,
7
browsing around in authoring
8
most usecases
9
10
known not to work:
11
==================
12
13
bxe,
14
tinymce
15
requests of the form <pubname>/<area>/ (i.e. without a document specified)
16
THIS IS WORK IN PROGRESS. DON'T USE IT FOR ANYTHING OTHER THAN PLAYING.
17
18
known to work:
19
==============
20
21
index page,
22
browsing around in authoring
23
most usecases
24
25
known not to work:
26
==================
27
28
bxe,
29
tinymce
30
requests of the form <pubname>/<area>/ (i.e. without a document specified)
(-)src/pubs/default/sitemap.xmap (-90 / +3 lines)
Lines 21-42 Link Here
21
21
22
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
22
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
23
23
24
  <map:components>
25
    <map:transformers default="xslt">
26
      <map:transformer name="metaData" logger="lenya.sitemap.transformer.metaData" src="org.apache.lenya.cms.cocoon.transformation.MetaDataTransformer"/>
27
    </map:transformers>
28
    <map:serializers default="xhtml">
29
      <map:serializer logger="sitemap.serializer.links" name="links" src="org.apache.lenya.cms.cocoon.serialization.LinkSerializer"/>
30
    </map:serializers>
31
  </map:components>
32
33
  <map:views>
34
    <map:view from-position="last" name="links">
35
      <map:serialize type="links" />
36
    </map:view>
37
  </map:views>
38
39
40
  <map:pipelines>
24
  <map:pipelines>
41
25
42
    <!-- This pipeline handles helper requests and metadata, not the actual publication documents -->
26
    <!-- This pipeline handles helper requests and metadata, not the actual publication documents -->
Lines 104-131 Link Here
104
88
105
    <map:pipeline type="caching">
89
    <map:pipeline type="caching">
106
90
107
      <!-- RSS formatting. 
91
       <!-- {1:rendertype}/{2:pub}/{3:area}/{4:path} -->
108
           FIXME: this should be handled by an RSS feed module!
109
      -->
110
      <map:match pattern="**.rss">
111
        <map:generate src="{resource-type:format-rss}"/>
112
        <map:serialize type="xml"/>
113
      </map:match>
114
115
      <!-- FIXME: either this should be moved into a metadata module, or at least we need to establish
116
           some standard for magic extra suffixes and stick to it.
117
           Here we use .html.meta, bxe uses .bxe.html.
118
      -->
119
      <map:match pattern="*/**.html.meta">
120
        <map:generate type="lenyaMetaData" src="lenya-document:{page-envelope:document-uuid},area={1}"/>
121
        <map:serialize type="xml"/>
122
      </map:match>
123
      <map:match pattern="**meta">
124
        <map:generate type="lenyaMetaData" src="lenya-document:{request-param:uuid},lang={request-param:lang},pubid={request-param:pubid},area={request-param:area}"/>
125
        <map:serialize type="xml"/>
126
      </map:match>
127
128
      <!-- {1:rendertype}/{2:pub}/{3:area}/{4:path} -->
129
      <map:match pattern="document-content/*/*/*/**">
92
      <map:match pattern="document-content/*/*/*/**">
130
        <map:act type="language-exists">
93
        <map:act type="language-exists">
131
          <map:generate src="{resource-type:format-xhtml}?rendertype={../1}"/>
94
          <map:generate src="{resource-type:format-xhtml}?rendertype={../1}"/>
Lines 217-245 Link Here
217
            <map:parameter name="title" value="{dublincore:title}"/>
180
            <map:parameter name="title" value="{dublincore:title}"/>
218
          </map:transform>
181
          </map:transform>
219
        </map:act>
182
        </map:act>
220
221
        <!-- This is a demonstration of the generic meta data transformer
222
          described in bug 39891.
223
224
          1) define the ns: xmlns:meta="http://apache.org/lenya/meta/1.0/"
225
          2) use it in above xsl like e.g.
226
          <meta:value ns="http://purl.org/dc/elements/1.1/" element="date" uuid="{@uuid}"/>
227
228
          Where @ns is the namespace for which you want to retrieve the @element for.
229
          If there is more then one element registered then the transformer returns:
230
          <value xmlns="http://apache.org/lenya/meta/1.0/" value="2005-09-11 12:44:05" element="date" />
231
          <value xmlns="http://apache.org/lenya/meta/1.0/" value="2006-09-11 12:44:05" element="date" />
232
233
          Otherwise it will return the value as characters.
234
        -->
235
        <map:transform type="metaData">
236
          <map:parameter name='pubid' value='{page-envelope:publication-id}'/>
237
          <map:parameter name='area' value='{page-envelope:area}'/>
238
        </map:transform>
239
        <map:transform type="i18n">      
240
          <map:parameter name="locale" value="{page-envelope:language}"/>
241
        </map:transform>
242
        <map:transform type="uuid2url"/>
243
        <map:serialize type="xml"/>
183
        <map:serialize type="xml"/>
244
      </map:match>
184
      </map:match>
245
185
Lines 252-267 Link Here
252
    <map:pipeline>
192
    <map:pipeline>
253
193
254
      <!-- 
194
      <!-- 
255
         FIXME: this is a BXE-specific hack that should be handled by BXE's module sitemap. The publication 
256
         should not be concerned with BXE-specific pre-processing of documents.
257
      -->
258
      <map:match pattern="**.bxe.html">
259
        <map:generate src="cocoon:/lenyabody-edit/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
260
        <map:transform type="proxy"/>
261
        <map:serialize type="xml"/>
262
      </map:match>
263
264
      <!-- 
265
        Finally: this matcher handles requests for publication documents. 
195
        Finally: this matcher handles requests for publication documents. 
266
        /{1:area}/{2:document-path}.html
196
        /{1:area}/{2:document-path}.html
267
      -->
197
      -->
Lines 330-341 Link Here
330
          </map:otherwise>
260
          </map:otherwise>
331
        </map:select>
261
        </map:select>
332
262
333
        <!-- 
334
            strip xhtml namespace prefix to ensure compatibility with non-XML conformant browsers
335
            workaround to avoid empty script, style and textarea tags (firefox chokes on those)
336
        -->
337
        <map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
338
339
        <!-- client cache expiration settings -->
263
        <!-- client cache expiration settings -->
340
        <map:select type="parameter">
264
        <map:select type="parameter">
341
          <map:parameter name="parameter-selector-test" value="{1}"/>
265
          <map:parameter name="parameter-selector-test" value="{1}"/>
Lines 356-372 Link Here
356
          </map:otherwise> 
280
          </map:otherwise> 
357
        </map:select>
281
        </map:select>
358
282
359
        <!-- pretty-print output for easier debugging and for the benefit of new users 
360
              NOTE: you may want to disable this in production for performance reasons,
361
              but it's on by default in the default publication to make the generated code 
362
              easier to work with for new users. -->
363
        <map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>
364
365
        <!-- the proxy transformer handles proxy-related URL rewriting -->
366
        <map:transform type="proxy"/>
367
368
        <map:act type="language-exists">
283
        <map:act type="language-exists">
369
          <map:serialize type="xhtml"/>
284
          <map:serialize/>
370
        </map:act>
285
        </map:act>
371
        <!-- 
286
        <!-- 
372
            When the requested document does not exist, we generate a nice error page.
287
            When the requested document does not exist, we generate a nice error page.
Lines 407-417 Link Here
407
          <map:parameter name="parameter-selector-test" value="{1}"/>
322
          <map:parameter name="parameter-selector-test" value="{1}"/>
408
          <map:when test="live"/>
323
          <map:when test="live"/>
409
          <map:otherwise>
324
          <map:otherwise>
410
            <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}?doctype={page-envelope:document-type}"/>
325
            <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}"/>
411
          </map:otherwise>
326
          </map:otherwise>
412
        </map:select>
327
        </map:select>
413
        <map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
414
        <map:transform type="proxy"/>
415
        <map:serialize type="xhtml" status-code="404"/>
328
        <map:serialize type="xhtml" status-code="404"/>
416
329
417
      </map:match>
330
      </map:match>
(-)src/webapp/global-sitemap.xmap (-31 / +31 lines)
Lines 27-43 Link Here
27
        <map:parameter name="locale" value="{request:locale}"/>
27
        <map:parameter name="locale" value="{request:locale}"/>
28
      </map:transform>    
28
      </map:transform>    
29
      <map:transform src="fallback://lenya/xslt/util/page2xhtml.xsl"/>
29
      <map:transform src="fallback://lenya/xslt/util/page2xhtml.xsl"/>
30
      <map:transform type="uuid2url"/>
30
      <map:transform type="proxy"/>
31
      <map:transform type="proxy"/>
31
      <map:transform src="context://lenya/xslt/util/strip_namespaces.xsl"/>
32
      <map:transform src="context://lenya/xslt/util/strip_namespaces.xsl"/>
32
      <map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>
33
      <map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>
34
      <map:select type="parameter">
35
        <map:parameter name="parameter-selector-test" value="{HTTPStatus}"/>
36
        <map:when test="">
37
          <map:serialize type="xhtml"/>
38
        </map:when>
39
        <map:otherwise>
40
          <map:serialize type="xhtml" status-code="{HTTPStatus}"/>
41
        </map:otherwise>
42
      </map:select>
33
    </map:resource>  
43
    </map:resource>  
34
44
35
    <map:resource name="i18n">
36
      <map:transform type="i18n">
37
        <map:parameter name="locale" value="{request:locale}"/>
38
      </map:transform>
39
    </map:resource>
40
41
    <!-- do proxy transformation on css files for url('') links -->
45
    <!-- do proxy transformation on css files for url('') links -->
42
    <map:resource name="proxy-css">
46
    <map:resource name="proxy-css">
43
      <map:act type="resource-exists"
47
      <map:act type="resource-exists"
Lines 82-88 Link Here
82
        <pipeline-expiration>now</pipeline-expiration>
86
        <pipeline-expiration>now</pipeline-expiration>
83
      </global-variables>
87
      </global-variables>
84
    </map:component-configurations>
88
    </map:component-configurations>
85
  
89
86
    <!-- create a list of publications for the global welcome page: -->  
90
    <!-- create a list of publications for the global welcome page: -->  
87
    <map:pipeline>
91
    <map:pipeline>
88
      <map:match pattern="aggregate-publications">
92
      <map:match pattern="aggregate-publications">
Lines 154-160 Link Here
154
          <map:parameter name="tabGroup" value="{usecase:tabGroup:{request-param:lenya.usecase}}"/>
158
          <map:parameter name="tabGroup" value="{usecase:tabGroup:{request-param:lenya.usecase}}"/>
155
          <map:parameter name="newMessages" value="{inbox:newMessageCount}"/>
159
          <map:parameter name="newMessages" value="{inbox:newMessageCount}"/>
156
        </map:transform>
160
        </map:transform>
157
        <map:call resource="i18n"/>
158
        <!-- Generate the meta-stylesheet -->
161
        <!-- Generate the meta-stylesheet -->
159
        <map:transform src="fallback://lenya/xslt/menu/menu2xslt.xsl">
162
        <map:transform src="fallback://lenya/xslt/menu/menu2xslt.xsl">
160
          <map:parameter name="publicationid" value="{1}"/>
163
          <map:parameter name="publicationid" value="{1}"/>
Lines 300-306 Link Here
300
        </map:aggregate>
303
        </map:aggregate>
301
        <map:transform src="lenya/xslt/util/welcome.xsl"/>
304
        <map:transform src="lenya/xslt/util/welcome.xsl"/>
302
        <map:call resource="style-cms-page"/>
305
        <map:call resource="style-cms-page"/>
303
        <map:serialize />
304
      </map:match>
306
      </map:match>
305
307
306
      <!-- any root-level request is directed to the welcome page -->
308
      <!-- any root-level request is directed to the welcome page -->
Lines 356-362 Link Here
356
        </map:aggregate>
358
        </map:aggregate>
357
        <map:transform src="lenya/xslt/util/introduction.xsl"/>
359
        <map:transform src="lenya/xslt/util/introduction.xsl"/>
358
        <map:call resource="style-cms-page"/>
360
        <map:call resource="style-cms-page"/>
359
        <map:serialize />
360
      </map:match>
361
      </map:match>
361
     
362
     
362
    </map:pipeline>
363
    </map:pipeline>
Lines 399-425 Link Here
399
        </map:match>
400
        </map:match>
400
      </map:match>
401
      </map:match>
401
402
402
     <!-- delegate publication requests to the publication sitemap -->
403
      <!-- delegate publication requests to the publication sitemap -->
403
     <map:match pattern="*/**">
404
      <map:match pattern="*/**">
404
       <map:select type="parameter">
405
        <map:select type="parameter">
405
         <map:parameter name="parameter-selector-test" value="{page-envelope:publication-id}"/>
406
          <map:parameter name="parameter-selector-test" value="{page-envelope:publication-id}"/>
406
         <map:when test="">
407
          <map:when test="">
407
           <map:generate type="jx" src="lenya/content/exception/publication-does-not-exist.jx">
408
            <map:generate type="jx" src="lenya/content/exception/publication-does-not-exist.jx">
408
             <map:parameter name="publicationId" value="{1}"/>
409
              <map:parameter name="publicationId" value="{1}"/>
409
           </map:generate>
410
            </map:generate>
410
           <map:transform type="i18n">
411
            <map:call resource="style-cms-page">
411
             <map:parameter name="locale" value="{request:locale}"></map:parameter>
412
              <map:parameter name="HTTPStatus" value="404"/>
412
           </map:transform>
413
            </map:call>
413
           <map:call resource="style-cms-page"/>
414
          </map:when>
414
           <map:serialize status-code="404" />
415
          <map:otherwise>
415
         </map:when>
416
            <map:generate src="cocoon:/{1}/{2}"/>
416
         <map:otherwise>
417
            <map:call resource="style-cms-page"/>
417
           <map:mount uri-prefix="{1}" src="{fallback:sitemap.xmap}" check-reload="true" reload-method="synchron"/>
418
          </map:otherwise>
418
         </map:otherwise>
419
        </map:select>
419
       </map:select>
420
      </map:match>
420
     </map:match>
421
    </map:pipeline>
421
   </map:pipeline>
422
422
423
</map:pipelines>
423
  </map:pipelines>
424
424
425
</map:sitemap>
425
</map:sitemap>

Return to bug 43769