SIMPLEVIEWER,
'module' => 'simpleviewer',
'shared_file' => 'simpleviewer/viewer.swf',
'file' => 'xmlDataPath',
'version' => '7',
'title' => t('SimpleViewer'),
'download' => 'http://www.airtightinteractive.com/simpleviewer/',
'width' => '700',
'height' => '600',
);
$methods[SWFTOOLS_IMAGE_DISPLAY_LIST][SIMPLEVIEWER] = $image_rotator;
return $methods;
}
/**
* Implementation of hook_menu().
*/
function simpleviewer_menu() {
$items = array();
$items['admin/settings/swftools/simpleviewer'] = array(
'title' => 'SimpleViewer',
'description' => 'Settings for Airtight Interactive\'s SimpleViewer image gallery.',
'weight' => 1,
'access arguments' => array('administer flash'),
'page callback' => 'drupal_get_form',
'page arguments' => array('simpleviewer_admin_form'),
'file' => 'simpleviewer.admin.inc',
'file path' => drupal_get_path('module', 'simpleviewer'),
);
return $items;
}
/**
* Implementation of swftools_flashvars hook
* Allows the Flash player provider to add variables to the Flashvars array.
* Other arrays can also be modified.
*
*/
function simpleviewer_swftools_flashvars($action, &$methods, &$vars) {
$sv_vars = _simpleviewer_vars();
// Here we only assign 'other' settings to othervars, and return 'swf' settings
// as the flashvars. 'xml' settings are for the xml file only.
// See http://www.airtightinteractive.com/forum/viewtopic.php?t=4085&start=0
if (is_array($sv_vars['other'])) {
$vars->othervars = array_merge($sv_vars['other'], $vars->othervars);
}
return $sv_vars['swf'];
}
/**
* These are the default options and flashvars.
*
*/
function _simpleviewer_vars() {
include_once(drupal_get_path('module', 'simpleviewer') .'/simpleviewer.admin.inc');
// Grab the admin form and use all of the default values as settings for the flash embedding.
$sv_vars = simpleviewer_admin_form(TRUE);
foreach (element_children($sv_vars) AS $name) {
$name_parts = explode('_', $name);
if ($name_parts[1] == 'xml') {
// The last part of the Drupal variable name matches the SimpleViewer XML option name
$return['xml'][$name_parts[2]] = $sv_vars[$name]['#default_value'];
}
elseif ($name_parts[1] == 'swf') {
$return['swf'][$name_parts[2]] = $sv_vars[$name]['#default_value'];
}
else {
$return['other'][$name_parts[2]] = $sv_vars[$name]['#default_value'];
}
}
return $return;
}
function simpleviewer_simpleviewer_swftools_playlist($playlist_data, &$method, &$vars) {
$sv_vars = _simpleviewer_vars();
$xml_vars = array_merge($sv_vars['xml'], $vars->flashvars);
$xml = ''."\n";
$xml .= 'params['base'] .'" '.
'thumbPath="'. $vars->params['base'] .'" '.
'enableRightClickOpen="'. $xml_vars['enableRightClickOpen'] .'" '.
'backgroundImagePath="'. $xml_vars['backgroundImagePath'] .'">';
foreach($playlist_data['playlist'] AS $track => $details) {
// Strip default sites path if it is present
if (strpos($details['filename'], file_create_path()) === 0) {
$details['filename'] = str_replace(file_create_path() . '/', '', $details['filename']);
}
$xml .= '
'. $details['filename']. '
'. $details['description'] .'
';
}
$xml .= "\n";
return $xml;
}