diff --git a/documentation/schemas/Action.markdown b/documentation/schemas/Action.markdown index 4d2eaebb..d903956b 100644 --- a/documentation/schemas/Action.markdown +++ b/documentation/schemas/Action.markdown @@ -18,6 +18,7 @@ This includes comments and favorites and could include other social actions in t appId: (string), targetId: (string), // FK Photos.id or Social.id targetType: (string), // photo, social + email: (string), name: (string), avatar: (string), website: (string), @@ -37,6 +38,7 @@ This includes comments and favorites and could include other social actions in t * appId, A string identifing the application creating this entry * targetId, a foreign key to a [Photo][Photo] or [Action][Action] object this action was taken on * targetType, a reference to the target type: photo or social + * email, email address of the user taking this action * name, name of the user taking this action * avatar, URL to an image which represents this user's avatar or profile photo * website, URL to the user's website diff --git a/src/html/assets/css/styles.css b/src/html/assets/css/styles.css index 2506e64d..2e8db464 100644 --- a/src/html/assets/css/styles.css +++ b/src/html/assets/css/styles.css @@ -183,6 +183,54 @@ div#photo div.picture img { -moz-box-shadow: 2px 2px 2px #888; -webkit-box-shadow: 2px 2px 2px #888; } +div#photo div.picture div{ + color:#666; + margin:auto; +} +div#photo div.picture div.title{ + font-size:1.75em; + padding-top:10px; +} +div#photo div.picture div.description{ + font-size:1em; + padding-top:5px; +} +div#photo div.meta-content { + color:#888; + border-bottom: solid 1px #eee; +} +div#photo div.meta-content>div { + width:50%; + float:left; + margin:10px 0; +} +div#photo img.map { + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + -o-border-radius: 4px; +} +div#photo ol.comments, div#photo ul.exif{ + list-style:none; + padding:0; + font-size:.9em; + margin:0; +} +div#photo ol.comments li{ + margin:0 0 15px; + clear:both; +} +div#photo ol.comments li div.date{ + font-size:smaller; + font-style:italic; +} +div#photo ol.comments li img.avatar{ + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border:solid 2px #ccc; + float:left; + margin:0 4px 4px 0; +} + div.margin { width:960px; margin:auto; } /* // themeage */ diff --git a/src/html/assets/js/openphoto.js b/src/html/assets/js/openphoto.js index 34a94839..7a009c66 100644 --- a/src/html/assets/js/openphoto.js +++ b/src/html/assets/js/openphoto.js @@ -1,4 +1,8 @@ var op = (function(){ + var log = function(msg) { + if(console !== undefined && console.log !== undefined) + console.log(msg); + }; var _this = {}; return { handlers: { @@ -14,7 +18,7 @@ var op = (function(){ return false; }, login: function() { - console.log('login'); + log('login'); navigator.id.getVerifiedEmail(function(assertion) { if (assertion) { op.user.loginSuccess(assertion); @@ -38,9 +42,9 @@ var op = (function(){ photoLink: function(event) { var el = this; if(event.type == 'click') { - console.log(el); + log(el); } else if(event.type == 'mouseover') { - console.log('mousover'); + log('mousover'); } }, searchBarToggle: function(event) { @@ -85,9 +89,8 @@ var op = (function(){ $('.action-delete').live('click', op.handlers.actionDelete); $('.search-bar-toggle').click(op.handlers.searchBarToggle); $('form#form-tag-search').submit(op.handlers.searchByTags); - $('a#login').click(op.handlers.login); + $('.login').click(op.handlers.login); $('form textarea.comment').click(function(){ $(this).animate({height:'30px'}, 100); }); - $('form textarea.comment').blur(function(){ $(this).animate({height:'15px'}, 100); }); } }, message: { @@ -135,17 +138,17 @@ var op = (function(){ }, user: { loginFailure: function(assertion) { - console.log('login failed'); + log('login failed'); // TODO something here to handle failed login }, loginProcessed: function(response) { if(response.code != 200) { - console.log('processing of login failed'); + log('processing of login failed'); // TODO do something here to handle failed login return; } - console.log('login processing succeeded'); + log('login processing succeeded'); }, loginSuccess: function(assertion) { var params = {assertion: assertion}; diff --git a/src/libraries/controllers/ApiActionController.php b/src/libraries/controllers/ApiActionController.php index 0e13f7c1..7a288fee 100644 --- a/src/libraries/controllers/ApiActionController.php +++ b/src/libraries/controllers/ApiActionController.php @@ -33,6 +33,7 @@ class ApiActionController extends BaseController $params = $_POST; $params['targetId'] = $targetId; $params['targetType'] = $targetType; + $params['email'] = getSession()->get('email'); $id = Action::add($params); if($id) diff --git a/src/libraries/models/Action.php b/src/libraries/models/Action.php index 1f74ab7a..e2720645 100644 --- a/src/libraries/models/Action.php +++ b/src/libraries/models/Action.php @@ -58,6 +58,7 @@ class Action { return array( 'appId' => getConfig()->get('application')->appId, + 'email' => '', 'name' => '', 'avatar' => '', 'website' => '', diff --git a/src/libraries/models/User.php b/src/libraries/models/User.php index 59d441cf..bbfcdd64 100644 --- a/src/libraries/models/User.php +++ b/src/libraries/models/User.php @@ -17,6 +17,21 @@ class User */ private static $user; + /** + * Get an avatar given an email address + * See http://en.gravatar.com/site/implement/images/ and http://en.gravatar.com/site/implement/hash/ + * + * @return string + */ + public static function getAvatarFromEmail($size = 50, $email = null) + { + if($email === null) + $email = getSession()->get('email'); + + $hash = md5(strtolower(trim($email))); + return "http://www.gravatar.com/avatar/{$hash}?s={$size}"; + } + /** * Get the next ID to be used for a photo. * The ID is a base 32 string that represents an autoincrementing integer. diff --git a/src/libraries/models/Utility.php b/src/libraries/models/Utility.php index 545d1aa7..4ace991b 100644 --- a/src/libraries/models/Utility.php +++ b/src/libraries/models/Utility.php @@ -81,6 +81,12 @@ class Utility return $int > 1 ? "{$word}s" : $word; } + public static function staticMapUrl($latitude, $longitude, $zoom, $size, $type = 'roadmap') + { + //http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false + return "http://maps.googleapis.com/maps/api/staticmap?center={$latitude},{$longitude}&zoom={$zoom}&size={$size}&maptype={$type}&markers=color:grey%7Clabel:S%7C{$latitude},{$longitude}&sensor=false"; + } + public static function tagsAsLinks($tags) { $ret = array(); diff --git a/src/views/header.php b/src/views/header.php index 81379161..78f25a80 100644 --- a/src/views/header.php +++ b/src/views/header.php @@ -14,7 +14,7 @@ get('email'); ?> - + -
- - - -
-   -
-
- - - -
-   -
-
-

Tags

- - -
+
+

This photo belongs to you

+ +
+

Tags

+ + +
+
diff --git a/src/views/photos.php b/src/views/photos.php index 125167c0..3ac141f7 100644 --- a/src/views/photos.php +++ b/src/views/photos.php @@ -16,6 +16,7 @@ +
display('partial/pagination.php', array_merge($pagination, array('labelPosition' => 'bottom'))); ?>

You haven't uploaded any photos yet