Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug fixes and Uploader UI Change

  • Loading branch information...
commit 25f281ffb6efa1cbf0638b8fd32b89a64a6dd201 1 parent 30bb3a6
Joshua Abenazer authored
View
12 app/assets/css/main.css
@@ -26,14 +26,16 @@ ul.bp-media-gallery li span img{height: 150px;}
#bp-media-activity-upload-ui { width: 50%;}
.bp-media-area-allocate{height: 10px;width: 100%;display: block;}
li #bp-media-upload-ui {padding: 0;max-width: 158px;position: relative;}
-#bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;text-align: center;background: url('../img/drag-drop-bg.png') repeat scroll 0 0 transparent;overflow: hidden;padding: 15px 0;}
+#bp-media-upload-ui {margin-top: 10px;}
+#bp-media-upload-ui #drag-drop-area{border: 4px dashed #DDD;text-align: center;background: #fafafa;overflow: hidden;padding: 15px 0;}
li #bp-media-upload-ui #drag-drop-area{max-width: 150px;min-height: auto;}
/*.albums li #bp-media-upload-ui #drag-drop-area{padding: 20px 0 10px;}*/
#bp-media-upload-ui .drag-drop-inside{float: left;width: 48%;}
.albums #bp-media-upload-ui .drag-drop-inside{float: none;width: auto;}
li #bp-media-upload-ui .drag-drop-inside,li #bp-media-upload-ui #bp-media-album-prompt{float: none;max-width: 100%;width: auto;}
li #bp-media-upload-ui #bp-media-album-prompt{margin: 8px auto 0;max-width: 144px;}
-#bp-media-upload-ui #bp-media-album-prompt{float: right;margin: 12px auto 0;width: 47%;}
+#bp-media-upload-ui #bp-media-album-prompt{float: left;width: 47%;}
+#bp-media-upload-ui .drag-drop-info{font-size:16px;}
#bp-media-upload-ui .drag-drop-inside p.drag-drop-info{font-size: 20px;line-height: 100%;}
#bp-media-upload-ui .drag-drop-buttons input,#bp-media-album-prompt input.button{-moz-box-sizing: content-box;border-color: #BBBBBB;border-radius: 15px;border-style: solid;border-width: 1px;color: #464646;cursor: pointer;font-size: 13px !important;line-height: 13px;padding: 5px 10px;text-decoration: none;}
li #bp-media-album-prompt input.button{font-size: 12px !important;padding: 3px 8px;text-decoration: none;margin-top: 5px;}
@@ -42,14 +44,14 @@ li #bp-media-album-prompt > p,li #bp-media-upload-ui #drag-drop-area p{display:
.albums li #bp-media-album-prompt > p,.albums li #bp-media-upload-ui #drag-drop-area p{display: block;}
li #bp-media-upload-ui #drag-drop-area p.drag-drop-buttons{display: block;}
#bp-media-album-prompt div.hide{display: none;margin: 0;}
-#bp-media-album-prompt > p{font-size: 20px;}
+#bp-media-album-prompt > span{font-size: 16px;}
+.bp-media-album-content { display: inline }
/*#bp-media-upload-ui .drag-drop-inside p,#bp-media-album-prompt #bp_media_album_new{font-size: 14px;margin: 0;}*/
#bp-media-album-prompt #bp_media_album_new{max-width: 90%;}
li #bp-media-album-prompt #bp_media_album_new{margin: 0;max-width: 134px;width: 94%;}
#bp-media-upload-ui .drag-drop-to{width: 22px;line-height: 22px;margin: 40px auto 0;float: left;}
li #bp-media-upload-ui .drag-drop-to{width: 100%;line-height: 22px;margin: 0;float: none;}
-#bp-media-album-in, .albums #bp-media-album-or{background-color: #333333;border-radius: 11px 11px 11px 11px;color: #FFFFFF;display: block;float: left;font-size: 14px;line-height: 22px;margin: 30px auto;width: 22px;}
-.albums #bp-media-album-or{float: none;margin: 20px auto;font-size: 14px;}
+#bp-media-album-in {background-color: #333333;border-radius: 11px 11px 11px 11px;color: #FFFFFF;display: block;float: left;font-size: 14px;line-height: 22px;width: 22px;}
.upload #bp-media-album-or{font-size: 14px;}
li #bp-media-album-in, .albums li #bp-media-album-or{float: none;margin: 20px auto;}
#bp-media-album-prompt #create-new{background-color: #DF562C;color: #fff;}
View
0  app/assets/img/private.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 app/assets/js/main.js
@@ -15,7 +15,11 @@ function bp_media_create_element(id){
}
var $current;
jQuery(document).ready(function(){
-
+
+ jQuery('#item-body').on('click','#bp-media-upload-button', function(){
+ jQuery(this).next().slideToggle();
+ });
+
var bp_media_recent_tabs = jQuery('.media-tabs-container-tabs');
if(bp_media_recent_tabs.length>0){
jQuery(bp_media_recent_tabs).tabs();
View
4 app/helper/BPMediaSettings.php
@@ -39,12 +39,12 @@ public function settings() {
add_settings_field('bpm-video', __('Video', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
'setting' => 'bp_media_options',
'option' => 'videos_enabled',
- 'desc' => __('Enable Video', BP_MEDIA_TXT_DOMAIN)
+ 'desc' => __('Enable Video (mp4)', BP_MEDIA_TXT_DOMAIN)
));
add_settings_field('bpm-audio', __('Audio', BP_MEDIA_TXT_DOMAIN), array($this, 'checkbox'), 'bp-media-settings', 'bpm-settings', array(
'setting' => 'bp_media_options',
'option' => 'audio_enabled',
- 'desc' => __('Enable Audio', BP_MEDIA_TXT_DOMAIN)
+ 'desc' => __('Enable Audio (mp3)', BP_MEDIA_TXT_DOMAIN)
));
if (bp_is_active('activity')) {
add_settings_section('bpm-activity-upload', __('Activity Upload', BP_MEDIA_TXT_DOMAIN), '', 'bp-media-settings');
View
132 app/main/includes/BPMediaActions.php
@@ -460,55 +460,55 @@ function footer() {
}
function upload_enqueue() {
- if( is_user_logged_in()){
- if (bp_is_activity_component() || bp_is_group_home()) {
- $params = array(
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
- 'browse_button' => 'bp-media-activity-upload-browse-button',
- 'container' => 'bp-media-activity-upload-ui',
- 'drop_element' => 'drag-drop-area',
- 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
- 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
- 'multipart' => true,
- 'urlstream_upload' => true,
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
- 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
- 'multi_selection' => true,
- 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
- );
- wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
- wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
- wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
- if (bp_get_current_group_id())
- $default_album = $this->default_group_album();
- else
- $default_album = $this->default_user_album();
- wp_localize_script('bp-media-activity-uploader', 'default_album', $default_album ? $default_album : 0);
- } elseif (in_array(bp_current_action(), array(BP_MEDIA_IMAGES_SLUG, BP_MEDIA_VIDEOS_SLUG, BP_MEDIA_AUDIO_SLUG, BP_MEDIA_SLUG, BP_MEDIA_ALBUMS_SLUG))) {
- $params = array(
- 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
- 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
- 'browse_button' => 'bp-media-upload-browse-button',
- 'container' => 'bp-media-upload-ui',
- 'drop_element' => 'drag-drop-area',
- 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
- 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
- 'multipart' => true,
- 'urlstream_upload' => true,
- 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
- 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
- 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
- 'multi_selection' => true,
- 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
- );
- wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
- wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
+ if (is_user_logged_in()) {
+ if (bp_is_activity_component() || bp_is_group_home()) {
+ $params = array(
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
+ 'browse_button' => 'bp-media-activity-upload-browse-button',
+ 'container' => 'bp-media-activity-upload-ui',
+ 'drop_element' => 'drag-drop-area',
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
+ 'multipart' => true,
+ 'urlstream_upload' => true,
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
+ 'multi_selection' => true,
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
+ );
+ wp_enqueue_script('bp-media-activity-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-activity-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
+ wp_localize_script('bp-media-activity-uploader', 'bp_media_uploader_params', $params);
+ wp_localize_script('bp-media-activity-uploader', 'activity_ajax_url', admin_url('admin-ajax.php'));
+ if (bp_is_active('groups') && bp_get_current_group_id())
+ $default_album = $this->default_group_album();
+ else
+ $default_album = $this->default_user_album();
+ wp_localize_script('bp-media-activity-uploader', 'default_album', $default_album ? $default_album : 0);
+ } elseif (in_array(bp_current_action(), array(BP_MEDIA_IMAGES_SLUG, BP_MEDIA_VIDEOS_SLUG, BP_MEDIA_AUDIO_SLUG, BP_MEDIA_SLUG, BP_MEDIA_ALBUMS_SLUG))) {
+ $params = array(
+ 'url' => BP_MEDIA_URL . 'app/main/includes/bp-media-upload-handler.php',
+ 'runtimes' => 'gears,html5,flash,silverlight,browserplus',
+ 'browse_button' => 'bp-media-upload-browse-button',
+ 'container' => 'bp-media-upload-ui',
+ 'drop_element' => 'drag-drop-area',
+ 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => "mp4,jpg,png,jpeg,gif,mp3"))),
+ 'max_file_size' => min(array(ini_get('upload_max_filesize'), ini_get('post_max_size'))),
+ 'multipart' => true,
+ 'urlstream_upload' => true,
+ 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
+ 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
+ 'file_data_name' => 'bp_media_file', // key passed to $_FILE.
+ 'multi_selection' => true,
+ 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload'))
+ );
+ wp_enqueue_script('bp-media-uploader', BP_MEDIA_URL . 'app/assets/js/bp-media-uploader.js', array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4', 'plupload-handlers'), BP_MEDIA_VERSION);
+ wp_localize_script('bp-media-uploader', 'bp_media_uploader_params', $params);
+ }
}
- }
wp_enqueue_style('bp-media-default', BP_MEDIA_URL . 'app/assets/css/main.css', '', BP_MEDIA_VERSION);
- wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/admin.css', '', BP_MEDIA_VERSION);
+ wp_enqueue_style('bp-media-admin', BP_MEDIA_URL . 'app/assets/css/admin.css', '', BP_MEDIA_VERSION);
}
//This is used only on the uploads page so its added as action in the screens function of upload page.
@@ -894,24 +894,26 @@ public function default_user_album() {
public function default_group_album() {
$album_id = 0;
- if ($group_id = bp_get_current_group_id()) {
- $album_id = groups_get_groupmeta($group_id, 'bp_media_default_album');
- if (!$album_id) {
- $args = array(
- 'post_type' => 'bp_media_album',
- 'posts_per_page' => 1,
- 'meta_key' => 'bp-media-key',
- 'meta_value' => -$group_id,
- 'meta_compare' => '=',
- 'order' => 'ASC'
- );
- $query = new WP_Query($args);
- wp_reset_postdata();
- if (isset($query->posts) && isset($query->posts[0])) {
- $album_id = $query->posts[0]->ID;
- }
- if ($album_id) {
- groups_update_groupmeta($group_id, 'bp_media_default_album', $album_id);
+ if (bp_is_active('groups')) {
+ if ($group_id = bp_get_current_group_id()) {
+ $album_id = groups_get_groupmeta($group_id, 'bp_media_default_album');
+ if (!$album_id) {
+ $args = array(
+ 'post_type' => 'bp_media_album',
+ 'posts_per_page' => 1,
+ 'meta_key' => 'bp-media-key',
+ 'meta_value' => -$group_id,
+ 'meta_compare' => '=',
+ 'order' => 'ASC'
+ );
+ $query = new WP_Query($args);
+ wp_reset_postdata();
+ if (isset($query->posts) && isset($query->posts[0])) {
+ $album_id = $query->posts[0]->ID;
+ }
+ if ($album_id) {
+ groups_update_groupmeta($group_id, 'bp_media_default_album', $album_id);
+ }
}
}
}
View
448 app/main/profile/BPMediaAlbumScreen.php
@@ -12,230 +12,230 @@
*/
class BPMediaAlbumScreen extends BPMediaScreen {
- var $filters;
-
- /**
- *
- * @param type $media_type
- * @param type $slug
- */
- public function __construct( $media_type, $slug ) {
- parent::__construct( $media_type, $slug );
- }
-
- /**
- *
- * @global type $bp
- */
- function screen() {
- global $bp;
- if ( isset( $bp->action_variables[ 0 ] ) ) {
- switch ( $bp->action_variables[ 0 ] ) {
- case BP_MEDIA_ALBUMS_EDIT_SLUG :
- $this->edit_screen();
- break;
- case BP_MEDIA_ALBUMS_VIEW_SLUG:
- $this->entry_screen();
- $this->template_actions( 'entry_screen' );
- break;
- case BP_MEDIA_DELETE_SLUG :
- if ( ! isset( $bp->action_variables[ 1 ] ) ) {
- $this->page_not_exist();
- }
- $this->entry_delete();
- break;
- default:
- $this->set_query();
- $this->template_actions( 'screen' );
- }
- } else {
- $this->set_query();
- $this->template_actions( 'screen' );
- }
- $this->template->loader();
- }
-
- /**
- *
- * @global type $bp_media_albums_query
- */
-
- /**
- *
- * @global type $bp_media_albums_query
- */
- function screen_content() {
- global $bp_media_albums_query;
-
- $this->hook_before();
-
- if ( $bp_media_albums_query && $bp_media_albums_query->have_posts() ):
- echo '<ul id="bp-album-list" class="bp-media-gallery item-list">';
- while ( $bp_media_albums_query->have_posts() ) : $bp_media_albums_query->the_post();
- $this->template->the_album_content();
- endwhile;
- echo '</ul>';
- $this->template->show_more( 'albums' );
- else:
- BPMediaFunction::show_formatted_error_message( sprintf( __( 'Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN ), $this->slug ), 'info' );
- endif;
- $this->hook_after();
- }
-
- /**
- *
- * @global type $bp
- * @global BPMediaAlbum $bp_media_current_album
- * @return boolean
- */
- function entry_screen() {
- global $bp, $bp_media_current_album;
- if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_VIEW_SLUG )
- return false;
- try {
- $bp_media_current_album = new BPMediaAlbum( $bp->action_variables[ 1 ] );
- } catch ( Exception $e ) {
- /* Send the values to the cookie for page reload display */
- @setcookie( 'bp-message', $_COOKIE[ 'bp-message' ], time() + 60 * 60 * 24, COOKIEPATH );
- @setcookie( 'bp-message-type', $_COOKIE[ 'bp-message-type' ], time() + 60 * 60 * 24, COOKIEPATH );
- $this->template->redirect( $this->media_const );
- exit;
- }
- }
-
- /**
- *
- * @global type $bp
- * @global BPMediaAlbum $bp_media_current_album
- * @global type $bp_media_query
- * @return boolean
- */
- function entry_screen_content() {
- global $bp, $bp_media_current_album, $bp_media_query;
- if ( ! $bp->action_variables[ 0 ] == BP_MEDIA_ALBUMS_VIEW_SLUG )
- return false;
- $allowed_edit = false;
- if ( is_user_logged_in() ) {
- if(!bp_is_user()){
- if ( bp_is_active( 'groups' ) ) {
- if ( groups_is_user_admin( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {
- $allowed_edit = true;
- } elseif ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
- $allowed_edit = true;
- }
- }
- } else {
- if ( bp_displayed_user_id() == bp_loggedin_user_id() ) {
- $allowed_edit = true;
- }
- }
-
- if ( $allowed_edit != false ) {
- echo '<div class="album-edit">';
- echo '<a href="' . $bp_media_current_album->get_edit_url() . '" class="button item-button bp-secondary-action bp-media-edit bp-media-edit-album" title="' . __( 'Edit Album', BP_MEDIA_TXT_DOMAIN ) . '">' . __( 'Edit', BP_MEDIA_TXT_DOMAIN ) . '</a>';
- echo '<a href="' . $bp_media_current_album->get_delete_url() . '" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">' . __( "Delete", BP_MEDIA_TXT_DOMAIN ) . '</a>';
- echo '</div>';
- }
- }
- $this->inner_query( $bp_media_current_album->get_id() );
- $this->hook_before();
- if ( $bp_media_current_album && $bp_media_query->have_posts() ):
- echo '<ul id="bp-media-list" class="bp-media-gallery albums item-list">';
- if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
- echo '<li>';
- BPMediaUploadScreen::upload_screen_content();
- echo '</li>';
- }
- while ( $bp_media_query->have_posts() ) : $bp_media_query->the_post();
- $this->template->the_content();
- endwhile;
- echo '</ul>';
- $this->template->show_more();
- else:
- BPMediaFunction::show_formatted_error_message( __( 'Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN ), 'info' );
- if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
- echo '<div class="bp-media-area-allocate"></div>';
- BPMediaUploadScreen::upload_screen_content();
- }
- endif;
- $this->hook_after();
- }
-
- function entry_screen_title() {
-
- global $bp_media_current_album;
- /** @var $bp_media_current_entry BPMediaHostWordpress */
- if ( is_object( $bp_media_current_album ) )
- echo $bp_media_current_album->get_title();
- }
-
- /**
- *
- * @global type $bp
- * @global type $bp_media_albums_query
- */
- function set_query() {
- global $bp, $bp_media_albums_query;
- if ( isset( $bp->action_variables ) && is_array( $bp->action_variables ) && isset( $bp->action_variables[ 0 ] ) && $bp->action_variables[ 0 ] == 'page' && isset( $bp->action_variables[ 1 ] ) && is_numeric( $bp->action_variables[ 1 ] ) ) {
- $paged = $bp->action_variables[ 1 ];
- } else {
- $paged = 1;
- }
- if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
- $query = new BPMediaQuery();
- $args = $query->init( 'album' );
- $bp_media_albums_query = new WP_Query( $args );
- }
- }
-
- /**
- *
- * @global type $bp
- * @global type $bp_media_query
- * @param type $album_id
- */
- function inner_query( $album_id = 0 ) {
- global $bp, $bp_media_query;
- $paged = 0;
- $action_variables = isset( $bp->canonical_stack[ 'action_variables' ] ) ? $bp->canonical_stack[ 'action_variables' ] : null;
- if ( isset( $action_variables ) && is_array( $action_variables ) && isset( $action_variables[ 0 ] ) ) {
- if ( $action_variables[ 0 ] == 'page' && isset( $action_variables[ 1 ] ) && is_numeric( $action_variables[ 1 ] ) )
- $paged = $action_variables[ 1 ];
- else if ( isset( $action_variables[ 1 ] ) && $action_variables[ 1 ] == 'page' && isset( $action_variables[ 2 ] ) && is_numeric( $action_variables[ 2 ] ) )
- $paged = $action_variables[ 2 ];
- }
- if ( ! $paged )
- $paged = 1;
- $this->filter_entries();
- if ( $bp->current_component == 'groups' ) {
- $query = new BPMediaQuery();
- $args = $query->init( false, $album_id, false, $paged );
- $bp_media_query = new WP_Query( $args );
- }
- if ( $bp->current_action == BP_MEDIA_ALBUMS_SLUG ) {
- $query = new BPMediaQuery();
- $args = $query->init( false, $album_id, false, $paged );
- $bp_media_query = new WP_Query( $args );
- }
- }
-
- function filter_entries() {
- global $bp_media;
- $enabled = $bp_media->enabled();
- if ( isset( $enabled[ 'upload' ] ) )
- unset( $enabled[ 'upload' ] );
- if ( isset( $enabled[ 'album' ] ) )
- unset( $enabled[ 'album' ] );
- foreach ( $enabled as $type => $active ) {
- if ( $active == true ) {
- $filters[ ] = $type;
- }
- }
-
- if ( count( $filters ) == 1 )
- $filters = $filters[ 0 ];
- $this->filters = $filters;
- }
+ var $filters;
+
+ /**
+ *
+ * @param type $media_type
+ * @param type $slug
+ */
+ public function __construct($media_type, $slug) {
+ parent::__construct($media_type, $slug);
+ }
+
+ /**
+ *
+ * @global type $bp
+ */
+ function screen() {
+ global $bp;
+ if (isset($bp->action_variables[0])) {
+ switch ($bp->action_variables[0]) {
+ case BP_MEDIA_ALBUMS_EDIT_SLUG :
+ $this->edit_screen();
+ break;
+ case BP_MEDIA_ALBUMS_VIEW_SLUG:
+ $this->entry_screen();
+ $this->template_actions('entry_screen');
+ break;
+ case BP_MEDIA_DELETE_SLUG :
+ if (!isset($bp->action_variables[1])) {
+ $this->page_not_exist();
+ }
+ $this->entry_delete();
+ break;
+ default:
+ $this->set_query();
+ $this->template_actions('screen');
+ }
+ } else {
+ $this->set_query();
+ $this->template_actions('screen');
+ }
+ $this->template->loader();
+ }
+
+ /**
+ *
+ * @global type $bp_media_albums_query
+ */
+
+ /**
+ *
+ * @global type $bp_media_albums_query
+ */
+ function screen_content() {
+ global $bp_media_albums_query;
+
+ $this->hook_before();
+
+ if ($bp_media_albums_query && $bp_media_albums_query->have_posts()):
+ echo '<ul id="bp-album-list" class="bp-media-gallery item-list">';
+ while ($bp_media_albums_query->have_posts()) : $bp_media_albums_query->the_post();
+ $this->template->the_album_content();
+ endwhile;
+ echo '</ul>';
+ $this->template->show_more('albums');
+ else:
+ BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
+ endif;
+ $this->hook_after();
+ }
+
+ /**
+ *
+ * @global type $bp
+ * @global BPMediaAlbum $bp_media_current_album
+ * @return boolean
+ */
+ function entry_screen() {
+ global $bp, $bp_media_current_album;
+ if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_VIEW_SLUG)
+ return false;
+ try {
+ $bp_media_current_album = new BPMediaAlbum($bp->action_variables[1]);
+ } catch (Exception $e) {
+ /* Send the values to the cookie for page reload display */
+ @setcookie('bp-message', $_COOKIE['bp-message'], time() + 60 * 60 * 24, COOKIEPATH);
+ @setcookie('bp-message-type', $_COOKIE['bp-message-type'], time() + 60 * 60 * 24, COOKIEPATH);
+ $this->template->redirect($this->media_const);
+ exit;
+ }
+ }
+
+ /**
+ *
+ * @global type $bp
+ * @global BPMediaAlbum $bp_media_current_album
+ * @global type $bp_media_query
+ * @return boolean
+ */
+ function entry_screen_content() {
+ global $bp, $bp_media_current_album, $bp_media_query;
+ if (!$bp->action_variables[0] == BP_MEDIA_ALBUMS_VIEW_SLUG)
+ return false;
+ $allowed_edit = false;
+ if (is_user_logged_in()) {
+ if (!bp_is_user()) {
+ if (bp_is_active('groups')) {
+ if (groups_is_user_admin(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
+ $allowed_edit = true;
+ } elseif (bp_displayed_user_id() == bp_loggedin_user_id()) {
+ $allowed_edit = true;
+ }
+ }
+ } else {
+ if (bp_displayed_user_id() == bp_loggedin_user_id()) {
+ $allowed_edit = true;
+ }
+ }
+
+ if ($allowed_edit != false) {
+ echo '<div class="album-edit">';
+ echo '<a href="' . $bp_media_current_album->get_edit_url() . '" class="button item-button bp-secondary-action bp-media-edit bp-media-edit-album" title="' . __('Edit Album', BP_MEDIA_TXT_DOMAIN) . '">' . __('Edit', BP_MEDIA_TXT_DOMAIN) . '</a>';
+ echo '<a href="' . $bp_media_current_album->get_delete_url() . '" class="button item-button bp-secondary-action delete-activity-single confirm" rel="nofollow">' . __("Delete", BP_MEDIA_TXT_DOMAIN) . '</a>';
+ echo '</div>';
+ }
+ }
+ $this->inner_query($bp_media_current_album->get_id());
+ $this->hook_before();
+ if ($bp_media_current_album && $bp_media_query->have_posts()) {
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
+ BPMediaUploadScreen::upload_screen_content();
+ }
+ echo '<ul id="bp-media-list" class="bp-media-gallery albums item-list">';
+
+ while ($bp_media_query->have_posts()) {
+ $bp_media_query->the_post();
+ $this->template->the_content();
+ }
+ echo '</ul>';
+ $this->template->show_more();
+ } else {
+ BPMediaFunction::show_formatted_error_message(__('Sorry, no media items were found in this album.', BP_MEDIA_TXT_DOMAIN), 'info');
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
+ echo '<div class="bp-media-area-allocate"></div>';
+ BPMediaUploadScreen::upload_screen_content();
+ }
+ }
+ $this->hook_after();
+ }
+
+ function entry_screen_title() {
+
+ global $bp_media_current_album;
+ /** @var $bp_media_current_entry BPMediaHostWordpress */
+ if (is_object($bp_media_current_album))
+ echo $bp_media_current_album->get_title();
+ }
+
+ /**
+ *
+ * @global type $bp
+ * @global type $bp_media_albums_query
+ */
+ function set_query() {
+ global $bp, $bp_media_albums_query;
+ if (isset($bp->action_variables) && is_array($bp->action_variables) && isset($bp->action_variables[0]) && $bp->action_variables[0] == 'page' && isset($bp->action_variables[1]) && is_numeric($bp->action_variables[1])) {
+ $paged = $bp->action_variables[1];
+ } else {
+ $paged = 1;
+ }
+ if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
+ $query = new BPMediaQuery();
+ $args = $query->init('album');
+ $bp_media_albums_query = new WP_Query($args);
+ }
+ }
+
+ /**
+ *
+ * @global type $bp
+ * @global type $bp_media_query
+ * @param type $album_id
+ */
+ function inner_query($album_id = 0) {
+ global $bp, $bp_media_query;
+ $paged = 0;
+ $action_variables = isset($bp->canonical_stack['action_variables']) ? $bp->canonical_stack['action_variables'] : null;
+ if (isset($action_variables) && is_array($action_variables) && isset($action_variables[0])) {
+ if ($action_variables[0] == 'page' && isset($action_variables[1]) && is_numeric($action_variables[1]))
+ $paged = $action_variables[1];
+ else if (isset($action_variables[1]) && $action_variables[1] == 'page' && isset($action_variables[2]) && is_numeric($action_variables[2]))
+ $paged = $action_variables[2];
+ }
+ if (!$paged)
+ $paged = 1;
+ $this->filter_entries();
+ if ($bp->current_component == 'groups') {
+ $query = new BPMediaQuery();
+ $args = $query->init(false, $album_id, false, $paged);
+ $bp_media_query = new WP_Query($args);
+ }
+ if ($bp->current_action == BP_MEDIA_ALBUMS_SLUG) {
+ $query = new BPMediaQuery();
+ $args = $query->init(false, $album_id, false, $paged);
+ $bp_media_query = new WP_Query($args);
+ }
+ }
+
+ function filter_entries() {
+ global $bp_media;
+ $enabled = $bp_media->enabled();
+ if (isset($enabled['upload']))
+ unset($enabled['upload']);
+ if (isset($enabled['album']))
+ unset($enabled['album']);
+ foreach ($enabled as $type => $active) {
+ if ($active == true) {
+ $filters[] = $type;
+ }
+ }
+
+ if (count($filters) == 1)
+ $filters = $filters[0];
+ $this->filters = $filters;
+ }
}
View
37 app/main/profile/BPMediaScreen.php
@@ -179,25 +179,24 @@ function screen_content() {
$this->hook_before();
- if ($bp_media_query && $bp_media_query->have_posts()):
- echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
+ if ($bp_media_query && $bp_media_query->have_posts()) {
if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
- echo '<li>';
BPMediaUploadScreen::upload_screen_content();
- echo '</li>';
}
- while ($bp_media_query->have_posts()) : $bp_media_query->the_post();
+ echo '<ul id="bp-media-list" class="bp-media-gallery item-list">';
+ while ($bp_media_query->have_posts()) {
+ $bp_media_query->the_post();
$this->template->the_content();
- endwhile;
+ }
echo '</ul>';
$this->template->show_more();
- else:
+ } else {
BPMediaFunction::show_formatted_error_message(sprintf(__('Sorry, no %s were found.', BP_MEDIA_TXT_DOMAIN), $this->slug), 'info');
if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
echo '<div class="bp-media-area-allocate"></div>';
BPMediaUploadScreen::upload_screen_content();
}
- endif;
+ }
$this->hook_after();
}
@@ -251,19 +250,19 @@ function entry_screen_content() {
$this->hook_before();
if (!$bp->action_variables[0] == constant($entryslug))
return false;
- echo '<div class="bp-media-single bp-media-image" id="bp-media-id-'.$bp_media_current_entry->get_id().'">';
- echo '<div class="bp-media-content-wrap" id="bp-media-content-wrap">';
+ echo '<div class="bp-media-single bp-media-image" id="bp-media-id-' . $bp_media_current_entry->get_id() . '">';
+ echo '<div class="bp-media-content-wrap" id="bp-media-content-wrap">';
echo $bp_media_current_entry->get_media_single_content();
- echo '</div>';
- echo '<div class="bp-media-meta-content-wrap">';
- echo '<div class="bp-media-mod-title">';
- echo '<h2>';
- $this->entry_screen_title();
- echo '</h2>';
- echo '<p>'.nl2br($bp_media_current_entry->get_description()).'</p>';
- echo '</div>';
+ echo '</div>';
+ echo '<div class="bp-media-meta-content-wrap">';
+ echo '<div class="bp-media-mod-title">';
+ echo '<h2>';
+ $this->entry_screen_title();
+ echo '</h2>';
+ echo '<p>' . nl2br($bp_media_current_entry->get_description()) . '</p>';
+ echo '</div>';
echo $bp_media_current_entry->show_comment_form();
- echo '</div>';
+ echo '</div>';
echo '</div>';
$this->hook_after();
}
View
160 app/main/profile/BPMediaTemplate.php
@@ -16,69 +16,83 @@ class BPMediaTemplate {
* @global type $bp_media_current_album
*/
function upload_form_multiple() {
- global $bp_media_current_album;
- $post_max_size = ini_get('post_max_size');
+ global $bp_media_current_album, $bp_media_query;
+ $post_max_size = ini_get('post_max_size');
$upload_max_filesize = ini_get('upload_max_filesize');
- $memory_limit = ini_get('memory_limit');
- $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN); ?>
- <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop">
+ $numeric_pms = (int)str_replace(array('K', 'M', 'G'), array('000', '000000', '000000000'), $post_max_size);
+ $numeric_umf = (int)str_replace(array('K', 'M', 'G'), array('000', '000000', '000000000'), $upload_max_filesize);
+ if ( $numeric_pms < $numeric_umf ) {
+ $size_limit = $post_max_size;
+ } else {
+ $size_limit = $upload_max_filesize;
+ }
+ $post_wall = __('Wall Posts', BP_MEDIA_TXT_DOMAIN);
+ if ($bp_media_query && $bp_media_query->have_posts()) {
+ $hidden = ' style="display:none;"';
+ ?>
+ <input id="bp-media-upload-button" type="button" value="Upload" class="button"><?php
+ } else {
+ $hidden = '';
+ }
+ ?>
+ <div id="bp-media-upload-ui" class="hide-if-no-js drag-drop"<?php echo $hidden; ?>>
<div id="drag-drop-area">
- <div class="drag-drop-inside">
- <p class="drag-drop-info"><?php _e('Drop files here', BP_MEDIA_TXT_DOMAIN); ?></p>
- <p id="bp-media-album-or"><?php _e(' or ', BP_MEDIA_TXT_DOMAIN); ?></p>
- <p class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e('Upload Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" /></p>
- </div>
- <?php if (!isset($bp_media_current_album)) { ?>
- <div id="bp-media-album-in"><span><?php _e('to', BP_MEDIA_TXT_DOMAIN); ?></span></div>
+ <?php if (isset($bp_media_current_album)) { ?>
+ <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
+ <?php } else { ?>
<div id="bp-media-album-prompt" title="Album">
- <p><?php _e('Album', BP_MEDIA_TXT_DOMAIN); ?></p>
- <div class="bp-media-album-content">
+ <span><?php _e('Select Album: ', BP_MEDIA_TXT_DOMAIN); ?></span>
+ <span class="bp-media-album-content">
<select id="bp-media-selected-album"><?php
- if (bp_is_current_component('groups')) {
- $albums = new WP_Query(array(
- 'post_type' => 'bp_media_album',
- 'posts_per_page' => -1,
- 'meta_key' => 'bp-media-key',
- 'meta_value' => -bp_get_current_group_id(),
- 'meta_compare' => '='
- ));
- } else {
- $albums = new WP_Query(array(
- 'post_type' => 'bp_media_album',
- 'posts_per_page' => -1,
- 'author' => get_current_user_id()
- ));
- }
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
- foreach ($albums->posts as $album) {
- if ($album->post_title == $post_wall)
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
- else
- echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
- };
- }else {
- $album = new BPMediaAlbum();
- if (bp_is_current_component('groups')) {
- $current_group = new BP_Groups_Group(bp_get_current_group_id());
- $album->add_album($post_wall, $current_group->creator_id, bp_get_current_group_id());
- } else {
- $album->add_album($post_wall, bp_loggedin_user_id());
- }
- echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
- }
- echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
- ?>
+ if (bp_is_current_component('groups')) {
+ $albums = new WP_Query(array(
+ 'post_type' => 'bp_media_album',
+ 'posts_per_page' => -1,
+ 'meta_key' => 'bp-media-key',
+ 'meta_value' => -bp_get_current_group_id(),
+ 'meta_compare' => '='
+ ));
+ } else {
+ $albums = new WP_Query(array(
+ 'post_type' => 'bp_media_album',
+ 'posts_per_page' => -1,
+ 'author' => get_current_user_id()
+ ));
+ }
+ if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
+ foreach ($albums->posts as $album) {
+ if ($album->post_title == $post_wall)
+ echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
+ else
+ echo '<option value="' . $album->ID . '">' . $album->post_title . '</option>';
+ };
+ }else {
+ $album = new BPMediaAlbum();
+ if (bp_is_current_component('groups')) {
+ $current_group = new BP_Groups_Group(bp_get_current_group_id());
+ $album->add_album($post_wall, $current_group->creator_id, bp_get_current_group_id());
+ } else {
+ $album->add_album($post_wall, bp_loggedin_user_id());
+ }
+ echo '<option value="' . $album->get_id() . '" selected="selected">' . $album->get_title() . '</option>';
+ }
+ echo '<option id="create-new" value="create_new" >' . __('+ Create New Album', BP_MEDIA_TXT_DOMAIN) . '</option>';
+ ?>
</select>
- </div>
+ </span>
<div class="hide">
<input type="text" id="bp_media_album_new" value="" placeholder="Album Name" /><br/>
<input type="button" class="button" id="btn-create-new" value="<?php _e('Create', BP_MEDIA_TXT_DOMAIN); ?>"/>
<input type="button" class="button" id="btn-create-cancel" value="<?php _e('Cancel', BP_MEDIA_TXT_DOMAIN); ?>"/>
</div>
</div>
- <?php } else { ?>
- <input type="hidden" id="bp-media-selected-album" value="<?php echo $bp_media_current_album->get_id(); ?>"/>
- <?php } ?>
+ <div id="bp-media-album-in"><span><?php _e('&', BP_MEDIA_TXT_DOMAIN); ?></span></div>
+ <?php } ?>
+ <div class="drag-drop-inside">
+ <span class="drag-drop-info"><?php _e('Drop files here', BP_MEDIA_TXT_DOMAIN); ?></span>
+ <span id="bp-media-album-or"><?php _e(' or ', BP_MEDIA_TXT_DOMAIN); ?></span>
+ <span class="drag-drop-buttons"><input id="bp-media-upload-browse-button" type="button" value="<?php _e('Upload Media', BP_MEDIA_TXT_DOMAIN); ?>" class="button" />(<?php _e('Max Upload Size', BP_MEDIA_TXT_DOMAIN);echo ': '.$size_limit; ?>)</span>
+ </div>
</div>
<div id="bp-media-uploaded-files"></div>
</div>
@@ -170,24 +184,24 @@ function the_album_content($id = 0) {
*/
function show_more($type = 'media') {
$showmore = false;
- global $bp_media;
- $count = $bp_media->default_count();
+ global $bp_media;
+ $count = $bp_media->default_count();
switch ($type) {
case 'media':
global $bp_media_query;
//found_posts
- if ( bp_is_my_profile() || BPMediaGroupLoader::can_upload() ) {
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > ($count-1) )
+ if (bp_is_my_profile() || BPMediaGroupLoader::can_upload()) {
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > ($count - 1))
$showmore = true;
} else {
- if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > $count )
+ if (isset($bp_media_query->found_posts) && $bp_media_query->found_posts > $count)
$showmore = true;
}
break;
case 'albums':
global $bp_media_albums_query;
- if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > $count ){
- $showmore = true;
+ if (isset($bp_media_albums_query->found_posts) && $bp_media_albums_query->found_posts > $count) {
+ $showmore = true;
}
break;
}
@@ -230,20 +244,20 @@ function upload_form_multiple_activity() {
</div>
<div class="bp-media-album-content">
<select id="bp-media-selected-album"><?php
- $albums = new WP_Query(array(
- 'post_type' => 'bp_media_album',
- 'posts_per_page' => -1,
- 'author' => get_current_user_id()
- ));
- if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
- foreach ($albums->posts as $album) {
- if ($album->post_title == $post_wall)
- echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
- else
- echo '<option value="' . $album->ID . '">' . $album->post_title, BP_MEDIA_TXT_DOMAIN . '</option>';
- };
- }
- ?></select>
+ $albums = new WP_Query(array(
+ 'post_type' => 'bp_media_album',
+ 'posts_per_page' => -1,
+ 'author' => get_current_user_id()
+ ));
+ if (isset($albums->posts) && is_array($albums->posts) && count($albums->posts) > 0) {
+ foreach ($albums->posts as $album) {
+ if ($album->post_title == $post_wall)
+ echo '<option value="' . $album->ID . '" selected="selected">' . $album->post_title . '</option>';
+ else
+ echo '<option value="' . $album->ID . '">' . $album->post_title, BP_MEDIA_TXT_DOMAIN . '</option>';
+ };
+ }
+ ?></select>
</div>
<div class="select-btn-div">
<input id="selected-btn" type="button" class="btn" value="<?php _e('Select', BP_MEDIA_TXT_DOMAIN); ?>" />
View
0  languages/buddypress-media-de.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-es.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-fr.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-it.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-ja.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-nl.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-pl.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-pt_BR.mo 100644 → 100755
File mode changed
View
0  languages/buddypress-media-sr.mo 100644 → 100755
File mode changed
View
0  screenshot-12.png 100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.