Ignore:
Timestamp:
03/28/11 23:08:39 (9 years ago)
Author:
gogo
Message:

See ticket #1502

Update to enhance reliability and functionality of MootoolsFileManager?.

  1. A couple of race type conditions caused various issues with loading the MFM.
  2. Add preselection of current image
  3. Add documentation for HSpace/VSpace in config.php

Also snuck in a couple of other bugfixes/additions:

  1. add support for having attribute "onxinhaready" on a textarea
  2. add a Xinha._posturlcontent as an analog to _geturlcontent, synchronouse post
  3. some PHP deprecation issues in the old ExtendedFileManager? and ImageManager?
  4. add a skin.xml to blue-look skin

Note: This is an older version of MFM, I am about to create a branch to work on bringing in a large update to MFM in a couple of stages.

Location:
trunk/plugins/MootoolsFileManager/mootools-filemanager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/MootoolsFileManager/mootools-filemanager/Backend/Upload.php

    r1269 r1297  
    9393                        'extension' => strtolower(pathinfo($file, PATHINFO_EXTENSION)), 
    9494                ), $options); 
    95                  
     95                $options['extension'] = strtolower($options['extension']); 
    9696                $mime = null; 
    9797                $ini = error_reporting(0); 
  • trunk/plugins/MootoolsFileManager/mootools-filemanager/Source/FileManager.js

    r1245 r1297  
    310310        }, 
    311311 
    312         load: function(dir, nofade){ 
     312        /* XINHA: We add a callback capability which will be called whe the loading is completed.  
     313    *  NOTE: For some reason, MFM wants the dir to include the last component of the prefix 
     314    *  eg if your images_dir is /fancy/images and you want to load /fancy/images/foo/bar you must pass 
     315    *   images/foo/bar -- crazy annoying 
     316    */ 
     317 
     318        load: function(dir, nofade, callback){ 
    313319                this.deselect(); 
    314320                if (!nofade) this.info.fade(0); 
     
    320326                        onSuccess: (function(j){ 
    321327                                this.fill(j, nofade); 
     328        if(callback) callback(j); 
    322329                        }).bind(this), 
    323330                        data: { 
     
    444451                        icons = $$(icons.map(function(icon){ return icon.appearOn(icon, [1, 0.7]); })).appearOn(el.getParent('li'), 0.7); 
    445452                }, this); 
    446  
     453       this.CurrentFiles = j.files;  // XINHA - fillInfo() will use this to find a pre-selected file 
     454     
    447455                var self = this, revert = function(el){ 
    448456                        el.set('opacity', 1).store('block', true).removeClass('drag').removeClass('move').setStyles({ 
     
    454462                                top: 0 
    455463                        }).inject(el.retrieve('parent')); 
    456                         el.getElements('img.browser-icon').set('opacity', 0); 
     464                //      el.getElements('img.browser-icon').set('opacity', 0); // XINHA - NOT REQUIRED? 
    457465                         
    458466                        document.removeEvents('keydown', self.bound.keydown).removeEvents('keyup', self.bound.keydown); 
     
    552560                if (!file) file = this.CurrentDir; 
    553561                if (!path) path = this.Directory; 
    554  
     562   
    555563                if (!file) return; 
     564        
     565       /* XINHA: In order to facilitate pre-selecting an image/file for modification, we can pass in a filename (just the basename) 
     566           as file and we will search in the current files for it.  You must have done a load first, and call the fillInfo as a result of the load. 
     567           YourImageManager.load('path/to/dir', true, function() { YourImageManager.fillInfo('file.jpg'); }); 
     568        */ 
     569       var self = this; 
     570        if(typeof file == 'string') 
     571    { 
     572        if(this.CurrentFiles) 
     573        { 
     574          this.CurrentFiles.each(function(f) 
     575          { 
     576            if(typeof file != 'string') return; 
     577            if(f.name == file)  
     578            { 
     579                file = f; 
     580                if(file.element)  
     581                { 
     582                  self.Current = file.element.addClass('selected'); 
     583                  self.switchButton(); 
     584                } 
     585                
     586            } 
     587          }); 
     588        } 
     589    } 
     590     
    556591                var size = this.size(file.size); 
    557592 
Note: See TracChangeset for help on using the changeset viewer.