From cf686f3d30b013a80569b743ffaf0660cc068e33 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Thu, 3 Jun 2010 18:42:47 +0000
Subject: [PATCH] Update imce module to 7.x-1.0-alpha2

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@91 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 sites/all/modules/imce/README.txt             |  7 +-
 sites/all/modules/imce/css/imce-content.css   | 15 ++--
 sites/all/modules/imce/imce.info              |  6 +-
 sites/all/modules/imce/imce.install           | 23 +++++-
 sites/all/modules/imce/imce.module            | 72 ++++++++++++++-----
 sites/all/modules/imce/inc/imce.admin.inc     | 14 +++-
 .../modules/imce/inc/imce.core.profiles.inc   | 10 +--
 sites/all/modules/imce/inc/imce.page.inc      | 39 +++++++++-
 sites/all/modules/imce/js/imce.js             | 12 ++--
 sites/all/modules/imce/js/imce_extras.js      | 51 ++++++++-----
 sites/all/modules/imce/js/imce_set_app.js     |  6 +-
 .../all/modules/imce/tpl/imce-content.tpl.php |  4 +-
 12 files changed, 188 insertions(+), 71 deletions(-)

diff --git a/sites/all/modules/imce/README.txt b/sites/all/modules/imce/README.txt
index 455318ac..19bb9a96 100644
--- a/sites/all/modules/imce/README.txt
+++ b/sites/all/modules/imce/README.txt
@@ -1,4 +1,4 @@
-// $Id: README.txt,v 1.13 2010/03/17 21:36:38 ufku Exp $
+// $Id: README.txt,v 1.15 2010/04/10 12:36:20 ufku Exp $
 
 IMCE
 http://drupal.org/project/imce
@@ -12,7 +12,7 @@ See INTEGRATION METHODS for more information.
 
 FEATURES
 -----------
- -Basic file operations: upload, delete
+- Basic file operations: upload, delete
 - Image(jpg, png, gif) operations: resize, create thumbnails, preview
 - Support for private file system
 - Configurable limits for user roles: file size per upload, directory quota, file extensions, and image dimensions
@@ -33,7 +33,8 @@ INSTALLATION
 2) Enable the module at: /admin/build/modules
 3) Create configuration profiles and assign them to user roles at /admin/config/media/imce
 4) Test it at /imce.
-5) See INTEGRATION METHODS to make IMCE collaborate with your application if it's not already integrated.
+5) See imce-content.tpl.php for some configuration options such as absolute URLs ad inline previewing.
+6) See INTEGRATION METHODS to make IMCE collaborate with your application if it's not already integrated.
 Notes:
  - When you configure IMCE for inline image/file insertion into textareas there should appear an IMCE link under each textarea you specified.
  - If you are uploading files containing unicode characters, it is strongly recommended to use the transliteration module that sanitizes filenames by converting characters from unicode to us-ascii. http://drupal.org/project/transliteration
diff --git a/sites/all/modules/imce/css/imce-content.css b/sites/all/modules/imce/css/imce-content.css
index 2e96904f..42543596 100644
--- a/sites/all/modules/imce/css/imce-content.css
+++ b/sites/all/modules/imce/css/imce-content.css
@@ -1,4 +1,4 @@
-/* $Id: imce-content.css,v 1.2 2010/03/17 20:55:38 ufku Exp $ */
+/* $Id: imce-content.css,v 1.5 2010/05/15 13:31:16 ufku Exp $ */
 
 /*Body*/
 body.imce {
@@ -22,7 +22,6 @@ body.imce {
 #imce-content {
   position: relative;
   background-color: #fff;
-  max-width: 760px;
 }
 #imce-content a {
   text-decoration: none;
@@ -87,7 +86,6 @@ body.imce {
   height: 180px;
   overflow: auto;
 }
-#content-resizer {}
 
 /*columns of browse-wrapper*/
 #navigation-wrapper {
@@ -257,7 +255,7 @@ body.imce {
 
 /*File operations*/
 #op-items {
-  min-height: 16px;
+  min-height: 26px;
 }
 #op-contents {
   position: absolute;
@@ -265,7 +263,7 @@ body.imce {
 }
 #op-contents .op-content {
   display: none;
-  padding: 14px;
+  padding: 16px;
   border: 2px solid #344454;
   background-color: #f5f5f5;
   position: relative;
@@ -276,8 +274,8 @@ body.imce {
   z-index: 3;
   top: 2px;
   right: 2px;
-  width: 14px;
-  height: 14px;
+  width: 16px;
+  height: 16px;
   background: url(close.png) no-repeat 50% 50%;
   visibility: hidden;
 }
@@ -320,6 +318,9 @@ body.imce {
 #op-item-delete a {
   background-image: url(delete.png);
 }
+#op-item-sendto a {
+  background-image: url(sendto.png);
+}
 
 /*resizers*/
 #imce-content .y-resizer {
