diff --git a/includes/media_mediahaven.admin.inc b/includes/media_mediahaven.admin.inc index b2bd3a0..ae2a321 100644 --- a/includes/media_mediahaven.admin.inc +++ b/includes/media_mediahaven.admin.inc @@ -18,13 +18,6 @@ function media_mediahaven_add($form, &$form_state = array(), $redirect = NULL) return; } - $files = array(); - // Add the files to JS so that they are accessible inside the browser - drupal_add_js(array('media' => array('files' => $files)), 'setting'); - - // Add media browser javascript and CSS. - drupal_add_js(drupal_get_path('module', 'media_mediahaven') . '/js/media-mediahaven.browser.js'); - $data['mediahaven_search'] = _generate_search($form_state); return array('mediahaven' => $data); @@ -53,7 +46,7 @@ function _generate_search($state) '#title' => 'Search', '#default_value' => $search !== null ? $search : '' ); - + $data['selected_facets'] = $facets_output; $data['facets'] = _generate_facets($facets); @@ -113,7 +106,7 @@ function _get_search_facets($selected_facets, $search_term) { $full_query .= $selected_facet; } - + if (isset($search_term) && strlen($search_term)>0) { if (strlen($full_query) > 0) { $full_query .= ' '; @@ -143,6 +136,7 @@ function _parse_selected_facets($selected_facets) $pattern = '/\+dtag\:\"root>([A-Za-z0-9 ]*)>([A-Za-z0-9 ]*)\"/'; preg_match_all($pattern, $selected_facets[0], $matches); + if(!empty($matches)) { $selected_facet_list = array( @@ -226,6 +220,7 @@ function parse_facet_link($query) { $query = $query . '&search=' . substr(trim($matches[0]),2,-1); } + return $query; } @@ -363,7 +358,6 @@ function _submit_mob(&$form, &$form_state) { $redirect = "media/{$file->fid}/edit"; } - // I do not understand the block below field_attach_submit('media', $file, $form, $form_state); // Make a copy of the file object to use as the media object @@ -382,4 +376,6 @@ function _submit_mob(&$form, &$form_state) { } $form_state['values']['redirect'] = $redirect; $form['#attributes']['target'] = '_parent'; -} \ No newline at end of file + +} + diff --git a/includes/media_mediahaven.utils.inc b/includes/media_mediahaven.utils.inc index 0f8362b..9a7e617 100644 --- a/includes/media_mediahaven.utils.inc +++ b/includes/media_mediahaven.utils.inc @@ -13,6 +13,7 @@ function media_mediahaven_file_save($media_data) { } elseif($media_data['type']=='Video') { $file->filemime = 'video/mp4'; + } else { $file->filemime = file_get_mimetype($media_data['original_filename']); @@ -26,7 +27,6 @@ function media_mediahaven_file_save($media_data) { $file->filename = $media_data['title']; } - if ($file === FALSE) { drupal_set_message(t('An error occurred and no file was saved.'), 'error'); $redirect = "media_mediahaven_add"; @@ -134,4 +134,4 @@ function media_mediahaven_uri_parse_fragmentid($uri){ } $index++; } -} \ No newline at end of file +} diff --git a/media_mediahaven.module b/media_mediahaven.module index 311d5a5..be6f5ad 100644 --- a/media_mediahaven.module +++ b/media_mediahaven.module @@ -397,7 +397,7 @@ function media_mediahaven_media_browser_plugin_info() { 'title' => t('MediaHaven'), 'class' => 'MediaMediaHavenBrowser', ); - + return $info; }