added location tagging

This commit is contained in:
Mike Macgirvin 2010-08-20 14:33:15 -07:00
parent 82174bbfa8
commit 709c86b2da
10 changed files with 36 additions and 7 deletions

View File

@ -331,6 +331,7 @@ CREATE TABLE IF NOT EXISTS `user` (
`nickname` char(255) NOT NULL, `nickname` char(255) NOT NULL,
`email` char(255) NOT NULL, `email` char(255) NOT NULL,
`timezone` char(128) NOT NULL, `timezone` char(128) NOT NULL,
`default-location` char(255) NOT NULL,
`theme` char(255) NOT NULL, `theme` char(255) NOT NULL,
`pubkey` text NOT NULL, `pubkey` text NOT NULL,
`prvkey` text NOT NULL, `prvkey` text NOT NULL,

BIN
images/globe.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -120,7 +120,8 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) {
'$title' => xmlify($item['title']), '$title' => xmlify($item['title']),
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), '$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$content' =>xmlify($item['body']), '$location' => xmlify($item['location']),
'$content' => xmlify($item['body']),
'$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'])) ? 1 : 0) '$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'])) ? 1 : 0)
)); ));
} }
@ -174,6 +175,11 @@ function get_atom_elements($item) {
if($rawcreated) if($rawcreated)
$res['created'] = unxmlify($rawcreated[0]['data']); $res['created'] = unxmlify($rawcreated[0]['data']);
$rawlocation = $item->get_item_tags('http://activitystrea.ms/spec/1.0/', 'place');
if($rawlocation)
$res['location'] = unxmlify($rawlocation[0]['data']);
$rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'updated'); $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'updated');
if($rawedited) if($rawedited)
$res['edited'] = unxmlify($rawcreated[0]['data']); $res['edited'] = unxmlify($rawcreated[0]['data']);
@ -204,6 +210,7 @@ function post_remote($a,$arr) {
$arr['created'] = datetime_convert('UTC','UTC',$arr['created'],'Y-m-d H:i:s'); $arr['created'] = datetime_convert('UTC','UTC',$arr['created'],'Y-m-d H:i:s');
$arr['edited'] = datetime_convert('UTC','UTC',$arr['edited'],'Y-m-d H:i:s'); $arr['edited'] = datetime_convert('UTC','UTC',$arr['edited'],'Y-m-d H:i:s');
$arr['title'] = notags(trim($arr['title'])); $arr['title'] = notags(trim($arr['title']));
$arr['location'] = notags(trim($arr['location']));
$arr['body'] = escape_tags(trim($arr['body'])); $arr['body'] = escape_tags(trim($arr['body']));
$arr['last-child'] = intval($arr['last-child']); $arr['last-child'] = intval($arr['last-child']);
$arr['visible'] = 1; $arr['visible'] = 1;
@ -213,7 +220,7 @@ function post_remote($a,$arr) {
$parent_id = 0; $parent_id = 0;
dbesc_array($arr); dbesc_array($arr);
//dbg(3);
$r = q("INSERT INTO `item` (`" $r = q("INSERT INTO `item` (`"
. implode("`, `", array_keys($arr)) . implode("`, `", array_keys($arr))
. "`) VALUES ('" . "`) VALUES ('"

View File

@ -176,7 +176,7 @@
$item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', '$updated' => xmlify(datetime_convert('UTC', 'UTC',
$item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$content' =>xmlify($item['body']), '$content' => xmlify($item['body']),
'$parent_id' => xmlify($item['parent-uri']), '$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => 0 '$comment_allow' => 0
)); ));
@ -209,6 +209,7 @@
$item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$updated' => xmlify(datetime_convert('UTC', 'UTC', '$updated' => xmlify(datetime_convert('UTC', 'UTC',
$item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')),
'$location' => xmlify($item['location']),
'$content' =>xmlify($item['body']), '$content' =>xmlify($item['body']),
'$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'])) ? 1 : 0) '$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'])) ? 1 : 0)
)); ));

View File

