summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Gilliland2008-12-06 17:10:47 (GMT)
committer James Gilliland2008-12-06 17:10:47 (GMT)
commitdac97b73d854be4bce0924d2ebe3d61b056785ae (patch)
tree1b1a87bca2151913218d364e3caebfe994ab5f1e
parent7a12d9fe7e5db837ad339f324d70db9b6e8e68f1 (diff)
based on #343063 by webchick
adding support for really attaching export views including images.
-rw-r--r--export/images/csv.pngbin0 -> 637 bytes
-rw-r--r--export/images/doc.pngbin0 -> 549 bytes
-rw-r--r--export/images/txt.pngbin0 -> 362 bytes
-rw-r--r--export/images/views_bonus_export.xcfbin0 -> 3056 bytes
-rw-r--r--export/images/xml.pngbin0 -> 568 bytes
-rw-r--r--export/views_bonus_export.views.inc11
-rw-r--r--export/views_bonus_plugin_style_export.inc71
-rw-r--r--export/views_bonus_plugin_style_export_csv.inc8
-rw-r--r--export/views_bonus_plugin_style_export_doc.inc7
-rw-r--r--export/views_bonus_plugin_style_export_txt.inc7
-rw-r--r--export/views_bonus_plugin_style_export_xml.inc7
11 files changed, 36 insertions, 75 deletions
diff --git a/export/images/csv.png b/export/images/csv.png
new file mode 100644
index 0000000..732d937
--- /dev/null
+++ b/export/images/csv.png
Binary files differ
diff --git a/export/images/doc.png b/export/images/doc.png
new file mode 100644
index 0000000..f12c9ef
--- /dev/null
+++ b/export/images/doc.png
Binary files differ
diff --git a/export/images/txt.png b/export/images/txt.png
new file mode 100644
index 0000000..6d282e2
--- /dev/null
+++ b/export/images/txt.png
Binary files differ
diff --git a/export/images/views_bonus_export.xcf b/export/images/views_bonus_export.xcf
new file mode 100644
index 0000000..f5a32e0
--- /dev/null
+++ b/export/images/views_bonus_export.xcf
Binary files differ
diff --git a/export/images/xml.png b/export/images/xml.png
new file mode 100644
index 0000000..e677a25
--- /dev/null
+++ b/export/images/xml.png
Binary files differ
diff --git a/export/views_bonus_export.views.inc b/export/views_bonus_export.views.inc
index 632f9b0..668dc7a 100644
--- a/export/views_bonus_export.views.inc
+++ b/export/views_bonus_export.views.inc
@@ -12,11 +12,19 @@ function views_bonus_export_views_plugins() {
$path = drupal_get_path('module', 'views_bonus_export');
return array(
'style' => array(
+ 'views_bonus_export' => array(
+ // this isn't really a display but is necessary so the file can
+ // be included.
+ 'no ui' => TRUE,
+ 'handler' => 'views_bonus_plugin_style_export',
+ 'path' => $path,
+ ),
'views_csv' => array(
'title' => t('CSV file'),
'help' => t('Display the view as a comma seperated list.'),
'path' => $path,
'handler' => 'views_bonus_plugin_style_export_csv',
+ 'parent' => 'views_bonus_export',
'theme' => 'views_bonus_export_csv',
'uses row plugin' => FALSE,
'uses fields' => TRUE,
@@ -28,6 +36,7 @@ function views_bonus_export_views_plugins() {
'help' => t('Display the view as a doc file.'),
'path' => $path,
'handler' => 'views_bonus_plugin_style_export_doc',
+ 'parent' => 'views_bonus_export',
'theme' => 'views_bonus_export_doc',
'uses row plugin' => FALSE,
'uses fields' => TRUE,
@@ -39,6 +48,7 @@ function views_bonus_export_views_plugins() {
'help' => t('Display the view as a txt file.'),
'path' => $path,
'handler' => 'views_bonus_plugin_style_export_txt',
+ 'parent' => 'views_bonus_export',
'theme' => 'views_bonus_export_txt',
'uses row plugin' => FALSE,
'uses fields' => TRUE,
@@ -50,6 +60,7 @@ function views_bonus_export_views_plugins() {
'help' => t('Display the view as a txt file.'),
'path' => $path,
'handler' => 'views_bonus_plugin_style_export_xml',
+ 'parent' => 'views_bonus_export',
'theme' => 'views_bonus_export_xml',
'uses row plugin' => FALSE,
'uses fields' => TRUE,
diff --git a/export/views_bonus_plugin_style_export.inc b/export/views_bonus_plugin_style_export.inc
index bfaee32..d0534e6 100644
--- a/export/views_bonus_plugin_style_export.inc
+++ b/export/views_bonus_plugin_style_export.inc
@@ -8,73 +8,18 @@
/**
* Generalized style plugin for export plugins.
*/
-class views_bonus_plugin_style_export_doc extends views_plugin_style {
+class views_bonus_plugin_style_export extends views_plugin_style {
+ function init(&$view, &$display, $options = NULL) {
+ parent::init(&$view, &$display, $options = NULL);
+ }
+
function attach_to($display_id, $path, $title) {
- $display = $this->view->display[$display_id]->handler;
- $url_options = array();
+ $url_options = array('html' => true);
$input = $this->view->get_exposed_input();
if ($input) {
$url_options['query'] = $input;
}
-
- $url = url($this->view->get_url(NULL, $path), $url_options);
- if ($display->has_path()) {
- if (empty($this->preview)) {
- drupal_add_feed($url, $title);
- }
- }
- else {
- if (empty($this->view->feed_icon)) {
- $this->view->feed_icon = '';
- }
-
- $this->view->feed_icon .= theme('feed_icon', $url, $title);
- drupal_add_link(array(
- 'rel' => 'alternate',
- 'type' => 'application/rss+xml',
- 'title' => $title,
- 'href' => $url
- ));
- }
- }
-
- function option_definition() {
- $options = parent::option_definition();
-
- $options['filename'] = array(
- 'default' => 'view-%view.csv',
- 'translatable' => FALSE,
- );
- $options['headers'] = array(
- 'default' => TRUE,
- 'translatable' => TRUE,
- );
- $options['quote'] = array(
- 'default' => TRUE,
- 'translatable' => TRUE,
- );
-
- return $options;
- }
-
- function options_form(&$form, &$form_state) {
- $form['filename'] = array(
- '#type' => 'textfield',
- '#title' => t('CSV filename'),
- '#default_value' => $this->options['filename'],
- '#description' => t('The filename that will be suggested to the browser for downloading purposes. %view will be replaced with the view name.'),
- '#process' => array('views_process_dependency'),
- '#dependency' => array('edit-style-options-override' => array(FALSE)),
- );
- $form['headers'] = array(
- '#type' => 'checkbox',
- '#default_value' => !empty($this->options['headers']),
- '#title' => t('Output field name headers with the file.'),
- );
- $form['quote'] = array(
- '#type' => 'checkbox',
- '#default_value' => !empty($this->options['quote']),
- '#title' => t('Quote values. Useful for output that might have commas as part of one of the values.'),
- );
+ $image = theme('image', $this->feed_image);
+ $this->view->feed_icon .= l($image, $path, $url_options);
}
}
diff --git a/export/views_bonus_plugin_style_export_csv.inc b/export/views_bonus_plugin_style_export_csv.inc
index c970d2e..b1dae1b 100644
--- a/export/views_bonus_plugin_style_export_csv.inc
+++ b/export/views_bonus_plugin_style_export_csv.inc
@@ -8,9 +8,10 @@
/**
* Generalized style plugin for export plugins.
*/
-class views_bonus_plugin_style_export_csv extends views_plugin_style {
- function attach_to($display_id, $path, $title) {
- //...
+class views_bonus_plugin_style_export_csv extends views_bonus_plugin_style_export {
+ function init(&$view, &$display, $options = NULL) {
+ parent::init(&$view, &$display, $options = NULL);
+ $this->feed_image = drupal_get_path('module', 'views_bonus_export') . '/images/csv.png';
}
function option_definition() {
@@ -43,4 +44,5 @@ class views_bonus_plugin_style_export_csv extends views_plugin_style {
'#title' => t('Quote values. Useful for output that might have commas as part of one of the values.'),
);
}
+
}
diff --git a/export/views_bonus_plugin_style_export_doc.inc b/export/views_bonus_plugin_style_export_doc.inc
index 115b41a..51f08f0 100644
--- a/export/views_bonus_plugin_style_export_doc.inc
+++ b/export/views_bonus_plugin_style_export_doc.inc
@@ -8,9 +8,10 @@
/**
* Generalized style plugin for export plugins.
*/
-class views_bonus_plugin_style_export_doc extends views_plugin_style {
- function attach_to($display_id, $path, $title) {
- // ...
+class views_bonus_plugin_style_export_doc extends views_bonus_plugin_style_export {
+ function init(&$view, &$display, $options = NULL) {
+ parent::init(&$view, &$display, $options = NULL);
+ $this->feed_image = drupal_get_path('module', 'views_bonus_export') . '/images/doc.png';
}
function option_definition() {
diff --git a/export/views_bonus_plugin_style_export_txt.inc b/export/views_bonus_plugin_style_export_txt.inc
index d950ebc..0ed35c4 100644
--- a/export/views_bonus_plugin_style_export_txt.inc
+++ b/export/views_bonus_plugin_style_export_txt.inc
@@ -8,9 +8,10 @@
/**
* Generalized style plugin for export plugins.
*/
-class views_bonus_plugin_style_export_txt extends views_plugin_style {
- function attach_to($display_id, $path, $title) {
- // ...
+class views_bonus_plugin_style_export_txt extends views_bonus_plugin_style_export {
+ function init(&$view, &$display, $options = NULL) {
+ parent::init(&$view, &$display, $options = NULL);
+ $this->feed_image = drupal_get_path('module', 'views_bonus_export') . '/images/txt.png';
}
function option_definition() {
diff --git a/export/views_bonus_plugin_style_export_xml.inc b/export/views_bonus_plugin_style_export_xml.inc
index dde024f..26c1f96 100644
--- a/export/views_bonus_plugin_style_export_xml.inc
+++ b/export/views_bonus_plugin_style_export_xml.inc
@@ -8,9 +8,10 @@
/**
* Generalized style plugin for export plugins.
*/
-class views_bonus_plugin_style_export_xml extends views_plugin_style {
- function attach_to($display_id, $path, $title) {
- //...
+class views_bonus_plugin_style_export_xml extends views_bonus_plugin_style_export {
+ function init(&$view, &$display, $options = NULL) {
+ parent::init(&$view, &$display, $options = NULL);
+ $this->feed_image = drupal_get_path('module', 'views_bonus_export') . '/images/xml.png';
}
function option_definition() {