Index: img_assist.admin.js =================================================================== RCS file: img_assist.admin.js diff -N img_assist.admin.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ img_assist.admin.js 22 Jul 2008 23:47:41 -0000 @@ -0,0 +1,22 @@ +/* $Id: img_assist.js,v 1.6.4.2 2008/07/22 23:08:13 sun Exp $ */ + +Drupal.behaviors.img_assistAdmin = function(context) { + // Dynamically enable/disable image browser default view options. + $('#edit-img-assist-views:not(.img_assist-processed)', context).each(function() { + $(this).addClass('img_assist-processed').change(function () { + $defaults = $('#edit-img-assist-views-default', context) + $('option', this).each(function () { + if (!this.selected) { + var $option = $('option[value="'+ this.value +'"]', $defaults).attr('disabled', true); + if ($option.is(':selected')) { + $option.attr('selected', false); + } + } + else { + $('option[value="'+ this.value +'"]', $defaults).attr('disabled', false); + } + }); + }).change(); + }); +} + Index: img_assist.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/img_assist.module,v retrieving revision 1.75.2.7 diff -u -p -r1.75.2.7 img_assist.module --- img_assist.module 22 Jul 2008 23:08:13 -0000 1.75.2.7 +++ img_assist.module 23 Jul 2008 00:09:22 -0000 @@ -212,6 +212,8 @@ function img_assist_block($op = 'list', * Implementation of hook_settings(). */ function img_assist_admin_settings() { + drupal_add_js(drupal_get_path('module', 'img_assist') .'/img_assist.admin.js'); + // Access settings. $form['access'] = array( '#type' => 'fieldset', @@ -284,6 +286,13 @@ function img_assist_admin_settings() { '#required' => TRUE, '#description' => t('Select the views to use for selecting images.'), ); + $form['access']['img_assist_views_default'] = array( + '#type' => 'select', + '#title' => t('Default image browser view'), + '#default_value' => variable_get('img_assist_views_default', (!empty($options['img_assist_browser']) ? drupal_map_assoc(array('img_assist_browser')) : 0)), + '#options' => array(0 => '<'. t('none') .'>') + $options, + '#description' => t('Select the default view to use upon startup of the image browser.'), + ); if (module_exists('taxonomy')) { $vocs = array(0 => '<'. t('none') .'>'); @@ -545,7 +554,7 @@ function img_assist_loader() { $output .= "\n\n"; $output .= '
\n"; @@ -642,9 +651,10 @@ function img_assist_header_form(&$form_s $options[$view_name] = "$view_title ($view->total_rows)"; } } + $default_view = variable_get('img_assist_views_default', 'img_assist_browser'); $form['browse'] = array( '#type' => 'select', - '#default_value' => 'img_assist_browser/' . $user->uid, + '#default_value' => $default_view != 'img_assist_browser' ? $default_view : 'img_assist_browser/' . $user->uid, '#options' => $options, '#attributes' => array('onchange' => 'parent.onChangeBrowseBy(this)'), ); Index: img_assist_textarea.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/img_assist/img_assist_textarea.js,v retrieving revision 1.4.4.1 diff -u -p -r1.4.4.1 img_assist_textarea.js --- img_assist_textarea.js 18 Jul 2008 22:54:36 -0000 1.4.4.1 +++ img_assist_textarea.js 23 Jul 2008 00:09:16 -0000 @@ -38,7 +38,7 @@ function initLoader() { } } } - frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/img_assist_browser'; + frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/' + frames['img_assist_header'].window.document.forms[0].browse.value; } function initProperties() {