To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Show
Ignore:
Timestamp:
09/01/10 11:59:43 (21 months ago)
Author:
wjohnald
Message:

this commit resolves tickets: #144 and #347

Location:
plugins/apostrophePlugin/trunk
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePlugin/trunk

  • plugins/apostrophePlugin/trunk/config/doctrine/schema.yml

    r2016 r2107  
    1010    - Timestampable 
    1111    - NestedSet 
     12    - Taggable 
    1213  columns: 
    1314    id: 
  • plugins/apostrophePlugin/trunk/lib/action/BaseaActions.class.php

    r2030 r2107  
    4141    $this->page = $page; 
    4242    $this->setTemplate($page->template); 
     43 
     44        $tagstring = implode(',', $page->getTags()); 
     45        if (strlen($tagstring)) 
     46        { 
     47        $this->getResponse()->addMeta('keywords', htmlspecialchars($tagstring)); 
     48    } 
     49    if (strlen($page->getMetaDescription())) 
     50    { 
     51          $this->getResponse()->addMeta('description', $page->getMetaDescription()); 
     52        } 
    4353 
    4454    return 'Template'; 
  • plugins/apostrophePlugin/trunk/lib/action/BaseaFeedSlotComponents.class.php

    r1868 r2107  
    3434      $this->posts = $this->getOption('posts', 5); 
    3535      $this->links = $this->getOption('links', true); 
    36       $this->markup = $this->getOption('markup', '<strong><em><p><br><ul><li>'); 
     36      $this->markup = $this->getOption('markup', '<strong><em><p><br><ul><li><a>'); 
    3737                        $this->attributes = $this->getOption('attributes', false); 
    3838                        $this->styles = $this->getOption('styles',false); 
  • plugins/apostrophePlugin/trunk/lib/form/BaseaPageSettingsForm.class.php

    r2016 r2107  
    9393    ))); 
    9494 
     95        // Tags 
     96        $tagstring = implode(', ', $this->getObject()->getTags());  // added a space after the comma for readability 
     97        // class tag-input enabled for typeahead support 
     98        $this->setWidget('tags', new sfWidgetFormInput(array('default' => $tagstring), array('class' => 'tags-input'))); 
     99        $this->setValidator('tags', new sfValidatorString(array('required' => false))); 
     100 
     101 
     102        // Meta Description 
     103        $metaDescription = $this->getObject()->getMetaDescription(); 
     104        $this->setWidget('meta_description', new sfWidgetFormTextArea(array('default' => html_entity_decode($metaDescription, ENT_COMPAT, 'UTF-8')))); 
     105        $this->setValidator('meta_description', new sfValidatorString(array('required' => false))); 
     106 
     107 
     108 
    95109    $this->addPrivilegeWidget('edit', 'editors'); 
    96110    $this->addPrivilegeWidget('manage', 'managers'); 
     
    236250    $object = parent::updateObject($values); 
    237251     
     252    // Update tags on Page 
     253    if ($this->getValue('tags') != '') 
     254    { 
     255            $this->getObject()->addTag($this->getValue('tags')); 
     256        } 
     257 
     258    // Update meta-description on Page 
     259    if ($this->getValue('meta_description') != '') 
     260    { 
     261            $this->getObject()->setMetaDescription(htmlentities($this->getValue('meta_description'))); 
     262        }     
     263     
    238264    // Check for cascading operations 
    239265    if($this->getValue('cascade_archived') || $this->getValue('cascade_view_is_secure')) 
  • plugins/apostrophePlugin/trunk/lib/model/doctrine/PluginaFeedSlot.class.php

    r279 r2107  
     1 
    12<?php 
    23 
     
    1314abstract class PluginaFeedSlot extends BaseaFeedSlot 
    1415{ 
    15  
    1616} 
  • plugins/apostrophePlugin/trunk/lib/model/doctrine/PluginaPage.class.php

    r2085 r2107  
    246246    return $title; 
    247247  } 
     248   
     249  public function getMetaDescription() 
     250  { 
     251        $metaDescriptionSlot = $this->getSlot('metaDescription'); 
     252         
     253        $result = ''; 
     254        if ($metaDescriptionSlot) 
     255        { 
     256                $result = $metaDescriptionSlot->value; 
     257        } 
     258        return trim($result); 
     259  } 
     260   
     261   
    248262   
    249263  // Changed in 1.5: returns a flat array, not an associative array indexed by version. 
     
    866880  } 
    867881 
     882  public function setMetaDescription($description) 
     883  { 
     884        $slot = $this->createSlot('aText'); 
     885        $slot->value = $description; 
     886        $slot->save(); 
     887         
     888        $this->newAreaVersion('metaDescription', 'update', 
     889                array( 
     890                        'permid' => 1, 
     891                        'slot' => $slot)); 
     892         
     893  } 
     894 
     895 
    868896  // SAVE ANY CHANGES to the actual page object FIRST before you call this method. 
    869897   
     
    12711299    $summary = $this->getSearchSummary(); 
    12721300    $text = $this->getSearchText(); 
     1301    $tags = implode(',', $this->getTags()); 
     1302    $metaDescription = $this->getMetaDescription(); 
    12731303    $slug = $this->getSlug(); 
    12741304    $info = $this->getInfo(); 
     
    12771307    // it lets us check explicit privileges 
    12781308    unset($info['title']); 
    1279     // These are indexed but not stored. Use for fat fields that 
    1280     // would otherwise turn Lucene into a database (it's a terrible database) 
    12811309    aZendSearch::updateLuceneIndex($this,  
    1282       array('text' => $text), 
     1310      array('text' => $text, 'tags' => $tags, 'metadescription' => $metaDescription), 
    12831311      $this->getCulture(), 
    1284       // These are stored, not indexed. They are used to present and filter summaries 
    1285       array( 
    1286         'summary' => $summary, 
    1287         'info' => serialize($info)), 
    1288       // These are stored AND indexed 
    12891312      array( 
    12901313        'title' => $title, 
    1291         'slug' => $slug 
    1292       )); 
     1314        'summary' => $summary, 
     1315        'slug' => $slug, 
     1316        'info' => serialize($info)), 
     1317      array('tags' => 2.0, 'metadescription' => 1.2)); 
    12931318  } 
    12941319 
  • plugins/apostrophePlugin/trunk/lib/toolkit/aHtml.class.php

    r1930 r2107  
    579579  { 
    580580    sfContext::getInstance()->getConfiguration()->loadHelpers(array('Tag', 'Text')); 
    581     return auto_link_text(simple_format_text(htmlentities($text, ENT_COMPAT, 'UTF-8'))); 
     581        return auto_link_text(simple_format_text(htmlentities($text, ENT_COMPAT, 'UTF-8'))); 
    582582  } 
    583583 
  • plugins/apostrophePlugin/trunk/lib/toolkit/aZendSearch.class.php

    r2030 r2107  
    252252  // use unStoredFields. For things that need not be indexed at all, like summaries, use unIndexedFields 
    253253 
    254   static public function updateLuceneIndex(Doctrine_Record $object, $unStoredFields = array(), $culture = null, $unIndexedFields = array(), $storedAndIndexedFields = array()) 
     254  static public function updateLuceneIndex(Doctrine_Record $object, $fields = array(), $culture = null, $storedFields = array(), $boostsByField = array()) 
    255255  { 
    256256    self::deleteFromLuceneIndex($object, $culture); 
     
    264264      $doc->addField(Zend_Search_Lucene_Field::Keyword('culture', $culture, 'UTF-8')); 
    265265    } 
    266     // index the UnStored fields 
    267     foreach ($unStoredFields as $key => $value) 
     266    // index the search fields 
     267    foreach ($fields as $key => $value) 
    268268    { 
    269269      // Ugh: UTF8 Lucene is case sensitive work around this 
     
    276276        $value = strtolower($value); 
    277277      } 
    278       $doc->addField(Zend_Search_Lucene_Field::UnStored($key, $value, 'UTF-8')); 
     278       
     279      $field = Zend_Search_Lucene_Field::UnStored($key, $value, 'UTF-8'); 
     280      if (isset($boostsByField[$key])) 
     281      { 
     282        $field->boost = $boostsByField[$key]; 
     283      } 
     284      $doc->addField($field); 
    279285    } 
    280286 
    281287    // store the data fields (a big performance win over hydrating things with Doctrine) 
    282     foreach ($unIndexedFields as $key => $value) 
     288    foreach ($storedFields as $key => $value) 
    283289    { 
    284290      $doc->addField(Zend_Search_Lucene_Field::UnIndexed($key, $value, 'UTF-8')); 
    285     } 
    286  
    287     // index and store the storedAndIndexed fields 
    288     foreach ($storedAndIndexedFields as $key => $value) 
    289     { 
    290       // Ugh: UTF8 Lucene is case sensitive work around this 
    291       if (function_exists('mb_strtolower')) 
    292       { 
    293         $value = mb_strtolower($value); 
    294       } 
    295       else 
    296       { 
    297         $value = strtolower($value); 
    298       } 
    299       $doc->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8')); 
    300291    } 
    301292    
     
    304295    $index->commit(); 
    305296  } 
    306  
     297   
    307298  // This does a clean job of saving the object in both doctrine and zend 
    308299  // without a lot of duplicated code, reducing the potential for 
  • plugins/apostrophePlugin/trunk/modules/a/templates/settingsSuccess.php

    r2077 r2107  
    5555                  <?php echo $form['template'] ?> 
    5656                  <?php echo $form['template']->renderError() ?> 
     57                </div> 
     58 
     59                <div class="a-form-row keywords"> 
     60                        <?php echo $form['tags']->renderLabel(__('Page Tags', array(), 'apostrophe')) ?> 
     61                        <?php echo $form['tags'] ?> 
     62                        <?php echo $form['tags']->renderError() ?> 
     63                </div> 
     64 
     65                <div class="a-form-row meta-description"> 
     66                        <?php echo $form['meta_description']->renderLabel(__('Meta Description', array(), 'apostrophe')) ?> 
     67                        <?php echo $form['meta_description'] ?> 
     68                        <?php echo $form['meta_description']->renderError() ?> 
    5769                </div> 
    5870 
  • plugins/apostrophePlugin/trunk/modules/aFeedSlot/templates/_aFeedItem.php

    r1914 r2107  
    11<?php 
     2  // Pull in the Symfony Text Helper 
     3  sfContext::getInstance()->getConfiguration()->loadHelpers(array('Text')); 
     4 
    25  // Compatible with sf_escaping_strategy: true 
    36  $attributes = isset($attributes) ? $sf_data->getRaw('attributes') : null; 
     
    1922    <?php $date = $feedItem->getPubDate() ?> 
    2023    <li class="date"><?php echo $dateFormat ? date($dateFormat, $date) : aDate::pretty($date) . ' ' . aDate::time($date) ?></li> 
    21     <li class="description"><?php echo aHtml::simplify($feedItem->getDescription(), $markup, false, (isset($attributes)? $attributes:false), (isset($styles)? $styles:false)) ?></li> 
     24    <li class="description"><?php echo auto_link_text(aHtml::simplify($feedItem->getDescription(), $markup, false, (isset($attributes)? $attributes:false), (isset($styles)? $styles:false))) ?></li> 
    2225  </ul> 
    2326</li> 
  • plugins/apostrophePlugin/trunk/web/css/a.css

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • plugins/apostrophePlugin/trunk/web/images

    • Property svn:mergeinfo changed (with no actual effect on merging)