[Isocial-svn] SF.net SVN: isocial: [288] public/stylesheets/groupapp
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-07-15 18:39:02
|
Revision: 288 http://isocial.svn.sourceforge.net/isocial/?rev=288&view=rev Author: dim0s77 Date: 2008-07-15 11:39:12 -0700 (Tue, 15 Jul 2008) Log Message: ----------- added user photo to profile and groupapp. refactoring Modified Paths: -------------- app/application_controller.php app/controllers/groupapp/board_controller.php app/controllers/groupapp/group_controller.php app/controllers/profile_controller.php app/installers/user_installer.php app/locales/groupapp/group/ru.php app/locales/layout/ru.php app/models/basic_profile.php app/models/groupapp_message.php app/models/user.php app/views/groupapp/board/_head.tpl app/views/groupapp/board/_menu.tpl app/views/groupapp/board/reply_to_post.tpl app/views/groupapp/board/reply_to_topic.tpl app/views/groupapp/board/show_topic.tpl app/views/groupapp/group/_picture_upload.tpl app/views/groupapp/group/edit_members.tpl app/views/groupapp/group/index.tpl app/views/groupapp/group/show_group.tpl app/views/layouts/application.tpl app/views/profile/picture.tpl public/stylesheets/friend_selector.css public/stylesheets/groupapp/Group.css Added Paths: ----------- public/stylesheets/upload_picture.css Modified: app/application_controller.php =================================================================== --- app/application_controller.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/application_controller.php 2008-07-15 18:39:12 UTC (rev 288) @@ -4,6 +4,8 @@ require_once(AK_VENDOR_DIR.DS.'phputf8'.DS.'ucfirst.php'); require_once(AK_APP_DIR.DS.'vendor'.DS.'utf8_to_ascii'.DS.'utf8_to_ascii.php'); +define('USER_DEFAULT_PICTURE_URL', "/images/nophoto_men_sm.gif"); + /** * This file is application-wide controller file. You can put all * application-wide controller-related methods here. Modified: app/controllers/groupapp/board_controller.php =================================================================== --- app/controllers/groupapp/board_controller.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/controllers/groupapp/board_controller.php 2008-07-15 18:39:12 UTC (rev 288) @@ -4,15 +4,28 @@ { var $models = array('GroupappMessage', 'GroupappGroup', 'GroupappMember', 'User'); + function beforeAction ( $method = '' ) { + parent::beforeAction($method); + + if (!empty($this->params['id'])) { + $group = $this->GroupappGroup->find( $this->params['id'] ); + if (isset($group)) { + $this->group = $group; + $this->groupapp_group_id = $group->getId(); + $this->group_name = $group->name; + $this->group_picture = $this->_group_picture($group); + } + } + } + function index () { - if (!empty($this->params['id'])) { + if (isset($this->group)) { $messages = $this->GroupappMessage->find('all', array( - 'conditions' => array("groupapp_group_id = ?", $this->params['id']), - 'include' => 'user' + 'conditions' => array("groupapp_group_id" => $this->group->getId()), + 'include' => 'user' ) ); - $group = $this->GroupappGroup->find( $this->params['id'] ); $topics = array(); $persons = array(); if(!empty($messages)) { @@ -33,30 +46,28 @@ $topics[$message->topic_id]['last'] = $message; } } - $this->groupapp_group_id = $group->getId(); - $this->group_name = $group->name; $this->topics = $topics; } } function show_topic () { - if (!empty($this->params['id'])) { + if (isset($this->group) && !empty($this->params['t'])) { $messages = $this->GroupappMessage->find('all', - array( - 'conditions' => array("topic_id = ?", $this->params['id']), - 'include' => 'user' - ) - ); + array( + 'conditions' => array( + "groupapp_group_id" => $this->group->getId(), + "topic_id" => $this->params['t']), + 'include' => 'user' + ) + ); if ($messages) { - $member = $this->GroupappMember->findFirst(array( 'groupapp_group_id' => $messages[0]->groupapp_group_id, - 'user_id' => $this->current_user->getId() - )); - $group = $this->GroupappGroup->find( $messages[0]->groupapp_group_id ); - if (($group && $group->access == 1) || $member) { + $member = $this->GroupappMember->findFirst(array( + 'groupapp_group_id' => $this->group->getId(), + 'user_id' => $this->current_user->getId() + )); + if ($this->group->access == 1 || $member) { $this->messages = $messages; - $this->groupapp_group_id = $group->getId(); - $this->group_name = $group->name; - $this->topic_id = $messages[0]->topic_id; + $this->topic_id = $this->params['t']; } else { $this->addError('_common', 'Access denied', 'Group id closed. You can\'t to see this topic'); } @@ -65,131 +76,142 @@ } $this->addError('_common', 'Topic not found', 'This topic is not founded'); } - + function start_topic () { - if (!empty($this->params['topic']) && - !empty($this->params['topic']['groupapp_group_id']) && - !empty($this->params['topic']['body'])) { - if ( $this->group = $this->GroupappGroup->find( $this->params['topic']['groupapp_group_id'] ) ) { - $member = $this->GroupappMember->findFirst(array( 'groupapp_group_id' => $this->group->getId(), - 'user_id' => $this->current_user->getId() - )); - if ($member) { - $message = $member->message->build(); - $message->setAttributes($this->params['topic']); - if (empty($message->subject)) { - $message->subject = $this->t('(no topic)'); - } - if ($message->save()) { - if (!$message->topic_id) { - $message->topic_id = $message->getId(); - if ($message->save()) { - $this->redirectTo(array('action' => 'show_topic', 'id' => $message->getId())); - return; - } - } - } - } + if (!isset($this->group)) { + $this->addError('_common', 'Start topic error', 'please, specify group'); + return; + } + if (empty($this->params['topic']) && empty($this->params['topic']['body'])) { + $this->topic = $this->group->message->build(); + $this->topic_id = $this->topic->getId(); + } else { + $member = $this->GroupappMember->findFirst(array( + 'groupapp_group_id' => $this->group->getId(), + 'user_id' => $this->current_user->getId() + )); + if (empty($member)) { + $this->addError('_common', 'Sending message error', 'please, try again'); + return; } - $this->addError('_common', 'Sending message error', 'please, try again'); - } else if (!empty($this->params['id'])) { - if ( $group = $this->GroupappGroup->find( $this->params['id'] ) ) { - $this->topic = $group->message->build(); - $this->groupapp_group_id = $group->getId(); - $this->group_name = $group->name; - $this->topic_id = $this->topic->getId(); + + $message = $this->current_user->groupapp_message->build(); + $message->setAttributes($this->params['topic']); + $message->assign($this->group); + + if (empty($message->subject)) { $message->subject = $this->t('(no topic)'); } + + if ($message->save()) { + $message->topic_id = $message->getId(); + $message->save(); + $this->redirectToAction('show_topic', array('id' => $this->group->getId(), + 't' => $message->topic_id)); } - } else { - $this->addError('_common', 'Start topic error', 'please, specify group'); } } + function reply_to_topic () { + if (!isset($this->group) || empty($this->params['t'])) { + $this->addError('_common', 'Reply to topic error', 'please, specify topic'); + return; + } - function reply_to_topic () { - if (!empty($this->params['topic']) && - !empty($this->params['topic']['groupapp_group_id']) && - !empty($this->params['topic']['topic_id']) && - !empty($this->params['topic']['body'])) { - if ( $this->group = $this->GroupappGroup->find( $this->params['topic']['groupapp_group_id'] ) ) { - $member = $this->GroupappMember->findFirst(array( 'groupapp_group_id' => $this->group->getId(), - 'user_id' => $this->current_user->getId() - )); - if ($member) { - $message = $member->message->build(); - $message->setAttributes($this->params['topic']); - if ($message->save()) { - $this->redirectTo(array('action' => 'show_topic', 'id' => $message->topic_id)); - return; - } + $topic = $this->GroupappMessage->find('all', + array( + 'conditions' => array( + "groupapp_group_id" => $this->group->getId(), + "topic_id" => $this->params['t']) + ) + ); + if (empty($topic)) { + $this->addError('_common', 'Reply to topic error', 'topic not found'); + return; + } + + $member = $this->GroupappMember->findFirst(array( + 'groupapp_group_id' => $this->group->getId(), + 'user_id' => $this->current_user->getId() + ) + ); + $this->topic_id = $this->params['t']; + + if ($this->Request->isPost() && + !empty($this->params['topic']) && + !empty($this->params['topic']['body']) + ) { + if ($member) { + $message = $this->current_user->groupapp_message->build(); + $message->setAttributes($this->params['topic']); + $message->group->assign($this->group); + if ($message->save()) { + $this->redirectToAction('show_topic', array('id' => $this->group->getId(), + 't' => $message->topic_id)); } } $this->addError('_common', 'Sending message error', 'please, try again'); - } else if (!empty($this->params['id'])) { - $messages = $this->GroupappMessage->find('all', array( - 'conditions' => array("topic_id = ?", $this->params['id']) - ) - ); - if ($messages) { - $member = $this->GroupappMember->findFirst(array( 'groupapp_group_id' => $messages[0]->groupapp_group_id, - 'user_id' => $this->current_user->getId() - )); - $group = $this->GroupappGroup->find( $messages[0]->groupapp_group_id ); - if (($group && $group->access == 1) || $member) { - $this->messages = $messages; - $this->groupapp_group_id = $group->getId(); - $this->group_name = $group->name; - $this->topic_id = $messages[0]->topic_id; - } else { - $this->addError('_common', 'Access denied', 'Group id closed. You can\'t reply to this topic'); - } - return; + } else { + if ($this->group->access == 1 || $member) { + $this->messages = $topic; + } else { + $this->addError('_common', 'Access denied', 'Group id closed. You can\'t reply to this topic'); } } - $this->addError('_common', 'Topic not found', 'This topic is not founded'); } function reply_to_post () { - if (!empty($this->params['topic'])) { - if ( $this->group = $this->GroupappGroup->find( $this->params['topic']['groupapp_group_id'] ) ) { - $member = $this->GroupappMember->findFirst(array( 'groupapp_group_id' => $this->group->getId(), - 'user_id' => $this->current_user->getId() - )); - if ($member) { - $message = $member->message->build(); - $message->setAttributes($this->params['topic']); - if ($message->save()) { - $this->redirectTo(array('action' => 'show_topic', 'id' => $message->topic_id)); - return; - } + if (!isset($this->group) || empty($this->params['p'])) { + $this->addError('_common', 'Reply to post error', 'please, specify post'); + return; + } + + $message = $this->GroupappMessage->find('all', + array( + 'conditions' => array( + "groupapp_group_id" => $this->group->getId(), + "id" => $this->params['p']), + 'include' => 'user' + ) + ); + if (empty($message)) { + $this->addError('_common', 'Reply to post error', 'post not found'); + return; + } + + $member = $this->GroupappMember->findFirst(array( + 'groupapp_group_id' => $this->group->getId(), + 'user_id' => $this->current_user->getId() + ) + ); + $this->topic_id = $message[0]->topic_id; + + if ($this->Request->isPost() && + !empty($this->params['topic']) && + !empty($this->params['topic']['body']) + ) { + if ($member) { + $message = $this->current_user->groupapp_message->build(); + $message->setAttributes($this->params['topic']); + $message->group->assign($this->group); + if ($message->save()) { + $this->redirectToAction('show_topic', array('id' => $this->group->getId(), + 't' => $message->topic_id)); } + $this->addError('_common', 'Sending message error', 'please, try again'); } - $this->addError('_common', 'Sending message error', 'please, try again'); - } else if (!empty($this->params['id'])) { - $message = $this->GroupappMessage->findFirst( - array( - 'conditions' => array("id = ?", $this->params['id']), - 'include' => 'user' - ) - ); - if ($message) { - $member = $this->GroupappMember->findFirst(array( 'groupapp_group_id' => $message->groupapp_group_id, - 'user_id' => $this->current_user->getId() - )); - $group = $this->GroupappGroup->find( $message->groupapp_group_id ); - if (($group && $group->access == 1) || $member) { - $this->message_to_reply = $message; - $this->groupapp_group_id = $group->getId(); - $this->group_name = $group->name; - $this->topic_id = $message->topic_id; - } else { - $this->addError('_common', 'Access denied', 'Group id closed. You can\'t reply to this message'); - } - return; + } else { + if ($this->group->access == 1 || $member) { + $this->message_to_reply = $message[0]; + } else { + $this->addError('_common', 'Access denied', 'Group id closed. You can\'t reply to this message'); } } - $this->addError('_common', 'Topic not found', 'This topic is not founded'); } + function _group_picture ($group) { + return $group->stored_file_id ? + $group->picture->load()->url() : GROUPAPP_DEFAULT_PICTURE_URL; + } + } ?> Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/controllers/groupapp/group_controller.php 2008-07-15 18:39:12 UTC (rev 288) @@ -19,8 +19,7 @@ if (!empty($this->params['id']) && $this->GroupappGroup->find($this->params['id'])) { $group = $this->GroupappGroup->find( $this->params['id'] ); if (isset($group) && $group) { - $this->group_picture = $group->stored_file_id ? - $group->picture->load()->url() : GROUPAPP_DEFAULT_PICTURE_URL; + $this->group_picture = $this->_group_picture($group); $this->group = $group; $members = $this->_getGroupMembers($this->group->getId()); @@ -56,6 +55,8 @@ $this->pages_links = $links['first'] . ' ' . $links['back'] . ' ' . $links['pages'] . ' ' . $links['next'] . ' ' . $links['last']; $this->user_groups = $this->array_pagination_helper->getPageItems("user_group_pages", $user_groups); + $this->user_picture = $this->_current_user_picture(); + $this->_extract_group_types(); } @@ -88,9 +89,9 @@ function customize () { if (isset($this->group)) { $this->step = 'group_customize'; - if (!empty($this->params['group'])){ + if ($this->Request->isPost() && !empty($this->params['group'])){ $this->group->setAttributes($this->params['group']); - if ($this->Request->isPost() && $this->group->save()) { + if ($this->group->save()) { $this->step = 'group_members'; $this->redirectTo(array('action' => 'edit_members', 'id' => $this->group->getId())); return; @@ -105,7 +106,7 @@ function edit_group () { if (isset($this->group)) { $this->group->category_id = floor($this->group->type_id / 100); - if (!empty($this->params['group'])){ + if ($this->Request->isPost() && !empty($this->params['group'])){ if (isset($this->params['group']['stored_file_id']) && !empty($this->params['group']['stored_file_id']) && $this->params['group']['stored_file_id'] != $this->group->stored_file_id @@ -117,9 +118,8 @@ $this->group->picture->build(); } $this->group->setAttributes($this->params['group']); - if ($this->Request->isPost() && $this->group->save()) { - $this->group_picture = $this->group->stored_file_id ? - $this->group->picture->load()->url() : GROUPAPP_DEFAULT_PICTURE_URL; + if ($this->group->save()) { + $this->group_picture = $this->_group_picture($this->group); return; } } @@ -148,9 +148,9 @@ if (!$this->is_admin) { $this->redirectTo(array('action' => 'index')); } $this->step = 'edit_members'; - if (!empty($this->params['member'])){ + if ($this->Request->isPost() && !empty($this->params['member'])){ $this->GroupappGroup->setAttributes($this->params['member']); - if ($this->Request->isPost() && $this->GroupappGroup->save()){ + if ($this->GroupappGroup->save()){ return; } } else if (isset($this->group)) { @@ -412,6 +412,16 @@ } $this->gt = $gt; } + + function _group_picture ($group) { + return $group->stored_file_id ? + $group->picture->load()->url() : GROUPAPP_DEFAULT_PICTURE_URL; + } + + function _current_user_picture () { + return $this->current_user->basic_profile->load()->stored_file_id ? + $this->current_user->basic_profile->picture->load()->url() : USER_DEFAULT_PICTURE_URL; + } } ?> Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/controllers/profile_controller.php 2008-07-15 18:39:12 UTC (rev 288) @@ -120,8 +120,27 @@ } function picture () { + $this->basic_profile = $this->current_user->basic_profile->load(); + if ($this->Request->isPost() && !empty($this->params['basic_profile'])) { + if (isset($this->params['basic_profile']['stored_file_id']) && + !empty($this->params['basic_profile']['stored_file_id']) && + $this->params['basic_profile']['stored_file_id'] != $this->basic_profile->stored_file_id + ) { + $stored_file = $this->StoredFile->findFirst(array( 'id' => $this->params['basic_profile']['stored_file_id'] )); + $this->basic_profile->picture->assign($stored_file); + } else { + $this->basic_profile->stored_file_id = NULL; + $this->basic_profile->picture->build(); + } + $this->basic_profile->setAttributes($this->params['basic_profile']); + if (!$this->basic_profile->save()) { + $this->importErrors( $this->Profile->getErrors() ); + return; + } + } + $this->user_picture = $this->basic_profile->stored_file_id ? + $this->basic_profile->picture->load()->url() : USER_DEFAULT_PICTURE_URL; } - } ?> \ No newline at end of file Modified: app/installers/user_installer.php =================================================================== --- app/installers/user_installer.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/installers/user_installer.php 2008-07-15 18:39:12 UTC (rev 288) @@ -197,6 +197,7 @@ `city_other` char(100), `country_id` int(11), `birthdate` date DEFAULT NULL, + `stored_file_id` int(11) DEFAULT NULL, `political_view_id` int(11), `religious_view_id` int(11), `created_at` datetime NOT NULL, @@ -207,6 +208,7 @@ FOREIGN KEY (country_id) REFERENCES countries(id), FOREIGN KEY (political_view_id) REFERENCES political_views(id), FOREIGN KEY (religious_view_id) REFERENCES religious_views(id), + FOREIGN KEY (stored_file_id) REFERENCES base_files(id), INDEX user_idx (user_id) ) ENGINE=InnoDB"); Modified: app/locales/groupapp/group/ru.php =================================================================== --- app/locales/groupapp/group/ru.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/locales/groupapp/group/ru.php 2008-07-15 18:39:12 UTC (rev 288) @@ -93,15 +93,6 @@ 'Это засекреченная группа. Эта группа не будет отображаться в результатах поиска или в профилях своих участников.'; $dictionary['Publicize'] = 'Опубликовать'; $dictionary['Show this group in search results'] = 'Показывать эту группу в результатах поиска'; -$dictionary['Current picture'] = 'Текущее изображение'; -$dictionary['Upload Picture'] = 'Загрузить изображение'; -$dictionary['You can upload a JPG, GIF or PNG file'] = 'Вы можете загрузить изображение в формате JPG, GIF или PNG'; -$dictionary['I certify that I have the right to distribute this picture and that it does not violate the'] = 'Подтверждаю то, что я обладаю правами на распространение этого изображения и оно не нарушает'; -$dictionary['Terms of Use'] = 'Условия пользования'; -$dictionary['Remove Picture'] = 'Удалить изображение'; -$dictionary['You can remove this picture, but be sure to upload another or we will display a question mark in its place'] = 'Вы можете удалить текущее изображение, но не забудьте загрузить другое или на этом месте появится картинка, используемая по-умолчанию для групп'; -$dictionary['Note'] = 'Примечание'; -$dictionary['to preserve the new images do not forget to save the parameters group'] = 'для сохранения нового изображения не забудьте сохранить параметры группы'; $dictionary['Invite people to group'] = 'Пригласить людей в группу'; $dictionary['Show'] = 'Показать'; Modified: app/locales/layout/ru.php =================================================================== --- app/locales/layout/ru.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/locales/layout/ru.php 2008-07-15 18:39:12 UTC (rev 288) @@ -20,6 +20,9 @@ $dictionary['edit'] = 'настроить'; $dictionary['Friends'] = 'Друзья'; $dictionary['Messages'] = 'Сообщения'; +$dictionary['friends'] = 'друзья'; +$dictionary['groups'] = 'группы'; +$dictionary['All'] = 'Все'; $dictionary['Save Changes'] = 'Сохранить'; $dictionary['Save'] = 'Сохранить'; @@ -49,4 +52,14 @@ $dictionary['Address field'] = 'Домашний адрес'; $dictionary['Website field'] = 'URL веб сайта'; +$dictionary['Current picture'] = 'Текущее изображение'; +$dictionary['Upload Picture'] = 'Загрузить изображение'; +$dictionary['You can upload a JPG, GIF or PNG file'] = 'Вы можете загрузить изображение в формате JPG, GIF или PNG'; +$dictionary['I certify that I have the right to distribute this picture and that it does not violate the'] = 'Подтверждаю то, что я обладаю правами на распространение этого изображения и оно не нарушает'; +$dictionary['Terms of Use'] = 'Условия пользования'; +$dictionary['Remove Picture'] = 'Удалить изображение'; +$dictionary['You can remove this picture, but be sure to upload another or we will display a question mark in its place'] = 'Вы можете удалить текущее изображение, но не забудьте загрузить другое или на этом месте появится картинка, используемая по-умолчанию'; +$dictionary['Note'] = 'Примечание'; +$dictionary['to preserve the new images do not forget to save the parameters group'] = 'для сохранения нового изображения не забудьте сохранить параметры группы'; +$dictionary['to preserve the new images do not forget to save the user profile'] = 'для сохранения нового изображения не забудьте сохранить профиль пользователя'; ?> Modified: app/models/basic_profile.php =================================================================== --- app/models/basic_profile.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/models/basic_profile.php 2008-07-15 18:39:12 UTC (rev 288) @@ -2,7 +2,9 @@ class BasicProfile extends ActiveRecord { - var $belongs_to = array('User', 'City', 'PoliticalView', 'ReligiousView', 'Sex'); + var $belongs_to = array('User', 'City', 'PoliticalView', 'ReligiousView', 'Sex', + 'picture' => array('class_name' => 'StoredFile', + 'primary_key_name' => 'stored_file_id')); } ?> Modified: app/models/groupapp_message.php =================================================================== --- app/models/groupapp_message.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/models/groupapp_message.php 2008-07-15 18:39:12 UTC (rev 288) @@ -8,6 +8,7 @@ 'foreign_key' => 'groupapp_group_id') ); + /* function validateOnCreate () */ /* { */ /* $this->validatesPresenceOf('name', 'Name is missing|please enter the name'); */ Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-07-14 18:35:39 UTC (rev 287) +++ app/models/user.php 2008-07-15 18:39:12 UTC (rev 288) @@ -18,6 +18,8 @@ 'foreign_key' => 'user_id'), 'work_profiles' => array('class_name' => 'WorkProfile', 'foreign_key' => 'user_id'), + 'groupapp_messages' => array('class_name' => 'GroupappMessage', + 'foreign_key' => 'user_id'), ); var $has_and_belongs_to_many = array('groupapp_groups' => array('join_table' => 'groupapp_members')); Modified: app/views/groupapp/board/_head.tpl =================================================================== --- app/views/groupapp/board/_head.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/board/_head.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -1,6 +1,6 @@ <div class="title_bar"> <div class="avatar"> - <a href="/profile/show/"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + <a href="/profile/show/"><img src="/preview/50x50/{group_picture}"></a> </div> <div class="info"> <div class="header"> Modified: app/views/groupapp/board/_menu.tpl =================================================================== --- app/views/groupapp/board/_menu.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/board/_menu.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -5,11 +5,11 @@ if ($controller->getActionName() == 'show_topic' || $controller->getActionName() == 'reply_to_topic' || $controller->getActionName() == 'reply_to_post' - ) { ?><li><a href="/groupapp/board/show_topic/{topic_id?}" class="<?= $controller->getActionName() == 'show_topic' ? 'last selected' : '' ?>" >_{Topic View}</a></li><? } ?><? + ) { ?><li><a href="/groupapp/board/show_topic/{group.id}/?t={topic_id?}" class="<?= $controller->getActionName() == 'show_topic' ? 'last selected' : '' ?>" >_{Topic View}</a></li><? } ?><? if ($controller->getActionName() == 'reply_to_topic') { ?> - <li><a href="/groupapp/board/reply_to_topic/{topic_id?}" class="last selected">_{Post Reply}</a></li> <? } + <li><a href="/groupapp/board/reply_to_topic/{group.id}/?t={topic_id?}" class="last selected">_{Post Reply}</a></li> <? } else if ($controller->getActionName() == 'reply_to_post') { ?> - <li><a href="/groupapp/board/reply_to_post/{message_to_reply.id?}" class="last selected">_{Post Reply}</a></li> + <li><a href="/groupapp/board/reply_to_post/{group.id}/?p={message_to_reply.id?}" class="last selected">_{Post Reply}</a></li> <? } ?> </ul> </div> Modified: app/views/groupapp/board/reply_to_post.tpl =================================================================== --- app/views/groupapp/board/reply_to_post.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/board/reply_to_post.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -6,7 +6,7 @@ <div class="submenu"> <div class="menu_block"> - <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{message_to_reply.topic_id}">{message_to_reply.subject?}</a></div> + <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{group.id}/?t={message_to_reply.topic_id}">{message_to_reply.subject?}</a></div> </div> </div> <div class="clearfix"></div> @@ -17,14 +17,15 @@ </div> <div class="avatar"> - <a href="/profile/show/{message_to_reply.user_id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + <? $user_picture = $message_to_reply->user->basic_profile->load()->stored_file_id ? $message_to_reply->user->basic_profile->picture->load()->url() : USER_DEFAULT_PICTURE_URL; ?> + <a href="/profile/show/{message_to_reply.user_id}"><img src="/preview/50x50/{user_picture}"></a> </div> <div class="message"> <div class="head"> <span class="sender"> - <? if ($current_user->getId() == $message_to_reply->user_id) { ?><span class="current_user">_{You}</span> - <? } else { ?><a href="/profile/show/{message_to_reply.user_id?}"><span class="other_user">{message_to_reply.user.name?}</span></a><? } ?> + <? if ($current_user->getId() == $message_to_reply->user_id): ?><span class="current_user">_{You}</span> + <? else: ?><a href="/profile/show/{message_to_reply.user_id?}"><span class="other_user">{message_to_reply.user.name?}</span></a><? endif ?> </span> _{wrote} <div class="subtext">{message_to_reply.created_at?}</div> @@ -38,7 +39,7 @@ <div class="clearfix"></div> <div class="board_from_background"> -<form action="/groupapp/board/reply_to_topic/{message_to_reply.topic_id?}" method="post"> +<form action="/groupapp/board/reply_to_topic/{group.id}/?t={message_to_reply.topic_id?}" method="post"> <div class="editform"> <div class="formrow"> <label> </label><span class="label">_{Your reply}</span><br> @@ -46,10 +47,9 @@ </div> <div class="formrow"> <label> - <?= $form_helper->hidden_field('topic', 'groupapp_group_id', array('value' => $message_to_reply->groupapp_group_id))?> - <?= $form_helper->hidden_field('topic', 'topic_id', array('value' => $message_to_reply->topic_id))?> - <?= $form_helper->hidden_field('topic', 'subject', array('value' => $message_to_reply->subject))?> - <?= $form_helper->hidden_field('topic', 'reply_message_id', array('value' => $message_to_reply->getId()))?> + <?= $form_helper->hidden_field('topic', 'topic_id', array('value' => $message_to_reply->topic_id)) ?> + <?= $form_helper->hidden_field('topic', 'subject', array('value' => $message_to_reply->subject)) ?> + <?= $form_helper->hidden_field('topic', 'reply_message_id', array('value' => $message_to_reply->getId())) ?> </label> <input class="submitinput" type="submit" value="_{Post reply}"> <input class="cancelinput" type="button" value="_{Cancel}"> Modified: app/views/groupapp/board/reply_to_topic.tpl =================================================================== --- app/views/groupapp/board/reply_to_topic.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/board/reply_to_topic.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -6,13 +6,13 @@ <div class="submenu"> <div class="menu_block"> - <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{messages-0.topic_id}">{messages-0.subject?}</a></div> + <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{group.id}/?t={messages-0.topic_id}">{messages-0.subject?}</a></div> </div> </div> <div class="clearfix"></div> <div class="board_from_background"> -<form action="/groupapp/board/reply_to_topic/{messages-0.topic_id?}" method="post"> +<form action="/groupapp/board/reply_to_topic/{group.id}/?t={messages-0.topic_id?}" method="post"> <div class="editform"> <div class="formrow"> <label> </label><span class="label">_{Your reply}</span><br> @@ -20,7 +20,6 @@ </div> <div class="formrow"> <label> - <?= $form_helper->hidden_field('topic', 'groupapp_group_id', array('value' => $messages[0]->groupapp_group_id))?> <?= $form_helper->hidden_field('topic', 'topic_id', array('value' => $messages[0]->topic_id))?> <?= $form_helper->hidden_field('topic', 'subject', array('value' => $messages[0]->subject))?> </label> Modified: app/views/groupapp/board/show_topic.tpl =================================================================== --- app/views/groupapp/board/show_topic.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/board/show_topic.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -4,11 +4,11 @@ <div class="submenu"> <div class="menu_block"> - <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{messages-0.topic_id}">{messages-0.subject?}</a></div> + <div class="header">_{Topic}: <a href="/groupapp/board/show_topic/{group.id}/?t={messages-0.topic_id}">{messages-0.subject?}</a></div> </div> <div class="menu_block right"> - <a href="/groupapp/board/reply_to_topic/{messages-0.topic_id?}">_{Reply to Topic}</a> + <a href="/groupapp/board/reply_to_topic/{group.id}/?t={messages-0.topic_id?}">_{Reply to Topic}</a> </div> </div> @@ -22,7 +22,7 @@ <div class="actions"> <ul class="actions_list"> - <li><a href="/groupapp/board/reply_to_post/{message.id?}">_{Reply} <? if ($current_user->getId() == $message->user_id) echo $text_helper->translate('to Your Post'); ?></a></li> + <li><a href="/groupapp/board/reply_to_post/{group.id}/?p={message.id?}">_{Reply} <? if ($current_user->getId() == $message->user_id) echo $text_helper->translate('to Your Post'); ?></a></li> <? if ($current_user->getId() != $message->user_id) { ?> <li><a href="#">_{Mark as Irrelevant}</a></li> <li><a href="#">_{Report}</a></li> @@ -32,7 +32,8 @@ </div> <div class="avatar"> - <a href="/profile/show/{message.user_id?}"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + <? $user_picture = $message->user->basic_profile->load()->stored_file_id ? $message->user->basic_profile->picture->load()->url() : USER_DEFAULT_PICTURE_URL; ?> + <a href="/profile/show/{message.user.id}"><img src="/preview/50x50/{user_picture}"></a> <div class="subtext">#{message_loop_counter}</div> <?= $form_helper->hidden_field('message_id', $message->id, array('value' => $message_loop_counter))?> </div> Modified: app/views/groupapp/group/_picture_upload.tpl =================================================================== --- app/views/groupapp/group/_picture_upload.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/group/_picture_upload.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -54,7 +54,7 @@ </div> <div class="right_big"> - <div class="left_content"> + <div class="right_content"> <div class="upload_picture"> @@ -70,9 +70,9 @@ <?= $form_helper->file_field('upload', 'photo', array('class' => 'textinput small')) ?> </div> - <div class="filter_name certify"> - <?= $form_helper->check_box('upload', 'certify', array('onclick' => "onCertifyClick(this)")) ?> - <label for="group_certify">_{I certify that I have the right to distribute this picture and that it does not violate the} <a href="#">_{Terms of Use}</a>.</label> + <div class="certify"> + <?= $form_helper->check_box('picture', 'certify', array('onclick' => "onCertifyClick(this)")) ?> + <label for="picture_certify">_{I certify that I have the right to distribute this picture and that it does not violate the} <a href="#">_{Terms of Use}</a>.</label> </div> <div class="upload_submit"> Modified: app/views/groupapp/group/edit_members.tpl =================================================================== --- app/views/groupapp/group/edit_members.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/group/edit_members.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -43,7 +43,7 @@ {?group_members}{loop group_members} <? if ($group_member->groupapp_member_role_id == 1): ?> <li> - <span class="member_name"><a href="/profile/show/{group_member.id}">{group_member.user.name}</a></span> + <span class="member_name"><a href="/profile/show/{group_member.user_id}">{group_member.user.name}</a></span> <span class="change_status"> <a href="#" onclick="change_member_status(this, {group.id}, 'moderators_list', {group_member.groupapp_member_role_id}); return false;" name="{group_member.id}">_{change status}</a> </span> @@ -66,7 +66,7 @@ {?group_members}{loop group_members} <? if ($group_member->groupapp_member_role_id == 2): ?> <li> - <span class="member_name"><a href="/profile/show/{group_member.id}">{group_member.user.name}</a></span> + <span class="member_name"><a href="/profile/show/{group_member.user_id}">{group_member.user.name}</a></span> <span class="change_status"> <a href="#" onclick="change_member_status(this, {group.id}, 'moderators_list', {group_member.groupapp_member_role_id}); return false;" name="{group_member.id}">_{change status}</a> </span> @@ -89,7 +89,7 @@ {?group_members}{loop group_members} <? if ($group_member->groupapp_member_role_id == 3): ?> <li> - <span class="member_name"><a href="/profile/show/{group_member.id}">{group_member.user.name}</a></span> + <span class="member_name"><a href="/profile/show/{group_member.user_id}">{group_member.user.name}</a></span> <span class="change_status"> <a href="#" onclick="change_member_status(this, {group.id}, 'moderators_list', {group_member.groupapp_member_role_id}); return false;" name="{group_member.id}">_{change status}</a> </span> @@ -113,7 +113,7 @@ <? if ($group_member->groupapp_member_role_id == 4): ?> <li> <span class="member_name"> - <a href="/profile/show/{group_member.id}">{group_member.user.name}</a> + <a href="/profile/show/{group_member.user_id}">{group_member.user.name}</a> </span> <span class="change_status"> <a href="#" onclick="change_member_status(this, {group.id}, 'moderators_list', {group_member.groupapp_member_role_id}); return false;" name="{group_member.id}">_{change status}</a> Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/group/index.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -4,7 +4,7 @@ <div class="title_bar"> <div class="avatar"> - <a href="/profile/show/"><img src="/images/nophoto_men_sm.gif" alt="" class=""></a> + <a href="/profile/show/"><img src="/preview/50x50/{user_picture}" alt="" class=""></a> </div> <div class="info"> <div class="header"> Modified: app/views/groupapp/group/show_group.tpl =================================================================== --- app/views/groupapp/group/show_group.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/groupapp/group/show_group.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -153,9 +153,10 @@ <div class="body"> {?group_members} {loop group_members} + <? $user_picture = $group_member->user->basic_profile->load()->stored_file_id ? $group_member->user->basic_profile->picture->load()->url() : USER_DEFAULT_PICTURE_URL; ?> <span class="member_ceil"> - <a href="/profile/show/{group_member.user.id?}"> - <img src="/preview/70x70//images/nophoto_men_sm.gif"><br>{group_member.user.name?} + <a href="/profile/show/{group_member.user.id}"> + <img src="/preview/70x70/{user_picture}"><br>{group_member.user.name?} </a> </span> <? if ($group_member_loop_counter >= 5) break; ?> Modified: app/views/layouts/application.tpl =================================================================== --- app/views/layouts/application.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/layouts/application.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -7,6 +7,7 @@ <link href="/stylesheets/dialog.css" rel="stylesheet" type="text/css"> <link href="/stylesheets/Application.css" rel="stylesheet" type="text/css"> <link href="/stylesheets/friend_selector.css" rel="stylesheet" type="text/css"> +<link href="/stylesheets/upload_picture.css" rel="stylesheet" type="text/css"> <? if ($controller->getModuleName()) : ?> <link href="/stylesheets/<?= $controller->getModuleName() . '/' . ucfirst($controller->getModuleName()) ?>.css" rel="stylesheet" type="text/css"> <? endif ?> Modified: app/views/profile/picture.tpl =================================================================== --- app/views/profile/picture.tpl 2008-07-14 18:35:39 UTC (rev 287) +++ app/views/profile/picture.tpl 2008-07-15 18:39:12 UTC (rev 288) @@ -2,4 +2,133 @@ <?= $controller->renderErrors() ?> -<p class="indent">Coming soon</p> \ No newline at end of file +<script type="text/javascript"> + function startCallback() { + return true; + } + + function completeCallback(response) { + $('upload_photo').value = ''; + var uploaded = response.evalJSON(true); + if (uploaded.length) { + $('current_picture').innerHTML = '<img src="/preview/200x200/' + uploaded[0].url + '">'; + $('basic_profile_stored_file_id').value = uploaded[0].id; + $('picture_note').show(); + } + } + + function onCertifyClick (el) { + if (el.checked) { + $('upload_submit_btn').enable(); + $('upload_submit_btn').writeAttribute('class', 'submitinput'); + } else { + $('upload_submit_btn').disable(); + $('upload_submit_btn').writeAttribute('class', 'cancelinput'); + } + } + + function removePicture() { + <? $default_picture = USER_DEFAULT_PICTURE_URL; ?> + $('current_picture').innerHTML = '<img src="/preview/200x200/{default_picture}">'; + $('basic_profile_stored_file_id').value = ''; + $('picture_note').show(); + } + +</script> + +<form enctype="multipart/form-data" method="post" id="picture_upload_form" action="/upload" onsubmit="return AIM.submit(this, {'onStart' : startCallback, 'onComplete' : completeCallback})"> + +<div class="picture"> + <div class="two_column"> + + <div class="left_small"> + <div class="left_content"> + + <div class="imghead">_{Current picture}:<br><br> + <div id="current_picture"> + <img src="/preview/200x200/{user_picture}"> + </div> + </div> + + <div class="note" id="picture_note" style="display: none"> + <strong>_{Note}</strong>: _{to preserve the new images do not forget to save the user profile}! + </div> + + </div> + </div> + + <div class="right_big"> + <div class="right_content"> + + <div class="upload_picture"> + + <div class="upload_title"> + _{Upload Picture} + </div> + + <div class="upload_text"> + _{You can upload a JPG, GIF or PNG file}. + </div> + + <div class="upload_field"> + <?= $form_helper->file_field('upload', 'photo', array('class' => 'textinput small')) ?> + </div> + + <div class="certify"> + <?= $form_helper->check_box('picture', 'certify', array('onclick' => "onCertifyClick(this)")) ?> + <label for="picture_certify">_{I certify that I have the right to distribute this picture and that it does not violate the} <a href="#">_{Terms of Use}</a>.</label> + </div> + + <div class="upload_submit"> + <input class="cancelinput" type="submit" value="_{Upload Picture}" disabled="disabled" id="upload_submit_btn" name="upload_submit_btn" /> + </div> + + {?basic_profile.stored_file_id} + <div class="spacer"> </div> + <div class="upload_title"> + _{Remove Picture} + </div> + + <div class="upload_text"> + _{You can remove this picture, but be sure to upload another or we will display a question mark in its place}. + </div> + + <div class="upload_submit"> + <input class="submitinput" type="button" value="_{Remove Picture}" id="remove_submit_btn" name="remove_submit_btn" onclick="removePicture()" /> + </div> + {end} + + </div> + + </div> + </div> + + </div> + <div class="clearfix"></div> +</div> +</form> + +<form id="profile_picture_form" action="/profile/picture" method="post"> + <div class="two_column"> + <div class="left_small"> + <div class="left_content"> + + </div> + </div> + + <div class="right_big"> + <div class="right_content"> + + <div class="upload_picture"> + <?= $form_helper->hidden_field('basic_profile', 'stored_file_id') ?> + <div class="upload_submit"> + <input class="submitinput" type="submit" value="_{Save Changes}"> + </div> + </div> + + </div> + </div> + + <div class="clearfix"></div> + </div> +</form> Modified: public/stylesheets/friend_selector.css =================================================================== --- public/stylesheets/friend_selector.css 2008-07-14 18:35:39 UTC (rev 287) +++ public/stylesheets/friend_selector.css 2008-07-15 18:39:12 UTC (rev 288) @@ -25,11 +25,11 @@ background: #ffffff; border-bottom: 1px solid #cccccc; padding: 3px 2px 3px 2px; + height: 30px; } .friend_selector .content .friend_row.first { border-top: 1px solid #cccccc; - } .friend_selector .content .friend_row .friend_check { Modified: public/stylesheets/groupapp/Group.css =================================================================== --- public/stylesheets/groupapp/Group.css 2008-07-14 18:35:39 UTC (rev 287) +++ public/stylesheets/groupapp/Group.css 2008-07-15 18:39:12 UTC (rev 288) @@ -245,45 +245,6 @@ padding: 10px 0px 3px 0px; } -.imghead { - color: #333333; - font-weight: bold; - font-size: 12px; - text-align: center; - padding: 0px 10px 20px 10px; -} - -.upload_picture { - padding: 0px 10px 20px 10px; -} - -.upload_picture .upload_title { - color: #333333; - font-weight: bold; - font-size: 13px; - border-bottom: solid 1px #6d84b4; - padding: 0px 0px 5px 0px; -} - -.upload_picture .upload_text { - padding: 10px 0px 10px 0px; -} - -.note { - font-size: 11px; - color: #ff5f5f; - margin: 0px 5px 10px 10px; -} - -.filter_name.certify { - padding: 10px 0px 10px 0px; -} - -.spacer { - dislay: block; - height: 20px; -} - .member_ceil { width: 80px; padding: 5px; Added: public/stylesheets/upload_picture.css =================================================================== --- public/stylesheets/upload_picture.css (rev 0) +++ public/stylesheets/upload_picture.css 2008-07-15 18:39:12 UTC (rev 288) @@ -0,0 +1,42 @@ +.imghead { + color: #333333; + font-weight: bold; + font-size: 12px; + text-align: center; + padding: 0px 10px 20px 10px; +} + +.upload_picture { + padding: 0px 10px 20px 10px; +} + +.upload_picture .upload_title { + color: #333333; + font-weight: bold; + font-size: 13px; + border-bottom: solid 1px #6d84b4; + padding: 0px 0px 5px 0px; +} + +.upload_picture .upload_text { + padding: 10px 0px 10px 0px; +} + +.certify { + color: #777777; + font-weight: bold; + font-size: 12px; + padding: 10px 0px 10px 0px; +} + +.note { + font-size: 11px; + color: #ff5f5f; + margin: 0px 5px 10px 10px; +} + +.spacer { + dislay: block; + height: 20px; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |