librefm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Librefm-commits] [1409] Allow group ownership to be reassigned.


From: Toby Inkster
Subject: [Librefm-commits] [1409] Allow group ownership to be reassigned.
Date: Fri, 08 May 2009 11:04:18 +0000

Revision: 1409
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1409
Author:   tobyink
Date:     2009-05-08 11:04:18 +0000 (Fri, 08 May 2009)
Log Message:
-----------
Allow group ownership to be reassigned.

Modified Paths:
--------------
    trunk/nixtape/edit_group.php
    trunk/nixtape/themes/librefm/templates/edit_group.tpl

Modified: trunk/nixtape/edit_group.php
===================================================================
--- trunk/nixtape/edit_group.php        2009-05-08 10:54:31 UTC (rev 1408)
+++ trunk/nixtape/edit_group.php        2009-05-08 11:04:18 UTC (rev 1409)
@@ -101,6 +101,23 @@
 
        if (!isset($errors[0]))
        {
+               if ($_POST['owner'] != $group->owner->username)
+               {
+                       $new_owner = new User($_POST['owner']);
+                       
+                       if (! $group->memberCheck($new_owner))
+                       {
+                               $smarty->assign('error', 'Error!');
+                               $smarty->assign('details', 'Cannot assign group 
ownership to someone who is not a member!');
+                               $smarty->display('error.tpl');
+                               die();                          
+                       }
+                       else
+                       {
+                               $group->owner = $new_owner;
+                       }
+               }
+               
                $group->fullname    = $_POST['fullname'];
                $group->homepage    = $_POST['homepage'];
                $group->bio         = $_POST['bio'];
@@ -134,12 +151,15 @@
        }
        else
        {
-               $smarty->assign('fullname',     ($group->fullname));
-               $smarty->assign('bio',          ($group->bio));
-               $smarty->assign('homepage',     ($group->homepage));
-               $smarty->assign('avatar_uri',   ($group->avatar_uri));
+               $smarty->assign('fullname',     $group->fullname);
+               $smarty->assign('bio',          $group->bio);
+               $smarty->assign('homepage',     $group->homepage);
+               $smarty->assign('avatar_uri',   $group->avatar_uri);
        }
 
+       $smarty->assign('members', $group->getUsers());
+       $smarty->assign('owner',   $group->owner);
+
        # And display the page.
        $smarty->assign('errors', $errors);
        $smarty->assign('newform', false);

Modified: trunk/nixtape/themes/librefm/templates/edit_group.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/edit_group.tpl       2009-05-08 
10:54:31 UTC (rev 1408)
+++ trunk/nixtape/themes/librefm/templates/edit_group.tpl       2009-05-08 
11:04:18 UTC (rev 1409)
@@ -26,7 +26,7 @@
 
 <h2 property="dc:title">{t}Edit your group{/t}</h2>
 
-<p><strong>{t}The form below is still very experimental. Using this may wreck 
your account!{/t}</strong></p>
+<p><strong>{t}The form below is still very experimental. Using this may wreck 
your group!{/t}</strong></p>
 
 <form action="{$base_url}/edit_group.php" method="post" class="notcrazy">
        <table>
@@ -51,6 +51,21 @@
                        <td>&nbsp;</td>
                </tr>
                <tr>
+                       <th align="right" valign="top"><label 
for="owner">Leader:</label></th>
+                       <td>
+                               <select name="owner" id="owner">
+                               {foreach from=$members item=me}
+                               
+                                       <option {if 
$me->name==$owner->name}selected="selected"{/if} 
+                                               
value="{$me->name|escape:'html':'UTF-8'}" 
+                                               
>{$me->fullname|escape:'html':'UTF-8'} 
({$me->name|escape:'html':'UTF-8'})</option>
+                               {/foreach}
+                               
+                               </select>
+                       </td>
+                       <td><a href="#dfn_owner" rel="glossary">What's 
this?</a> <strong>Important!</strong></td>
+               </tr>
+               <tr>
                        <td colspan="3" align="center">
                                <input type="submit" value="Change" />
                                <input name="submit" value="1" type="hidden" />
@@ -65,6 +80,11 @@
        <dt id="dfn_avatar_uri">Logo URL</dt>
        <dd>{t}The web address for a picture to represent your group on 
libre.fm. It should
        not be more than 80x80 pixels. (64x64 is best.){/t}</dd>
+
+       <dt id="dfn_owner">Leader</dt>
+       <dd>{t}The group leader 'owns' the group and is able to make changes to 
the group.
+       A group can only have one leader, so if you make someone else the 
leader, you will
+       no longer be able to edit this group. You will not be able to undo this 
change!{/t}</dd>
 </dl>
 
 {/if}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]