[Isocial-svn] SF.net SVN: isocial: [272] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-07-08 12:47:48
|
Revision: 272 http://isocial.svn.sourceforge.net/isocial/?rev=272&view=rev Author: dim0s77 Date: 2008-07-08 05:47:57 -0700 (Tue, 08 Jul 2008) Log Message: ----------- added picture upload to the few groupapp pages Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/installers/groupapp/group_installer.php app/models/groupapp_group.php app/models/user.php app/views/blogapp/post/_form.tpl app/views/groupapp/group/_customize.tpl app/views/groupapp/group/_picture_upload.tpl app/views/groupapp/group/browse.tpl app/views/groupapp/group/customize.tpl app/views/groupapp/group/index.tpl app/views/groupapp/group/show_group.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-07 19:30:34 UTC (rev 271) +++ app/controllers/groupapp/group_controller.php 2008-07-08 12:47:57 UTC (rev 272) @@ -19,7 +19,11 @@ if (!empty($this->params['id']) && $this->GroupappGroup->find($this->params['id'])) { $group = $this->GroupappGroup->find( $this->params['id'] ); if (isset($group) && $group) { - if ($group->base_file_id) { $group->picture->load(); } + $this->group_picture = GROUPAPP_DEFAULT_PICTURE_URL; + if ($group->stored_file_id) { + $group->picture->load(); + $this->group_picture = $group->picture->url(); + } $this->group = $group; $members = $this->_getGroupMembers($this->group->getId()); $current_user_id = $this->current_user->getId(); @@ -100,13 +104,9 @@ function edit_group () { if (isset($this->group)) { - $this->group_picture = GROUPAPP_DEFAULT_PICTURE_URL; - if ($this->group->picture) { - $this->group_picture = $this->group->picture->url(); - } if (!empty($this->params['group'])){ - if ($this->params['group']['base_file_id'] != $this->group->base_file_id) { - $stored_file = $this->StoredFile->findFirst(array( 'id' => $this->params['group']['base_file_id'] )); + if ($this->params['group']['stored_file_id'] != $this->group->stored_file_id) { + $stored_file = $this->StoredFile->findFirst(array( 'id' => $this->params['group']['stored_file_id'] )); $this->group->picture->assign($stored_file); } $this->group->setAttributes($this->params['group']); @@ -281,7 +281,7 @@ $links = $group_pages->paginator->getLinks(); $this->pages_links = $links['first'] . ' ' . $links['back'] . ' ' . $links['pages'] . ' ' . $links['next'] . ' ' . $links['last']; - $_filter = array('conditions' => "type_id" . $type_id); + $_filter = array('conditions' => "type_id" . $type_id, 'include' => 'picture'); $options = array_merge($_filter, $this->pagination_helper->getFindOptions($this->GroupappGroup)); $this->groups = $this->GroupappGroup->find('all', $options); } Modified: app/installers/groupapp/group_installer.php =================================================================== --- app/installers/groupapp/group_installer.php 2008-07-07 19:30:34 UTC (rev 271) +++ app/installers/groupapp/group_installer.php 2008-07-08 12:47:57 UTC (rev 272) @@ -206,10 +206,10 @@ `video_member` tinyint(1) NOT NULL DEFAULT '0', `access` int(1) UNSIGNED NOT NULL DEFAULT '0', `show_in_search` tinyint(1) NOT NULL DEFAULT '1', - `base_file_id` int(11) DEFAULT NULL, + `stored_file_id` int(11) DEFAULT NULL, FOREIGN KEY (type_id) REFERENCES groupapp_group_types(id), - FOREIGN KEY (base_file_id) REFERENCES base_files(id), + FOREIGN KEY (stored_file_id) REFERENCES base_files(id), INDEX type_idx (type_id) ) ENGINE=InnoDB"); Modified: app/models/groupapp_group.php =================================================================== --- app/models/groupapp_group.php 2008-07-07 19:30:34 UTC (rev 271) +++ app/models/groupapp_group.php 2008-07-08 12:47:57 UTC (rev 272) @@ -3,19 +3,15 @@ class GroupappGroup extends ActiveRecord { var $has_one = array('group_member' => array('class_name' => 'GroupappMember', - 'foreign_key' => 'groupapp_group_id') - ); - var $has_many = array( 'messages' => array('class_name' => 'GroupappMessage', - 'foreign_key' => 'groupapp_group_id') ); + 'foreign_key' => 'groupapp_group_id')); + var $has_many = array( 'messages' => array('class_name' => 'GroupappMessage', + 'foreign_key' => 'groupapp_group_id')); - var $belongs_to = array('group_type' => array('class_name' => 'GroupappGroupType', + var $belongs_to = array('group_type' => array('class_name' => 'GroupappGroupType', 'primary_key_name' => 'type_id'), - 'picture' => array('class_name' => 'StoredFile', - 'primary_key_name' => 'base_file_id') + 'picture' => array('class_name' => 'StoredFile', + 'primary_key_name' => 'stored_file_id')); - ); - - function validateOnCreate () { $this->validatesPresenceOf('name', 'Name is missing|please enter the name'); Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-07-07 19:30:34 UTC (rev 271) +++ app/models/user.php 2008-07-08 12:47:57 UTC (rev 272) @@ -14,8 +14,6 @@ 'foreign_key' => 'user_id'), 'stored_files' => array('class_name' => 'StoredFile', 'foreign_key' => 'user_id'), - /* 'groupapp_groups' => array('class_name' => 'GroupappMember', */ - /* 'foreign_key' => 'user_id'), */ ); var $has_and_belongs_to_many = array('groupapp_groups' => array('join_table' => 'groupapp_members')); Modified: app/views/blogapp/post/_form.tpl =================================================================== --- app/views/blogapp/post/_form.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/blogapp/post/_form.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -21,7 +21,7 @@ <div class="formrow"> <label class="required">_{Attach}:<br><small>(_{required})</small></label> <div class="formcol"> - <?= $form_helper->file_field('post', 'base_file_id', array('class' => 'textinput small')) ?> + <?= $form_helper->file_field('post', 'stored_file_id', array('class' => 'textinput small')) ?> </div> <div class="clearfix"></div> </div> Modified: app/views/groupapp/group/_customize.tpl =================================================================== --- app/views/groupapp/group/_customize.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/groupapp/group/_customize.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -137,4 +137,4 @@ </div> <div class="clearfix"></div> - <?= $form_helper->hidden_field('group', 'base_file_id') ?> + <?= $form_helper->hidden_field('group', 'stored_file_id') ?> Modified: app/views/groupapp/group/_picture_upload.tpl =================================================================== --- app/views/groupapp/group/_picture_upload.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/groupapp/group/_picture_upload.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -8,7 +8,7 @@ var uploaded = response.evalJSON(true); if (uploaded.length) { $('current_picture').innerHTML = '<img src="/preview/200x200/' + uploaded[0].url + '">'; - $('group_base_file_id').value = uploaded[0].id; + $('group_stored_file_id').value = uploaded[0].id; } } @@ -32,7 +32,9 @@ <div class="left_content"> <div class="imghead">_{Current picture}:<br><br> - <div id="current_picture"><img src="/preview/200x200/{group_picture}"></div> + <div id="current_picture"> + <img src="/preview/200x200/{group_picture}"> + </div> </div> </div> Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/groupapp/group/browse.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -75,7 +75,12 @@ <div class="group_row"> <div class="avatar"> - <a href="/groupapp/group/show_group/{group.id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + {?group.picture.id} + <? $group_picture = $group->picture->load()->url(); ?> + {else} + <? $group_picture = GROUPAPP_DEFAULT_PICTURE_URL; ?> + {end} + <a href="/groupapp/group/show_group/{group.id?}"><img src="/preview/100x100/{group_picture}"></a> </div> <div class="actions"> Modified: app/views/groupapp/group/customize.tpl =================================================================== --- app/views/groupapp/group/customize.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/groupapp/group/customize.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -10,6 +10,12 @@ <?= $controller->renderPartial("bar") ?> <div class="editform"> + <div class="formrow"> + <?= $controller->renderErrors() ?> + </div> + + <?= $controller->renderPartial("picture_upload") ?> + <form action="/groupapp/group/customize/{group.id?}" method="post"> <?= $controller->renderPartial("customize") ?> </form> Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/groupapp/group/index.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -50,7 +50,12 @@ </div> <div class="avatar"> - <a href="/groupapp/group/show_group/{user_group.id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + {?user_group.stored_file_id} + <? $group_picture = $user_group->picture->load()->url(); ?> + {else} + <? $group_picture = GROUPAPP_DEFAULT_PICTURE_URL; ?> + {end} + <a href="/groupapp/group/show_group/{user_group.id?}"><img src="/preview/100x100/{group_picture}"></a> </div> <div class="info"> Modified: app/views/groupapp/group/show_group.tpl =================================================================== --- app/views/groupapp/group/show_group.tpl 2008-07-07 19:30:34 UTC (rev 271) +++ app/views/groupapp/group/show_group.tpl 2008-07-08 12:47:57 UTC (rev 272) @@ -12,7 +12,7 @@ <div class="right_content"> <div class="group_avatar"> - <img src="/images/nophoto_men_sm.gif" alt="" class=""> + <img src="/preview/100x100/{group_picture}"> </div> <ul class="actions_list"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |