Development

Changeset 4665

You must first sign up to be able to contribute.

Changeset 4665

Show
Ignore:
Timestamp:
07/18/07 18:04:25 (6 years ago)
Author:
francois
Message:

sfSimpleCMSPlugin Added the ability to use a list of components as the value of a slot

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfSimpleCMSPlugin/README

    r4663 r4665  
    125125      RichText:       Rich text 
    126126      Php:            PHP code 
     127      Modular:        List of components 
    127128}}} 
    128129 
     
    182183 * Refactor the `sfSimpleCMS` action code to make it DRYier (use mixins?) 
    183184 * Add a validator for the slug 
    184  * Ability to use a list of components as the value of a slot 
    185185 * Better integration with sfGuard 
    186186 * Search engine 
     
    191191=== Trunk ===  
    192192 
     193=== 2007-07-18 | 0.6.2 Beta ===  
     194 
     195 * francois: Added the ability to use a list of components as the value of a slot 
    193196 * francois: Fixed problem with encoded placeholder on certain configurations 
    194197 * francois: Fixed problem when using SQLite in sfSimpleCMSAdmin module 
  • plugins/sfSimpleCMSPlugin/lib/helper/sfSimpleCMSBasicSlotTypesHelper.php

    r4660 r4665  
    11<?php 
    22 
     3/** 
     4 * Returns the value of a simple text slot. To be used by the sfSimpleCMSHelper. 
     5 * The slot must contain text, and is fimply formatted in HTML 
     6 * By transforming carriage returns into <br/> and URLs into hyperlinks.  
     7 * Example: 
     8 * <code> 
     9 * // If the slot value is 
     10 * Hello, world.  
     11 * My address is http://www.example.com 
     12 * // Then the helper will return 
     13 * Hello, world.<br /> 
     14 * My address is <a href='http://www.example.com'>http://www.example.com</a> 
     15 * </code> 
     16 * 
     17 * @param string $page the page object 
     18 * @param string $slot slot name 
     19 * @return slot value 
     20 */ 
    321function getTextSlotValue($page, $slot) 
    422{ 
     
    1230} 
    1331 
     32/** 
     33 * Returns the value of a rich text slot. To be used by the sfSimpleCMSHelper. 
     34 * The slot must contain valid HTML code. 
     35 * Example: 
     36 * <code> 
     37 * // If the slot value is 
     38 * Hello, <b>world</b>! 
     39 * // Then the helper will return 
     40 * Hello, <b>world</b>! 
     41 * </code> 
     42 * 
     43 * @param string $page the page object 
     44 * @param string $slot slot name 
     45 * @return slot value 
     46 */ 
    1447function getRichTextSlotValue($page, $slot) 
    1548{ 
     
    3063} 
    3164 
     65/** 
     66 * Returns the value of a PHP slot. To be used by the sfSimpleCMSHelper. 
     67 * The slot must contain valid HTML with embedded PHP tags 
     68 * Example: 
     69 * <code> 
     70 * // If the slot value is 
     71 * Hello, <?php echo 'world' ?>! 
     72 * // Then the helper will return 
     73 * Hello, world! 
     74 * </code> 
     75 * 
     76 * @param string $page the page object 
     77 * @param string $slot slot name 
     78 * @return slot value 
     79 */ 
    3280function getPHPSlotValue($page, $slot) 
    3381{ 
     
    4189  return textarea_tag('slot_content', $page->getByName($slot), 'size=80x10 id=edit_textarea'. $slot .' style=width:100% class=code'); 
    4290} 
     91 
     92/** 
     93 * Returns the value of a modular slot. To be used by the sfSimpleCMSHelper. 
     94 * The slot must contain a valid list of components in YAML format 
     95 * Example: 
     96 * <code> 
     97 * // If the slot value is 
     98 * mycomponent: 
     99 *   component: mymodule/myaction 
     100 *   foo:       bar 
     101 * // Then the helper will return the result of a call to 
     102 * get_component('mymodule', 'myaction', array('foo' => 'bar')); 
     103 * </code> 
     104 * 
     105 * @param string $page the page object 
     106 * @param string $slot slot name 
     107 * @return slot value 
     108 */ 
     109function getModularSlotValue($page, $slot) 
     110{ 
     111  sfLoader::loadHelpers(array('Partial')); 
     112  $components = sfYaml::load($page->getByName($slot)); 
     113  $res = ''; 
     114  foreach($components as $name => $params) 
     115  { 
     116    list($module, $action) = split('/', $params['component']); 
     117    unset($params['component']); 
     118    $res .= get_component($module, $action, $params); 
     119  } 
     120   
     121  return $res; 
     122} 
     123 
     124function getModularSlotEditor($page, $slot) 
     125{ 
     126  return textarea_tag('slot_content', $page->getByName($slot), 'size=80x10 id=edit_textarea'. $slot .' style=width:100% class=modular'); 
     127} 
  • plugins/sfSimpleCMSPlugin/package.xml

    r4652 r4665  
    2626 <date>2007-07-18</date> 
    2727 <version> 
    28    <release>0.6.1</release> 
     28   <release>0.6.2</release> 
    2929   <api>0.6.0</api> 
    3030 </version>