librefm-commits
[Top][All Lists]
Advanced

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

[Librefm-commits] [1049] URI fixes


From: Toby Inkster
Subject: [Librefm-commits] [1049] URI fixes
Date: Thu, 30 Apr 2009 09:41:36 +0000

Revision: 1049
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1049
Author:   tobyink
Date:     2009-04-30 09:41:36 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
URI fixes

Modified Paths:
--------------
    trunk/nixtape/themes/librefm/templates/maxiprofile.tpl
    trunk/nixtape/themes/librefm/templates/user-edit.tpl

Added Paths:
-----------
    trunk/nixtape/js/user-edit.js

Removed Paths:
-------------
    trunk/nixtape/js/edit_profile.js

Deleted: trunk/nixtape/js/edit_profile.js
===================================================================
--- trunk/nixtape/js/edit_profile.js    2009-04-30 09:32:18 UTC (rev 1048)
+++ trunk/nixtape/js/edit_profile.js    2009-04-30 09:41:36 UTC (rev 1049)
@@ -1,193 +0,0 @@
-/* Libre.fm -- a free network service for sharing your music listening habits
-
-   Copyright (C) 2009 Libre.fm Project
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Affero General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-function unrecognised ( msg )
-{
-       $('#location_uri')[0].value = '';
-       $('#location_uri_label').removeClass('ok');
-       $('#location_uri_label').addClass('no');
-       $('#location_uri_label').text( msg );
-       return 0;
-}
-
-function UpdateLocationLabel ()
-{
-       if ($('#location_uri')[0].value)
-       {
-               $('#location_uri_label').text($('#location_uri')[0].value);
-       }
-}
-
-function LocationCheck ()
-{
-       if ( !$('#location').val() )
-       {
-               return unrecognised("You must enter a location.");
-       }
-
-       ajaxLoading(1);
-       
-       var ajaxSuccess = function (data, status)
-               {
-                       ajaxLoading(0);
-
-                       if (! data.geonames[0])
-                       {
-                               return unrecognised("This location was 
unrecognisable.");
-                       }
-
-                       var list;
-
-                       if ($('#chooser_list')[0])
-                       {
-                               $('#chooser_list').empty();
-                               $('#chooser_list').show();
-                               list = $('#chooser_list')[0];
-                       }
-                       else
-                       {
-                               list = document.createElement('UL');
-                               list.id = 'chooser_list';
-                               $('#chooser')[0].appendChild(list);
-                       }
-                       
-                       for (var g in data.geonames)
-                       {
-                               var G = data.geonames[g];
-                               
-                               var fullName = G.name;
-                               if (G.adminName3) fullName += ", " + 
G.adminName3;
-                               if (G.adminName2) fullName += ", " + 
G.adminName2;
-                               if (G.adminName1) fullName += ", " + 
G.adminName1;
-                               if (G.countryName) fullName += ", " + 
G.countryName;
-                               
-                               var coords = G.lat.toFixed(2) + ';' + 
G.lng.toFixed(2);
-                               
-                               var shortName = G.name;
-                               if (G.countryCode == 'US')
-                                       shortName += ", " + G.adminCode1 + ", 
USA";
-                               else
-                                       shortName += ", " + G.countryCode;
-
-                               var item = document.createElement('LI');
-                               var label1 = document.createElement('B');
-                               
label1.appendChild(document.createTextNode(fullName));
-                               item.appendChild(label1);
-                               item.appendChild(document.createTextNode(' '));
-                               var label2 = document.createElement('SMALL');
-                               
label2.appendChild(document.createTextNode('['+coords+']'));
-                               item.appendChild(label2);
-                               
-                               item.setAttribute('data-geoname', 
'http://sws.geonames.org/' + G.geonameId + '/');
-                               item.setAttribute('data-geoname-name', 
shortName);
-                               item.setAttribute('data-geoname-coords', 
coords);
-                               
-                               item.onclick = function (e) {
-                                       if (!e) var e = window.event;
-                                       var tg = (window.event) ? e.srcElement 
: e.target;
-                                       var geoname = 
$(tg).closest('li').attr('data-geoname');
-                                       $('#location_uri')[0].value = geoname;
-                                       $('#chooser_list').empty();
-                                       $('#chooser_list').hide();
-                                       UpdateLocationLabel();
-                                       $('#location_uri_label').addClass('ok');
-                                       
$('#location_uri_label').removeClass('no');
-                               }               
-                               $(item).hover(function ()
-                                       {
-                                               $(this).addClass('hover');
-                                       }, 
-                                       function ()
-                                       {
-                                               $(this).removeClass('hover');
-                                       }
-                                       );
-                               list.appendChild(item);
-                       }
-               };
-               
-       var ajaxError = function (XMLHttpRequest, textStatus, errorThrown)
-               {
-                       ajaxLoading(0);
-                       return unrecognised("Request error: " + textStatus);
-               };
-
-       $.ajax({
-                       'type' : 'GET' ,
-                       'url' : "/utils/location-ws.php" ,
-                       'data' : { 'q' : $('#location').val() },
-                       'dataType' : 'json' ,
-                       'timeout' : 30000 ,
-                       'success' : ajaxSuccess ,
-                       'error' : ajaxError 
-               });
-}
-
-function ajaxLoading (l)
-{
-       if (l==1)
-       {
-               if ($('#loading')[0])
-               {
-                       $('#loading').show();
-               }
-               else
-               {
-                       var loading = document.createElement('IMG');
-                       loading.id = 'loading';
-                       document.body.appendChild(loading);
-                       loading.src = '/i/loading.gif';
-                       loading.style.height = '32px';
-                       loading.style.width = '32px';
-                       loading.style.position = 'absolute';
-                       loading.style.top = '50%';
-                       loading.style.left = '50%';
-                       loading.style.marginTop = '-16px';
-                       loading.style.marginLeft = '-16px';
-               }
-       }
-       else
-       {
-               $('#loading').hide();
-       }
-}
-
-function webidLookup ()
-{
-       window.open("/utils/webid-finder-ws/form.php?javascript=id",
-               "webid-finder",
-               "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';

Copied: trunk/nixtape/js/user-edit.js (from rev 1048, 
trunk/nixtape/js/edit_profile.js)
===================================================================
--- trunk/nixtape/js/user-edit.js                               (rev 0)
+++ trunk/nixtape/js/user-edit.js       2009-04-30 09:41:36 UTC (rev 1049)
@@ -0,0 +1,193 @@
+/* Libre.fm -- a free network service for sharing your music listening habits
+
+   Copyright (C) 2009 Libre.fm Project
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Affero General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Affero General Public License for more details.
+
+   You should have received a copy of the GNU Affero General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+function unrecognised ( msg )
+{
+       $('#location_uri')[0].value = '';
+       $('#location_uri_label').removeClass('ok');
+       $('#location_uri_label').addClass('no');
+       $('#location_uri_label').text( msg );
+       return 0;
+}
+
+function UpdateLocationLabel ()
+{
+       if ($('#location_uri')[0].value)
+       {
+               $('#location_uri_label').text($('#location_uri')[0].value);
+       }
+}
+
+function LocationCheck ()
+{
+       if ( !$('#location').val() )
+       {
+               return unrecognised("You must enter a location.");
+       }
+
+       ajaxLoading(1);
+       
+       var ajaxSuccess = function (data, status)
+               {
+                       ajaxLoading(0);
+
+                       if (! data.geonames[0])
+                       {
+                               return unrecognised("This location was 
unrecognisable.");
+                       }
+
+                       var list;
+
+                       if ($('#chooser_list')[0])
+                       {
+                               $('#chooser_list').empty();
+                               $('#chooser_list').show();
+                               list = $('#chooser_list')[0];
+                       }
+                       else
+                       {
+                               list = document.createElement('UL');
+                               list.id = 'chooser_list';
+                               $('#chooser')[0].appendChild(list);
+                       }
+                       
+                       for (var g in data.geonames)
+                       {
+                               var G = data.geonames[g];
+                               
+                               var fullName = G.name;
+                               if (G.adminName3) fullName += ", " + 
G.adminName3;
+                               if (G.adminName2) fullName += ", " + 
G.adminName2;
+                               if (G.adminName1) fullName += ", " + 
G.adminName1;
+                               if (G.countryName) fullName += ", " + 
G.countryName;
+                               
+                               var coords = G.lat.toFixed(2) + ';' + 
G.lng.toFixed(2);
+                               
+                               var shortName = G.name;
+                               if (G.countryCode == 'US')
+                                       shortName += ", " + G.adminCode1 + ", 
USA";
+                               else
+                                       shortName += ", " + G.countryCode;
+
+                               var item = document.createElement('LI');
+                               var label1 = document.createElement('B');
+                               
label1.appendChild(document.createTextNode(fullName));
+                               item.appendChild(label1);
+                               item.appendChild(document.createTextNode(' '));
+                               var label2 = document.createElement('SMALL');
+                               
label2.appendChild(document.createTextNode('['+coords+']'));
+                               item.appendChild(label2);
+                               
+                               item.setAttribute('data-geoname', 
'http://sws.geonames.org/' + G.geonameId + '/');
+                               item.setAttribute('data-geoname-name', 
shortName);
+                               item.setAttribute('data-geoname-coords', 
coords);
+                               
+                               item.onclick = function (e) {
+                                       if (!e) var e = window.event;
+                                       var tg = (window.event) ? e.srcElement 
: e.target;
+                                       var geoname = 
$(tg).closest('li').attr('data-geoname');
+                                       $('#location_uri')[0].value = geoname;
+                                       $('#chooser_list').empty();
+                                       $('#chooser_list').hide();
+                                       UpdateLocationLabel();
+                                       $('#location_uri_label').addClass('ok');
+                                       
$('#location_uri_label').removeClass('no');
+                               }               
+                               $(item).hover(function ()
+                                       {
+                                               $(this).addClass('hover');
+                                       }, 
+                                       function ()
+                                       {
+                                               $(this).removeClass('hover');
+                                       }
+                                       );
+                               list.appendChild(item);
+                       }
+               };
+               
+       var ajaxError = function (XMLHttpRequest, textStatus, errorThrown)
+               {
+                       ajaxLoading(0);
+                       return unrecognised("Request error: " + textStatus);
+               };
+
+       $.ajax({
+                       'type' : 'GET' ,
+                       'url' : "/utils/location-ws.php" ,
+                       'data' : { 'q' : $('#location').val() },
+                       'dataType' : 'json' ,
+                       'timeout' : 30000 ,
+                       'success' : ajaxSuccess ,
+                       'error' : ajaxError 
+               });
+}
+
+function ajaxLoading (l)
+{
+       if (l==1)
+       {
+               if ($('#loading')[0])
+               {
+                       $('#loading').show();
+               }
+               else
+               {
+                       var loading = document.createElement('IMG');
+                       loading.id = 'loading';
+                       document.body.appendChild(loading);
+                       loading.src = '/i/loading.gif';
+                       loading.style.height = '32px';
+                       loading.style.width = '32px';
+                       loading.style.position = 'absolute';
+                       loading.style.top = '50%';
+                       loading.style.left = '50%';
+                       loading.style.marginTop = '-16px';
+                       loading.style.marginLeft = '-16px';
+               }
+       }
+       else
+       {
+               $('#loading').hide();
+       }
+}
+
+function webidLookup ()
+{
+       window.open("/utils/webid-finder-ws/form.php?javascript=id",
+               "webid-finder",
+               "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/maxiprofile.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/maxiprofile.tpl      2009-04-30 
09:32:18 UTC (rev 1048)
+++ trunk/nixtape/themes/librefm/templates/maxiprofile.tpl      2009-04-30 
09:41:36 UTC (rev 1049)
@@ -5,7 +5,7 @@
        </div>
 
        {if $isme}
-       <a class="edit" href="{$base_url}/edit_profile.php">[edit]</a>
+       <a class="edit" href="{$base_url}/user-edit.php">[edit]</a>
        {/if}
 
        <dl>

Modified: trunk/nixtape/themes/librefm/templates/user-edit.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/user-edit.tpl        2009-04-30 
09:32:18 UTC (rev 1048)
+++ trunk/nixtape/themes/librefm/templates/user-edit.tpl        2009-04-30 
09:41:36 UTC (rev 1049)
@@ -4,7 +4,7 @@
 
 <p><strong>The form below is still <em>very</em> experimental. Using this may 
wreck your account!</strong></p>
 
-<form action="{$base_url}/edit_profile.php" method="post" class="notcrazy">
+<form action="{$base_url}/user-edit.php" method="post" class="notcrazy">
        <table>
                <tr>
                        <th align="right" valign="top"><label 
for="fullname">Full name:</label></th>
@@ -54,7 +54,7 @@
                        <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>
+                       <th align="right" valign="top"><label 
for="journal_rss">RSS Feed:</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>
@@ -76,7 +76,7 @@
        </table>
 </form>
 
-<script type="text/javascript" src="{$base_url}/js/edit_profile.js"></script>
+<script type="text/javascript" src="{$base_url}/js/user-edit.js"></script>
 
 <h3>Help</h3>
 <dl>





reply via email to

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