diff --git a/sites/all/modules/imce/README.txt b/sites/all/modules/imce/README.txt index 76fbf2bbdfd01c0599eb532090df8d1bbfc32aae..acdd5af711c649ba199d2947700ff96781fe237f 100644 --- a/sites/all/modules/imce/README.txt +++ b/sites/all/modules/imce/README.txt @@ -1,4 +1,4 @@ -// $Id: README.txt,v 1.17 2010/06/19 15:12:34 ufku Exp $ +// $Id: README.txt,v 1.18 2010/10/06 04:42:57 ufku Exp $ IMCE http://drupal.org/project/imce @@ -68,8 +68,8 @@ Install http://drupal.org/project/imce_wysiwyg bridge module and enable IMCE as BUEditor: IMCE is integrated in image and link dialogs. -FCKeditor(without WYSIWYG): -Fckeditor profile->File browser settings->IMCE integration +(F)CKeditor(without WYSIWYG): +(F)ckeditor profile->File browser settings->IMCE integration If your application is not one of the above, please keep reading in order to learn how to integrate IMCE. diff --git a/sites/all/modules/imce/css/imce-content.css b/sites/all/modules/imce/css/imce-content.css index 42543596b25eaaad926fbb44bb7b7aa25b80720f..6aae3e5b02ddeac829c716f84dfba305cd9b8505 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.5 2010/05/15 13:31:16 ufku Exp $ */ +/* $Id: imce-content.css,v 1.9 2010/10/09 05:47:47 ufku Exp $ */ /*Body*/ body.imce { @@ -32,7 +32,7 @@ body.imce { #imce-content label.option { font-weight: normal; } -#imce-content input.form-text, #imce-content input[type=text], #imce-content input.form-file, #imce-content input[type=file], #imce-content select { +#imce-content input.form-text, #imce-content input[type=text], #imce-content input.form-file, #imce-content input[type=file], #imce-content select, #imce-content textarea { border: 1px inset #aaa; padding: 2px; background-color: #fff; @@ -44,6 +44,9 @@ body.imce { padding: 2px 6px 2px 20px; margin: 2px 0; background: #e8e8d8 url(submit.png) no-repeat 2px 50%; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; } #imce-content [disabled], #imce-content .disabled { color: #999; @@ -56,6 +59,9 @@ body.imce { #imce-content .form-item { margin: 4px 0; } +#imce-content .form-item .description { + font-size: 0.9em; +} #imce-content strong, #imce-content h4 { font-weight: bold; } @@ -269,7 +275,7 @@ body.imce { position: relative; } #op-close-link { - display: inline-block; + display: none; position: absolute; z-index: 3; top: 2px; @@ -277,7 +283,6 @@ body.imce { width: 16px; height: 16px; background: url(close.png) no-repeat 50% 50%; - visibility: hidden; } #ops-list { } @@ -321,6 +326,25 @@ body.imce { #op-item-sendto a { background-image: url(sendto.png); } +#op-item-help a { + background-image: url(help.png); +} +#op-item-changeview a { + background-image: url(view-box.png); +} +.box-view #op-item-changeview a { + background-image: url(view-list.png); +} +#op-item-help a, #op-item-changeview a { + white-space: nowrap; + overflow: hidden; + width: 1px; + padding: 5px 0 5px 25px; + background-position: 5px 50%; +} +#op-item-help, #op-item-changeview { + float: right !important; +} /*resizers*/ #imce-content .y-resizer { @@ -338,41 +362,13 @@ body.imce { border-right: 1px solid #e0e3e5; } -/*Help box*/ -#help-box { - position: absolute; - z-index: 9; - right: 0; - background: url(help.png) no-repeat 100% 0; - max-width: 500px; -} -#help-box-title { - cursor: help; -} -#help-box-title span { - display: inline-block; - width: 16px; - height: 16px; - overflow: hidden; - visibility: hidden; -} -#help-box-content { - display: none; - padding: 10px; - border: 2px solid #344454; - background-color: #f5f5f5; -} -#help-box:hover #help-box-content, #help-box-content.hover { - display: block; -} - /*Message box*/ #message-box { display: none; position: absolute; width: 60%; left: 20%; - top: 40%; + top: 32%; z-index: 10; padding: 5px; background-color: #fff; @@ -409,7 +405,7 @@ body.imce { #file-preview { text-align: center; } -.imce-hide, .js #forms-wrapper { +.imce-hide, .js #forms-wrapper, #help-box { display: none; } @@ -426,4 +422,35 @@ body.imce { } .ie-7 #ops-list a span { cursor: pointer; +} +.ie-7 #file-list-wrapper { + display: inline-block; /* Gives hasLayout */ +} + +/* File list in box view */ +.box-view #file-list tr { + display: block; + float: left; + border: 1px solid #ccf; + margin: 10px; +} +.box-view #file-list td { + border: 0; +} +.box-view #file-list td.name { + min-width: 0; + padding: 5px; + text-align: center; + vertical-align: middle; +} +.box-view #file-list td.name img { + margin: 0; +} +.box-view #file-list td.name span { + display: block; + overflow: hidden; + white-space: nowrap; +} +.box-view #file-list td.size, .box-view #file-list td.date, .box-view #file-list td.width, .box-view #file-list td.height { + display: none; } \ No newline at end of file diff --git a/sites/all/modules/imce/imce.info b/sites/all/modules/imce/imce.info index b032cc4b3c4b13f5fbc190ece3cb93fd13e6d82e..c939de2d14f13d38c5fb7bfd0cd618a07221f46f 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-06-21 -version = "7.x-1.0-alpha3" +; Information added by drupal.org packaging script on 2010-10-09 +version = "7.x-1.0-beta1" core = "7.x" project = "imce" -datestamp = "1277145015" +datestamp = "1286606462" diff --git a/sites/all/modules/imce/imce.install b/sites/all/modules/imce/imce.install index 3a0cfcc85e4635d958bd0675b42bfc59fdcfdf1c..a5552b3d57c08a8c68444b9d1cb8805b84276a82 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.7 2010/06/02 08:27:00 ufku Exp $ +// $Id: imce.install,v 1.8 2010/08/30 04:06:25 ufku Exp $ /** * @file @@ -22,6 +22,7 @@ function imce_uninstall() { variable_del('imce_profiles'); variable_del('imce_roles_profiles'); variable_del('imce_settings_textarea'); + variable_del('imce_settings_absurls'); variable_del('imce_settings_replace'); variable_del('imce_settings_thumb_method'); variable_del('imce_settings_disable_private'); @@ -30,34 +31,11 @@ function imce_uninstall() { 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 {file_managed}.fid that belongs to IMCE.', - ), - ), - 'primary key' => array('fid'), - 'foreign keys' => array( - 'fid' => array('file_managed' => 'fid'), - ), - ); - return $schema; -} - /** * Updates from 6.x to 7.x. */ function imce_update_7000() { - //update role-profile assignments + // Update role-profile assignments $roles_profiles = variable_get('imce_roles_profiles', array()); if (!empty($roles_profiles)) { $scheme = variable_get('file_default_scheme', 'public'); @@ -67,7 +45,7 @@ function imce_update_7000() { } variable_set('imce_roles_profiles', $roles_profiles); } - //update textarea ids + // Update textarea ids $ids = str_replace(' ', '', variable_get('imce_settings_textarea', '')); if ($ids != '') { $ids = explode(',', $ids); @@ -76,4 +54,28 @@ function imce_update_7000() { } variable_set('imce_settings_textarea', implode(', ', $ids)); } +} + +/** + * Removes {imce_files} in favor of {file_usage}. + */ +function imce_update_7001(&$sandbox) { + if (!db_table_exists('imce_files')) { + return; + } + if (!isset($sandbox['progress'])) { + $sandbox['progress'] = 0; + $sandbox['last_fid_processed'] = -1; + $sandbox['max'] = db_query("SELECT COUNT(*) FROM {imce_files}")->fetchField(); + } + $limit = 500; + $result = db_query_range('SELECT i.fid FROM {imce_files} i INNER JOIN {file_managed} f ON i.fid = f.fid WHERE i.fid > :fid ORDER BY i.fid', 0, $limit, array(':fid' => $sandbox['last_fid_processed']))->fetchAll(); + foreach ($result as $file) { + file_usage_add($file, 'imce', 'file', $file->fid); + $sandbox['progress']++; + $sandbox['last_fid_processed'] = $file->fid; + } + if ($sandbox['#finished'] = empty($sandbox['max']) || ($sandbox['progress'] / $sandbox['max'])) { + db_drop_table('imce_files'); + } } \ No newline at end of file diff --git a/sites/all/modules/imce/imce.module b/sites/all/modules/imce/imce.module index 6b6cb01dfefc24c2db45212d5569897ccd7f06ff..1632e94d1c4f8dbdc49bd1a04bc8a184c7467b27 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.34 2010/06/02 08:31:10 ufku Exp $ +// $Id: imce.module,v 1.36 2010/10/09 05:48:35 ufku Exp $ /** * @file @@ -40,7 +40,7 @@ function imce_menu() { 'title' => 'Add new profile', 'page callback' => 'imce_profile_operations', 'access arguments' => $access, - 'type' => MENU_CALLBACK, + 'type' => MENU_VISIBLE_IN_BREADCRUMB, 'file' => 'inc/imce.admin.inc', ); return $items; @@ -104,26 +104,6 @@ function imce_file_download($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); - } -} - /** * Implements hook_element_info(). */ diff --git a/sites/all/modules/imce/inc/imce.admin.inc b/sites/all/modules/imce/inc/imce.admin.inc index 7d1d4a30273f5ef3657af95a04b3166419972443..420ee39616b34fc1384a64c5946f418edb91c42e 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.5 2010/06/02 08:31:10 ufku Exp $ +// $Id: imce.admin.inc,v 1.7 2010/10/09 05:49:37 ufku Exp $ /** * @file @@ -59,18 +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'), '#default_value' => variable_get('imce_settings_textarea', ''), '#maxlength' => NULL, - '#description' => t('If you don\'t use any WYSIWYG editor, this feature will allow you to add your images or files as <strong>html code into any plain textarea</strong>. Enter <strong>comma separated textarea IDs</strong> under which you want to enable a link to IMCE. The * character is a wildcard. Hint: ID of Body fields in most node types starts with edit-body.'), + '#description' => t('If you don\'t use any WYSIWYG editor, this feature will allow you to add your images or files as <strong>html code into any plain textarea</strong>. Enter <strong>comma separated textarea IDs</strong> under which you want to enable a link to IMCE. The * character is a wildcard. Hint: ID of Body fields in most node types starts with edit-body*.'), ); $form['common']['absurls'] = array( '#type' => 'checkbox', @@ -97,6 +91,12 @@ function imce_admin_form($form, &$form_state) { 'scale_and_crop' => t('First scale then crop the image to fit the thumbnail dimensions.') ), ); + $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 disable this feature.'), + ); $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); $form['#theme'] = 'imce_admin'; @@ -480,6 +480,7 @@ function imce_role_form($role, $weight = TRUE, $core = TRUE) { '#type' => 'select', '#options' => imce_profile_options(), '#default_value' => $role[$scheme . '_pid'], + '#empty_value' => 0, ); } return $form; @@ -517,7 +518,7 @@ function imce_profile_delete_submit($form, &$form_state) { * Profile options. */ function imce_profile_options() { - $options = array(t('none')); + $options = array(); foreach (variable_get('imce_profiles', array()) as $pid => $profile) { $options[$pid] = $profile['name']; } @@ -668,4 +669,4 @@ function imce_rolesort($r1, $r2) { } //Include core profile functions. -module_load_include('inc', 'imce', 'inc/imce.core.profiles'); \ No newline at end of file +include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'imce') . '/inc/imce.core.profiles.inc'; \ No newline at end of file diff --git a/sites/all/modules/imce/inc/imce.page.inc b/sites/all/modules/imce/inc/imce.page.inc index c16ca5a6966fff8f325fce6c73d03718e004aa89..d517ab993fd4eb0a4d3e1d42c32944e6e0e61f75 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.9 2010/06/19 15:13:35 ufku Exp $ +// $Id: imce.page.inc,v 1.10 2010/08/30 04:06:25 ufku Exp $ /** * @file @@ -403,22 +403,26 @@ function imce_delete_filepath($uri) { $file = file_load_multiple(array(), array('uri' => $uri)); $file = reset($file); - //file exists in database + // 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)) { + $usage = file_usage_list($file); + $is_imce = isset($usage['imce']); + unset($usage['imce']); + // File is in use by an other module. + if (!empty($usage)) { drupal_set_message(t('%filename is in use by another application.', array('%filename' => $file->filename)), 'error'); return FALSE; } - //general failure - if (!$result) { + // Force delete file. Prevent running file_usage_list() second time. + if (!file_delete($file, TRUE)) { return FALSE; } + // Remove imce usage + if ($is_imce) { + file_usage_delete($file, 'imce'); + } } - //not in db. probably loaded via ftp. + // Not in db. Probably loaded via ftp. elseif (!file_unmanaged_delete($uri)) { return FALSE; } @@ -1080,7 +1084,7 @@ function theme_imce_user_page($variables) { * Registers the file as an IMCE file. */ function imce_file_register($file) { - if (!db_query('SELECT 1 FROM {imce_files} WHERE fid = :fid', array(':fid' => $file->fid))->fetchField()) { - return @db_insert('imce_files')->fields(array('fid' => $file->fid))->execute(); + if (!db_query("SELECT 1 FROM {file_usage} WHERE module = 'imce' AND fid = :fid", array(':fid' => $file->fid))->fetchField()) { + file_usage_add($file, 'imce', 'file', $file->fid); } } \ 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 87211864218d24b4e170bfdd9002f30b1bc7baf3..9331291ea4cedcc5d48bdc42280ebf56f7fd7069 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.23 2010/06/19 15:14:20 ufku Exp $ +// $Id: imce.js,v 1.26 2010/10/06 04:42:57 ufku Exp $ (function($) { //Global container. @@ -10,8 +10,9 @@ hooks: {load: [], list: [], navigate: [], cache: []}, initiate: function() { imce.conf = Drupal.settings.imce || {}; if (imce.conf.error != false) return; - imce.FLW = imce.el('file-list-wrapper'); - imce.SBW = imce.el('sub-browse-wrapper'); + imce.FLW = imce.el('file-list-wrapper'), imce.SBW = imce.el('sub-browse-wrapper'); + imce.NW = imce.el('navigation-wrapper'), imce.BW = imce.el('browse-wrapper'); + imce.PW = imce.el('preview-wrapper'), imce.FW = imce.el('forms-wrapper'); imce.updateUI(); imce.prepareMsgs();//process initial status messages imce.initiateTree();//build directory tree @@ -81,6 +82,7 @@ dirCollapsible: function (branch) { if (branch.ul) { $(branch.ul).toggle(); $(branch.li).toggleClass('expanded'); + $.browser.msie && $('#navigation-header').css('top', imce.NW.scrollTop); } else if (branch.clkbl){ $(branch.a).click(); @@ -285,15 +287,16 @@ refreshOps: function() { opAdd: function (op) { var oplist = imce.el('ops-list'), opcons = imce.el('op-contents'); var name = op.name || ('op-'+ $(oplist).children('li').size()); - var Op = imce.ops[name] = {title: op.title || 'Untitled'}; + var title = op.title || 'Untitled'; + var Op = imce.ops[name] = {title: title}; if (op.content) { Op.div = imce.newEl('div'); $(Op.div).attr({id: 'op-content-'+ name, 'class': 'op-content'}).appendTo(opcons).append(op.content); } Op.a = imce.newEl('a'); Op.li = imce.newEl('li'); - $(Op.a).attr({href: '#', 'name': name}).html('<span>' + op.title +'</span>').click(imce.opClickEvent); - $(Op.li).attr('id', 'op-item-'+ op.name).append(Op.a).appendTo(oplist); + $(Op.a).attr({href: '#', name: name, title: title}).html('<span>' + title +'</span>').click(imce.opClickEvent); + $(Op.li).attr('id', 'op-item-'+ name).append(Op.a).appendTo(oplist); Op.func = op.func || imce.opVoid; return Op; }, @@ -316,12 +319,12 @@ opClick: function(name) { if (Op.div) { if (oldop) { var toggle = oldop == name; - imce.opShrink(oldop, toggle ? 'slideUp' : 'hide'); + imce.opShrink(oldop, toggle ? 'fadeOut' : 'hide'); if (toggle) return false; } var left = Op.li.offsetLeft; var $opcon = $('#op-contents').css({left: 0}); - $(Op.div).slideDown('normal', function() { + $(Op.div).fadeIn('normal', function() { setTimeout(function() { if (imce.vars.op) { var $inputs = $('input', imce.ops[imce.vars.op].div); @@ -334,7 +337,7 @@ opClick: function(name) { var diff = left + $opcon.width() - $('#imce-content').width(); $opcon.css({left: diff > 0 ? left - diff : left}); $(Op.li).addClass('active'); - $(imce.opCloseLink).css('visibility', 'visible'); + $(imce.opCloseLink).fadeIn(300); imce.vars.op = name; } Op.func(true); @@ -366,7 +369,7 @@ opShrink: function(name, effect) { var Op = imce.ops[name]; $(Op.div).stop(true, true)[effect || 'hide'](); $(Op.li).removeClass('active'); - $(imce.opCloseLink).css('visibility', 'hidden'); + $(imce.opCloseLink).hide(); Op.func(false); imce.vars.op = null; }, @@ -424,7 +427,7 @@ navUpdate: function(data, dir) { navCache: function (dir, newdir) { var C = imce.cache[dir] = {'dir': dir, files: imce.el('file-list'), dirsize: imce.el('dir-size').innerHTML, perm: $.extend({}, imce.conf.perm)}; C.files.id = 'cached-list-'+ dir; - imce.el('forms-wrapper').appendChild(C.files); + imce.FW.appendChild(C.files); imce.invoke('cache', C, newdir); }, @@ -565,7 +568,9 @@ setMessage: function (msg, type) { $box.css({opacity: 0, display: 'block'}).html(msg); $box.dequeue(); }); - $box.fadeTo(600, 1).fadeTo(1000, 1).fadeOut(400); + var q = $box.queue().length; + q = q < 2 ? 1 : q < 3 ? 0.8 : q < 4 ? 0.7 : 0.4;//adjust speed with respect to queue length + $box.fadeTo(600 * q, 1).fadeTo(1000 * q, 1).fadeOut(400 * q); $(logs).append(msg); return false; }, @@ -687,7 +692,7 @@ highlight: function (fid) { }, //process a row processRow: function (row) { - row.cells[0].innerHTML = imce.decode(row.id); + row.cells[0].innerHTML = '<span>' + imce.decode(row.id) + '</span>'; row.onmousedown = function(e) { var e = e||window.event; imce.fileClick(this, e.ctrlKey, e.shiftKey); @@ -740,7 +745,7 @@ updateUI: function() { var host = location.host; var baseurl = location.protocol + '//' + host; if (furl.charAt(furl.length - 1) != '/') { - furl += '/'; + furl = imce.conf.furl = furl + '/'; } imce.conf.modfix = imce.conf.clean && furl.indexOf(host + '/system/') > -1; if (absurls && !isabs) { @@ -750,7 +755,7 @@ updateUI: function() { imce.conf.furl = furl.substr(baseurl.length); } //convert button elements to input elements. - imce.convertButtons(imce.el('forms-wrapper')); + imce.convertButtons(imce.FW); //ops-list $('#ops-list').removeClass('tabs secondary').addClass('clear-block clearfix'); imce.opCloseLink = $(imce.newEl('a')).attr({id: 'op-close-link', href: '#', title: Drupal.t('Close')}).click(function() { @@ -759,7 +764,7 @@ updateUI: function() { }).appendTo('#op-contents')[0]; //navigation-header if (!$('#navigation-header').size()) { - $('#navigation-wrapper > .navigation-text').attr('id', 'navigation-header').wrapInner('<span></span>'); + $(imce.NW).children('.navigation-text').attr('id', 'navigation-header').wrapInner('<span></span>'); } //log $('#log-prv-wrapper').before($('#log-prv-wrapper > #preview-wrapper')).remove(); @@ -767,29 +772,22 @@ updateUI: function() { //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 + imce.msgBox = imce.el('message-box') || $(imce.newEl('div')).attr('id', 'message-box').prependTo('#imce-content')[0]; + //create help tab var $hbox = $('#help-box'); $hbox.is('a') && $hbox.replaceWith($(imce.newEl('div')).attr('id', 'help-box').append($hbox.children())); - var $htitle = $('#help-box-title'); - if ($.browser.msie) { - $('html').addClass('ie'); - if (parseFloat($.browser.version) < 8) { - var $hcontent = $('#help-box-content'); - $hcontent.add($htitle).hover(function() { - $hcontent.addClass('hover'); - }, function() { - $hcontent.removeClass('hover'); - }); - $('html').addClass('ie-7'); - } - } - !$htitle.children('span').size() && $htitle.wrapInner('<span></span>'); + imce.hooks.load.push(function() { + imce.opAdd({name: 'help', title: $('#help-box-title').remove().text(), content: $('#help-box').show()}); + }); + //add ie classes + $.browser.msie && $('html').addClass('ie') && parseFloat($.browser.version) < 8 && $('html').addClass('ie-7'); + // enable box view for file list + imce.vars.boxW && imce.boxView(); //scrolling file list imce.syncScroll(imce.SBW, '#file-header-wrapper'); imce.syncScroll(imce.SBW, '#dir-stat', true); //scrolling directory tree - imce.syncScroll('#navigation-wrapper', '#navigation-header'); + imce.syncScroll(imce.NW, '#navigation-header'); } }; diff --git a/sites/all/modules/imce/js/imce_extras.js b/sites/all/modules/imce/js/imce_extras.js index a06ad3426bc8203e847c44edcfd8d10a5c36df82..4f736e5f7f2d4da0a050610374ba1f5e4374811d 100644 --- a/sites/all/modules/imce/js/imce_extras.js +++ b/sites/all/modules/imce/js/imce_extras.js @@ -1,14 +1,10 @@ -// $Id: imce_extras.js,v 1.6 2010/06/05 08:04:41 ufku Exp $ +// $Id: imce_extras.js,v 1.9 2010/10/06 04:42:57 ufku Exp $ //This pack implemets: keyboard shortcuts, file sorting, resize bars, and inline thumbnail preview. (function($) { -//add onload hook. unshift to make sure it runs first after imce loads. -imce.hooks.load.unshift(function () { - imce.NW = imce.el('navigation-wrapper'); - imce.BW = imce.el('browse-wrapper'); - imce.PW = imce.el('preview-wrapper'); - //add scale calculator for resizing. +// add scale calculator for resizing. +imce.hooks.load.push(function () { $('#edit-width, #edit-height').focus(function () { var fid, r, w, isW, val; if (fid = imce.vars.prvfid) { @@ -19,7 +15,7 @@ imce.hooks.load.unshift(function () { }); }); -/**************** SHORTCUTS ********************/ +// Shortcuts var F = null; imce.initiateShortcuts = function () { $(imce.NW).attr('tabindex', '0').keydown(function (e) { @@ -97,8 +93,6 @@ $.each({k46: 'delete', k82: 'resize', k84: 'thumb', k85: 'upload'}, function (k, }; }); -/**************** SORTING ********************/ - //prepare column sorting imce.initiateSorting = function() { //add cache hook. cache the old directory's sort settings before the new one replaces it. @@ -154,14 +148,12 @@ imce.sortStrDsc = function(a, b) {return imce.sortStrAsc(b, a);}; imce.sortNumAsc = function(a, b) {return a-b;}; imce.sortNumDsc = function(a, b) {return b-a}; -/**************** RESIZE-BARS ********************/ - //set resizers for resizable areas and recall previous dimensions imce.initiateResizeBars = function () { - imce.setResizer('navigation-resizer', 'X', 'navigation-wrapper', null, 1, function(p1, p2, m) { + imce.setResizer('#navigation-resizer', 'X', imce.NW, null, 1, function(p1, p2, m) { p1 != p2 && imce.cookie('imcenww', p2); }); - imce.setResizer('browse-resizer', 'Y', 'browse-wrapper', 'preview-wrapper', 50, function(p1, p2, m) { + imce.setResizer('#browse-resizer', 'Y', imce.BW, imce.PW, 50, function(p1, p2, m) { p1 != p2 && imce.cookie('imcebwh', p2); }); imce.recallDimensions(); @@ -171,8 +163,8 @@ imce.initiateResizeBars = function () { imce.setResizer = function (resizer, axis, area1, area2, Min, callback) { var opt = axis == 'X' ? {pos: 'pageX', func: 'width'} : {pos: 'pageY', func: 'height'}; var Min = Min || 0; - var $area1 = $(imce.el(area1)), $area2 = area2 ? $(imce.el(area2)) : null, $doc = $(document); - $(imce.el(resizer)).mousedown(function(e) { + var $area1 = $(area1), $area2 = area2 ? $(area2) : null, $doc = $(document); + $(resizer).mousedown(function(e) { var pos = e[opt.pos]; var end = start = $area1[opt.func](); var Max = $area2 ? start + $area2[opt.func]() : 1200; @@ -238,12 +230,12 @@ imce.cookie = function (name, value) { imce.thumbRow = function (row) { var w = row.cells[2].innerHTML * 1; if (!w) return; - var h = row.cells[3].innerHTML*1; + var h = row.cells[3].innerHTML * 1; if (imce.vars.tMaxW < w || imce.vars.tMaxH < h) { - if (!imce.vars.prvstyle) return; + if (!imce.vars.prvstyle || imce.conf.dir.indexOf('styles') == 0) return; var img = new Image(); img.src = imce.imagestyleURL(imce.getURL(row.id), imce.vars.prvstyle); - img.className = 'imagestyle imagestyle-' + imce.vars.prvstyle; + img.className = 'imagestyle-' + imce.vars.prvstyle; } else { var prvH = h, prvW = w; @@ -267,7 +259,32 @@ imce.thumbRow = function (row) { //convert a file URL returned by imce.getURL() to an image style(imagecache preset) URL imce.imagestyleURL = function (url, stylename) { var len = imce.conf.furl.length - 1; - return url.substr(0, len) + '/styles/' + stylename + url.substr(len); + return url.substr(0, len) + '/styles/' + stylename + '/' + imce.conf.scheme + url.substr(len); +}; + +// replace table view with box view for file list +imce.boxView = function () { + var w = imce.vars.boxW, h = imce.vars.boxH; + if (!w || !h || $.browser.msie && parseFloat($.browser.version) < 8) return; + var $body = $(document.body); + var toggle = function() { + $body.toggleClass('box-view'); + // refresh dom. required by all except FF. + !$.browser.mozilla && $('#file-list').appendTo(imce.FW).appendTo(imce.FLW); + }; + $body.append('<style type="text/css">.box-view #file-list td.name {width: ' + w + 'px;height: ' + h + 'px;} .box-view #file-list td.name span {width: ' + w + 'px;word-wrap: normal;text-overflow: ellipsis;}</style>'); + imce.hooks.load.push(function() { + toggle(); + imce.SBW.scrollTop = 0; + imce.opAdd({name: 'changeview', title: Drupal.t('Change view'), func: toggle}); + }); + imce.hooks.list.push(imce.boxViewRow); +}; + +// process a row for box view. include all data in box title. +imce.boxViewRow = function (row) { + var s = ' | ', w = row.cells[2].innerHTML * 1, dim = w ? s + w + 'x' + row.cells[3].innerHTML * 1 : ''; + row.cells[0].title = imce.decode(row.id) + s + row.cells[1].innerHTML + (dim) + s + row.cells[4].innerHTML; }; })(jQuery); \ No newline at end of file diff --git a/sites/all/modules/imce/js/imce_set_app.js b/sites/all/modules/imce/js/imce_set_app.js index f910cc57e9a74a9d96c630364781ceff2f80e97d..7dfea4c3a863b35c7f427fdd5636854f50b6656f 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.6 2010/06/02 08:28:47 ufku Exp $ +// $Id: imce_set_app.js,v 1.8 2010/08/29 03:46:54 ufku Exp $ /* * IMCE Integration by URL * Ex-1: http://example.com/imce?app=XEditor|url@urlFieldId|width@widthFieldId|height@heightFieldId @@ -82,7 +82,7 @@ var isFunc = function(str, scope) { var obj = scope || appWindow; var parts = str.split('.'), len = parts.length; for (var i = 0; i < len && (obj = obj[parts[i]]); i++); - return i == len && $.isFunction(obj) ? obj : false; + return obj && i == len && (typeof obj == 'function' || typeof obj != 'string' && !obj.nodeName && obj.constructor != Array && /^[\s[]?function/.test(obj.toString())) ? obj : false; } })(jQuery); \ No newline at end of file diff --git a/sites/all/modules/imce/tpl/imce-content.tpl.php b/sites/all/modules/imce/tpl/imce-content.tpl.php index 00a1c51d37731398e8e545337c1532255997f568..8b3bece7b354e422ea59174ab8717be9727f322c 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.11 2010/05/15 13:31:16 ufku Exp $ +// $Id: imce-content.tpl.php,v 1.12 2010/10/06 04:42:57 ufku Exp $ $imce =& $imce_ref['imce'];//keep this line. ?> @@ -17,6 +17,10 @@ $imce =& $imce_ref['imce'];//keep this line. imce.vars.prvH = 40; //maximum height of the thumbnail used in inline preview. //imce.vars.prvstyle = 'stylename'; //preview larger images inline using an image style(imagecache preset). + //enable box view for file list. set box dimensions = preview dimensions + 30 or more + //imce.vars.boxW = 100; //width of a file info box + //imce.vars.boxH = 100; //height of a file info box + //imce.vars.previewImages = 0; //disable click previewing of images. //imce.vars.cache = 0; //disable directory caching. File lists will always refresh. //imce.vars.absurls = 1; //make IMCE return absolute file URLs to external applications.