diff --git a/sites/all/modules/imce/imce.info b/sites/all/modules/imce/imce.info
index 81b3cbe0..130f5561 100644
--- a/sites/all/modules/imce/imce.info
+++ b/sites/all/modules/imce/imce.info
@@ -9,9 +9,9 @@ files[] = "imce.module"
 files[] = "inc/imce.admin.inc"
 files[] = "inc/imce.page.inc"
 
-; Information added by drupal.org packaging script on 2010-03-17
-version = "7.x-1.0-alpha1"
+; Information added by drupal.org packaging script on 2010-05-29
+version = "7.x-1.0-alpha2"
 core = "7.x"
 project = "imce"
-datestamp = "1268868306"
+datestamp = "1275125108"
 
diff --git a/sites/all/modules/imce/imce.install b/sites/all/modules/imce/imce.install
index eaa644c9..3c3256e2 100644
--- a/sites/all/modules/imce/imce.install
+++ b/sites/all/modules/imce/imce.install
@@ -1,5 +1,5 @@
 <?php
-// $Id: imce.install,v 1.4 2010/03/17 21:36:38 ufku Exp $
+// $Id: imce.install,v 1.6 2010/05/29 08:23:20 ufku Exp $
 
 /**
  * @file
@@ -24,11 +24,32 @@ function imce_uninstall() {
   variable_del('imce_settings_textarea');
   variable_del('imce_settings_replace');
   variable_del('imce_settings_thumb_method');
+  variable_del('imce_settings_disable_private');
   variable_del('imce_custom_content');
   variable_del('imce_custom_process');
   variable_del('imce_custom_scan');
 }
 
+/**
+ * Implements hook_schema().
+ */
+function imce_schema() {
+  $schema['imce_files'] = array(
+    'description' => 'Stores files created by IMCE.',
+    'fields' => array(
+      'fid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => 'The {files}.fid that belongs to IMCE.',
+      ),
+    ),
+    'primary key' => array('fid'),
+  );
+  return $schema;
+}
+
 /**
  * Updates from 6.x to 7.x.
  */
diff --git a/sites/all/modules/imce/imce.module b/sites/all/modules/imce/imce.module
index 44156ab8..680e6957 100644
--- a/sites/all/modules/imce/imce.module
+++ b/sites/all/modules/imce/imce.module
@@ -1,5 +1,5 @@
 <?php
