[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1048] First stab at journal entries
From: |
Toby Inkster |
Subject: |
[Librefm-commits] [1048] First stab at journal entries |
Date: |
Thu, 30 Apr 2009 09:32:19 +0000 |
Revision: 1048
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1048
Author: tobyink
Date: 2009-04-30 09:32:18 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
First stab at journal entries
Modified Paths:
--------------
trunk/gnukebox/install.php
trunk/nixtape/data/User.php
trunk/nixtape/js/edit_profile.js
trunk/nixtape/themes/librefm/templates/user-edit.tpl
trunk/nixtape/user-edit.php
Added Paths:
-----------
trunk/nixtape/utils/tobyink_temp.php
Modified: trunk/gnukebox/install.php
===================================================================
--- trunk/gnukebox/install.php 2009-04-30 08:57:50 UTC (rev 1047)
+++ trunk/gnukebox/install.php 2009-04-30 09:32:18 UTC (rev 1048)
@@ -70,7 +70,9 @@
webid_uri VARCHAR(255),
avatar_uri VARCHAR(255),
active INTEGER DEFAULT 1,
- location_uri VARCHAR(255) REFERENCES Places(location_uri))");
+ location_uri VARCHAR(255) REFERENCES Places(location_uri),
+ laconica_profile VARCHAR(255),
+ journal_rss VARCHAR(255))");
$res = $mdb2->query("CREATE TABLE Groups (
groupname VARCHAR(64) PRIMARY KEY,
Modified: trunk/nixtape/data/User.php
===================================================================
--- trunk/nixtape/data/User.php 2009-04-30 08:57:50 UTC (rev 1047)
+++ trunk/nixtape/data/User.php 2009-04-30 09:32:18 UTC (rev 1048)
@@ -33,7 +33,7 @@
class User {
public $name, $email, $fullname, $bio, $location, $homepage, $error,
$userlevel;
- public $id, $acctid, $avatar_uri, $location_uri, $webid_uri;
+ public $id, $acctid, $avatar_uri, $location_uri, $webid_uri,
$laconica_profile, $journal_rss;
public $password;
/**
@@ -70,6 +70,8 @@
$this->id = $row["webid_uri"];
$this->webid_uri = $row["webid_uri"];
$this->avatar_uri = $row["avatar_uri"];
+ $this->laconica_profile = $row["laconica_profile"];
+ $this->journal_rss = $row["journal_rss"];
$this->acctid = $this->getURL() . '#acct';
if (! preg_match('/\:/', $this->id))
@@ -98,6 +100,8 @@
. "webid_uri=%s, "
. "location_uri=%s, "
. "avatar_uri=%s, "
+ . "laconica_profile=%s, "
+ . "journal_rss=%s, "
. "modified=%d "
. "WHERE username=%s"
, $mdb2->quote($this->email, 'text')
@@ -110,6 +114,8 @@
, $mdb2->quote($this->id, 'text')
, (empty($this->location_uri) ? 'NULL' :
$mdb2->quote($this->location_uri, 'text'))
, $mdb2->quote($this->avatar_uri, 'text')
+ , $mdb2->quote($this->laconica_profile, 'text')
+ , $mdb2->quote($this->journal_rss, 'text')
, time()
, $mdb2->quote($this->name, 'text'));
Modified: trunk/nixtape/js/edit_profile.js
===================================================================
--- trunk/nixtape/js/edit_profile.js 2009-04-30 08:57:50 UTC (rev 1047)
+++ trunk/nixtape/js/edit_profile.js 2009-04-30 09:32:18 UTC (rev 1048)
@@ -175,4 +175,19 @@
"status=1,resizable=1,scrollbars=1,width=600,height=500");
}
+function laconicaClick ()
+{
+ if ($('#laconica_profile')[0].value == 'http://identi.ca/example')
+ $('#laconica_profile')[0].value = '';
+}
+
+function laconicaUpdate ()
+{
+ if ($('#laconica_profile')[0].value.match(/^http:\/\/.+\/.+/))
+ {
+ $('#journal_rss')[0].value = $('#laconica_profile')[0].value +
'/rss';
+ }
+}
+
UpdateLocationLabel();
+$('#laconica_profile')[0].value = 'http://identi.ca/example';
Modified: trunk/nixtape/themes/librefm/templates/user-edit.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/user-edit.tpl 2009-04-30
08:57:50 UTC (rev 1047)
+++ trunk/nixtape/themes/librefm/templates/user-edit.tpl 2009-04-30
09:32:18 UTC (rev 1048)
@@ -49,6 +49,16 @@
<td><a href="#dfn_id" rel="glossary">What's
this?</a></td>
</tr>
<tr>
+ <th align="right" valign="top"><label
for="laconica_profile">Laconica/identi.ca Profile:</label></th>
+ <td><input onchange="laconicaChange();"
onclick="laconicaClick();" name="laconica_profile" id="laconica_profile"
value="{$laconica_profile|escape:'html':'UTF-8'}" /></td>
+ <td><a href="#dfn_laconica_profile"
rel="glossary">What's this?</a></td>
+ </tr>
+ <tr>
+ <th align="right" valign="top"><label
for="journal_rss">Avatar URL:</label></th>
+ <td><input name="journal_rss" id="journal_rss"
value="{$journal_rss|escape:'html':'UTF-8'}" /></td>
+ <td><a href="#dfn_journal_rss" rel="glossary">What's
this?</a></td>
+ </tr>
+ <tr>
<th align="right" valign="top"><label
for="password_1">Password:</label></th>
<td><input name="password_1" id="password_1"
type="password" value="" /></td>
<td rowspan="2">Leave this blank if you don't want to
change your password.</td>
@@ -66,7 +76,6 @@
</table>
</form>
-<script type="text/javascript"
src="{$base_url}/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="{$base_url}/js/edit_profile.js"></script>
<h3>Help</h3>
Modified: trunk/nixtape/user-edit.php
===================================================================
--- trunk/nixtape/user-edit.php 2009-04-30 08:57:50 UTC (rev 1047)
+++ trunk/nixtape/user-edit.php 2009-04-30 09:32:18 UTC (rev 1048)
@@ -69,6 +69,26 @@
$errors[] = "Avatar must be a URI. Valid URIs cannot
contain whitespace.";
}
+ if (!empty($_POST['laconica_profile']))
+ {
+ # Need better URI validation, but this will do for now. I think
+ # PEAR has a suitable module to help out here.
+ if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i',
$_POST['laconica_profile']) )
+ $errors[] = "Laconica profile must be a URI.";
+ if ( preg_match('/\s/', $_POST['laconica_profile']) )
+ $errors[] = "Laconica profile must be a URI. Valid URIs
cannot contain whitespace.";
+ }
+
+ if (!empty($_POST['journal_rss']))
+ {
+ # Need better URI validation, but this will do for now. I think
+ # PEAR has a suitable module to help out here.
+ if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i',
$_POST['journal_rss']) )
+ $errors[] = "Journal RSS must be a URI.";
+ if ( preg_match('/\s/', $_POST['journal_rss']) )
+ $errors[] = "Journal RSS must be a URI. Valid URIs
cannot contain whitespace.";
+ }
+
if (!empty($_POST['password_1']))
{
if ($_POST['password_1'] != $_POST['password_2'])
@@ -94,13 +114,15 @@
$user->location = $_POST['location'];
$user->location_uri = $_POST['location_uri'];
$user->avatar_uri = $_POST['avatar_uri'];
+ $user->laconica_profile = $_POST['laconica_profile'];
+ $user->journal_rss = $_POST['journal_rss'];
if (!empty( $_POST['password_1'] ))
$user->password = md5($_POST['password_1']);
$user->save();
- header("Location: " . $base_url . "/user/" . $user->name);
+ header("Location: " . $user->getURL());
exit;
}
@@ -134,6 +156,8 @@
$smarty->assign('location', $_POST['location']);
$smarty->assign('location_uri', $_POST['location_uri']);
$smarty->assign('avatar_uri', $_POST['avatar_uri']);
+ $smarty->assign('laconica_profile', $_POST['laconica_profile']);
+ $smarty->assign('journal_rss', $_POST['journal_rss']);
}
else
{
@@ -144,6 +168,8 @@
$smarty->assign('location', ($user->location));
$smarty->assign('location_uri', ($user->location_uri));
$smarty->assign('avatar_uri', ($user->avatar_uri));
+ $smarty->assign('laconica_profile', ($user->laconica_profile));
+ $smarty->assign('journal_rss', ($user->journal_rss));
}
# And display the page.
Added: trunk/nixtape/utils/tobyink_temp.php
===================================================================
--- trunk/nixtape/utils/tobyink_temp.php (rev 0)
+++ trunk/nixtape/utils/tobyink_temp.php 2009-04-30 09:32:18 UTC (rev
1048)
@@ -0,0 +1,8 @@
+<?php
+
+require_once '../database.php';
+
+$mdb2->query('ALTER TABLE Users ADD COLUMN laconica_profile VARCHAR(255);');
+
+$mdb2->query('ALTER TABLE Users ADD COLUMN journal_rss VARCHAR(255);');
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1048] First stab at journal entries,
Toby Inkster <=