Index: imagecache.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.info,v
retrieving revision 1.4
diff -r1.4 imagecache.info
5c5,6
< dependencies = imageapi
---
> dependencies[] = imageapi
> core = 6.x
Index: imagecache.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.install,v
retrieving revision 1.9
diff -r1.9 imagecache.install
25c25
< if (_imagecache_return_bytes($memory_limit) < _imagecache_return_bytes('96M')) {
---
> if (parse_size($memory_limit) < parse_size('96M')) {
71,86c71,128
< // convert php settings value to bytes.
< function _imagecache_return_bytes($val) {
< $val = trim($val);
< $last = strtolower($val{strlen($val)-1});
< switch ($last) {
< // The 'G' modifier is available since PHP 5.1.0
< case 'g':
< $val *= 1024;
< case 'm':
< $val *= 1024;
< case 'k':
< $val *= 1024;
< }
<
< return $val;
< }
---
> function imagecache_schema() {
> $schema['imagecache_preset'] = array(
> 'fields' => array(
> 'presetid' => array(
> 'description' => t('The primary identifier for an imagecache_preset.'),
> 'type' => 'serial',
> 'unsigned' => TRUE,
> 'not null' => TRUE),
> 'presetname' => array(
> 'description' => t('The primary identifier for a node.'),
> 'type' => 'varchar',
> 'length' => 255,
> 'not null' => TRUE),
> ),
> 'primary key' => array('presetid'),
> );
>
> $schema['imagecache_action'] = array(
> 'fields' => array(
> 'actionid' => array(
> 'description' => t('The primary identifier for an imagecache_action.'),
> 'type' => 'serial',
> 'unsigned' => TRUE,
> 'not null' => TRUE),
> 'presetid' => array(
> 'description' => t('The primary identifier for an imagecache_preset.'),
> 'type' => 'int',
> 'unsigned' => TRUE,
> 'not null' => TRUE,
> 'default' => 0),
> 'weight' => array(
> 'description' => t('The weight of the action in the preset.'),
> 'type' => 'int',
> 'unsigned' => FALSE,
> 'not null' => TRUE,
> 'default' => 0),
> 'module' => array(
> 'description' => t('The module that defined the action.'),
> 'type' => 'varchar',
> 'length' => 255,
> 'not null' => TRUE),
> 'action' => array(
> 'description' => t('The unique ID of the action to be executed.'),
> 'type' => 'varchar',
> 'length' => 255,
> 'not null' => TRUE),
> 'data' => array(
> 'description' => t('The configuration data for the action.'),
> 'type' => 'text',
> 'not null' => TRUE,
> 'size' => 'big',
> 'serialize' => TRUE),
> ),
> 'primary key' => array('actionid'),
> 'indexes' => array(
> 'presetid' => array('presetid'),
> ),
> );
89,108d130
< function imagecache_install() {
< switch ($GLOBALS['db_type']) {
< case 'mysql':
< case 'mysqli':
< $ret1 = db_query("CREATE TABLE {imagecache_preset} (
< presetid INT UNSIGNED NOT NULL PRIMARY KEY,
< presetname VARCHAR(255) NOT NULL DEFAULT '' )
< /*!40100 DEFAULT CHARACTER SET utf8 */
< ");
<
< $ret2 = db_query("CREATE TABLE {imagecache_action} (
< actionid INT UNSIGNED NOT NULL PRIMARY KEY,
< presetid INT UNSIGNED NOT NULL DEFAULT 0,
< weight INT NOT NULL DEFAULT 0,
< module varchar(255) not null default '',
< action varchar(255) not null default '',
< data TEXT NOT NULL)
< /*!40100 DEFAULT CHARACTER SET utf8 */
< ");
< break;
110,128c132,133
< case 'pgsql':
< $ret1 = db_query("CREATE TABLE {imagecache_preset} (
< presetid INTEGER NOT NULL CHECK (presetid > 0),
< presetname VARCHAR(255) NOT NULL DEFAULT '',
< PRIMARY KEY (presetid));
< ");
< $ret2 = db_query("CREATE TABLE {imagecache_action} (
< actionid INTEGER NOT NULL CHECK (actionid > 0),
< presetid INTEGER NOT NULL DEFAULT 0,
< weight INTEGER NOT NULL DEFAULT 0,
< module varchar(255) not null default '',
< action varchar(255) not null default '',
< data TEXT NOT NULL DEFAULT '',
< PRIMARY KEY (actionid));
< ");
< db_query("CREATE SEQUENCE imagecache_preset_presetid_seq INCREMENT 1 START 1;");
< db_query("CREATE SEQUENCE imagecache_action_actionid_seq INCREMENT 1 START 1;");
< break;
< }
---
> return $schema;
> }
130,136c135,139
< if ($ret1 && $ret2) {
< drupal_set_message(t('Imagecache module installed succesfully.'));
< }
< else {
< drupal_set_message(t('Imagecache module installation was unsuccessfull. Necessary database tables should be created by hand.', 'error'));
< }
< return $ret;
---
> /**
> * Implementation of hook_install().
> */
> function imagecache_install() {
> drupal_install_schema('imagecache');
143,156c146
< db_query('DROP TABLE {imagecache_preset}');
< db_query('DROP TABLE {imagecache_action}');
<
< switch ($GLOBALS['db_type']) {
< case 'mysql':
< case 'mysqli':
< db_query("DELETE FROM {sequences} WHERE name = '{imagecache_action}_actionid'");
< db_query("DELETE FROM {sequences} WHERE name = '{imagecache_action}_presetid'");
< break;
< case 'pgsql':
< db_query('DROP SEQUENCE {imagecache_action}_actionid_seq');
< db_query('DROP SEQUENCE {imagecache_preset}_presetid_seq');
< break;
< }
---
> drupal_uninstall_schema('imagecache');
178c168
<
---
>
189c179
< /**
---
> /**
191c181
< */
---
> */
194c184
<
---
>
197c187
<
---
>
237c227
< // Keep scale and crop and the old scale function seperate... I don't really want to break BC with
---
> // Keep scale and crop and the old scale function seperate... I don't really want to break BC with
247c237
< // Keep scale and crop and the old scale function seperate... I don't really want to break BC with
---
> // Keep scale and crop and the old scale function seperate... I don't really want to break BC with
264d253
<
Index: imagecache.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v
retrieving revision 1.66
diff -r1.66 imagecache.module
52c52
< function imagecache_menu($may_cache) {
---
> function imagecache_menu() {
54d53
< if ($may_cache) {
56,62c55,66
< // standard imagecache callback.
< $items[] = array(
< 'path' => file_directory_path() .'/imagecache',
< 'callback' => 'imagecache_cache',
< 'access' => true,
< 'type' => MENU_CALLBACK
< );
---
> // standard imagecache callback.
> $items[file_directory_path() .'/imagecache'] = array(
> 'page callback' => 'imagecache_cache',
> 'access callback' => TRUE,
> 'type' => MENU_CALLBACK
> );
> // private downloads imagecache callback
> $items['system/files/imagecache'] = array(
> 'page callback' => 'imagecache_cache_private',
> 'access callback' => TRUE,
> 'type' => MENU_CALLBACK
> );
64,71d67
< // private downloads imagecache callback
< $items[] = array(
< 'path' => 'system/files/imagecache',
< 'callback' => 'imagecache_cache_private',
< 'access' => true,
< 'type' => MENU_CALLBACK
< );
< }
74a71,128
>
> /**
> * Implementation of hook_theme().
> */
> function imagecache_theme() {
> return array(
> 'imagecache' => array(
> 'arguments' => array(
> 'namespace' => NULL,
> 'path' => NULL,
> 'alt' => NULL,
> 'title' => NULL,
> )),
> 'imagecache_imagelink' => array(
> 'arguments' => array(
> 'namespace' => NULL,
> 'path' => NULL,
> 'alt' => NULL,
> 'title' => NULL,
> 'attributes' => array(),
> )),
> 'imagecache_formatter' => array(
> 'arguments' => array(
> 'field' => NULL,
> 'item' => NULL,
> 'formatter' => NULL,
> )),
> 'imagecache_resize' => array(
> 'arguments' => array('element' => NULL),
> ),
> 'imagecache_scale' => array(
> 'file' => 'imagecache_actions.inc',
> 'arguments' => array('element' => NULL),
> ),
> 'imagecache_scale_and_crop' => array(
> 'file' => 'imagecache_actions.inc',
> 'arguments' => array('element' => NULL),
> ),
> 'imagecache_deprecated_scale' => array(
> 'file' => 'imagecache_actions.inc',
> 'arguments' => array('element' => NULL),
> ),
> 'imagecache_crop' => array(
> 'file' => 'imagecache_actions.inc',
> 'arguments' => array('element' => NULL),
> ),
> 'imagecache_desaturate' => array(
> 'file' => 'imagecache_actions.inc',
> 'arguments' => array('element' => NULL),
> ),
> 'imagecache_rotate' => array(
> 'file' => 'imagecache_actions.inc',
> 'arguments' => array('element' => NULL),
> ),
>
> );
> }
>
79,80c133,134
< * An array of information on the actions implemented by a module. The array contains a
< * sub-array for each action node type, with the machine-readable action name as the key.
---
> * An array of information on the actions implemented by a module. The array contains a
> * sub-array for each action node type, with the machine-readable action name as the key.
82c136
< *
---
> *
85c139
< * "file": the name of the include file the action can be found
---
> * "file": the name of the include file the action can be found
143c197
< $actions = unserialize($cache->data);
---
> $actions = $cache->data;
149c203
< if ($action['file']) {
---
> if (!empty($action['file'])) {
156c210
< cache_set('imagecache_actions', 'cache', serialize($actions));
---
> cache_set('imagecache_actions', $actions);
176c230
<
---
>
183c237
< }
---
> }
217c271
< /**
---
> /**
237c291
< }
---
> }
251c305
< * handle request validation and responses to imagecache requests.
---
> * handle request validation and responses to imagecache requests.
255,256c309,310
< // send a 404 if we dont' know of a preset.
< header('HTTP/1.0 404 Not Found');
---
> // Send a 404 if we don't know of a preset.
> header("HTTP/1.0 404 Not Found");
261c315
< // to prevent lock files from being created when delivering private files.
---
> // to prevent lock files from being created when delivering private files.
265c319,320
< }
---
> }
>
279c334
< foreach ($_SESSION['imagefield'] as $fieldname => $files) {
---
> foreach ((array) $_SESSION['imagefield'] as $fieldname => $files) {
281a337
>
290,291c346,347
< watchdog('imagecache', t('Failed generating a preview image from %image using imagecache preset %preset.', array('%image' => $path, '%preset' => $presetname)), WATCHDOG_ERROR);
< header('HTTP/1.0 500 Internal Server Error');
---
> watchdog('imagecache', 'Failed generating a preview image from %image using imagecache preset %preset.', array('%image' => $path, '%preset' => $presetname), WATCHDOG_ERROR);
> header("HTTP/1.0 500 Internal Server Error");
298c354
<
---
>
318,319c374,375
< watchdog('imagecache', t('Imagecache already generating: %dst, Lock file: %tmp.', array('%dst' => $dst, '%tmp' => $lockfile)), WATCHDOG_NOTICE);
< // send a response code that will make the browser wait and reload in a 1/2 sec.
---
> watchdog('imagecache', 'Imagecache already generating: %dst, Lock file: %tmp.', array('%dst' => $dst, '%tmp' => $lockfile), WATCHDOG_NOTICE);
> // send a response code that will make the browser wait and reload in a 1/2 sec.
332c388
< // otherwise try to create the derivative.
---
> // otherwise try to create the derivative.
335,336c391,392
< watchdog('imagecache', t('Failed generating an image from %image using imagecache preset %preset.', array('%image' => $path, '%preset' => $preset)), WATCHDOG_ERROR);
< header('HTTP/1.0 500 Internal Server Error');
---
> watchdog('imagecache', 'Failed generating an image from %image using imagecache preset %preset.', array('%image' => $path, '%preset' => $preset['presetname']), WATCHDOG_ERROR);
> header("HTTP/1.0 500 Internal Server Error");
338c394
< }
---
> }
344c400
<
---
>
349c405
< watchdog('imagecache', t('non-existant action %action', array('%action' => $action['action'])), WATCHDOG_NOTICE);
---
> watchdog('imagecache', 'non-existant action %action', array('%action' => $action['action']), WATCHDOG_NOTICE);
425c481
< watchdog('imagecache', t('file exists where we would like a directory: %path', array('%path' => $path)), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'file exists where we would like a directory: %path', array('%path' => $path), WATCHDOG_ERROR);
427c483
< }
---
> }
429c485
< watchdog('imagecache', t('Could not create destination: %dir halted at: %path', array('%dir' => $dir, '%path' => $path)), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'Could not create destination: %dir halted at: %path', array('%dir' => $dir, '%path' => $path), WATCHDOG_ERROR);
433c489
< watchdog('imagecache', t('Could not set permissons on created directory: %dir halted at: %path', array('%dir' => $dir, '%path' => $path)), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'Could not set permissons on created directory: %dir halted at: %path', array('%dir' => $dir, '%path' => $path), WATCHDOG_ERROR);
435c491
< }
---
> }
439c495
<
---
>
442c498
< *
---
> *
455c511
< watchdog('imagecache', t('Failed to create imagecache directory: %dir', array('%dir' => $dir)), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'Failed to create imagecache directory: %dir', array('%dir' => $dir), WATCHDOG_ERROR);
478c534
< watchdog( 'imagecache', t('action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src)), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src), WATCHDOG_ERROR);
485c541
< watchdog('imagecache', t('Cached image file already exists. There is an issue with your Rewrite configuration.'), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'Cached image file already exists. There is an issue with your Rewrite configuration.', WATCHDOG_ERROR);
492c548
<
---
>
499,501c555,557
< // Create imagecache derivatives when files are saved.
< case 'save':
< break;
---
> // Create imagecache derivatives when files are saved.
> case 'save':
> break;
517a574
> $formatters = array();
548c605
< $item = $field['default_image'];
---
> $item = $field['default_image'];
682,683c739,743
<
< function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = null) {
---
> function theme_imagecache($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
> if ($image = image_get_info(imagecache_create_path($namespace, $path))) {
> $attributes['width'] = $image['width'];
> $attributes['height'] = $image['height'];
> }
693a754,758
> function theme_imagecache_imagelink($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
> $image = theme('imagecache', $namespace, $path, $alt, $title);
> $original_image_url = file_create_url($path);
> return l($image, $original_image_url, array('absolute' => FALSE, 'html' => TRUE));
> }
701c766
< watchdog('imagecache', t('imagecache_resize_image failed. image: %image, data: %data.', array('%path' => $image, '%data' => print_r($data, true))), WATCHDOG_ERROR);
---
> watchdog('imagecache', 'imagecache_resize_image failed. image: %image, data: %data.', array('%path' => $image, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
711c776
< '#default_value' => $action['width'],
---
> '#default_value' => isset($action['width']) ? $action['width'] : '100%',
717c782
< '#default_value' => $action['height'],
---
> '#default_value' => isset($action['height']) ? $action['height'] : '100%',
733c798
< * The API for imagecache has changed. There is a compatibility layer for
---
> * The API for imagecache has changed. There is a compatibility layer for
735,736c800,801
< *
< * The 2.x API returns more structured data, has shorter function names, and
---
> *
> * The 2.x API returns more structured data, has shorter function names, and
746c811
< *
---
> *
770c835
< $presets = unserialize($cache->data);
---
> $presets = $cache->data;
778c843
< cache_set('imagecache:presets', 'cache', serialize($presets));
---
> cache_set('imagecache:presets', $presets);
788c853
< *
---
> *
807c872
<
---
>
815c880
< return (isset($presets_by_name[$preset_name])) ? $presets_by_name[$preset_name] : array();
---
> return (isset($presets_by_name[$preset_name])) ? $presets_by_name[$preset_name] : array();
829c894
< db_query('UPDATE {imagecache_preset} SET presetname =\'%s\' WHERE presetid = %d', $preset['presetname'], $preset['presetid']);
---
> drupal_write_record('imagecache_preset', $preset, 'presetid');
832,833c897
< $preset['presetid'] = db_next_id('{imagecache_preset}_presetid');
< db_query('INSERT INTO {imagecache_preset} (presetid, presetname) VALUES (%d, \'%s\')', $preset['presetid'], $preset['presetname']);
---
> drupal_write_record('imagecache_preset', $preset);
858c922
< }
---
> }
904c968
< }
---
> }
907a972,975
> function imagecache_action_load($actionid) {
> return imagecache_action($actionid, TRUE);
> }
>
909,910c977,978
< if ($action['actionid']) {
< db_query('UPDATE {imagecache_action} SET weight=%d, data=\'%s\' WHERE actionid=%d', $action['weight'], serialize($action['data']), $action['actionid']);
---
> if (!empty($action['actionid'])) {
> drupal_write_record('imagecache_action', $action, 'actionid');
913,914c981
< $action['actionid'] = db_next_id('{imagecache_action}_actionid');
< db_query('INSERT INTO {imagecache_action} (actionid, presetid, weight, action, data) VALUES (%d, %d, %d,\'%s\', \'%s\')', $action['actionid'], $action['presetid'], $action['weight'], $action['action'], serialize($action['data']));
---
> drupal_write_record('imagecache_action', $action);
928,929d994
<
<
Index: imagecache_actions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_actions.inc,v
retrieving revision 1.11
diff -r1.11 imagecache_actions.inc
5c5
< * Imagecache Scale
---
> * Imagecache Scale
19c19
< $output = theme_imagecache_resize($element) . ', upscale: '.
---
> $output = theme_imagecache_resize($element) . ', upscale: '.
120c120
< * Imagecache Crop
---
> * Imagecache Crop
122a123,128
> $data += array(
> 'width' => '',
> 'height' => '',
> 'xoffset' => '',
> 'yoffset' => '',
> );
187c193
< * Imagecache Rotate
---
> * Imagecache Rotate
Index: imagecache_ui.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.info,v
retrieving revision 1.3
diff -r1.3 imagecache_ui.info
4c4,5
< dependencies = imagecache imageapi
---
> dependencies[] = imagecache
> dependencies[] = imageapi
6c7
<
---
> core = 6.x
Index: imagecache_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.module,v
retrieving revision 1.10
diff -r1.10 imagecache_ui.module
9,10c9,10
< function imagecache_ui_help($section) {
< switch ($section) {
---
> function imagecache_ui_help($path, $arg) {
> switch($path) {
15c15
< function imagecache_ui_menu($may_cache) {
---
> function imagecache_ui_menu() {
17,102c17,87
< if ($may_cache) {
< $items[] = array(
< 'path' => 'admin/build/imagecache',
< 'title' => t('Imagecache Presets'),
< 'description' => t('Administer imagecache presets and actions.'),
< 'callback' => 'imagecache_ui_presets',
< 'access' => user_access('administer imagecache'),
<
< );
< $items[] = array(
< 'path' => 'admin/build/imagecache/list',
< 'title' => t('List'),
< 'type' => MENU_DEFAULT_LOCAL_TASK,
< 'weight' => -10,
< );
< $items[] = array(
< 'path' => 'admin/build/imagecache/add',
< 'title' => t('Add New Preset'),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_preset_add_form'),
< 'access' => user_access('administer imagecache'),
< 'type' => MENU_LOCAL_TASK,
< );
< }
< // Use Dynamic menu items to get better breadcrumb trails by default.
< elseif (arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'imagecache' && arg(3) == 'preset') {
< $preset = imagecache_preset(arg(4));
< if (empty($preset)) {
< return $items;
< }
< $t = array('!presetname' => $preset['presetname']);
< $items[] = array(
< 'path' => 'admin/build/imagecache/preset/'. arg(4) .'/delete',
< 'title' => t('Delete Preset: !presetname', $t),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_preset_delete_form', arg(4)),
< 'type' => MENU_CALLBACK,
< );
< $items[] = array(
< 'path' => 'admin/build/imagecache/preset/'. arg(4) .'/flush',
< 'title' => t('Flush Preset: !presetname', $t),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_preset_flush_form', arg(4)),
< 'access' => user_access('flush imagecache'),
< 'type' => MENU_CALLBACK,
< );
< $items[] = array(
< 'path' => 'admin/build/imagecache/preset/'. arg(4),
< 'title' => t('!presetname', $t),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_preset_form', arg(4)),
< 'type' => MENU_CALLBACK,
< );
<
< $definition = imagecache_action_definition(arg(7));
< if (!empty($definition)) {
< $t['!action'] = $definition['name'];
< $items[] = array(
< 'path' => 'admin/build/imagecache/preset/'. arg(4) .'/action/add/'. arg(7),
< 'title' => t('Add !action to !presetname', $t),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_action_add_form', arg(4), arg(7)),
< 'type' => MENU_CALLBACK,
< );
< }
<
< $action = imagecache_action(arg(6));
< if ($action) {
< $t['!action'] = $action['name'];
< $items[] = array(
< 'path' => 'admin/build/imagecache/preset/'. arg(4) .'/action/'. arg(6),
< 'title' => t('!action for preset !presetname', $t),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_action_form', arg(6)),
< 'type' => MENU_CALLBACK,
< );
<
< $items[] = array(
< 'path' => 'admin/build/imagecache/preset/'. arg(4) .'/action/'. arg(6) .'/delete',
< 'title' => t('Delete !action for preset !presetname', $t),
< 'callback' => 'drupal_get_form',
< 'callback arguments' => array('imagecache_ui_action_delete_form', arg(4), arg(6)),
< 'type' => MENU_CALLBACK,
< );
< }
< }
---
> $items['admin/build/imagecache'] = array(
> 'title' => 'Imagecache presets',
> 'description' => 'Administer imagecache presets and actions.',
> 'page callback' => 'imagecache_ui_presets',
> 'access arguments' => array('administer imagecache'),
> );
> $items['admin/build/imagecache/list'] = array(
> 'title' => 'List',
> 'type' => MENU_DEFAULT_LOCAL_TASK,
> 'weight' => -10,
> );
>
> $items['admin/build/imagecache/add'] = array(
> 'title' => 'Add new preset',
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_preset_add_form'),
> 'access arguments' => array('administer imagecache'),
> 'type' => MENU_LOCAL_TASK,
> );
>
> $items['admin/build/imagecache/preset/%imagecache_preset'] = array(
> 'title callback' => 'imagecache_preset_title_callback',
> 'title arguments' => array('Edit preset: !presetname', 4),
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_preset_form', 4),
> 'access arguments' => array('administer imagecache'),
> 'type' => MENU_CALLBACK,
> );
> $items['admin/build/imagecache/preset/%imagecache_preset/delete'] = array(
> 'title callback' => 'imagecache_preset_title_callback',
> 'title arguments' => array('Delete preset: !presetname', 4),
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_preset_delete_form', 4),
> 'access arguments' => array('administer imagecache'),
> 'type' => MENU_CALLBACK,
> );
> $items['admin/build/imagecache/preset/%imagecache_preset/flush'] = array(
> 'title callback' => 'imagecache_preset_title_callback',
> 'title arguments' => array('Flush preset: !presetname', 4),
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_preset_flush_form', 4),
> 'access arguments' => array('flush imagecache'),
> 'type' => MENU_CALLBACK,
> );
>
> $items['admin/build/imagecache/preset/%imagecache_preset/action-add/%'] = array(
> 'title callback' => 'imagecache_preset_title_callback',
> 'title arguments' => array('Add !actionname to !presetname', 4, 6),
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_action_add_form', 4, 6),
> 'access arguments' => array('administer imagecache'),
> 'type' => MENU_CALLBACK,
> );
>
> $items['admin/build/imagecache/preset/%imagecache_preset/action/%imagecache_action'] = array(
> 'title callback' => 'imagecache_preset_title_callback',
> 'title arguments' => array('!action for preset !presetname', 4, 6),
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_action_form', 4, 6),
> 'access arguments' => array('administer imagecache'),
> 'type' => MENU_CALLBACK,
> );
>
> $items['admin/build/imagecache/preset/%imagecache_preset/action-delete/%imagecache_action'] = array(
> 'title callback' => 'imagecache_preset_title_callback',
> 'title arguments' => array('Delete !action for preset !presetname', 4, 6),
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('imagecache_ui_action_delete_form', 4, 6),
> 'access arguments' => array('administer imagecache'),
> 'type' => MENU_CALLBACK,
> );
105a91,121
> function imagecache_preset_title_callback($title, $preset = array(), $action = array()) {
> $replacements = array();
> if (!empty($preset)) {
> $replacements['!presetname'] = $preset['presetname'];
> $replacements['!presetid'] = $preset['presetid'];
> }
> if (!empty($action) && !is_array($action)) {
> $replacements['!actionname'] = $action;
> }
> elseif (!empty($action)) {
> $replacements['!action'] = $action['action'];
> }
> return t($title, $replacements);
> }
>
> /**
> * Implementation of hook_theme().
> */
> function imagecache_ui_theme() {
> return array(
> 'imagecache_admin_title' => array(
> 'arguments' => array(
> 'element' => NULL,
> )),
> 'imagecache_ui_preset_actions' => array(
> 'arguments' => array(
> 'form' => NULL,
> )),
> );
> }
>
123a140
>
127c144
< function imagecache_ui_preset_add_form($presetid = 0) {
---
> function imagecache_ui_preset_add_form($form_state) {
144,145c161,162
< function imagecache_ui_preset_add_form_submit($id, $form_values) {
< $preset = array('presetname' => $form_values['presetname']);
---
> function imagecache_ui_preset_add_form_submit($form, &$form_state) {
> $preset = array('presetname' => $form_state['values']['presetname']);
148c165
< return 'admin/build/imagecache/preset/'. $preset['presetid'];
---
> $form_state['redirect'] = 'admin/build/imagecache/preset/'. $preset['presetid'];
164,167c181,182
< function imagecache_ui_preset_delete_form($presetid) {
< $preset = imagecache_preset($presetid);
<
< if (!$preset) {
---
> function imagecache_ui_preset_delete_form($form_state, $preset = array()) {
> if (empty($preset)) {
176c191
< t('Are you sure you want to delete the preset %preset?',
---
> t('Are you sure you want to delete the preset %preset?',
179c194
< 'admin/build/imagecache',
---
> 'admin/build/imagecache',
181c196
< t('Delete'), t('Cancel')
---
> t('Delete'), t('Cancel')
185,187c200,202
< function imagecache_ui_preset_delete_form_submit($form_id, $form_values) {
< $preset = imagecache_preset($form_values['presetid']);
< imagecache_preset_delete($preset);
---
> function imagecache_ui_preset_delete_form_submit($form, &$form_state) {
> $preset = imagecache_preset($form_state['values']['presetid']);
> imagecache_preset_delete($preset);
189c204
< return 'admin/build/imagecache';
---
> $form_state['redirect'] = 'admin/build/imagecache';
192,195c207,208
< function imagecache_ui_preset_flush_form($presetid) {
< $preset = imagecache_preset($presetid);
<
< if (!$preset) {
---
> function imagecache_ui_preset_flush_form(&$form_state, $preset = array()) {
> if (empty($preset)) {
197c210
< drupal_goto('admin/build/imagecache');
---
> $form_state['redirect'] = 'admin/build/imagecache';
204c217
< t('Are you sure you want to flush the preset %preset?',
---
> t('Are you sure you want to flush the preset %preset?',
207c220
< 'admin/build/imagecache',
---
> 'admin/build/imagecache',
209c222
< t('Flush'), t('Cancel')
---
> t('Flush'), t('Cancel')
213,215c226,228
< function imagecache_ui_preset_flush_form_submit($form_id, $form_values) {
< $preset = imagecache_preset($form_values['presetid']);
< imagecache_preset_flush($preset);
---
> function imagecache_ui_preset_flush_form_submit($form, &$form_state) {
> $preset = imagecache_preset($form_state['values']['presetid']);
> imagecache_preset_flush($preset);
217c230
< return 'admin/build/imagecache';
---
> $form_state['redirect'] = 'admin/build/imagecache';
224,227c237,238
< function imagecache_ui_preset_form($presetid) {
< $preset = imagecache_preset($presetid, true);
<
< if (!$preset) {
---
> function imagecache_ui_preset_form($form_state, $preset = array()) {
> if (empty($preset)) {
253d263
<
293c303
< '#value' => l(t('Delete'), 'admin/build/imagecache/preset/'. $action['presetid'] .'/action/'. $action['actionid'] .'/delete'),
---
> '#value' => l(t('Delete'), 'admin/build/imagecache/preset/'. $action['presetid'] .'/action-delete/'. $action['actionid']),
295,297c305,307
< $form['actions'][$i] = $action_form;
< }
<
---
> $form['actions'][$i] = $action_form;
> }
>
312,313c322,323
< '#value' => l(t('Add !action', array('!action' => $definition['name'])),
< 'admin/build/imagecache/preset/'. $preset['presetid'] .'/action/add/'. $action) .
---
> '#value' => l(t('Add !action', array('!action' => $definition['name'])),
> 'admin/build/imagecache/preset/'. $preset['presetid'] .'/action-add/'. $action) .
321c331
<
---
>
334c344
<
---
>
340c350
< '#value' => '
',
---
> '#value' => '
',
363,364c373,374
< function theme_imagecache_ui_preset_actions($element) {
< $header = array(t('Action'), t('Settings'), t('Weight'), '', '');
---
> function theme_imagecache_ui_preset_actions($form) {
> $header = array(t('Action'), t('Settings'), t('Weight'), '','');
366c376,379
< foreach (element_children($element) as $key) {
---
> foreach(element_children($form) as $key) {
> if (!is_numeric($key)) {
> continue;
> }
368,373c381,390
< $row[] = drupal_render($element[$key]['name']);
< $row[] = drupal_render($element[$key]['settings']);
< $row[] = drupal_render($element[$key]['weight']);
< $row[] = drupal_render($element[$key]['configure']);
< $row[] = drupal_render($element[$key]['remove']);
< $rows[] = $row;
---
> $form[$key]['weight']['#attributes']['class'] = 'imagecache-action-order-weight';
> $row[] = drupal_render($form[$key]['name']);
> $row[] = drupal_render($form[$key]['settings']);
> $row[] = drupal_render($form[$key]['weight']);
> $row[] = drupal_render($form[$key]['configure']);
> $row[] = drupal_render($form[$key]['remove']);
> $rows[] = array(
> 'data' => $row,
> 'class' => 'draggable',
> );
375,376c392,394
< $output .= theme('table', $header, $rows);
< $output .= drupal_render($element);
---
> $output = theme('table', $header, $rows, array('id' => 'imagecache-preset-actions'));
> drupal_add_tabledrag('imagecache-preset-actions', 'order', 'sibling', 'imagecache-action-order-weight');
> $output .= drupal_render($form);
380,382c398,400
< function imagecache_ui_preset_form_submit($form_id, $form_values) {
< if (isset($form_values['actions'])) {
< foreach ($form_values['actions'] as $action) {
---
> function imagecache_ui_preset_form_submit($form, &$form_state) {
> if (isset($form_state['values']['actions'])) {
> foreach($form_state['values']['actions'] as $action) {
386,387c404,405
< imagecache_preset_save($form_values);
< return 'admin/build/imagecache/preset/'. $form_values['presetid'];
---
> imagecache_preset_save($form_state['values']);
> $form_state['redirect'] = 'admin/build/imagecache/preset/'. $form_state['values']['presetid'];
390c408
< function imagecache_ui_action_form($actionid) {
---
> function imagecache_ui_action_form($form_state, $preset, $action) {
392,393c410,411
<
< if (!$action = imagecache_action($actionid)) {
---
>
> if (empty($action)) {
396c414
< }
---
> }
398c416
< if (!$preset = imagecache_preset($action['presetid'])) {
---
> if (empty($preset)) {
402c420
<
---
>
413c431
< if ($definitions[$action['action']]['file']) {
---
> if (!empty($definitions[$action['action']]['file'])) {
421c439
< return $form;
---
> return $form;
424,426c442,444
< function imagecache_ui_action_form_submit($form_id, $form_values) {
< if ($action = imagecache_action($form_values['actionid'])) {
< $action = array_merge($action, $form_values);
---
> function imagecache_ui_action_form_submit($form, &$form_state) {
> if ($action = imagecache_action($form_state['values']['actionid'])) {
> $action = array_merge($action, $form_state['values']);
429c447,451
< return 'admin/build/imagecache/preset/'. $action['presetid'];
---
> $form_state['redirect'] = 'admin/build/imagecache/preset/'. $action['presetid'];
> }
> else {
> drupal_set_message('Unknown Action: '. $form_state['values']['actionid']);
> $form_state['redirect'] = 'admin/build/imagecache';
431,432d452
< drupal_set_message('Unknown Action: '. $form_values['actionid']);
< return 'admin/build/imagecache';
435,436c455,456
< function imagecache_ui_action_delete_form($presetid, $actionid) {
< if (!$action = imagecache_action($actionid)) {
---
> function imagecache_ui_action_delete_form($form_state, $preset = array(), $action = array()) {
> if (empty($action)) {
439,440c459,460
< }
< if (!$preset = imagecache_preset($action['presetid'])) {
---
> }
> if (empty($preset)) {
449c469
< t('Are you sure you want to delete the !action action from preset !preset?',
---
> t('Are you sure you want to delete the !action action from preset !preset?',
452c472
< 'admin/build/imagecache',
---
> 'admin/build/imagecache',
454c474
< t('Delete'), t('Cancel')
---
> t('Delete'), t('Cancel')
459,460c479,480
< function imagecache_ui_action_delete_form_submit($form_id, $form_values) {
< $action = imagecache_action($form_values['actionid']);
---
> function imagecache_ui_action_delete_form_submit($form, &$form_state) {
> $action = imagecache_action($form_state['values']['actionid']);
463c483
< return 'admin/build/imagecache/preset/'. $action['presetid'];
---
> $form_state['redirect'] = 'admin/build/imagecache/preset/'. $action['presetid'];
466c486
< function imagecache_ui_action_add_form($presetid, $actionname) {
---
> function imagecache_ui_action_add_form($form_state, $preset, $actionname) {
468c488
<
---
>
478c498
< '#value' => $presetid,
---
> '#value' => $preset['presetid'],
483c503
< );
---
> );
485c505
< $form['data'] = call_user_func($actionname .'_form', $action['data']);
---
> $form['data'] = call_user_func($actionname .'_form', array());
490c510
< return $form;
---
> return $form;
494,496c514,516
< function imagecache_ui_action_add_form_submit($form_id, $form_values) {
< imagecache_action_save($form_values);
< return 'admin/build/imagecache/preset/'. $form_values['presetid'];
---
> function imagecache_ui_action_add_form_submit($form, &$form_state) {
> imagecache_action_save($form_state['values']);
> $form_state['redirect'] = 'admin/build/imagecache/preset/'. $form_state['values']['presetid'];