Changeset 4473
- Timestamp:
- 01/16/12 15:33:21 (4 months ago)
- Location:
- plugins/apostropheExtraSlotsPlugin/trunk
- Files:
-
- 7 modified
-
config/apostropheExtraSlotsPluginConfiguration.class.php (modified) (1 diff)
-
config/doctrine/schema.yml (modified) (1 diff)
-
lib/form/aReusableSlideshowSlotEditForm.class.php (modified) (2 diffs)
-
modules/aReusableSlideshowSlot/actions/actions.class.php (modified) (3 diffs)
-
modules/aReusableSlideshowSlot/actions/components.class.php (modified) (3 diffs)
-
modules/aReusableSlideshowSlot/templates/_editView.php (modified) (2 diffs)
-
modules/aReusableSlideshowSlot/templates/_normalView.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostropheExtraSlotsPlugin/trunk/config/apostropheExtraSlotsPluginConfiguration.class.php
r4379 r4473 27 27 $migrate->sql(array('CREATE TABLE a_reusable_slot (id BIGINT AUTO_INCREMENT, label VARCHAR(100) NOT NULL, type VARCHAR(100) NOT NULL, page_id BIGINT NOT NULL, area_name TEXT NOT NULL, permid BIGINT NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB DEFAULT CHARSET=utf8;')); 28 28 } 29 if (!$migrate->columnExists('a_reusable_slot', 'blurb')) 30 { 31 $migrate->sql(array('ALTER TABLE a_reusable_slot ADD COLUMN blurb LONGTEXT')); 32 } 29 33 } 30 34 } -
plugins/apostropheExtraSlotsPlugin/trunk/config/doctrine/schema.yml
r4468 r4473 280 280 type: string(100) 281 281 notnull: true 282 blurb: 283 type: clob 282 284 type: 283 285 type: string(100) -
plugins/apostropheExtraSlotsPlugin/trunk/lib/form/aReusableSlideshowSlotEditForm.class.php
r4400 r4473 55 55 // See validateCallback 56 56 $this->setValidator('label', new sfValidatorPass(array('required' => false))); 57 58 // The rest of the options passed become attributes of the widget 59 $this->setWidget('blurb', new aWidgetFormRichTextarea()); 60 $this->setValidator('blurb', new sfValidatorHtml(array('required' => false))); 61 57 62 $page = aTools::getCurrentPage(); 58 63 $reusableSlots = Doctrine::getTable('aReusableSlot')->createQuery('r')->where('r.type = ? AND r.id <> ? AND r.page_id <> ?', array($this->slot->type, $this->aReusableSlot ? $this->aReusableSlot->id : 0, $page ? $page->id : 0))->orderBy('r.label')->fetchArray(); … … 79 84 $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateCallback')))); 80 85 81 // Ensures unique IDs throughout the page. Hyphen between slot and form to please our CSS 82 $this->widgetSchema->setNameFormat('slot-form-' . $this->id . '[%s]'); 86 // There are problems with AJAX plus FCK plus Symfony forms. FCK insists on making the name and ID 87 // the same and brackets are not valid in IDs which can lead to problems in strict settings 88 // like AJAX in IE. Work around this by not attempting to use brackets here 89 $this->widgetSchema->setNameFormat('slot-form-' . $this->id . '-%s'); 90 83 91 84 92 // You don't have to use our form formatter, but it makes things nice -
plugins/apostropheExtraSlotsPlugin/trunk/modules/aReusableSlideshowSlot/actions/actions.class.php
r4403 r4473 26 26 $aReusableSlot = Doctrine::getTable('aReusableSlot')->findOneBySlot($this->pageid, $this->name, $this->permid); 27 27 28 $value = $this->getRequestParameter('slot-form-' . $this->id); 28 // Work around FCK's incompatibility with AJAX and bracketed field names 29 // (it insists on making the ID bracketed too which won't work for AJAX) 30 31 // Don't forget, there's a CSRF field out there too. We need to grep through 32 // the submitted fields and get all of the relevant ones, reinventing what 33 // PHP's bracket syntax would do for us if FCK were compatible with it 34 35 $values = $request->getParameterHolder()->getAll(); 36 $value = array(); 37 foreach ($values as $k => $v) 38 { 39 if (preg_match('/^slot-form-' . $this->id . '-(.*)$/', $k, $matches)) 40 { 41 $value[$matches[1]] = $v; 42 } 43 } 44 29 45 if ($value) 30 46 { … … 44 60 } 45 61 $aReusableSlot->label = $this->form->getValue('label'); 62 $aReusableSlot->blurb = $this->form->getValue('blurb'); 46 63 $aReusableSlot->save(); 47 64 … … 53 70 unset($values['reuse']); 54 71 $values['label'] = $this->form->getValue('label'); 72 $values['blurb'] = $this->form->getValue('blurb'); 55 73 $this->slot->setArrayValue($values); 56 74 return $this->editSave(); -
plugins/apostropheExtraSlotsPlugin/trunk/modules/aReusableSlideshowSlot/actions/components.class.php
r4421 r4473 20 20 parent::executeNormalView(); 21 21 $values = $this->slot->getArrayValue(); 22 if (isset($this->options['slideshowLabel'])) 22 $labelActive = isset($this->options['slideshowLabel']) && $this->options['slideshowLabel']; 23 $blurbActive = isset($this->options['slideshowBlurb']) && $this->options['slideshowBlurb']; 24 if ($labelActive || $blurbActive) 23 25 { 24 26 if (isset($values['reuse']['id'])) … … 29 31 error_log("Offending id is " . $values['reuse']['id']); 30 32 $this->label = 'Error'; 33 $this->blurb = 'Error'; 31 34 } 32 35 else 33 36 { 34 37 $this->label = $aReusableSlot->label; 38 $this->blurb = $aReusableSlot->blurb; 35 39 } 36 40 } … … 38 42 { 39 43 $this->label = isset($values['label']) ? $values['label'] : null; 44 $this->blurb = isset($values['blurb']) ? $values['blurb'] : null; 40 45 } 41 46 } 42 else47 if (!$labelActive) 43 48 { 44 49 $this->label = null; 45 50 } 51 if (!$blurbActive) 52 { 53 $this->blurb = null; 54 } 55 46 56 $this->reusing = isset($values['reuse']); 47 57 } -
plugins/apostropheExtraSlotsPlugin/trunk/modules/aReusableSlideshowSlot/templates/_editView.php
r4382 r4473 11 11 12 12 <div class="a-form-row a-label-or-reuse-row <?php echo $formName ?>_label_or_reuse"> 13 <input type="radio" class="a-label-or-reuse a-js-label-or-reuse" name="<?php echo $formName ?> [label_or_reuse]" value="label" <?php echo $isLabel ?>/> Label for Reuse13 <input type="radio" class="a-label-or-reuse a-js-label-or-reuse" name="<?php echo $formName ?>-label_or_reuse" value="label" <?php echo $isLabel ?>/> Label for Reuse 14 14 </div> 15 15 … … 18 18 </div> 19 19 20 <div class="a-form-indent"> 21 <?php echo $form['blurb']->renderRow(array('class' => 'a-js-label')) ?> 22 </div> 23 20 24 <div class="a-form-row a-reuse-section <?php echo $formName ?>_label_or_reuse"> 21 <input type="radio" class="a-label-or-reuse a-js-label-or-reuse" name="<?php echo $formName ?> [label_or_reuse]" value="reuse" <?php echo $isReuse ?>/> Reuse Another Slideshow25 <input type="radio" class="a-label-or-reuse a-js-label-or-reuse" name="<?php echo $formName ?>-label_or_reuse" value="reuse" <?php echo $isReuse ?>/> Reuse Another Slideshow 22 26 </div> 23 27 -
plugins/apostropheExtraSlotsPlugin/trunk/modules/aReusableSlideshowSlot/templates/_normalView.php
r4382 r4473 11 11 $slot = isset($slot) ? $sf_data->getRaw('slot') : null; 12 12 $slug = isset($slug) ? $sf_data->getRaw('slug') : null; 13 $blurb = isset($blurb) ? $sf_data->getRaw('blurb') : null; 13 14 ?> 14 15 <?php use_helper('a') ?> … … 64 65 <?php // This is the same label that is displayed when selecting a slideshow to reuse. ?> 65 66 <?php // Using it this way as well helps promote reuse ?> 66 <?php if ( $label): ?>67 <?php if (strlen($label)): ?> 67 68 <h4><?php echo $label ?></h4> 68 69 <?php endif ?> 70 <?php if (strlen($blurb)): ?> 71 <div class="a-slideshow-blurb"><?php echo $blurb ?></div> 72 <?php endif ?>

