scs_views.module in Simplenews Content Selection 6
File
simplenews_content_selection_views/scs_views.module
View source
<?php
function scs_views_menu() {
$items = array();
$items['scs_views/nodeselected'] = array(
'title' => 'Node selected in view',
'page callback' => 'scs_views_node_selected',
'access arguments' => array(
'access content',
),
'type' => MENU_CALLBACK,
);
return $items;
}
function scs_views_action_info() {
return array(
'scs_views_create_newsletter_action' => array(
'type' => 'node',
'description' => t('Create newsletter'),
'configurable' => false,
'behavior' => array(
'scs_views_create_newsletter',
),
),
);
}
function scs_views_form_alter(&$form, &$form_state, $form_id) {
if (ereg('views_bulk_operations', $form_id)) {
drupal_add_js(drupal_get_path('module', 'scs_views') . '/scs_views.js');
}
}
function scs_views_create_newsletter_action($node) {
$nodes = $_SESSION['scs_nodes'];
$nodes = explode('-', $nodes);
unset($nodes[count($nodes) - 1]);
_scs_create_newsletter('', $nodes);
}
function scs_views_node_selected() {
$nodes = $_GET['nid'];
unset($_SESSION['scs_nodes']);
$_SESSION['scs_nodes'] = $nodes;
print $_SESSION['scs_nodes'];
}