Changeset 4470
- Timestamp:
- 01/13/12 16:44:07 (4 months ago)
- Location:
- plugins/apostrophePlugin/branches/1.5
- Files:
-
- 5 modified
-
lib/action/BaseaButtonSlotActions.class.php (modified) (3 diffs)
-
lib/action/BaseaButtonSlotComponents.class.php (modified) (1 diff)
-
lib/form/BaseaButtonForm.class.php (modified) (2 diffs)
-
modules/aButtonSlot/templates/_editView.php (modified) (1 diff)
-
web/js/a.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostrophePlugin/branches/1.5/lib/action/BaseaButtonSlotActions.class.php
r4118 r4470 29 29 $this->slot->link('MediaItems', array($item->id)); 30 30 } 31 $this->editSave();31 return $this->editSave(); 32 32 } 33 33 … … 57 57 } 58 58 } 59 60 // Trim whitespace off the front & end of the URL to avoid failing validation on a perfectly acceptable URL 61 $value['url'] = trim($value['url']); 59 60 if ($this->getOption('editLink', null) !== false) 61 { 62 // Trim whitespace off the front & end of the URL to avoid failing validation on a perfectly acceptable URL 63 $value['url'] = trim($value['url']); 64 } 62 65 63 66 $this->form = new aButtonForm($this->id, $this->options); … … 65 68 if ($this->form->isValid()) 66 69 { 67 $url = $this->form->getValue('url'); 70 if ($this->getOption('editLink', null) !== false) 71 { 72 $url = $this->form->getValue('url'); 73 } 68 74 $value = $this->slot->getArrayValue(); 69 $value['url'] = $url; 75 if ($this->getOption('editLink', null) !== false) 76 { 77 $value['url'] = $url; 78 } 70 79 $value['title'] = $this->form->getValue('title'); 71 80 $value['description'] = $this->form->getValue('description'); -
plugins/apostrophePlugin/branches/1.5/lib/action/BaseaButtonSlotComponents.class.php
r4203 r4470 88 88 $this->form->setDefault('url', $value['url']); 89 89 } 90 else 91 { 92 $this->form->setDefault('url', $this->getOption('link')); 93 } 90 94 if (isset($value['title'])) 91 95 { 92 96 $this->form->setDefault('title', $value['title']); 97 } 98 else 99 { 100 // Careful, just plain true is a valid setting for this option 101 $title = $this->getOption('title'); 102 if (strlen($title) && ($title !== true)) 103 { 104 $this->form->setDefault('title', $title); 105 } 93 106 } 94 107 if (isset($value['description'])) -
plugins/apostrophePlugin/branches/1.5/lib/form/BaseaButtonForm.class.php
r3508 r4470 64 64 'title' => new sfWidgetFormInputText(array(), array('class' => 'aButtonSlot')) 65 65 )); 66 66 67 67 $this->setValidators(array( 68 68 'description' => new sfValidatorHtml(array('required' => false, 'allowed_tags' => $this->allowedTags, 'allowed_attributes' => $this->allowedAttributes, 'allowed_styles' => $this->allowedStyles)), … … 75 75 'title' => new sfValidatorString(array('required' => false)) 76 76 )); 77 78 $editLink = $this->consumeSlotOption('editLink'); 79 if ($editLink === false) 80 { 81 unset($this['url']); 82 } 77 83 78 84 // Ensures unique IDs throughout the page. Hyphen between slot and form to please our CSS -
plugins/apostrophePlugin/branches/1.5/modules/aButtonSlot/templates/_editView.php
r4204 r4470 34 34 <?php endif ?> 35 35 36 <div class="a-form-row link"> 37 <?php echo $form['url']->renderLabel('Link') ?> 38 <div class="a-form-field"> 39 <?php echo $form['url']->render() ?> 40 </div> 41 <?php echo $form['url']->renderError() ?> 42 </div> 36 <?php if ((!isset($options['editLink'])) || ($options['editLink'] !== false)): ?> 37 <div class="a-form-row link"> 38 <?php echo $form['url']->renderLabel('Link') ?> 39 <div class="a-form-field"> 40 <?php echo $form['url']->render() ?> 41 </div> 42 <?php echo $form['url']->renderError() ?> 43 </div> 44 <?php endif ?> 43 45 44 46 <?php if ($options['description']): ?> -
plugins/apostrophePlugin/branches/1.5/web/js/a.js
r4466 r4470 931 931 } 932 932 }; 933 933 934 934 this.afterAddingSlot = function(name) 935 935 { … … 2288 2288 if ($('.a-slot.a-editing').length) 2289 2289 { 2290 return "You are still editing content. Any edits you have made will be lost if you do not save them first before leaving the page."; 2290 // Don't stop the user if all of the open slot edit forms have .a-no-unload-warning 2291 var stop = false; 2292 $('.a-slot.a-editing').each(function() { 2293 if (!$(this).hasClass('a-no-unload-warning')) 2294 { 2295 stop = true; 2296 } 2297 }); 2298 if (stop) 2299 { 2300 return "You are still editing content. Any edits you have made will be lost if you do not save them first before leaving the page."; 2301 } 2291 2302 } 2292 2303 });

