From a3a929123699ee9e8e2dc183b4e7a14049b49254 Mon Sep 17 00:00:00 2001 From: Heshan Date: Thu, 22 Sep 2011 10:04:25 -0400 Subject: [PATCH 1/2] Issue #919700: Fix using the file ID directly in Views. --- includes/jplayer_style_plugin.inc | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/includes/jplayer_style_plugin.inc b/includes/jplayer_style_plugin.inc index a712648..5df11f3 100644 --- a/includes/jplayer_style_plugin.inc +++ b/includes/jplayer_style_plugin.inc @@ -84,18 +84,22 @@ class jplayer_style_plugin extends views_plugin_style { foreach ($sets as $title => $records) { foreach ($records as $row_index => $row) { $filepath = NULL; + $fileid = NULL; foreach ($this->options['path_field'] as $field_name) { if (isset($row->{$fields[$field_name]->field_alias})) { - $filepath = $row->{$fields[$field_name]->field_alias}; + $fileid = $row->{$fields[$field_name]->field_alias}; break; } } + $file = db_fetch_object(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fileid)); + $filepath = $file->filepath; $this->view->row_index = $row_index; $label = trim(strip_tags($this->row_plugin->render($row))); if (empty($label)) { $label = basename($filepath); } + // get the file path from the file object $items[] = array( 'url' => file_create_url($filepath), -- 1.7.6.1 From 86f85edcf03c757806dc63fdb053b9e34890a280 Mon Sep 17 00:00:00 2001 From: Andrew Berry Date: Thu, 22 Sep 2011 10:05:33 -0400 Subject: [PATCH 2/2] Issue #919700: Fix comment style. --- includes/jplayer_style_plugin.inc | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/includes/jplayer_style_plugin.inc b/includes/jplayer_style_plugin.inc index 5df11f3..44b77ca 100644 --- a/includes/jplayer_style_plugin.inc +++ b/includes/jplayer_style_plugin.inc @@ -92,14 +92,15 @@ class jplayer_style_plugin extends views_plugin_style { } } + // Get the file path from the file object. $file = db_fetch_object(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fileid)); $filepath = $file->filepath; + $this->view->row_index = $row_index; $label = trim(strip_tags($this->row_plugin->render($row))); if (empty($label)) { $label = basename($filepath); } - // get the file path from the file object $items[] = array( 'url' => file_create_url($filepath), -- 1.7.6.1