Complete shares implementation

This commit is contained in:
Eike Foken
2011-09-09 00:27:56 +02:00
parent 4832e8eab0
commit a017aaff06
5 changed files with 60 additions and 26 deletions

View File

@@ -6,7 +6,7 @@
<h2>
<?=anchor('projects', _('Projects'));?> &raquo; <?=$project['name'];?>
<a class="share" href="<?=site_url('projects/share/' . $project['id']);?>"><?=_(sprintf('Shared with %s people', count($shares)));?></a>
<a class="share" href="<?=site_url('projects/shares/' . $project['id']);?>"><?=_(sprintf('Shared with %s people', count($shares)));?></a>
</h2>
</div>

View File

@@ -7,34 +7,38 @@
</div>
<div class="box">
<table class="tableList">
<thead>
<tr>
<th scope="col"><?=_('User');?></th>
<th scope="col"><?=_('Rights');?></th>
<th scope="col"><?=_('Actions');?></th>
</tr>
</thead>
<tbody>
<form method="post" name="updateShares" action="?action=update">
<table class="tableList">
<thead>
<tr>
<th scope="col"><?=_('User');?></th>
<th scope="col"><?=_('Rights');?></th>
<th scope="col"><?=_('Actions');?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($shares as $share):
?>
<tr>
<td><a href="<?=site_url('users/profile/' . $share['user_id']);?>"><?=$share['firstname'];?> <?=$share['lastname'];?></a></td>
<td><?=form_dropdown('rights', array('Can edit', 'Can view'), $share['can_edit'], 'class="drop"')?></td>
<td><a href="?action=delete&user_id=<?=$share['user_id'];?>"><?=_('Delete');?></a></td>
</tr>
<tr>
<td><a href="<?=site_url('users/profile/' . $share['username']);?>"><?=$share['firstname'];?> <?=$share['lastname'];?></a></td>
<td><?=form_dropdown('rights[' . $share['user_id'] . ']', array('Can view', 'Can edit'), $share['can_edit'], 'class="drop"')?></td>
<td><a href="?action=delete&user_id=<?=$share['user_id'];?>"><?=_('Delete');?></a></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</tbody>
</table>
</form>
<form method="post" name="addShare" action="<?=site_url('projects/share/' . $project['id']);?>">
<p><a class="button save" href="javascript:void(0);" onclick="$('form[name=updateShares]').submit();"><?=_('Save and back');?></a></p>
<h3><?=_('Share with someone');?></h3>
<form method="post" name="addShare" action="?action=add">
<ul>
<li>
<div>
<?=form_label(_('Add person:'), 'user_id');?>
<select name="user_id" id="user_id" class="drop">
<?php
foreach ($this->user->getAll() as $user):
@@ -44,13 +48,12 @@
endforeach;
?>
</select>
<?=form_submit('', _('Share'), 'class="submit"');?>
<?=form_dropdown('rights', array('Can view', 'Can edit'), $share['can_edit'], 'class="drop"')?>
<?=form_submit('add', _('Share'), 'class="submit"');?>
</div>
</li>
</ul>
</form>
<p><a class="button save" href="javascript:history.back();"><?=_('Save and back');?></a></p>
</div>
</div>