Changeset 13560
- Timestamp:
- Jul 13, 2010, 11:49:21 PM (12 years ago)
- Location:
- OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/apps/pc_frontend/modules/communityTopic/templates/editSuccess.php
r10557 r13560 3 3 $options['title'] = __('Edit the topic'); 4 4 $options['url'] = url_for('communityTopic_update', $communityTopic); 5 $options['isMultipart'] = true; 5 6 op_include_form('formCommunityTopic', $form, $options); 6 7 ?> -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/apps/pc_frontend/modules/communityTopic/templates/newSuccess.php
r10557 r13560 3 3 $options['title'] = __('Create a new topic'); 4 4 $options['url'] = url_for('communityTopic_create', $community); 5 $options['isMultipart'] = true; 5 6 op_include_form('formCommunityTopic', $form, $options); 6 7 ?> -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/apps/pc_frontend/modules/communityTopic/templates/showSuccess.php
r13534 r13560 16 16 </div> 17 17 <div class="body"> 18 <?php if (count($images = $communityTopic->getImages()) != 0): ?> 19 <ul class="photo"> 20 <?php foreach ($images as $image): ?> 21 <li><a href="<?php echo sf_image_path($image->File) ?>" target="_blank"><?php echo image_tag_sf_image($image->File, array('size' => '120x120')) ?></a></li> 22 <?php endforeach; ?> 23 </ul> 24 <?php endif; ?> 18 25 <p class="text"> 19 26 <?php echo op_url_cmd(nl2br($communityTopic->getBody())) ?> -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/config/doctrine/schema.yml
r12351 r13560 1 1 options: 2 2 charset: utf8 3 actAs: [Timestampable]4 3 5 4 CommunityTopic: 5 actAs: 6 opCommunityTopicPluginImagesBehavior: 7 Timestampable: 6 8 columns: 7 9 id: { type: integer(4), primary: true, autoincrement: true } … … 18 20 19 21 CommunityTopicComment: 22 actAs: 23 opCommunityTopicPluginImagesBehavior: 24 Timestampable: 20 25 columns: 21 26 id: { type: integer(4), primary: true, autoincrement: true } … … 31 36 32 37 CommunityEvent: 38 actAs: 39 opCommunityTopicPluginImagesBehavior: 40 Timestampable: 33 41 columns: 34 42 id: { type: integer(4), primary: true, autoincrement: true } … … 50 58 51 59 CommunityEventComment: 60 actAs: 61 opCommunityTopicPluginImagesBehavior: 62 Timestampable: 52 63 columns: 53 64 id: { type: integer(4), primary: true, autoincrement: true } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/lib/action/opCommunityTopicPluginTopicActions.class.php
r12519 r13560 236 236 { 237 237 $form->bind( 238 $request->getParameter($form->getName()) 238 $request->getParameter($form->getName()), 239 $request->getFiles($form->getName()) 239 240 ); 240 241 … … 242 243 { 243 244 $communityTopic = $form->save(); 244 245 245 $this->redirect('@communityTopic_show?id='.$communityTopic->getId()); 246 246 } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/lib/form/doctrine/PluginCommunityTopicForm.class.php
r11642 r13560 31 31 unset($this['topic_updated_at']); 32 32 33 if (sfConfig::get('app_community_topic_is_upload_images', true)) 34 { 35 $images = array(); 36 if (!$this->isNew()) 37 { 38 $images = $this->getObject()->getImagesWithNumber(); 39 } 40 41 $max = (int)sfConfig::get('app_community_topic_max_image_file_num', 3); 42 for ($i = 1; $i <= $max; $i++) 43 { 44 $key = 'photo_'.$i; 45 46 if (isset($images[$i])) 47 { 48 $image = $images[$i]; 49 } 50 else 51 { 52 $image = new CommunityTopicImage(); 53 $image->setCommunityTopic($this->getObject()); 54 $image->setNumber($i); 55 } 56 $imageForm = new CommunityTopicImageForm($image); 57 $imageForm->getWidgetSchema()->setFormFormatterName('list'); 58 $this->embedForm($key, $imageForm, '<ul id="community_topic_'.$key.'">%content%</ul>'); 59 } 60 } 33 61 $this->setWidget('name', new sfWidgetFormInput()); 34 62 $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('community_topic_form'); 35 63 } 64 65 public function updateObject($values = null) 66 { 67 $object = parent::updateObject($values); 68 69 foreach ($this->embeddedForms as $key => $form) 70 { 71 if (!($form->getObject() && $form->getObject()->File != null)) 72 { 73 unset($this->embeddedForms[$key]); 74 } 75 } 76 77 return $object; 78 } 36 79 } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/shingo_uploader/lib/model/doctrine/PluginCommunityTopic.class.php
r13486 r13560 53 53 $this->getCommunity()->getImageFilename(); 54 54 } 55 56 public function getImagesWithNumber() 57 { 58 $images = $this->getImages(); 59 $result = array(); 60 foreach ($images as $image) 61 { 62 $result[$image->number] = $image; 63 } 64 65 return $result; 66 } 55 67 }
Note: See TracChangeset
for help on using the changeset viewer.