Thread: [Isocial-svn] SF.net SVN: isocial: [279] app (Page 3)
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <di...@us...> - 2008-07-09 09:14:04
|
Revision: 279 http://isocial.svn.sourceforge.net/isocial/?rev=279&view=rev Author: dim0s77 Date: 2008-07-09 02:14:07 -0700 (Wed, 09 Jul 2008) Log Message: ----------- minor fixes Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/_membersbar.tpl app/views/groupapp/group/edit_members.tpl app/views/groupapp/group/members.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-09 08:48:17 UTC (rev 278) +++ app/controllers/groupapp/group_controller.php 2008-07-09 09:14:07 UTC (rev 279) @@ -214,12 +214,14 @@ $this->admins_count = 0; $this->moderators_count = 0; $this->members_count = 0; + $this->all_members_count= 0; if (!empty($this->group_members)) { foreach ($this->group_members as $member) { - $this->members_count++; + $this->all_members_count++; if ($member->groupapp_member_role_id == 1) $this->owners_count++; elseif ($member->groupapp_member_role_id == 2) $this->admins_count++; elseif ($member->groupapp_member_role_id == 3) $this->moderators_count++; + elseif ($member->groupapp_member_role_id == 4) $this->members_count++; } } } Modified: app/views/groupapp/group/_membersbar.tpl =================================================================== --- app/views/groupapp/group/_membersbar.tpl 2008-07-09 08:48:17 UTC (rev 278) +++ app/views/groupapp/group/_membersbar.tpl 2008-07-09 09:14:07 UTC (rev 279) @@ -1,8 +1,8 @@ <div class="minitabs"> <div class="left"> <ul class="toggle_minitabs"> - {?members_count} - <li><a href="/groupapp/group/show_members/{group.id?}" class="<?= !empty($step) && $step == 'show_members' ? 'selected' : '' ?> right_border">_{All Members}: {members_count}</a> + {?all_members_count} + <li><a href="/groupapp/group/show_members/{group.id?}" class="<?= !empty($step) && $step == 'show_members' ? 'selected' : '' ?> right_border">_{All Members}: {all_members_count}</a> {else} <li class="empty right_border">_{All Members}: 0 {end} Modified: app/views/groupapp/group/edit_members.tpl =================================================================== --- app/views/groupapp/group/edit_members.tpl 2008-07-09 08:48:17 UTC (rev 278) +++ app/views/groupapp/group/edit_members.tpl 2008-07-09 09:14:07 UTC (rev 279) @@ -108,15 +108,17 @@ <div class="members_list"> <ul> {?group_members}{loop group_members} + <? 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></span> - <? if ($group_member->groupapp_member_role_id == 4): ?> + <span class="member_name"> + <a href="/profile/show/{group_member.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> <a href="#" onclick="remove_member(this, {group.id}, 'members_list', {group_member.groupapp_member_role_id}); return false;" name="{group_member.id}">_{remove}</a> - <? endif ?> </li> + <? endif ?> {end}{end} </ul> </div> Modified: app/views/groupapp/group/members.tpl =================================================================== --- app/views/groupapp/group/members.tpl 2008-07-09 08:48:17 UTC (rev 278) +++ app/views/groupapp/group/members.tpl 2008-07-09 09:14:07 UTC (rev 279) @@ -22,9 +22,9 @@ <div class="actions wide"> <ul class="actions_list"> - <li><a href="/profile/show/{member.id?}">_{View Profile}</a></li> - <li><a href="/message/send/{member.id?}">_{Send a Message}</a></li> - <li><a href="/friend/{member.id?}">_{View Friends}</a></li> + <li><a href="/profile/show/{member.user_id?}">_{View Profile}</a></li> + <li><a href="/message/send/{member.user_id?}">_{Send a Message}</a></li> + <li><a href="/friend/{member.user_id?}">_{View Friends}</a></li> </ul> </div> @@ -35,7 +35,7 @@ <div class="info"> <div class="other"> <span class="param">_{Name}:</span> - <span class="name"><a href="/profile/show/{member.id?}">{member.user.name?}</a></span> + <span class="name"><a href="/profile/show/{member.user_id?}">{member.user.name?}</a></span> </div> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-09 10:36:22
|
Revision: 280 http://isocial.svn.sourceforge.net/isocial/?rev=280&view=rev Author: dim0s77 Date: 2008-07-09 03:36:31 -0700 (Wed, 09 Jul 2008) Log Message: ----------- hide 'join group' link if user in current group Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/views/groupapp/group/browse.tpl app/views/groupapp/group/index.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-09 09:14:07 UTC (rev 279) +++ app/controllers/groupapp/group_controller.php 2008-07-09 10:36:31 UTC (rev 280) @@ -284,9 +284,17 @@ $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, 'include' => 'picture'); + $_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); + + $user_groups = $this->current_user->groupapp_group->load(); + if (!empty($user_groups)) { + $this->user_groups = array(); + foreach ($user_groups as $user_group) { + $this->user_groups[$user_group->id] = true; + } + } } function show_members () { Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-07-09 09:14:07 UTC (rev 279) +++ app/views/groupapp/group/browse.tpl 2008-07-09 10:36:31 UTC (rev 280) @@ -85,13 +85,19 @@ <div class="actions"> <ul class="actions_list"> - <li><a href="#">_{Join Group}</a></li> + {?user_groups} + <? if (!isset($user_groups[$group->id])): ?> + <li><a href="#">_{Join Group}</a></li> + <? endif ?> + {end} </ul> </div> <div class="info"> <div class="name"><a href="/groupapp/group/show_group/{group.id?}">{group.name}</a></div> - <div class="other"><span class="param">_{Members count}:</span> {group.members_count}</div> + <div class="other"><span class="param">_{Members count}:</span> + <a href="/groupapp/group/show_members/{group.id?}">{group.members_count}</a> + </div> <div class="other"><span class="param">_{Type}:</span> <a href="/groupapp/group/browse/?g={group_type_id}"><?= $gt[$group_type_id] ?></a> - <a href="/groupapp/group/browse/?g={group_type_id}&sg={group.type_id}"><?= $gt[$group->type_id] ?></a> Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-07-09 09:14:07 UTC (rev 279) +++ app/views/groupapp/group/index.tpl 2008-07-09 10:36:31 UTC (rev 280) @@ -60,7 +60,9 @@ <div class="info"> <div class="name"><a href="/groupapp/group/show_group/{user_group.id?}">{user_group.name}</a></div> - <div class="other"><span class="param">_{Members count}:</span> {user_group.members_count}</div> + <div class="other"><span class="param">_{Members count}:</span> + <a href="/groupapp/group/show_members/{user_group.id?}">{user_group.members_count}</a> + </div> <div class="other"><span class="param">_{Type}:</span> <? $subtype_id = $user_group->type_id; $type_id = $subgroup_types[$subtype_id]; ?> <a href="/groupapp/group/browse/?g={type_id?}"><?= $gt[$type_id] ?></a> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-09 13:57:43
|
Revision: 281 http://isocial.svn.sourceforge.net/isocial/?rev=281&view=rev Author: dim0s77 Date: 2008-07-09 06:57:52 -0700 (Wed, 09 Jul 2008) Log Message: ----------- show/hide page elements if user is/not admin Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/models/groupapp_group.php app/views/groupapp/group/_info.tpl app/views/groupapp/group/index.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-09 10:36:31 UTC (rev 280) +++ app/controllers/groupapp/group_controller.php 2008-07-09 13:57:52 UTC (rev 281) @@ -129,17 +129,23 @@ } function edit_info () { + if (!$this->is_admin) { $this->redirectTo(array('action' => 'index')); } + $this->step = 'edit_info'; $this->_extract_group_types(); $this->edit_group(); } function edit_customize () { + if (!$this->is_admin) { $this->redirectTo(array('action' => 'index')); } + $this->step = 'edit_customize'; $this->edit_group(); } function edit_members () { + if (!$this->is_admin) { $this->redirectTo(array('action' => 'index')); } + $this->step = 'edit_members'; if (!empty($this->params['member'])){ $this->GroupappGroup->setAttributes($this->params['member']); Modified: app/models/groupapp_group.php =================================================================== --- app/models/groupapp_group.php 2008-07-09 10:36:31 UTC (rev 280) +++ app/models/groupapp_group.php 2008-07-09 13:57:52 UTC (rev 281) @@ -5,7 +5,9 @@ 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'), + 'groupapp_members' => array('class_name' => 'GroupappMember', + 'foreign_key' => 'groupapp_group_id')); var $belongs_to = array('group_type' => array('class_name' => 'GroupappGroupType', 'primary_key_name' => 'type_id'), Modified: app/views/groupapp/group/_info.tpl =================================================================== --- app/views/groupapp/group/_info.tpl 2008-07-09 10:36:31 UTC (rev 280) +++ app/views/groupapp/group/_info.tpl 2008-07-09 13:57:52 UTC (rev 281) @@ -22,15 +22,15 @@ <label class="required">_{Group Type}:<br><small>(_{required})</small></label> <div class="formcol"> <select id="group_category_id" name="group[category_id]" onchange="on_category_change('group_category_id', category_subtypes, category_sublabels);" typefor="group_type_id"> - <option <? if (!$group->category_id): ?>selected="selected" <? endif ?>value="">_{Select Category:}</option> + <option <? if (!empty($group) && !$group->category_id): ?>selected="selected" <? endif ?>value="">_{Select Category:}</option> {loop group_types} - <option <? if ($group->category_id == $group_type->id): ?>selected="selected" <? endif ?>value="{group_type.id?}"><?= $gt[$group_type->id] ?></option> + <option <? if (!empty($group) && $group->category_id == $group_type->id): ?>selected="selected" <? endif ?>value="{group_type.id?}"><?= $gt[$group_type->id] ?></option> {end} </select> - <select id="group_type_id" name="group[type_id]" subtypefor="group_category_id" <? if (!$group->category_id): ?>disabled="disabled" <? endif ?>> - <option <? if (!$group->category_id || !$group->type_id): ?>selected="selected" <? endif ?>value="">_{Select Type:}</option> + <select id="group_type_id" name="group[type_id]" subtypefor="group_category_id" <? if (empty($group) || !$group->category_id): ?>disabled="disabled" <? endif ?>> + <option <? if (!empty($group) && (!$group->category_id || !$group->type_id)): ?>selected="selected" <? endif ?>value="">_{Select Type:}</option> {loop subgroup_types} - <? if ($group->category_id != $subgroup_type) continue; ?> + <? if (empty($group) || $group->category_id != $subgroup_type) continue; ?> <option <? if ($group->type_id == $subgroup_type_loop_key): ?>selected="selected" <? endif ?>value="{subgroup_type_loop_key}"><?= $gt[$subgroup_type_loop_key] ?></option> {end} </select> Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-07-09 10:36:31 UTC (rev 280) +++ app/views/groupapp/group/index.tpl 2008-07-09 13:57:52 UTC (rev 281) @@ -44,7 +44,13 @@ <div class="actions"> <ul class="actions_list"> - <li><a href="/groupapp/group/edit_info/{user_group.id?}">_{Edit Group}</a></li> + <? if ($members = $user_group->groupapp_member->load()): ?> + {loop members} + <? if ($member->user_id == $current_user->getId() && $member->groupapp_member_role_id < 3): ?> + <li><a href="/groupapp/group/edit_info/{user_group.id?}">_{Edit Group}</a></li> + <? endif ?> + {end} + <? endif ?> <li><a href="#">_{Leave Group}</a></li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-09 15:00:54
|
Revision: 282 http://isocial.svn.sourceforge.net/isocial/?rev=282&view=rev Author: dim0s77 Date: 2008-07-09 08:01:01 -0700 (Wed, 09 Jul 2008) Log Message: ----------- added joining to group Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/locales/groupapp/group/ru.php app/views/groupapp/group/browse.tpl app/views/groupapp/group/show_group.tpl app/views/message/outbox.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-09 13:57:52 UTC (rev 281) +++ app/controllers/groupapp/group_controller.php 2008-07-09 15:01:01 UTC (rev 282) @@ -355,6 +355,23 @@ function show_topic () { } + function join () { + if ($this->group && !$this->is_member) { + $member = $this->GroupappMemberRole->find(4); + $group_member = $this->GroupappGroup->group_member->build(); + $group_member->group->assign($this->group); + $group_member->user->assign($this->current_user); + $group_member->role->assign($member); + if ($group_member->save()) { + $this->group->members_count += 1; + $this->group->save(); + $this->renderText('OK'); + return; + } + } + $this->renderText(''); + } + function help () { } Modified: app/locales/groupapp/group/ru.php =================================================================== --- app/locales/groupapp/group/ru.php 2008-07-09 13:57:52 UTC (rev 281) +++ app/locales/groupapp/group/ru.php 2008-07-09 15:01:01 UTC (rev 282) @@ -84,7 +84,7 @@ $dictionary['Administrative approval is required for new members to join. Anyone can see the group information. Only the members will be able to see the following: the discussion board, the wall, videos and photos.'] = 'Для вступления в группу необходимо разрешение администратора. Все могут смотреть описание группы, ее содержание доступно только участникам.'; $dictionary['The group will not appear in search results or in the profiles of its members. Membership is by invitation only, and only members can see the group information. Only the members will be able to see the following: the discussion board, the wall, videos and photos.'] = - 'Группа не будет отображаться в результатах поиска или в профилях ее участников. Вступить можно только по приглашениям, и только члены могут видеть информацию и содержание группы.'; + 'Группа не будет отображаться в результатах поиска или в профилях ее участников. Вступить можно только по приглашениям, и только участники группы могут видеть информацию и содержание группы.'; $dictionary['This is an open group. Anyone can join and invite others to join.'] = 'Это открытая группа. Каждый может присоединиться и пригласить других.'; $dictionary['This is a closed group. Members must be invited or approved by an admin.'] = @@ -133,7 +133,7 @@ $dictionary['Videos'] = 'Видео'; $dictionary['No one has uploaded any videos'] = 'Никто не загружал видео'; $dictionary['Add Videos'] = 'Добавить видео'; -$dictionary['Discussion board'] = 'Доска обсуждений'; +$dictionary['Discussion board'] = 'Форум'; $dictionary['There are no discussions'] = 'Обсуждения отсутствуют'; $dictionary['Start the first topic'] = 'Начать первую тему'; $dictionary['Members count'] = 'Количество участников'; @@ -152,6 +152,11 @@ $dictionary['Create first group'] = 'Создать первую группу'; $dictionary['All'] = 'Все'; $dictionary['Join Group'] = 'Присоединиться'; +$dictionary['Join this Group'] = 'Присоединиться к группе'; +$dictionary['View Discussion Board'] = 'Просмотреть форум'; +$dictionary['Add group membership'] = 'Присоединиться к группе'; +$dictionary['Do you want to join'] = 'Вы хотите присоединиться к'; +$dictionary['Join'] = 'Присоединиться'; $dictionary['Search groups'] = 'Поиск групп'; $dictionary['Search by name'] = 'Поиск по имени'; Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-07-09 13:57:52 UTC (rev 281) +++ app/views/groupapp/group/browse.tpl 2008-07-09 15:01:01 UTC (rev 282) @@ -87,7 +87,7 @@ <ul class="actions_list"> {?user_groups} <? if (!isset($user_groups[$group->id])): ?> - <li><a href="#">_{Join Group}</a></li> + <li><a href="#" onclick="join_this_group(this); return false;" id="{group.id?}" name="{group.name?}">_{Join Group}</a></li> <? endif ?> {end} </ul> @@ -133,3 +133,23 @@ </div> {end} <div class="clearfix"></div> + +<script type="text/javascript"> +function join_this_group (element) { + new Dialog.Box(element, { + classname: 'delete_dialog', + title: '_{Add group membership}?', + body: '_{Do you want to join} "' + element.name + '"?', + yes: '_{Join}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Request('/groupapp/group/join/' + element.id, { + onComplete: function () { + window.location = "/groupapp/group/show_group/" + element.id; + } + }); + } + }); + return false; +} +</script> Modified: app/views/groupapp/group/show_group.tpl =================================================================== --- app/views/groupapp/group/show_group.tpl 2008-07-09 13:57:52 UTC (rev 281) +++ app/views/groupapp/group/show_group.tpl 2008-07-09 15:01:01 UTC (rev 282) @@ -12,7 +12,7 @@ <div class="right_content"> <div class="group_avatar"> - <img src="/preview/100x100/{group_picture}"> + <img src="/preview/200x200/{group_picture}"> </div> <ul class="actions_list"> @@ -27,7 +27,7 @@ {end} {?is_guest} <li><a href="#">_{View Discussion Board}</a></li> - <li><a href="#">_{Join this Group}</a></li> + <li><a href="#" onclick="join_this_group(this); return false;" name="{group.id?}">_{Join this Group}</a></li> {end} </ul> @@ -178,3 +178,22 @@ </div> <div class="clearfix"></div> +<script type="text/javascript"> +function join_this_group (element) { + new Dialog.Box(element, { + classname: 'delete_dialog', + title: '_{Add group membership}?', + body: '_{Do you want to join} "{group.name?}"?', + yes: '_{Join}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Request('/groupapp/group/join/{group.id?}', { + onComplete: function () { + window.location = "/groupapp/group/show_group/{group.id?}"; + } + }); + } + }); + return false; +} +</script> Modified: app/views/message/outbox.tpl =================================================================== --- app/views/message/outbox.tpl 2008-07-09 13:57:52 UTC (rev 281) +++ app/views/message/outbox.tpl 2008-07-09 15:01:01 UTC (rev 282) @@ -26,7 +26,7 @@ </div> </form> -<script> +<script type="text/javascript"> var checkids = new Array(); function oncheck (element, is_read) { checked = $$('input[type=checkbox]:checked'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2008-07-09 15:55:02
|
Revision: 283 http://isocial.svn.sourceforge.net/isocial/?rev=283&view=rev Author: dim0s77 Date: 2008-07-09 08:55:12 -0700 (Wed, 09 Jul 2008) Log Message: ----------- added leaving group Modified Paths: -------------- app/controllers/groupapp/group_controller.php app/locales/groupapp/group/ru.php app/views/groupapp/group/_members_list.tpl app/views/groupapp/group/browse.tpl app/views/groupapp/group/index.tpl app/views/groupapp/group/members.tpl app/views/groupapp/group/show_group.tpl Modified: app/controllers/groupapp/group_controller.php =================================================================== --- app/controllers/groupapp/group_controller.php 2008-07-09 15:01:01 UTC (rev 282) +++ app/controllers/groupapp/group_controller.php 2008-07-09 15:55:12 UTC (rev 283) @@ -35,6 +35,7 @@ if ($current_user_id == $member->user_id) { $this->is_member = true; $this->is_guest = false; + $this->group_member_id = $member->id; } } $this->group_members = $members; @@ -324,7 +325,7 @@ function _members () { $this->_calcGroupMembersCount(); - if (!count($this->group_members)) { + if (empty($this->group_members)) { $this->renderAction('members.tpl'); return; } @@ -357,7 +358,11 @@ function join () { if ($this->group && !$this->is_member) { - $member = $this->GroupappMemberRole->find(4); + if ($this->group->members_count > 0) { + $member = $this->GroupappMemberRole->find(4); + } else { + $member = $this->GroupappMemberRole->find(1); + } $group_member = $this->GroupappGroup->group_member->build(); $group_member->group->assign($this->group); $group_member->user->assign($this->current_user); @@ -372,6 +377,23 @@ $this->renderText(''); } + function leave () { + if ($this->group && $this->is_member) { + $this->group->members_count -= 1; + if (!$this->group->save()) { + $this->renderText(''); + return; + } + if (!$this->GroupappMember->destroy($this->group_member_id)) { + $this->group->members_count += 1; + $this->group->save(); + $this->renderText('OK'); + return; + }; + } + $this->renderText(''); + } + function help () { } Modified: app/locales/groupapp/group/ru.php =================================================================== --- app/locales/groupapp/group/ru.php 2008-07-09 15:01:01 UTC (rev 282) +++ app/locales/groupapp/group/ru.php 2008-07-09 15:55:12 UTC (rev 283) @@ -157,6 +157,9 @@ $dictionary['Add group membership'] = 'Присоединиться к группе'; $dictionary['Do you want to join'] = 'Вы хотите присоединиться к'; $dictionary['Join'] = 'Присоединиться'; +$dictionary['Remove group membership'] = 'Прекратить свое участие в группе'; +$dictionary['Are you sure you want to remove your membership from'] = 'Вы уверены, что хотите покинуть группу'; +$dictionary['Remove'] = 'Покинуть'; $dictionary['Search groups'] = 'Поиск групп'; $dictionary['Search by name'] = 'Поиск по имени'; Modified: app/views/groupapp/group/_members_list.tpl =================================================================== --- app/views/groupapp/group/_members_list.tpl 2008-07-09 15:01:01 UTC (rev 282) +++ app/views/groupapp/group/_members_list.tpl 2008-07-09 15:55:12 UTC (rev 283) @@ -1,20 +1,20 @@ <div class="list_header"><?= $text_helper->translate($members_group_name, array()); ?>: {members_count}</div> -<? if (!$members_count) { ?> +<? if (!$members_count): ?> <div class="empty_list"><?= $text_helper->translate($empty_message, array()); ?></div> -<? } else { ?> -<? if ($list_id == 'members_list') { ?><div class="members_list_container"><? } ?> +<? else: ?> + <? if ($list_id == 'members_list'): ?><div class="members_list_container"><? endif ?> <div class="members_list"> <ul> {?members}{loop members} - <? if ($member->groupapp_member_role_id == $role) { ?> + <? if ($member->groupapp_member_role_id == $role): ?> <li> <span class="member_name"><a href="/profile/show/{member.id}">{member.user.name}</a></span> <span class="change_status"><a href="#" onclick="change_member_status(this); return false;" name="{member.id}">_{change status}</a></span> <a href="#" onclick="remove_member(this, {group.id}, '{list_id}', {role}); return false;" name="{member.id}">_{remove}</a> </li> - <? } ?> + <? endif ?> {end}{end} </ul> </div> -<? if ($list_id == 'members_list') { ?></div><? } ?> -<? } ?> + <? if ($list_id == 'members_list'): ?></div><? endif ?> +<? endif ?> Modified: app/views/groupapp/group/browse.tpl =================================================================== --- app/views/groupapp/group/browse.tpl 2008-07-09 15:01:01 UTC (rev 282) +++ app/views/groupapp/group/browse.tpl 2008-07-09 15:55:12 UTC (rev 283) @@ -152,4 +152,5 @@ }); return false; } + </script> Modified: app/views/groupapp/group/index.tpl =================================================================== --- app/views/groupapp/group/index.tpl 2008-07-09 15:01:01 UTC (rev 282) +++ app/views/groupapp/group/index.tpl 2008-07-09 15:55:12 UTC (rev 283) @@ -51,7 +51,7 @@ <? endif ?> {end} <? endif ?> - <li><a href="#">_{Leave Group}</a></li> + <li><a href="#" onclick="leave_this_group(this); return false;" id="{user_group.id?}" name="{user_group.name?}">_{Leave Group}</a></li> </ul> </div> @@ -129,3 +129,23 @@ </div> <div class="clearfix"></div> </div> + +<script type="text/javascript"> +function leave_this_group (element) { + new Dialog.Box(element, { + classname: 'delete_dialog', + title: '_{Remove group membership}?', + body: '_{Are you sure you want to remove your membership from} "' + element.name + '"?', + yes: '_{Remove}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Request('/groupapp/group/leave/' + element.id, { + onComplete: function () { + window.location = "/groupapp/group"; + } + }); + } + }); + return false; +} +</script> Modified: app/views/groupapp/group/members.tpl =================================================================== --- app/views/groupapp/group/members.tpl 2008-07-09 15:01:01 UTC (rev 282) +++ app/views/groupapp/group/members.tpl 2008-07-09 15:55:12 UTC (rev 283) @@ -51,7 +51,27 @@ </div> {else} <div class="nogroups"> - _{Group have no members}. <a href="">_{Become the owner of the group}</a>. + _{Group have no members}. <a href="#" onclick="join_this_group(this); return false;">_{Become the owner of the group}</a>. <div class="clearfix"></div> </div> + +<script type="text/javascript"> +function join_this_group (element) { + new Dialog.Box(element, { + classname: 'delete_dialog', + title: '_{Add group membership}?', + body: '_{Do you want to join} "{group.name?}"?', + yes: '_{Join}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Request('/groupapp/group/join/{group.id?}', { + onComplete: function () { + window.location = "/groupapp/group/show_members/{group.id?}"; + } + }); + } + }); + return false; +} +</script> {end} Modified: app/views/groupapp/group/show_group.tpl =================================================================== --- app/views/groupapp/group/show_group.tpl 2008-07-09 15:01:01 UTC (rev 282) +++ app/views/groupapp/group/show_group.tpl 2008-07-09 15:55:12 UTC (rev 283) @@ -23,11 +23,11 @@ {end} {?is_member} <li><a href="/groupapp/group/edit_members/{group.id?}">_{Invite People to Join}</a></li> - <li><a href="#">_{Leave Group}</a></li> + <li><a href="#" onclick="leave_this_group(this); return false;">_{Leave Group}</a></li> {end} {?is_guest} <li><a href="#">_{View Discussion Board}</a></li> - <li><a href="#" onclick="join_this_group(this); return false;" name="{group.id?}">_{Join this Group}</a></li> + <li><a href="#" onclick="join_this_group(this); return false;">_{Join this Group}</a></li> {end} </ul> @@ -149,6 +149,7 @@ <div class="info">_{Members count}: {members_count?}</div> </div> <div class="clearfix"></div> + {?members_count} <div class="body"> {?group_members} {loop group_members} @@ -161,6 +162,11 @@ {end} {end} </div> + {else} + <div class="emptyblock"> + _{Group have no members}.<br><a href="#" onclick="join_this_group(this); return false;">_{Become the owner of the group}</a> + </div> + {end} </div> <!-- <div class="box"> --> @@ -196,4 +202,23 @@ }); return false; } + +function leave_this_group (element) { + new Dialog.Box(element, { + classname: 'delete_dialog', + title: '_{Remove group membership}?', + body: '_{Are you sure you want to remove your membership from} "{group.name?}"?', + yes: '_{Remove}', + cancel: '_{Cancel}', + onYes : function () { + new Ajax.Request('/groupapp/group/leave/{group.id?}', { + onComplete: function () { + window.location = "/groupapp/group"; + } + }); + } + }); + return false; +} + </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <agu...@us...> - 2008-07-14 18:27:35
|
Revision: 286 http://isocial.svn.sourceforge.net/isocial/?rev=286&view=rev Author: aguidrevitch Date: 2008-07-14 11:27:43 -0700 (Mon, 14 Jul 2008) Log Message: ----------- some stubs for education/work profiles Modified Paths: -------------- app/controllers/profile_controller.php app/installers/russian_installer.php app/installers/user_installer.php app/locales/profile/ru.php app/models/network.php app/models/user.php app/views/profile/_menu.tpl Added Paths: ----------- app/models/education_profile.php app/models/network_type.php app/models/work_profile.php app/views/profile/education.tpl app/views/profile/work.tpl Removed Paths: ------------- app/models/network_profile.php app/views/profile/networks.tpl Modified: app/controllers/profile_controller.php =================================================================== --- app/controllers/profile_controller.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/controllers/profile_controller.php 2008-07-14 18:27:43 UTC (rev 286) @@ -109,9 +109,16 @@ } } - function networks () { + function education () { + $this->education_profile = $this->current_user->education_profile->load(); + } + function work () { + $this->work_profile = $this->current_user->work_profile->load(); + + } + function picture () { } Modified: app/installers/russian_installer.php =================================================================== --- app/installers/russian_installer.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/installers/russian_installer.php 2008-07-14 18:27:43 UTC (rev 286) @@ -26,6 +26,9 @@ $this->execute("UPDATE marital_statuses set {$locale}_name ='Сложно объяснить' WHERE id = 5"); $this->execute("UPDATE marital_statuses set {$locale}_name ='В открытых взаимоотношениях' WHERE id = 6"); + $this->execute("ALTER TABLE network_types ADD COLUMN {$locale}_name char(40) NOT NULL AFTER en_name"); + $this->execute("UPDATE network_types set {$locale}_name ='Образование' WHERE id = 1"); + $this->execute("UPDATE network_types set {$locale}_name ='Работа' WHERE id = 2"); } function down_1() Modified: app/installers/user_installer.php =================================================================== --- app/installers/user_installer.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/installers/user_installer.php 2008-07-14 18:27:43 UTC (rev 286) @@ -286,20 +286,55 @@ ) ENGINE=InnoDB"); $this->execute( + "CREATE TABLE `network_types` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `en_name` char(50) + ) ENGINE=InnoDB"); + + $this->execute("INSERT INTO network_types (id, en_name) VALUES (1, 'Education')"); + $this->execute("INSERT INTO network_types (id, en_name) VALUES (2, 'Work')"); + + $this->execute( "CREATE TABLE `networks` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `network_type_id` int(11), `city_id` int(11), - `name` char(255), - FOREIGN KEY (city_id) REFERENCES cities(id) + `name` char(200), + FOREIGN KEY (network_type_id) REFERENCES network_types(id), + FOREIGN KEY (city_id) REFERENCES cities(id) ) ENGINE=InnoDB"); $this->execute( - "CREATE TABLE `network_profiles` ( + "CREATE TABLE `network_votes` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11), + `network_id` int(11), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (network_id) REFERENCES networks(id), + UNIQUE vote_idx (user_id, network_id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `education_profiles` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `user_id` int(11) NOT NULL, `network_id` int(11), `from` datetime, `to` datetime, + `concentration` char(200), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (network_id) REFERENCES networks(id), + INDEX user_idx (user_id) + ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `work_profiles` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `network_id` int(11), + `from` datetime, + `to` datetime, + `position` char(100), `description` char(255), FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (network_id) REFERENCES networks(id), @@ -309,10 +344,11 @@ function down_1() { - $this->transactionComplete(); - $this->dropTable('network_profiles'); + $this->dropTable('work_profiles'); + $this->dropTable('education_profiles'); $this->dropTable('networks'); + $this->dropTable('network_types'); $this->dropTable('personal_profiles'); $this->dropTable('marital_statuses'); $this->dropTable('relationship_profiles'); Modified: app/locales/profile/ru.php =================================================================== --- app/locales/profile/ru.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/locales/profile/ru.php 2008-07-14 18:27:43 UTC (rev 286) @@ -8,7 +8,8 @@ $dictionary['Contact'] = 'Контакты'; $dictionary['Relationships'] = 'Семейное положение'; $dictionary['Personal'] = 'Интересы'; -$dictionary['Groups'] = 'Группы'; +$dictionary['Education'] = 'Образование'; +$dictionary['Work'] = 'Работа'; $dictionary['Picture'] = 'Фото'; $dictionary['Sex'] = 'Пол'; Added: app/models/education_profile.php =================================================================== --- app/models/education_profile.php (rev 0) +++ app/models/education_profile.php 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,8 @@ +<?php + +class EducationProfile extends ActiveRecord +{ + var $belongs_to = array('User','Network'); +} + +?> Modified: app/models/network.php =================================================================== --- app/models/network.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/models/network.php 2008-07-14 18:27:43 UTC (rev 286) @@ -2,20 +2,23 @@ class Network extends VotableActiveRecord { - var $belongs_to = array('City'); + var $belongs_to = array('City', 'NetworkType'); var $votes_model = 'NetworkVote'; var $strtolower = false; var $_alternate = false; function findConditions () { - return array('conditions' => array("country_id = ? AND region_id = ? AND name LIKE ?", $this->country_id, $this->region_id, $this->name)); + return array('conditions' => array("network_id = ? AND name LIKE ?", $this->network_id, $this->name)); } function validateOnCreate () { $this->validatesPresenceOf('name', "Network Name|network name can't be blank"); $this->validatesPresenceOf('city_id', "City|city can't be blank"); + $this->validatesPresenceOf('network_type_id', "Network type|network type can't be blank"); if (!$this->getErrors()) { $this->validatesNumericalityOf('city_id', "City: hack attempt detected|city does not exist"); + $this->validatesNumericalityOf('network_type_id', "Network type: hack attempt detected|network type does not exist"); + if (!$this->getErrors()) { $City = new City(); $city = $City->find( $this->city_id ); @@ -23,6 +26,15 @@ $this->addError('city_id', "City: hack attempt detected|city does not exist"); } } + + if (!$this->getErrors()) { + $NetworkType = new NetworkType(); + $network_type = $NetworkType->find( $this->network_type_id ); + if (empty($network_type)) { + $this->addError('network_type_id', "Network type: hack attempt detected|network does not exist"); + } + } + } } Deleted: app/models/network_profile.php =================================================================== --- app/models/network_profile.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/models/network_profile.php 2008-07-14 18:27:43 UTC (rev 286) @@ -1,8 +0,0 @@ -<?php - -class NetworkProfile extends ActiveRecord -{ - var $belongs_to = array('User', 'Network'); -} - -?> Added: app/models/network_type.php =================================================================== --- app/models/network_type.php (rev 0) +++ app/models/network_type.php 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,7 @@ +<?php + +class NetworkType extends ActiveRecord +{ +} + +?> Modified: app/models/user.php =================================================================== --- app/models/user.php 2008-07-14 17:59:26 UTC (rev 285) +++ app/models/user.php 2008-07-14 18:27:43 UTC (rev 286) @@ -2,22 +2,26 @@ class User extends ActiveRecord { - var $has_many = array('outbox_messages' => array('class_name' => 'Message', - 'order' => 'created_at desc', - 'foreign_key' => 'sender_id', - 'conditions' => 'is_sender_del = 0'), - 'inbox_messages' => array('class_name' => 'Message', - 'order' => 'created_at desc', - 'foreign_key' => 'recipient_id', - 'conditions' => 'is_recipient_del = 0'), - 'im_profiles' => array('class_name' => 'ImProfile', - 'foreign_key' => 'user_id'), - 'stored_files' => array('class_name' => 'StoredFile', - 'foreign_key' => 'user_id'), + var $has_many = array('outbox_messages' => array('class_name' => 'Message', + 'order' => 'created_at desc', + 'foreign_key' => 'sender_id', + 'conditions' => 'is_sender_del = 0'), + 'inbox_messages' => array('class_name' => 'Message', + 'order' => 'created_at desc', + 'foreign_key' => 'recipient_id', + 'conditions' => 'is_recipient_del = 0'), + 'im_profiles' => array('class_name' => 'ImProfile', + 'foreign_key' => 'user_id'), + 'stored_files' => array('class_name' => 'StoredFile', + 'foreign_key' => 'user_id'), + 'education_profiles' => array('class_name' => 'EducationProfile', + 'foreign_key' => 'user_id'), + 'work_profiles' => array('class_name' => 'WorkProfile', + 'foreign_key' => 'user_id'), ); var $has_and_belongs_to_many = array('groupapp_groups' => array('join_table' => 'groupapp_members')); - + var $has_one = array('BasicProfile', 'ContactProfile', 'RelationshipProfile', 'PersonalProfile'); function login($email, $password) { Added: app/models/work_profile.php =================================================================== --- app/models/work_profile.php (rev 0) +++ app/models/work_profile.php 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,8 @@ +<?php + +class WorkProfile extends ActiveRecord +{ + var $belongs_to = array('User','Network'); +} + +?> Modified: app/views/profile/_menu.tpl =================================================================== --- app/views/profile/_menu.tpl 2008-07-14 17:59:26 UTC (rev 285) +++ app/views/profile/_menu.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -6,7 +6,8 @@ ?><li><a href="/profile/contact" class="<?= $controller->getActionName() == 'contact' ? 'selected' : '' ?>">_{Contact}</a></li><? ?><li><a href="/profile/relationships" class="<?= $controller->getActionName() == 'relationships' ? 'selected' : '' ?>">_{Relationships}</a></li><? ?><li><a href="/profile/personal" class="<?= $controller->getActionName() == 'personal' ? 'selected' : '' ?>">_{Personal}</a></li><? - ?><li><a href="/profile/networks" class="<?= $controller->getActionName() == 'groups' ? 'selected' : '' ?>">_{Groups}</a></li><? + ?><li><a href="/profile/education" class="<?= $controller->getActionName() == 'education' ? 'selected' : '' ?>">_{Education}</a></li><? + ?><li><a href="/profile/work" class="<?= $controller->getActionName() == 'work' ? 'selected' : '' ?>">_{Work}</a></li><? ?><li><a href="/profile/picture" class="last <?= $controller->getActionName() == 'picture' ? 'selected' : '' ?>">_{Picture}</a></li> </ul> </div> Added: app/views/profile/education.tpl =================================================================== --- app/views/profile/education.tpl (rev 0) +++ app/views/profile/education.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,64 @@ +<?= $controller->renderPartial("menu") ?> + +<div class="editform"> + <form method="post"> + + <div class="formrow"> + <?= $controller->renderErrors() ?> + </div> + + <div class="formrow"> + <label class="required">_{Educational institution}:</label> + <div class="formcol"> + <input name="" class="mediumtextinput autocomplete"> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label>_{Concentration}:</label> + <div class="formcol"> + <input name="" class="textinput"> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label>_{Degree}:</label> + <div class="formcol"> + <input name="" class="textinput"> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label>_{Time period}:</label> + <div class="formcol"> + <div> + <input type="checkbox">_{I currently work here} + </div> + <select type=""><option>October</option></select> + <select type=""><option>1995</option></select> to present + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label> </label> + <div class="formcol"> + <a href="#">_{Add Another Institution}</a> + </div> + <div class="clearfix"></div> + </div> + + <div class="formrow"> + <label> </label> + <div class="formcol"> + <input class="submitinput" type="submit" value="_{Save}"> + <input class="cancelinput" type="button" value="_{Cancel}"> + </div> + <div class="clearfix"></div> + </div> + + </form> +</div> Deleted: app/views/profile/networks.tpl =================================================================== --- app/views/profile/networks.tpl 2008-07-14 17:59:26 UTC (rev 285) +++ app/views/profile/networks.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -1,5 +0,0 @@ -<?= $controller->renderPartial("menu") ?> - -<?= $controller->renderErrors() ?> - -<p class="indent">Coming soon</p> Added: app/views/profile/work.tpl =================================================================== --- app/views/profile/work.tpl (rev 0) +++ app/views/profile/work.tpl 2008-07-14 18:27:43 UTC (rev 286) @@ -0,0 +1,5 @@ +<?= $controller->renderPartial("menu") ?> + +<?= $controller->renderErrors() ?> + +<p class="indent">Coming soon</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |