| 1 |
<?php |
<?php |
| 2 |
// $Id: zoomify.module,v 1.1.2.2.2.2.2.7 2009/02/25 01:22:58 kratib Exp $ |
// $Id: zoomify.module,v 1.1.2.2.2.2.2.8 2009/03/22 04:39:54 kratib Exp $ |
| 3 |
|
|
| 4 |
require_once('pathinfo_filename.inc'); |
require_once('pathinfo_filename.inc'); |
| 5 |
require_once('rrmdir.inc'); |
require_once('rrmdir.inc'); |
| 13 |
|
|
| 14 |
function zoomify_menu() { |
function zoomify_menu() { |
| 15 |
$items['admin/settings/zoomify'] = array( |
$items['admin/settings/zoomify'] = array( |
| 16 |
'title' => 'Zoomify', |
'title' => 'Zoomify settings', |
| 17 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 18 |
'page arguments' => array('zoomify_admin_settings'), |
'page arguments' => array('zoomify_admin_settings'), |
| 19 |
'access arguments' => array('administer site configuration'), |
'access arguments' => array('administer site configuration'), |
| 43 |
} |
} |
| 44 |
|
|
| 45 |
function zoomify_admin_settings() { |
function zoomify_admin_settings() { |
| 46 |
|
global $base_url; |
| 47 |
|
$form['zoomify_applet'] = array( |
| 48 |
|
'#type' => 'textfield', |
| 49 |
|
'#title' => t('URL to Flash applet'), |
| 50 |
|
'#default_value' => variable_get('zoomify_applet', $base_url .'/'. drupal_get_path('module', 'zoomify') .'/ZoomifyViewer.swf'), |
| 51 |
|
'#description' => t('The URL that leads to the Zoomify Flash applet as accessed from a browser. Note that the domain name should be the same as your Drupal site to avoid Flash security problems.'), |
| 52 |
|
); |
| 53 |
$form['zoomify_minimum_width'] = array( |
$form['zoomify_minimum_width'] = array( |
| 54 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 55 |
'#title' => t('Minimum width'), |
'#title' => t('Minimum width'), |
| 91 |
return system_settings_form($form); |
return system_settings_form($form); |
| 92 |
} |
} |
| 93 |
|
|
| 94 |
|
function zoomify_admin_settings_validate($form, $form_state) { |
| 95 |
|
$path = $form_state['values']['zoomify_applet']; |
| 96 |
|
if (!$handle = @fopen($path, 'r')) { |
| 97 |
|
form_set_error('zoomify_applet', t('The URL %path does not exist. Please type a valid URL to the Zoomify Flash applet.', array('%path' => $path))); |
| 98 |
|
} |
| 99 |
|
else { |
| 100 |
|
fclose($handle); |
| 101 |
|
} |
| 102 |
|
} |
| 103 |
|
|
| 104 |
function zoomify_theme() { |
function zoomify_theme() { |
| 105 |
return array( |
return array( |
| 106 |
'zoomify_admin_settings' => array( |
'zoomify_admin_settings' => array( |
| 115 |
function theme_zoomify_admin_settings($form) { |
function theme_zoomify_admin_settings($form) { |
| 116 |
$output = ''; |
$output = ''; |
| 117 |
$output .= drupal_render($form); |
$output .= drupal_render($form); |
| 118 |
$output .= '<p class="cvs-version">$Id: zoomify.module,v 1.1.2.2.2.2.2.7 2009/02/25 01:22:58 kratib Exp $</p>'; |
$output .= '<p class="cvs-version">$Id: zoomify.module,v 1.1.2.2.2.2.2.8 2009/03/22 04:39:54 kratib Exp $</p>'; |
| 119 |
return $output; |
return $output; |
| 120 |
} |
} |
| 121 |
|
|
| 153 |
|
|
| 154 |
drupal_set_title($node->title); |
drupal_set_title($node->title); |
| 155 |
global $base_url; |
global $base_url; |
| 156 |
$viewer = $base_url .'/'. drupal_get_path('module', 'zoomify') .'/zoomifyViewer.swf'; |
$viewer = variable_get('zoomify_applet', $base_url .'/'. drupal_get_path('module', 'zoomify') .'/ZoomifyViewer.swf'); |
| 157 |
$fids = array_keys($images); |
$fids = array_keys($images); |
| 158 |
$image = file_create_url(_zoomify_filepath($node, $fids[$index])); |
$image = file_create_url(_zoomify_filepath($node, $fids[$index])); |
| 159 |
$width = variable_get('zoomify_width', 800); |
$width = variable_get('zoomify_width', 800); |