Changeset 1305 for branches


Ignore:
Timestamp:
04/02/11 03:54:45 (9 years ago)
Author:
gogo
Message:

Further fixes for MFM.

Location:
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager
Files:
192 added
22 edited

Legend:

Unmodified
Added
Removed
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/MootoolsFileManager.ImageManager.js

    r1302 r1305  
    7979      propagateData:  Object.merge({'__function': 'image-manager'}, this.editor.config.MootoolsFileManager.backend_data), 
    8080      propagateType:  'POST', 
     81       
     82      uploadAuthData: Object.merge({'__function': 'image-manager'}, this.editor.config.MootoolsFileManager.backend_data), 
    8183                                               
    8284      onComplete:     function(path, file, mgr) { self.ImageManagerReturn(path,file); }, 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/COMMIT_EDITMSG

    r1304 r1305  
    1 Add an option "thumbnailsMustGoThroughBackend" to FileManager.php, it defaults to true (current behaviour).  When set to false, IF and only if a thumbnail of the correct size has been created already, then onView will return the direct thumbnail url, otherwise it will still go through the onThumbnail event to get the thumbnail (the first time).  This is a means to reduce the roundtrips required whe using the POST type of propagateData, it also would reduce server load for normal GET type setups because it cuts down drastically on PHP execution requests and all that entails. 
    2  
    3 # Please enter the commit message for your changes. Lines starting 
    4 # with '#' will be ignored, and an empty message aborts the commit. 
    5 # On branch master 
    6 # Your branch is ahead of 'origin/master' by 2 commits. 
    7 # 
    8 # Changes to be committed: 
    9 #   (use "git reset HEAD <file>..." to unstage) 
    10 # 
    11 #       modified:   Assets/Connector/FileManager.php 
    12 #       modified:   Source/FileManager.js 
    13 # 
    14 # Untracked files: 
    15 #   (use "git add <file>..." to include in what will be committed) 
    16 # 
    17 #       .svn/ 
    18 #       Assets/.svn/ 
    19 #       Assets/Connector/.svn/ 
    20 #       Assets/Connector/Assets/.svn/ 
    21 #       Assets/Connector/Assets/getid3/.svn/ 
    22 #       Assets/Connector/Assets/helperapps/.svn/ 
    23 #       Assets/Css/.svn/ 
    24 #       Assets/Images/.svn/ 
    25 #       Assets/Images/Icons/.svn/ 
    26 #       Assets/Images/Icons/Large/.svn/ 
    27 #       Assets/js/.svn/ 
    28 #       Assets/js/milkbox/.svn/ 
    29 #       Assets/js/milkbox/css/.svn/ 
    30 #       Demos/.svn/ 
    31 #       Language/.svn/ 
    32 #       Source/.svn/ 
    33 #       Source/Uploader/.svn/ 
     1Fix to the non-backend thumbs 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/info/exclude

    r1300 r1305  
    55# *.[oa] 
    66# *~ 
     7*.svn 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/logs/HEAD

    r1304 r1305  
    44794418a4483a3bc4dcc6fd4d631dafb328c518c3 b08f652f527a193c89233ac17a8b65d980f5dab2 James Sleeman <james@gogo.co.nz> 1301669667 +1300     commit: Make preview image (250 thumb) work with POST type propagateData. There are 2 ways I could have done this, either just used getThumb() to obtain the thumb250, or hijack onThumbnail() to do the work. I chose the latter because it more closely aligns with the previous logic even if it is a larger diff to do it. 
    55b08f652f527a193c89233ac17a8b65d980f5dab2 b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 James Sleeman <james@gogo.co.nz> 1301671697 +1300     commit: Add an option "thumbnailsMustGoThroughBackend" to FileManager.php, it defaults to true (current behaviour). When set to false, IF and only if a thumbnail of the correct size has been created already, then onView will return the direct thumbnail url, otherwise it will still go through the onThumbnail event to get the thumbnail (the first time). This is a means to reduce the roundtrips required whe using the POST type of propagateData, it also would reduce server load for normal GET type setups because it cuts down drastically on PHP execution requests and all that entails. 
     6b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 4e349f2f12886f75cd3c40ec4f7fc785aa540159 James Sleeman <james@gogo.co.nz> 1301702953 +1300     commit: Add "fmDisplayErrors" option to FileManager.Request for automated display of errors (defaults false for backcompat), add POST type propagateData support for download. 
     74e349f2f12886f75cd3c40ec4f7fc785aa540159 664eebf5ed7edefb88ee3d027d096766232cafa4 James Sleeman <james@gogo.co.nz> 1301705367 +1300     commit: Popup blockers mean that the POST download has occasion to fail to open the popup, in that case, display a message with a link the user can click. 
     8664eebf5ed7edefb88ee3d027d096766232cafa4 4e60fb83d41d11a209a915eac0c67759889c391f James Sleeman <james@gogo.co.nz> 1301705464 +1300     commit: Left a log message in. Removed. 
     94e60fb83d41d11a209a915eac0c67759889c391f 42b807929a7848261d77002daa551de4fa49db75 James Sleeman <james@gogo.co.nz> 1301706668 +1300     commit: Better popup block detection. 
     1042b807929a7848261d77002daa551de4fa49db75 1f00497875fe99586de479e9e97a5b622f19a309 James Sleeman <james@gogo.co.nz> 1301710649 +1300     commit: Mimetype detection is (was) faulty, because tmp_name does not include an extention, the "fallback" GD detection for images failed to be tried. This results in not being able to upload images if you are using a filter for image mimetypes. 
     111f00497875fe99586de479e9e97a5b622f19a309 212ce5b69fb9903683616f7fa2008d84e83bf802 James Sleeman <james@gogo.co.nz> 1301710853 +1300     commit: Extentions needed to be matched case insensitively. 
     12212ce5b69fb9903683616f7fa2008d84e83bf802 51074c3d3f996df4df4cd0b66c4975bc4ec29e72 James Sleeman <james@gogo.co.nz> 1301711217 +1300     commit: Firefox (3.6.15) failed with using application/json as the response content type to a multipart/form-data post as used by the NoFlash, change to text/plain which seems to be working. 
     1351074c3d3f996df4df4cd0b66c4975bc4ec29e72 b10f3a8f3adf642d17390c7a465324238c79f42c James Sleeman <james@gogo.co.nz> 1301713831 +1300     commit: Fixes for the NoFlash uploader. 
     14b10f3a8f3adf642d17390c7a465324238c79f42c 2496febb122d7eb87d7947ec6c8bc254d8a3251f James Sleeman <james@gogo.co.nz> 1301714051 +1300     commit: Icons did not function for files with non-lowercase file extentions. 
     152496febb122d7eb87d7947ec6c8bc254d8a3251f ba30f60375703e9a9c68a5712e639b7d8a814e39 James Sleeman <james@gogo.co.nz> 1301715015 +1300     commit: The order of directories and files was inverted, directories where appearing at the bottom, which is contrary to what I would expect for almost everybody's preference. 
     16ba30f60375703e9a9c68a5712e639b7d8a814e39 6179fdb569651c0be91598235ad1743eca28831d James Sleeman <james@gogo.co.nz> 1301715421 +1300     commit: Add option showHiddenFoldersAndFiles which defaults to false. 
     176179fdb569651c0be91598235ad1743eca28831d f50e7e9e85bcee7a2f98a8d80c851875230f1f8c James Sleeman <james@gogo.co.nz> 1301715951 +1300     commit: Fix to the non-backend thumbs 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/logs/refs/heads/master

    r1304 r1305  
    44794418a4483a3bc4dcc6fd4d631dafb328c518c3 b08f652f527a193c89233ac17a8b65d980f5dab2 James Sleeman <james@gogo.co.nz> 1301669667 +1300     commit: Make preview image (250 thumb) work with POST type propagateData. There are 2 ways I could have done this, either just used getThumb() to obtain the thumb250, or hijack onThumbnail() to do the work. I chose the latter because it more closely aligns with the previous logic even if it is a larger diff to do it. 
    55b08f652f527a193c89233ac17a8b65d980f5dab2 b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 James Sleeman <james@gogo.co.nz> 1301671697 +1300     commit: Add an option "thumbnailsMustGoThroughBackend" to FileManager.php, it defaults to true (current behaviour). When set to false, IF and only if a thumbnail of the correct size has been created already, then onView will return the direct thumbnail url, otherwise it will still go through the onThumbnail event to get the thumbnail (the first time). This is a means to reduce the roundtrips required whe using the POST type of propagateData, it also would reduce server load for normal GET type setups because it cuts down drastically on PHP execution requests and all that entails. 
     6b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 4e349f2f12886f75cd3c40ec4f7fc785aa540159 James Sleeman <james@gogo.co.nz> 1301702953 +1300     commit: Add "fmDisplayErrors" option to FileManager.Request for automated display of errors (defaults false for backcompat), add POST type propagateData support for download. 
     74e349f2f12886f75cd3c40ec4f7fc785aa540159 664eebf5ed7edefb88ee3d027d096766232cafa4 James Sleeman <james@gogo.co.nz> 1301705367 +1300     commit: Popup blockers mean that the POST download has occasion to fail to open the popup, in that case, display a message with a link the user can click. 
     8664eebf5ed7edefb88ee3d027d096766232cafa4 4e60fb83d41d11a209a915eac0c67759889c391f James Sleeman <james@gogo.co.nz> 1301705464 +1300     commit: Left a log message in. Removed. 
     94e60fb83d41d11a209a915eac0c67759889c391f 42b807929a7848261d77002daa551de4fa49db75 James Sleeman <james@gogo.co.nz> 1301706668 +1300     commit: Better popup block detection. 
     1042b807929a7848261d77002daa551de4fa49db75 1f00497875fe99586de479e9e97a5b622f19a309 James Sleeman <james@gogo.co.nz> 1301710649 +1300     commit: Mimetype detection is (was) faulty, because tmp_name does not include an extention, the "fallback" GD detection for images failed to be tried. This results in not being able to upload images if you are using a filter for image mimetypes. 
     111f00497875fe99586de479e9e97a5b622f19a309 212ce5b69fb9903683616f7fa2008d84e83bf802 James Sleeman <james@gogo.co.nz> 1301710853 +1300     commit: Extentions needed to be matched case insensitively. 
     12212ce5b69fb9903683616f7fa2008d84e83bf802 51074c3d3f996df4df4cd0b66c4975bc4ec29e72 James Sleeman <james@gogo.co.nz> 1301711217 +1300     commit: Firefox (3.6.15) failed with using application/json as the response content type to a multipart/form-data post as used by the NoFlash, change to text/plain which seems to be working. 
     1351074c3d3f996df4df4cd0b66c4975bc4ec29e72 b10f3a8f3adf642d17390c7a465324238c79f42c James Sleeman <james@gogo.co.nz> 1301713831 +1300     commit: Fixes for the NoFlash uploader. 
     14b10f3a8f3adf642d17390c7a465324238c79f42c 2496febb122d7eb87d7947ec6c8bc254d8a3251f James Sleeman <james@gogo.co.nz> 1301714051 +1300     commit: Icons did not function for files with non-lowercase file extentions. 
     152496febb122d7eb87d7947ec6c8bc254d8a3251f ba30f60375703e9a9c68a5712e639b7d8a814e39 James Sleeman <james@gogo.co.nz> 1301715015 +1300     commit: The order of directories and files was inverted, directories where appearing at the bottom, which is contrary to what I would expect for almost everybody's preference. 
     16ba30f60375703e9a9c68a5712e639b7d8a814e39 6179fdb569651c0be91598235ad1743eca28831d James Sleeman <james@gogo.co.nz> 1301715421 +1300     commit: Add option showHiddenFoldersAndFiles which defaults to false. 
     176179fdb569651c0be91598235ad1743eca28831d f50e7e9e85bcee7a2f98a8d80c851875230f1f8c James Sleeman <james@gogo.co.nz> 1301715951 +1300     commit: Fix to the non-backend thumbs 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/.git/refs/heads/master

    r1304 r1305  
    1 b39b68cda2d7c9f06cdaaeb2aa6556965ae99604 
     1f50e7e9e85bcee7a2f98a8d80c851875230f1f8c 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/Connector/FileManager.php

    r1304 r1305  
    556556                        'MoveIsAuthorized_cb' => null, 
    557557                        'thumbnailsMustGoThroughBackend' => true, // If set true (default) all thumbnail requests go through the backend (onThumbnail), if false, thumbnails will "shortcircuit" if they exist, saving roundtrips when using POST type propagateData 
     558                        'showHiddenFoldersAndFiles'      => false, // Hide dot dirs/files ? 
    558559                        'URIpropagateData' => null 
    559560                ), (is_array($options) ? $options : array())); 
     
    668669                } 
    669670                $files = $this->scandir($dir, $filemask); 
     671 
     672    // This can not be done in scandir, because other stuff (particularly delete) 
     673    // might need those dotfiles. 
     674    if(!$this->options['showHiddenFoldersAndFiles']) 
     675    { 
     676      $nohidden = array(); 
     677      foreach($files as $file) 
     678      { 
     679        if($file[0] == '.' && $file != '.' & $file != '..') continue; 
     680        $nohidden[] = $file; 
     681      } 
     682      $files = $nohidden; 
     683    } 
    670684 
    671685                if ($files === false) 
     
    782796        { 
    783797          try 
    784           { 
    785             $thumb48  = $this->getThumb ($legal_url, $file, 48, 48, true); 
    786             $thumb250 = $this->getThumb ($legal_url, $file, 250, 250, true); 
     798          {   
     799            $thumb48  = $this->getThumb ($url, $file, 48, 48, true); 
     800            $thumb250 = $this->getThumb ($url, $file, 250, 250, true); 
    787801          } 
    788802          catch(Exception $E) 
     
    859873                } 
    860874                return array( 
    861                         'dirs' => (!empty($out[0]) ? $out[0] : array()), 
    862                         'files' => (!empty($out[1]) ? $out[1] : array()), 
     875                        'dirs' => (!empty($out[1]) ? $out[1] : array()), 
     876                        'files' => (!empty($out[0]) ? $out[0] : array()), 
    863877                        'json' => array_merge((is_array($json) ? $json : array()), array( 
    864878                                'root' => substr($this->options['directory'], 1), 
     
    16441658         *                        Examples: 'image/' or 'application/zip' 
    16451659         * 
     1660         * $_GET['asJson']        if true, returns { status:1, url: '.....' } or { status:0, error: '......' } 
     1661         * 
    16461662         * On errors a HTTP 403 error response will be sent instead. 
    16471663         */ 
     
    16891705                                throw new FileManagerException('authorized'); 
    16901706 
     1707      if($this->getGETparam('asJson', 0)) 
     1708      { 
     1709        $Response = array('status' => 1, 'url' => $this->legal2abs_url_path($fileinfo['legal_url']), 'fileinfo' => $fileinfo); 
     1710        echo json_encode($Response); 
     1711        exit; 
     1712      } 
     1713       
    16911714                        $legal_url = $fileinfo['legal_url']; 
    16921715                        $file = $fileinfo['file']; 
     
    17221745                } 
    17231746                catch(FileManagerException $e) 
    1724                 { 
     1747                {  
     1748      if($this->getGETparam('asJson', 0)) 
     1749      { 
     1750        $Response = array('status' => 0, 'error' => $e->getMessage()); 
     1751        echo json_encode($Response); 
     1752        exit; 
     1753      } 
     1754       
    17251755                        // we don't care whether it's a 404, a 403 or something else entirely: we feed 'em a 403 and that's final! 
    17261756                        send_response_status_header(403); 
     
    17291759                catch(Exception $e) 
    17301760                { 
     1761      if($this->getGETparam('asJson', 0)) 
     1762      { 
     1763        $Response = array('status' => 0, 'error' => $e->getMessage()); 
     1764        echo json_encode($Response); 
     1765        exit; 
     1766      } 
     1767       
    17311768                        // we don't care whether it's a 404, a 403 or something else entirely: we feed 'em a 403 and that's final! 
    17321769                        send_response_status_header(403); 
     
    17951832                        $mime_filter = $this->getGETparam('filter', $this->options['filter']); 
    17961833                        $tmppath = $_FILES['Filedata']['tmp_name']; 
    1797                         $mime = $this->getMimeType($tmppath); 
     1834                         
     1835                        // tmp_name does not include an extention, if we don't provide it, the mime detection is too 
     1836                        // easily thwarted and returns application/octet-stream, if you are using a filter to only have images, you're dead 
     1837                        // even if it was an image (because the GD based image check only checks if the extention is recognised)                         
     1838                        $mime = $this->getMimeType($tmppath, false, strtolower(preg_replace('/.*\.([a-z0-9]+)$/i', '$1',$_FILES['Filedata']['name'])) ); 
    17981839                        $mime_filters = $this->getAllowedMimeTypes($mime_filter); 
    17991840                        if (!$this->IsAllowedMimeType($mime, $mime_filters)) 
     
    18801921                        } 
    18811922 
    1882                         if (!headers_sent()) header('Content-Type: application/json'); 
     1923                        if (!headers_sent()) header('Content-Type: text/plain');//application/json'); 
    18831924 
    18841925                        echo json_encode(array( 
     
    19001941                $this->modify_json4exception($jserr, $emsg); 
    19011942 
    1902                 if (!headers_sent()) header('Content-Type: application/json'); 
     1943                if (!headers_sent()) header('Content-Type: text/plain');//application/json'); 
    19031944 
    19041945                // when we fail here, it's pretty darn bad and nothing to it. 
    19051946                // just push the error JSON as go. 
    1906                 echo json_encode($jserr); 
     1947                echo json_encode(array_merge($jserr, $_FILES)); 
    19071948        } 
    19081949 
     
    27872828        public function getIcon($file, $smallIcon) 
    27882829        { 
    2789                 $ext = pathinfo($file, PATHINFO_EXTENSION); 
     2830                $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); 
    27902831 
    27912832                $largeDir = (!$smallIcon ? 'Large/' : ''); 
     
    33683409         *                            the mime type from the file extension is performed. 
    33693410         */ 
    3370         public function getMimeType($file, $just_guess = false) 
     3411        public function getMimeType($file, $just_guess = false, $ext = NULL) 
    33713412        { 
    33723413                if (is_dir($file)) 
    33733414                        return 'text/directory'; 
    33743415 
     3416    if(!isset($ext)) // _FILES['tmp_name'] does not have an extention, we need to provide it    
    33753417                $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); 
    33763418 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.cs.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
    53  
     53         
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
     56   
    5457        'backend.disabled': 'Nahrávání souborů je na tomto serveru zakázáno.', 
    5558        'backend.authorized': 'Nemáte právo nahrávat soubory.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.da.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked',   
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'Det er ikke muligt at uploade filer pÃ¥ serveren.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.de.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'Dieser Funktion wurde auf diesem Server deaktiviert.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.en.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53 
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'This operation has been disabled on this Server.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.es.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'La carga de archivos ha sido deshabilitada.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.fi.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'Tiedostojen lÀhetys otettu kÀytöstÀ.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.fr.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'Le téléversement de fichier a été désactivé sur ce serveur.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.it.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'L Upload dei file Ú disabilitato.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.pl.js

    r1302 r1305  
    5858        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5959        goto_page: 'Go to page', 
     60   
     61  popup_blocked:  'Popup Blocked', 
     62  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    6063 
    6164        'backend.disabled': 'Wysyłanie plików na serwer zostało wyłĠ
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.pt.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'Envio de ficheiros desactivado neste servidor.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.ru.js

    r1302 r1305  
    5252        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5353        goto_page: 'Go to page', 
     54   
     55  popup_blocked:  'Popup Blocked', 
     56  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5457 
    5558        'backend.disabled': 'Загрузка файлПв ПтключеМа Ма сервере.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.se.js

    r1302 r1305  
    5151        drag_n_drop_disabled: 'Drag & drop has been temporarily disabled for this directory', 
    5252        goto_page: 'Go to page', 
     53   
     54  popup_blocked:  'Popup Blocked', 
     55  popup_blocked_download: 'To download the file, use this URL: {link} ', 
    5356 
    5457        'backend.disabled': 'Uppladdning Àr avstÀngt pÃ¥ denna server.', 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/FileManager.js

    r1304 r1305  
    669669                } 
    670670                 
    671                 // @FIXME propagateData may need to be passed by POST 
     671                // propagateData may need to be passed by POST 
     672    if(this.options.propagateType == 'POST') 
     673    { 
     674      var self = this; 
     675      new FileManager.Request( 
     676      {  
     677        url: this.options.url + (this.options.url.indexOf('?') == -1 ? '?' : '&') + Object.toQueryString(Object.merge({ 
     678              event: 'download', 
     679              file: this.normalize(file.dir + file.name), 
     680              filter: this.options.filter, 
     681              asJson: true 
     682            })), 
     683                               
     684        fmDisplayErrors: true, 
     685                               
     686        onSuccess: function(j) 
     687        {             
     688          if(j && j.status) 
     689          {              
     690            // For popup blockers, and browsers we can't reliably detect popup blocks 
     691            // we display the link in a dialog 
     692            function show_link_in_dialog(title) 
     693            { 
     694              self.showMessage(self.language.popup_blocked_download.substitute({link: " <a href=\"" + j.url +"\" target=\"_blank\">"+j.url+"</a>"}),title ? title : ''); 
     695            } 
     696             
     697            if(!Browser.chrome) 
     698            { 
     699              var popup; 
     700              setTimeout(function() { 
     701                if(!popup) 
     702                {                   
     703                  // Blocked 
     704                  show_link_in_dialog(self.language.popup_blocked); 
     705                } 
     706              }, 1500);               
     707              popup = window.open(j.url);          
     708            } 
     709            else 
     710            { 
     711              // Chrome has no good way to detect a blocked popup and it's  
     712              // blocked popup notification icon is really easy to miss, so we will  
     713              // always show the dialog. 
     714              show_link_in_dialog(); 
     715            }             
     716          } 
     717        } 
     718      }, this).send(); 
     719      return; 
     720    } 
     721     
    672722                window.open(this.options.url + (this.options.url.indexOf('?') == -1 ? '?' : '&') + Object.toQueryString(Object.merge({}, this.options.propagateData, { 
    673723                        event: 'download', 
    674724                        file: this.normalize(file.dir + file.name), 
    675725                        filter: this.options.filter 
    676                 }))); 
     726                })));     
    677727        }, 
    678728 
     
    15101560      { 
    15111561        // This is just a raw image 
    1512         console.log(file.thumbnail); 
    15131562        var el = list_row_maker(file.thumbnail); 
    15141563      } 
     
    15241573            new FileManager.Request({ 
    15251574              url: file.thumbnail + '&asJson=1', 
    1526               onComplete: function(j) {                 
     1575              onSuccess: function(j) {                 
    15271576                if(!j || !j.status) 
    15281577                { 
    15291578                  // Should we display the error here? 
    1530                   if(j && j.thumbnail) 
    1531                   { 
    1532                     list_row.getElement('span.fm-thumb-bg').setStyle('background-image', 'url('+j.thumbnail+')'); 
    1533                   } 
     1579                  // Probably not, could be too noisy. 
    15341580                } 
    1535                 else 
     1581                 
     1582                if(j && j.thumbnail) 
    15361583                { 
    15371584                  list_row.getElement('span.fm-thumb-bg').setStyle('background-image', 'url('+j.thumbnail+')'); 
     
    16251672 
    16261673                        // ->> LOAD the FILE/IMAGE from history when PAGE gets REFRESHED (only directly after refresh) 
    1627                         if (typeof console !== 'undefined' && console.log) console.log('fill on PRESELECT: onShow = ' + this.onShow + ', file = ' + file.name + ', preselect = ' + (typeof preselect != 'undefined' ? preselect : '???')); 
     1674                        //if (typeof console !== 'undefined' && console.log) console.log('fill on PRESELECT: onShow = ' + this.onShow + ', file = ' + file.name + ', preselect = ' + (typeof preselect != 'undefined' ? preselect : '???')); 
    16281675                        if(this.onShow && typeof preselect != 'undefined') 
    16291676                        { 
     
    21672214        }, 
    21682215 
     2216  showMessage: function(textOrElement, title) {     
     2217    if(!title) title = ''; 
     2218    new Dialog(title, { 
     2219      buttons: ['confirm'], 
     2220      language: { 
     2221        confirm: this.language.ok 
     2222      }, 
     2223      content: [ 
     2224        textOrElement 
     2225      ], 
     2226      onOpen: this.onDialogOpen.bind(this), 
     2227      onClose: this.onDialogClose.bind(this) 
     2228    }); 
     2229  },                             
     2230                             
    21692231        onRequest: function(){ 
    21702232                this.loader.fade(1); 
     
    21962258 
    21972259FileManager.Request = new Class({ 
    2198         Extends: Request.JSON, 
    2199         secure: true, 
    2200  
     2260        Extends: Request.JSON,   
     2261                                 
     2262  options: 
     2263  {  
     2264    secure:          true, // Isn't this true by default anyway in REQUEST.JSON? 
     2265    fmDisplayErrors: false // Automatically display errors - ** your onSuccess still gets called, just ignore if it's an error ** 
     2266  }, 
     2267                                 
    22012268        initialize: function(options, filebrowser){ 
    22022269                this.parent(options); 
    2203      
     2270         
    22042271    if(filebrowser) // When is this NOT supplied, I think it always should be, we are always dealing with a filebrowser somewhere eh? 
    22052272    { 
     
    22122279        this.options.data = Object.merge({}, this.options.data, filebrowser.options.propagateData); 
    22132280      }       
     2281       
     2282      if(this.options.fmDisplayErrors) 
     2283      { 
     2284        this.addEvents({ 
     2285          success: function(j) {              
     2286            if(!j)        return filebrowser.showError();              
     2287            if(!j.status) return filebrowser.showError(j.error); 
     2288          }, 
     2289                        
     2290          error: function(text, error) { 
     2291            filebrowser.showError(text);             
     2292          }, 
     2293           
     2294          failure: function(xmlHttpRequest) { 
     2295            var text = filebrowser.cvtXHRerror2msg(xmlHttpRequest); 
     2296            filebrowser.showError(text);             
     2297          }   
     2298        }); 
     2299      } 
    22142300    } 
    22152301     
     
    22212307                        failure: filebrowser.onFailure.bind(filebrowser) 
    22222308                }); 
     2309     
    22232310        } 
    22242311}); 
  • branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/NoFlash.Uploader.js

    r1302 r1305  
    2525    resizeImages: true, 
    2626    upload: true, 
     27 
     28    // Is there a useful reason to have this different from propagateData... dubious :-/ 
    2729    uploadAuthData: {} 
    2830  }, 
     
    5860 
    5961  startUpload: function(){ 
     62    var self = this; 
    6063 
    6164    if (!this.options.upload || typeof this._dummyframe != 'undefined') return; 
     
    6972      .setStyles({ 'float': 'left', 'padding-left': '3px', 'display':'block'}); 
    7073 
    71     (new Object(this.options.uploadAuthData)).each(function(v, k){ 
     74    (new Hash(this.options.uploadAuthData)).each(function(v, k){ 
    7275        f.adopt((new Element('input')).set({type:'hidden', name: k, value: v})); 
    7376    }); 
    7477 
    7578    f.adopt((new Element('input')).set({type:'file', 'name':'Filedata'}).setStyles({width:120})); 
     79     
     80    // The FileManager.php can't make up it's mind about which it wants, directory is documented as GET,  
     81    // but is checked as POST, we'll send both. 
     82    f.adopt((new Element('input')).set({type:'hidden', 'name':'directory'})); 
     83     
    7684    f.inject(this.menu, 'top'); 
    7785 
     
    8189          mfm.browserLoader.set('opacity', 1); 
    8290          f.action = mfm.options.url 
    83                                         + (mfm.options.url.indexOf('?') == -1 ? '?' : '&') + Object.toQueryString(Object.merge({}, self.options.propagateData, { 
     91                                        + (mfm.options.url.indexOf('?') == -1 ? '?' : '&') + Object.toQueryString(Object.merge({}, { 
    8492                                                event: 'upload', 
    8593                                                directory: self.normalize(mfm.Directory), 
     
    8795                                                resize: (this.label && this.label.getElement('.checkbox').hasClass('checkboxChecked')) ? 1 : 0 
    8896                                          })); 
    89  
     97          f.getElement('input[name=directory]').value = mfm.Directory; 
    9098          f.submit(); 
    9199        }, 
     
    124132        try 
    125133        { 
    126           var response = JSON.decode(this.contentDocument.documentElement.innerText); 
     134          var response; 
     135            try { response = this.contentDocument.documentElement.textContent; } catch(e) {} 
     136           
     137          if(!response) 
     138            try { response = this.contentWindow.document.innerText; } catch(e) {} 
     139           
     140          if(!response) 
     141            try { response = this.contentDocument.innerText; } catch(e) {} 
     142           
     143          if(!response) throw "Can't find response."; 
     144             
     145          response = JSON.decode(response); 
     146           
    127147          if (response && !response.status) 
    128148          { 
    129149            new Dialog(('' + response.error).substitute(self.language, /\\?\$\{([^{}]+)\}/g) , {language: {confirm: mfm.language.ok}, buttons: ['confirm']}); 
    130150          } 
    131                   else 
    132                   { 
    133                         mfm.load(mfm.Directory, true, response.name ? response.name : null); 
    134                   } 
     151          else 
     152          { 
     153            console.log(response.name); 
     154            console.log(mfm.Directory); 
     155            mfm.load(mfm.Directory.replace(/\/$/, ''), response.name ? response.name : null); 
     156          } 
    135157        } 
    136158        catch(e) 
    137159        { 
    138160          // Maybe this.contentDocument.documentElement.innerText isn't where we need to look? 
     161          // debugger; console.log(this); 
     162          mfm.load(mfm.Directory); 
    139163        } 
    140164    }); 
Note: See TracChangeset for help on using the changeset viewer.