[Isocial-svn] SF.net SVN: isocial: [281] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
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. |