-// $Id: imce.module,v 1.26 2010/03/17 22:07:09 ufku Exp $
+// $Id: imce.module,v 1.32 2010/05/29 08:23:20 ufku Exp $
 
 /**
  * @file
@@ -19,6 +19,16 @@ function imce_menu() {
     'file' => 'inc/imce.page.inc',
     'type' => MENU_CALLBACK,
   );
+  $items['user/%user/imce'] = array(
+    'title' => 'File browser',
+    'page callback' => 'imce_user_page',
+    'page arguments' => array(1),
+    'access callback' => 'imce_user_page_access',
+    'access arguments' => array(1),
+    'file' => 'inc/imce.page.inc',
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 10,
+  );
   $items['admin/config/media/imce'] = array(
     'title' => 'IMCE',
     'description' => 'Control how your image/file browser works.',
@@ -43,7 +53,7 @@ function imce_permission() {
   return array(
     'administer imce' => array(
       'title' => t('Administer IMCE'),
-      'description' => t('Warning: Give to trusted roles only; this permission has security implications.'),
+      'restrict access' => TRUE,
     ),
   );
 }
@@ -59,6 +69,9 @@ function imce_theme() {
   $theme['imce_root_text'] = array(
     'variables' => array('imce_ref' => NULL),
   );
+  $theme['imce_user_page'] = array(
+    'variables' => array('account' => NULL),
+  );
   $theme['imce_file_list'] = array(
     'template' => 'imce-file-list',
     'variables' => array('imce_ref' => NULL),
@@ -79,12 +92,36 @@ function imce_theme() {
 
 /**
  * Implements hook_file_download().
+ * Support private downloads if not disabled.
  */
 function imce_file_download($uri) {
-  return array(
-    'Content-type' => file_get_mimetype($uri),
-    'Content-Length' => filesize($uri),
-  );
+  $serve = file_uri_scheme($uri) == 'private' && !variable_get('imce_settings_disable_private', 1) &&  file_exists($uri);
+  if ($serve) {
+    return array(
+      'Content-type' => file_get_mimetype($uri),
+      'Content-Length' => filesize($uri),
+    );
+  }
+}
+
+/**
+ * Implements hook_file_delete().
+ */
+function imce_file_delete($file) {
+  db_delete('imce_files')->condition('fid', $file->fid)->execute();
+}
+
+/**
+ * Implements of hook_file_references().
+ */
+function imce_file_references($file) {
+  //do not report reference count on internal file deletion
+  if (isset($file->imce_noref) && $file->imce_noref) {
+    return;
+  }
+  if (db_query('SELECT 1 FROM {imce_files} WHERE fid = :fid', array(':fid' => $file->fid))->fetchField()) {
+    return array('imce' => 1);
+  }
 }
 
 /**
@@ -98,11 +135,7 @@ function imce_element_info() {
  * Inline image/link insertion to textareas.
  */
 function imce_textarea($element) {
-  static $regexp, $done = array();
-  if (isset($done[$element['#id']])) {
-    return $element;
-  }
-  $done[$element['#id']] = TRUE;
+  static $regexp;
   if (!isset($regexp)) {
     $regexp = FALSE;
     if (imce_access() && $regexp = str_replace(' ', '', variable_get('imce_settings_textarea', ''))) {
@@ -207,16 +240,19 @@ function imce_access($user = FALSE) {
 }
 
 /**
- * Check if the directory name is regular.
+ * Checks access to user/{$account->uid}/imce for the $user.
  */
-function imce_reg_dir($dirname) {
-  return $dirname == '.' || (is_string($dirname) && $dirname != '' && !preg_match('@(^\s)|(^/)|(^\./)|(\s$)|(/$)|(/\.$)|(\.\.)|(//)|(\\\\)|(/\./)@', $dirname));
+function imce_user_page_access($account, $user = FALSE) {
+  if ($user === FALSE) {
+    global $user;
+  }
+
+  return $account->uid == $user->uid && ($profile = imce_user_profile($user)) && $profile['usertab'];
 }
 
 /**
- * Returns the text for the root directory in a directory tree.
+ * Check if the directory name is regular.
  */
-function theme_imce_root_text($variables) {
-  //$imce = &$variables['imce_ref']['imce'];
-  return '&lt;' . t('root') . '&gt;';
+function imce_reg_dir($dirname) {
+  return $dirname == '.' || (is_string($dirname) && $dirname != '' && !preg_match('@(^\s)|(^/)|(^\./)|(\s$)|(/$)|(/\.$)|(\.\.)|(//)|(\\\\)|(/\./)@', $dirname));
 }
\ No newline at end of file
diff --git a/sites/all/modules/imce/inc/imce.admin.inc b/sites/all/modules/imce/inc/imce.admin.inc
index ddee1e52..a36a1f29 100644
--- a/sites/all/modules/imce/inc/imce.admin.inc
+++ b/sites/all/modules/imce/inc/imce.admin.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: imce.admin.inc,v 1.2 2010/03/17 21:36:38 ufku Exp $
+// $Id: imce.admin.inc,v 1.4 2010/05/29 02:09:05 ufku Exp $
 
 /**
  * @file
@@ -59,6 +59,12 @@ function imce_admin_form($form, &$form_state) {
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
   );
+  $form['common']['disable_private'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable serving of private files'),
+    '#default_value' => variable_get('imce_settings_disable_private', 1),
+    '#description' => t('IMCE serves all files under private files directory without applying any access restrictions. This allows anonymous access to any file(/system/files/filename) unless there is a module restricting access to the files. Here you can switch this behavior.'),
+  );
   $form['common']['textarea'] = array(
     '#type' => 'textfield',
     '#title' => t('Enable inline image/file insertion into plain textareas'),
@@ -146,6 +152,7 @@ function imce_admin_submit($form, &$form_state) {
   variable_set('imce_settings_textarea', $form_state['values']['textarea']);
   variable_set('imce_settings_replace', $form_state['values']['replace']);
   variable_set('imce_settings_thumb_method', $form_state['values']['thumb_method']);
+  variable_set('imce_settings_disable_private', $form_state['values']['disable_private']);
   drupal_set_message(t('Changes have been saved.'));
 }
 
@@ -201,6 +208,11 @@ function imce_profile_form($form, &$form_state, $pid = 0) {
   $form['import'] = array(
     '#markup' => imce_profile_import_html($pid),
   );
+  $form['usertab'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display file browser tab in user profile pages.'),
+    '#default_value' => $profile['usertab'],
+  );
   $form['filesize'] = array(
     '#type' => 'textfield',
     '#title' => t('Maximum file size per upload'),
diff --git a/sites/all/modules/imce/inc/imce.core.profiles.inc b/sites/all/modules/imce/inc/imce.core.profiles.inc
index db6f0436..39247a31 100644
--- a/sites/all/modules/imce/inc/imce.core.profiles.inc
+++ b/sites/all/modules/imce/inc/imce.core.profiles.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: imce.core.profiles.inc,v 1.2 2010/03/17 21:36:38 ufku Exp $
+// $Id: imce.core.profiles.inc,v 1.3 2010/05/14 19:57:24 ufku Exp $
 
 /**
  * @file
@@ -27,8 +27,8 @@ function imce_install_profiles() {
 /**
  * Construct a profile based on arguments.
  */
-function imce_construct_profile($n, $f, $q, $tq, $e, $d, $fn, $ds, $ts) {
-  $profile = array('name' => $n, 'filesize' => $f, 'quota' => $q, 'tuquota' => $tq, 'extensions' => $e, 'dimensions' => $d, 'filenum' => $fn, 'directories' => array(), 'thumbnails' => array());
+function imce_construct_profile($n, $u, $f, $q, $tq, $e, $d, $fn, $ds, $ts) {
+  $profile = array('name' => $n, 'usertab' => $u, 'filesize' => $f, 'quota' => $q, 'tuquota' => $tq, 'extensions' => $e, 'dimensions' => $d, 'filenum' => $fn, 'directories' => array(), 'thumbnails' => array());
   foreach ($ds as $d) {
     $profile['directories'][] = array('name' => $d[0], 'subnav' => $d[1], 'browse' => $d[2], 'upload' => $d[3], 'thumb' => $d[4], 'delete' => $d[5], 'resize' => $d[6]);
   }
@@ -46,12 +46,12 @@ function imce_user1_profile() {
   if (isset($profiles[1])) {
     return $profiles[1];
   }
-  return  imce_construct_profile('User-1', 0, 0, 0, '*', '1200x1200', 0, array(array('.', 1, 1, 1, 1, 1, 1)), array(array('Small', '90x90', 'small_', ''), array('Medium', '120x120', 'medium_', ''), array('Large', '180x180', 'large_', '')));
+  return  imce_construct_profile('User-1', 1, 0, 0, 0, '*', '1200x1200', 0, array(array('.', 1, 1, 1, 1, 1, 1)), array(array('Small', '90x90', 'small_', ''), array('Medium', '120x120', 'medium_', ''), array('Large', '180x180', 'large_', '')));
 }
 
 /**
  * Default profile.
  */
 function imce_sample_profile() {
-  return imce_construct_profile('Sample profile', 1, 2, 0, 'gif png jpg jpeg', '800x600', 1, array(array('u%uid', 0, 1, 1, 1, 0, 0)), array(array('Thumb', '90x90', 'thumb_', '')));
+  return imce_construct_profile('Sample profile', 1, 1, 2, 0, 'gif png jpg jpeg', '800x600', 1, array(array('u%uid', 0, 1, 1, 1, 0, 0)), array(array('Thumb', '90x90', 'thumb_', '')));
 }
diff --git a/sites/all/modules/imce/inc/imce.page.inc b/sites/all/modules/imce/inc/imce.page.inc
index fedd65aa..b907ce30 100644
--- a/sites/all/modules/imce/inc/imce.page.inc
+++ b/sites/all/modules/imce/inc/imce.page.inc
@@ -1,5 +1,5 @@
 <?php
-// $Id: imce.page.inc,v 1.2 2010/03/17 21:36:38 ufku Exp $
+// $Id: imce.page.inc,v 1.5 2010/05/29 08:23:20 ufku Exp $
 
 /**
  * @file
@@ -16,6 +16,13 @@ function imce($scheme = NULL) {
   exit();
 }
 
+/**
+ * q = user/x/imce.
+ */
+function imce_user_page($account) {
+  return theme('imce_user_page', array('account' => $account));
+}
+
 /**
  * Returns the imce page for the specified user and the file scheme.
  */
@@ -74,7 +81,7 @@ function imce_content($user, $scheme = NULL, $jsop = NULL) {
 
   //make necessary changes for js conversion
   $imce['dir'] = str_replace('%2F', '/', rawurlencode($imce['dir']));
-  unset($imce['files'], $imce['name'], $imce['directories'], $imce['subdirectories'], $imce['filesize'], $imce['quota'], $imce['tuquota'], $imce['thumbnails'], $imce['uid']);
+  unset($imce['files'], $imce['name'], $imce['directories'], $imce['subdirectories'], $imce['filesize'], $imce['quota'], $imce['tuquota'], $imce['thumbnails'], $imce['uid'], $imce['usertab']);
 
   drupal_add_js($imce_ref, 'setting');
 
@@ -100,6 +107,8 @@ function imce_js($user, $scheme, $jsop = '') {
   //messages
   $response['messages'] = drupal_get_messages();
 
+  //disable devel log.
+  $GLOBALS['devel_shutdown'] = FALSE;
   //for upload we must return plain text header.
   drupal_add_http_header('Content-Type', 'text/' . ($jsop == 'upload' ? 'html' : 'javascript') . '; charset=utf-8');
   print drupal_json_encode($response);
@@ -289,6 +298,7 @@ function imce_upload_submit($form, &$form_state) {
     $file->uid = $imce['uid'];//global user may not be the owner.
     $file->status = FILE_STATUS_PERMANENT;
     file_save($file);
+    imce_file_register($file);
     drupal_set_message(t('%filename has been uploaded.', array('%filename' => $file->filename)));
 
     //update file list
@@ -384,6 +394,8 @@ function imce_delete_file($filename, &$imce) {
 
   //file exists in database
   if ($file) {
+    //prevent imce returning ref count
+    $file->imce_noref = TRUE;
     $result = file_delete($file);
     //deletion blocked by an other module.
     if (is_array($result)) {
@@ -516,6 +528,7 @@ function imce_resize_image($filename, &$imce, $width, $height, $copy = TRUE, $de
   if (!$file = file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
     return FALSE;
   }
+  imce_file_register($file);
 
   //update file list
   //if the file was scaled get the new dimensions
@@ -1027,4 +1040,26 @@ function imce_dir_uri($imce, $dir = NULL) {
     $dir = $imce['dir'];
   }
   return $imce['scheme'] . '://' . ($dir == '.' ? '' : $dir . '/');
+}
+
+/**
+ * Returns the text for the root directory in a directory tree.
+ */
+function theme_imce_root_text($variables) {
+  //$imce = &$variables['imce_ref']['imce'];
+  return '&lt;' . t('root') . '&gt;';
+}
+
+/**
+ * Returns the html for user's file browser tab.
+ */
+function theme_imce_user_page($variables) {
+  return '<iframe src="' . url('imce') . '" frameborder="0" style="border: 1px solid #eee; width: 99%; height: 520px" class="imce-frame"></iframe>';
+}
+
+/**
+ * Registers the file as an IMCE file.
+ */
+function imce_file_register($file) {
+  return $file->fid && @db_insert('imce_files')->fields(array('fid' => $file->fid))->execute();
 }
\ No newline at end of file
diff --git a/sites/all/modules/imce/js/imce.js b/sites/all/modules/imce/js/imce.js
index 8341d899..c67866a2 100644
--- a/sites/all/modules/imce/js/imce.js
+++ b/sites/all/modules/imce/js/imce.js
@@ -1,4 +1,4 @@
-// $Id: imce.js,v 1.16 2010/03/17 20:55:38 ufku Exp $
+// $Id: imce.js,v 1.19 2010/05/29 08:24:01 ufku Exp $
 
 (function($) {
 //Global container.
@@ -442,7 +442,7 @@ uploadValidate: function (data, form, options) {
 
 //settings for upload
 uploadSettings: function () {
-  return {beforeSubmit: imce.uploadValidate, success: function (response) {imce.processResponse(Drupal.parseJson(response));}, complete: function () {imce.fopLoading('upload', false);}, resetForm: true};
+  return {beforeSubmit: imce.uploadValidate, success: function (response) {imce.processResponse($.parseJSON(response));}, complete: function () {imce.fopLoading('upload', false);}, resetForm: true};
 },
 
 /**************** FILE OPS  ********************/
@@ -521,18 +521,18 @@ setPreview: function (fid) {
 
 //default file send function. sends the file to the new window.
 send: function (fid) {
-  if (fid) window.open(imce.getURL(fid));
+  fid && window.open(imce.getURL(fid));
 },
 
 //add an operation for an external application to which the files are send.
 setSendTo: function (title, func) {
-  imce.send = function (fid) { if(fid) func(imce.fileGet(fid), window);};
+  imce.send = function (fid) { fid && func(imce.fileGet(fid), window);};
   var opFunc = function () {
     if (imce.selcount != 1) return imce.setMessage(Drupal.t('Please select a file.'), 'error');
     imce.send(imce.vars.prvfid);
   };
   imce.vars.prvtitle = title;
-  return imce.opAdd({'title': title, func: opFunc});
+  return imce.opAdd({name: 'sendto', title: title, func: opFunc});
 },
 
 /**************** LOG MESSAGES  ********************/
@@ -752,6 +752,8 @@ updateUI: function() {
   //log
   $('#log-prv-wrapper').before($('#log-prv-wrapper > #preview-wrapper')).remove();
   $('#log-clearer').remove();
+  //content resizer
+  $('#content-resizer').remove();
   //message-box
   imce.msgBox = imce.el('message-box') || $('<div id="message-box"></div>').prependTo('#imce-content')[0];
   //help box & ie fix
diff --git a/sites/all/modules/imce/js/imce_extras.js b/sites/all/modules/imce/js/imce_extras.js
index 5cf6cbe5..8f7586e5 100644
--- a/sites/all/modules/imce/js/imce_extras.js
+++ b/sites/all/modules/imce/js/imce_extras.js
@@ -1,4 +1,4 @@
-// $Id: imce_extras.js,v 1.4 2010/03/17 21:36:38 ufku Exp $
+// $Id: imce_extras.js,v 1.5 2010/05/15 13:31:16 ufku Exp $
 //This pack implemets: keyboard shortcuts, file sorting, resize bars, and inline thumbnail preview.
 
 (function($) {
@@ -161,12 +161,10 @@ imce.sortNumDsc = function(a, b) {return b-a};
 imce.initiateResizeBars = function () {
   imce.setResizer('navigation-resizer', 'X', 'navigation-wrapper', null, 1);
   imce.setResizer('browse-resizer', 'Y', 'browse-wrapper', 'preview-wrapper', 50);
-  imce.setResizer('content-resizer', 'Y', 'resizable-content', null, 150, imce.resizeRows);
   imce.recallDimensions();
   $(window).unload(function() {
-    imce.cookie('ih1', $(imce.BW).height());
-    imce.cookie('ih2', $(imce.PW).height());
-    imce.cookie('iw1', Math.max($(imce.NW).width(), 1));
+    imce.cookie('imcebwh', $(imce.BW).height());
+    imce.cookie('imcenww', Math.max($(imce.NW).width(), 1));
   });
 };
 
@@ -194,23 +192,38 @@ imce.setResizer = function (resizer, axis, area1, area2, Min, callback) {
   });
 };
 
-//set heights of browse and preview areas.
-imce.resizeRows = function(start, end, Max) {
-  var el = $(imce.BW), h = el.height();
-  var diff = end - start, r = h / start, d = Math.round(diff * r), h1 = Math.max(h + d, 50);
-  el.height(h1);
-  $(imce.PW).height(end - h1 - $(imce.el('browse-resizer')).height() - 1);
+//get&set area dimensions of the last session from the cookie
+imce.recallDimensions = function() {
+  var $body = $(document.body);
+  if (!$body.is('.imce')) return;
+  //row heights
+  imce.recallHeights(imce.cookie('imcebwh') * 1);
+  $(window).resize(function(){imce.recallHeights()});
+  //navigation wrapper
+  var nwOldWidth = imce.cookie('imcenww') * 1;
+  nwOldWidth && $(imce.NW).width(Math.min(nwOldWidth, $body.width() - 10));
 };
 
-//get area dimensions of the last session from the cookie
-imce.recallDimensions = function() {
-  if (h1 = imce.cookie('ih1')*1) {
-    var h2 = imce.cookie('ih2')*1, w1 = imce.cookie('iw1')*1, w2 = imce.cookie('iw2')*1;
-    var el = $(imce.BW), h = el.height(), w = el.width();
-    $(imce.NW).width(Math.min(w1, w-5));
-    el.height(h1);
-    $(imce.PW).height(h2);
+//set row heights with respect to window height
+imce.recallHeights = function(bwFixedHeight) {
+  //window & body dimensions
+  var winHeight = $.browser.opera ? window.innerHeight : $(window).height();
+  var bodyHeight = $(document.body).outerHeight(true);
+  var diff = winHeight - bodyHeight;
+  var bwHeight = $(imce.BW).height(), pwHeight = $(imce.PW).height();
+  if (bwFixedHeight) {
+    //row heights
+    diff -= bwFixedHeight - bwHeight;
+    bwHeight = bwFixedHeight;
+    pwHeight += diff;
+  }
+  else {
+    diff = parseInt(diff/2);
+    bwHeight += diff;
+    pwHeight += diff;
   }
+  $(imce.BW).height(bwHeight);
+  $(imce.PW).height(pwHeight);
 };
 
 //cookie get & set
diff --git a/sites/all/modules/imce/js/imce_set_app.js b/sites/all/modules/imce/js/imce_set_app.js
index 6c5ef31d..38a317b9 100644
--- a/sites/all/modules/imce/js/imce_set_app.js
+++ b/sites/all/modules/imce/js/imce_set_app.js
@@ -1,4 +1,4 @@
-// $Id: imce_set_app.js,v 1.4 2010/03/17 20:55:38 ufku Exp $
+// $Id: imce_set_app.js,v 1.5 2010/04/03 16:04:41 ufku Exp $
 /*
  * IMCE Integration by URL
  * Ex-1: http://example.com/imce?app=XEditor|url@urlFieldId|width@widthFieldId|height@heightFieldId
@@ -55,9 +55,7 @@ imce.hooks.load.push(function(win) {
     imce.highlight(filename.substr(filename.lastIndexOf('/')+1));
   }
   //set send to
-  if (sendtoFunc) {
-    imce.setSendTo(Drupal.t('Send to @app', {'@app': appName}), sendtoFunc);
-  }
+  sendtoFunc && imce.setSendTo(Drupal.t('Insert file'), sendtoFunc);
 });
 
 //sendTo function
diff --git a/sites/all/modules/imce/tpl/imce-content.tpl.php b/sites/all/modules/imce/tpl/imce-content.tpl.php
index daa6011a..00a1c51d 100644
--- a/sites/all/modules/imce/tpl/imce-content.tpl.php
+++ b/sites/all/modules/imce/tpl/imce-content.tpl.php
@@ -1,5 +1,5 @@
 <?php
-// $Id: imce-content.tpl.php,v 1.10 2010/03/17 21:36:39 ufku Exp $
+// $Id: imce-content.tpl.php,v 1.11 2010/05/15 13:31:16 ufku Exp $
 $imce =& $imce_ref['imce'];//keep this line.
 ?>
 
@@ -100,8 +100,6 @@ $imce =& $imce_ref['imce'];//keep this line.
 
 </div><!-- resizable-content -->
 
-<div id="content-resizer" class="y-resizer"></div>
-
 <div id="forms-wrapper"><?php print $forms; ?></div>
 
 </div><!-- imce-content -->
\ No newline at end of file
-- 
GitLab