[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1030] Group creation
From: |
Toby Inkster |
Subject: |
[Librefm-commits] [1030] Group creation |
Date: |
Wed, 29 Apr 2009 23:12:42 +0000 |
Revision: 1030
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1030
Author: tobyink
Date: 2009-04-29 23:12:42 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Group creation
Modified Paths:
--------------
trunk/nixtape/.htaccess
trunk/nixtape/data/Group.php
trunk/nixtape/edit_group.php
trunk/nixtape/themes/librefm/templates/edit_group.tpl
Modified: trunk/nixtape/.htaccess
===================================================================
--- trunk/nixtape/.htaccess 2009-04-29 22:53:11 UTC (rev 1029)
+++ trunk/nixtape/.htaccess 2009-04-29 23:12:42 UTC (rev 1030)
@@ -6,7 +6,8 @@
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/?$
track.php?artist=$1&album=$2&track=$3 [B,NC]
RewriteRule ^artist/([^/]+)/album/([^/]+)/?$
album.php?artist=$1&album=$2 [B,NC]
RewriteRule ^artist/([^/]+)/?$
artist.php?artist=$1 [B,NC]
+RewriteRule ^group/new$
edit_group.php?group=new [B,NC]
RewriteRule ^group/([^/]+)/?$
group.php?group=$1 [B,NC,QSA]
-RewriteRule ^group/?$ group.php
[B,NC,QSA]
+RewriteRule ^group/?$ group.php
[B,NC]
RewriteRule ^country/([^/]+)/?$
location.php?country=$1 [B,NC]
RewriteRule ^logout
login.php?action=logout [B,NC]
Modified: trunk/nixtape/data/Group.php
===================================================================
--- trunk/nixtape/data/Group.php 2009-04-29 22:53:11 UTC (rev 1029)
+++ trunk/nixtape/data/Group.php 2009-04-29 23:12:42 UTC (rev 1030)
@@ -83,6 +83,8 @@
{
global $mdb2;
+ // Should check to make sure no existing group with same name
(case-insensitive).
+
$q = sprintf("INSERT INTO Groups (groupname, owner, modified)
VALUES (%s, %s, %d)"
, $mdb2->quote($name, 'text')
, $mdb2->quote($owner->name, 'text')
Modified: trunk/nixtape/edit_group.php
===================================================================
--- trunk/nixtape/edit_group.php 2009-04-29 22:53:11 UTC (rev 1029)
+++ trunk/nixtape/edit_group.php 2009-04-29 23:12:42 UTC (rev 1030)
@@ -33,6 +33,23 @@
die();
}
+if ($_REQUEST['group']=='new')
+{
+ if ($_REQUEST['new'])
+ {
+ $owner = new User($_SESSION['user']->name);
+ Group::create($_REQUEST['new'], $owner);
+ header("Location:
{$base_url}/edit_group.php?group=".$_REQUEST['new']);
+ exit;
+ }
+ else
+ {
+ $smarty->assign('newform', true);
+ $smarty->display('edit_group.tpl');
+ exit();
+ }
+}
+
$group = new Group($_REQUEST['group']);
if ($group->owner->name != $_SESSION['user']->name)
@@ -110,6 +127,7 @@
# And display the page.
$smarty->assign('errors', $errors);
+ $smarty->assign('newform', false);
$smarty->display('edit_group.tpl');
}
Modified: trunk/nixtape/themes/librefm/templates/edit_group.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/edit_group.tpl 2009-04-29
22:53:11 UTC (rev 1029)
+++ trunk/nixtape/themes/librefm/templates/edit_group.tpl 2009-04-29
23:12:42 UTC (rev 1030)
@@ -1,5 +1,24 @@
{include file='header.tpl'}
+{if $newform}
+
+<h2 property="dc:title">Create a group</h2>
+
+<form action="{$base_url}/edit_group.php" method="post">
+
+<p style="display:center">
+<label for="new">Address for the group:</label>
+<b>{$base_url}</b><input id="new" name="new" /></p>
+
+<p>
+<input name="group" value="new" type="hidden" />
+<input type="submit" value=" Create " />
+</p>
+
+</form>
+
+{else}
+
<h2 property="dc:title">Edit your group</h2>
<p><strong>The form below is still <em>very</em> experimental. Using this may
wreck your account!</strong></p>
@@ -43,4 +62,7 @@
not be more than 80x80 pixels. (64x64 is best.)</dd>
</dl>
+{/if}
+
+
{include file='footer.tpl'}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1030] Group creation,
Toby Inkster <=