From 81b8ba32beb3151025d3b390c0621e074bceae36 Mon Sep 17 00:00:00 2001 From: Greg Froese Date: Mon, 19 Oct 2009 05:34:47 +0000 Subject: flickr integration changes --- actions/flickrImportPhotoset.php | 4 ++-- actions/flickrSetup.php | 10 +++++----- languages/en.php | 21 ++++++++++++++++++++- lib/flickr.php | 4 ++-- pages/flickr/importPhotosets.php | 8 ++++---- pages/flickr/setup.php | 4 ++-- start.php | 4 ++-- views/default/tidypics/forms/setupFlickr.php | 14 +++++++------- 8 files changed, 44 insertions(+), 25 deletions(-) diff --git a/actions/flickrImportPhotoset.php b/actions/flickrImportPhotoset.php index d28ea8564..ec0d65b5d 100644 --- a/actions/flickrImportPhotoset.php +++ b/actions/flickrImportPhotoset.php @@ -18,7 +18,7 @@ $user = get_loggedin_user(); $flickr_id = get_metadata_byname( $user->guid, "flickr_id" ); if( empty( $flickr_id )) { - register_error( "You must enter a username" ); + register_error( elgg_echo( 'flickr:errorusername2' )); forward( $return_url ); die; //just in case } @@ -33,7 +33,7 @@ foreach( $photos["photoset"]["photo"] as $photo ) { //check if we already have this image $meta = get_metadata_byname( $user->guid, $photo["id"] ); if( $meta->value == 1 ) { //we've downloaded this already - register_error( "This image has already been imported" ); + register_error( elgg_echo( 'flickr:errorimageimport' )); continue; } //store this so we don't download the same photo multiple times diff --git a/actions/flickrSetup.php b/actions/flickrSetup.php index 2a1f82315..fbc519b02 100644 --- a/actions/flickrSetup.php +++ b/actions/flickrSetup.php @@ -11,7 +11,7 @@ $return_url = get_input( "return_url" ); $user = get_loggedin_user(); if( empty( $flickr_username )) { - register_error( "You must enter a username" ); + register_error( elgg_echo( 'flickr:enterusername' )); forward( $return_url ); die; //just in case } else { @@ -24,11 +24,11 @@ if( empty( $flickr_username )) { $album = get_entity( $album_id ); } - system_message( "Successfully saved Flickr username of $flickr_username" ); - system_message( "flickr user id: $flickr_user[id]" ); - system_message( "Album saved - $album->title" ); + system_message( sprintf( elgg_echo( 'flickr:savedusername' ), $flickr_username )); + system_message( sprintf( elgg_echo( 'flickr:saveduserid' ), $flickr_user["id"] )); + system_message( sprintf( elgg_echo( 'flickr:savedalbum' ), $album->title )); } else { - register_error( "Username $flickr_username not found on Flickr" ); + register_error( sprintf( elgg_echo( 'flickr:errorusername' ), $flickr_username )); } } diff --git a/languages/en.php b/languages/en.php index 4fc9bcd64..3d669fee8 100644 --- a/languages/en.php +++ b/languages/en.php @@ -49,7 +49,16 @@ 'tidypics:viewsbyothers' => "(%s by you)", 'tidypics:administration' => 'Tidypics Administration', 'tidypics:stats' => 'Stats', - + 'flickr:setup' => 'Flickr Setup', + 'flickr:usernamesetup' => 'Please enter your Flickr username here:', + 'flickr:selectalbum' => 'Select album to import photos into', + 'flickr:albumdesc' => 'Album to import photos to:', + 'flickr:importmanager' => 'Photoset Import Manager', + 'flickr:desc' => 'Click on the set you wish to import into this site.
Copies of the photos will be made and stored on this site where they can be viewed and commented on.', + 'flickr:intro' => 'Flickr Integration allows you to import photos from your flickr account into this Elgg site. By entering your username and choosing an album to import into, you can begin the process.
When you have saved your username and album selection, click on the ' . elgg_echo( 'flickr:menuimport' ) . ' link to the left to select which Flickr set you would like to import photos from.', + 'flickr:menusetup' => 'Flickr Setup', + 'flickr:menuimport' => 'Import Flickr Photos', + //settings 'tidypics:settings' => 'Settings', 'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.', @@ -171,6 +180,11 @@ The photo can be viewed here: %s", 'tidypics:settings:save:ok' => 'Successfully saved the Tidypics plugin settings', 'tidypics:upgrade:success' => 'Upgrade of Tidypics a success', + + 'flickr:enterusername' => 'You must enter a username', + 'flickr:savedusername' => 'Successfully saved username of %s', + 'flickr:saveduserid' => 'Successfully saved userid of %s', + 'flickr:savedalbum' => 'Album saved - %s', //Error messages @@ -195,6 +209,11 @@ The photo can be viewed here: %s", 'album:blank' => "Please give this album a title and description.", 'tidypics:upgrade:failed' => "The upgrade of Tidypics failed", + + 'flickr:errorusername' => 'Username %s not found on Flickr', + 'flickr:errorusername2' => 'You must enter a username', + 'flickr:errorimageimport' => 'This image has already been imported', + 'flickr:errornoalbum' => "No album selected. Please choose and save an album: %s" ); add_translation("en",$english); diff --git a/lib/flickr.php b/lib/flickr.php index 48872c31f..effd186c4 100644 --- a/lib/flickr.php +++ b/lib/flickr.php @@ -1,8 +1,8 @@ \ No newline at end of file diff --git a/pages/flickr/importPhotosets.php b/pages/flickr/importPhotosets.php index fe241439e..a807a0782 100644 --- a/pages/flickr/importPhotosets.php +++ b/pages/flickr/importPhotosets.php @@ -6,8 +6,8 @@ // Load Elgg engine include_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php"; - $body = elgg_view_title( "Photoset Import Manager" ); - $body .= "

Click on the set you wish to import into this site. Copies of the photos will be made and stored on this site where they can be viewed and commented on.

"; + $body = elgg_view_title( elgg_echo( 'flickr:importmanager' )); + $body .= "

" . elgg_echo( 'flickr:desc' ) . "

"; $viewer = get_loggedin_user(); @@ -21,7 +21,7 @@ $album_id = get_metadata_byname( $viewer->guid, "flickr_album_id" ); if( intval( $album_id->value ) <= 0 ) { - register_error( "No album selected. Please choose and save an album: $album_id->value" ); + register_error( sprintf( elgg_echo( 'flickr:errornoalbum' ), $album_id->value )); forward( "/mod/tidypics/pages/flickr/setup.php" ); } @@ -45,6 +45,6 @@ // $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true ); flickr_menu(); - page_draw( "Photoset Import", elgg_view_layout("two_column_left_sidebar", '', $body)); + page_draw( elgg_echo( 'flickr:importmanager' ), elgg_view_layout("two_column_left_sidebar", '', $body)); ?> \ No newline at end of file diff --git a/pages/flickr/setup.php b/pages/flickr/setup.php index a2aa20db6..1de8c29c2 100644 --- a/pages/flickr/setup.php +++ b/pages/flickr/setup.php @@ -10,8 +10,8 @@ $viewer = get_loggedin_user(); - $body = elgg_view_title( "Setup Flickr" ); + $body = elgg_view_title( elgg_echo( 'flickr:setup') ); $body .= elgg_view("tidypics/forms/setupFlickr", array(), false, true ); // echo "
"; var_dump($body); echo "
"; - page_draw( "Setup Flickr", elgg_view_layout("two_column_left_sidebar", '', $body)); + page_draw( elgg_echo( 'flickr:setup'), elgg_view_layout("two_column_left_sidebar", '', $body)); ?> \ No newline at end of file diff --git a/start.php b/start.php index 9648915bd..466c14be8 100644 --- a/start.php +++ b/start.php @@ -187,7 +187,7 @@ 'tidypics-z'); if( get_loggedin_userid() == 9 ) { add_submenu_item( 'Flickr Integration', - $CONFIG->wwwroot . 'mod/tidypics/pages/setupFlickr.php', + $CONFIG->wwwroot . 'mod/tidypics/pages/flickr/setup.php', 'tidypics-z'); } @@ -323,7 +323,7 @@ case "flickr": if (isset($page[1])) set_input('username',$page[1]); - include($CONFIG->pluginspath . "tidypics/pages/lists/flickr.php"); + include($CONFIG->pluginspath . "tidypics/pages/flickr/setup.php"); break; } } diff --git a/views/default/tidypics/forms/setupFlickr.php b/views/default/tidypics/forms/setupFlickr.php index 8ae7c27bb..8c31d0883 100644 --- a/views/default/tidypics/forms/setupFlickr.php +++ b/views/default/tidypics/forms/setupFlickr.php @@ -7,29 +7,29 @@ $flickr_album_id = get_metadata_byname( $user->guid, "flickr_album_id" ); $action = $vars['url'] . 'action/tidypics/flickrSetup'; -$form_body = "

"; -$form_body .= "Please enter your Flickr username here:
"; +$form_body = "

". elgg_echo( 'flickr:intro' ) . "

"; +$form_body .= elgg_echo( 'flickr:usernamesetup') . "
"; $form_body .= ""; $albums = get_entities( "object", "album", $user->guid ); -$options = array( 0 => "Select album" ); +$options = array( 0 => elgg_echo( 'flickr:selectalbum' )); foreach( $albums as $album ) { $title = $album->title; switch( $album->access_id ) { case ACCESS_PRIVATE: - $title .= " (private)"; + $title .= " (" . elgg_echo( 'private' ) . ")"; break; case ACCESS_PUBLIC: - $title .= " (public)"; + $title .= " (" . elgg_echo( 'public' ) . ")"; break; default: - $title .= " (not sure)"; + $title .= " (no known permission set)"; break; } $options[$album->guid] = $title; } -$form_body .= "
Album to import photos to: "; +$form_body .= "
" . elgg_echo( 'flickr:albumdesc' ); $form_body .= elgg_view('input/pulldown', array('internalname' => 'album_id', 'options_values' => $options, 'value' => $flickr_album_id->value )); -- cgit v1.2.3