@ -72,6 +72,7 @@ function item_post(&$a) {
$title = notags(trim($_POST['title'])); $title = notags(trim($_POST['title']));
$body = escape_tags(trim($_POST['body'])); $body = escape_tags(trim($_POST['body']));
$location = notags(trim($_POST['location']));
if(! strlen($body)) { if(! strlen($body)) {
notice( t('Empty post discarded.') . EOL ); notice( t('Empty post discarded.') . EOL );
@ -142,8 +143,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`uid`,`type`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, $r = q("INSERT INTO `item` (`uid`,`type`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `author-name`, `author-link`, `author-avatar`, `created`,
`edited`, `uri`, `title`, `body`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`) `edited`, `uri`, `title`, `body`, `location`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`)
VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )", VALUES( %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($profile_uid), intval($profile_uid),
dbesc($post_type), dbesc($post_type),
intval($contact_id), intval($contact_id),
@ -158,6 +159,7 @@ function item_post(&$a) {
dbesc($uri), dbesc($uri),
dbesc($title), dbesc($title),
dbesc($body), dbesc($body),
dbesc($location),
dbesc($str_contact_allow), dbesc($str_contact_allow),
dbesc($str_group_allow), dbesc($str_group_allow),
dbesc($str_contact_deny), dbesc($str_contact_deny),

View File

@ -2,7 +2,8 @@
<feed xmlns="http://www.w3.org/2005/Atom" <feed xmlns="http://www.w3.org/2005/Atom"
xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:thr="http://purl.org/syndication/thread/1.0"
xmlns:at="http://purl.org/atompub/tombstones/1.0" xmlns:at="http://purl.org/atompub/tombstones/1.0"
xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" > xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0"
xmlns:as="http://activitystrea.ms/spec/1.0/" >
<id>$feed_id</id> <id>$feed_id</id>
<title>$feed_title</title> <title>$feed_title</title>

View File

@ -15,5 +15,6 @@
<published>$published</published> <published>$published</published>
<updated>$updated</updated> <updated>$updated</updated>
<content>$content</content> <content>$content</content>
<as:place>$location</as:place>
<dfrn:comment-allow>$comment_allow</dfrn:comment-allow> <dfrn:comment-allow>$comment_allow</dfrn:comment-allow>
</entry> </entry>

View File

@ -80,6 +80,14 @@ tinyMCE.init({
} }
} }
function jotGetLocation() {
reply = prompt("Where are you right now?");
if(reply && reply.length) {
$('#jot-location').val(reply);
}
}
function linkdropper(event) { function linkdropper(event) {
var linkFound = event.dataTransfer.types.contains("text/uri-list"); var linkFound = event.dataTransfer.types.contains("text/uri-list");
if(linkFound) if(linkFound)

View File

@ -9,6 +9,7 @@
<input type="hidden" name="type" value="wall" /> <input type="hidden" name="type" value="wall" />
<input type="hidden" name="profile_uid" value="$profile_uid" /> <input type="hidden" name="profile_uid" value="$profile_uid" />
<input type="hidden" name="return" value="$return_path" /> <input type="hidden" name="return" value="$return_path" />
<input type="hidden" name="location" id="jot-location" value="" />
<textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" ></textarea> <textarea rows="5" cols="64" class="profile-jot-text" id="profile-jot-text" name="body" ></textarea>
@ -24,6 +25,9 @@
<div id="profile-youtube-wrapper" style="display: $visitor;" > <div id="profile-youtube-wrapper" style="display: $visitor;" >
<img id="profile-video" src="images/youtube_icon.gif" alt="Insert YouTube video" title="Insert YouTube video" onclick="jotGetVideo();" /> <img id="profile-video" src="images/youtube_icon.gif" alt="Insert YouTube video" title="Insert YouTube video" onclick="jotGetVideo();" />
</div> </div>
<div id="profile-location-wrapper" style="display: $visitor;" >
<img id="profile-location" src="images/globe.gif" alt="Set your location" title="Set your lcoation" onclick="jotGetLocation();" />
</div>
<div id="profile-rotator-wrapper" style="display: $visitor;" > <div id="profile-rotator-wrapper" style="display: $visitor;" >
<img id="profile-rotator" src="images/rotator.gif" alt="Please wait" title="Please wait" style="display: none;" /> <img id="profile-rotator" src="images/rotator.gif" alt="Please wait" title="Please wait" style="display: none;" />
</div> </div>

View File

@ -720,10 +720,14 @@ input#dfrn-url {
float: left; float: left;
margin-left: 20px; margin-left: 20px;
} }
#profile-location-wrapper {
float: left;
margin-left: 20px;
}
#profile-jot-perms { #profile-jot-perms {
float: left; float: left;
margin-left: 250px; margin-left: 200px;
} }
#profile-jot-perms-end { #profile-jot-perms-end {