Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using filemanager with the user's data in a specific rootfolder #467

Open
JosHuybrighs opened this issue Mar 4, 2016 · 1 comment
Open

Comments

@JosHuybrighs
Copy link

I am using filemanager in an ASP.NET MVC environment as follows:

"serverRoot": false,
"fileRoot": "Archive",

Interesting to know: The complete filemanager package is located in wwwroot/FMPackage.

With this setup everything works fine except for a couple of things:

  1. When initially opened the "Archive" folder (with a big icon) is shown in the center of the page without the subfolders. I have to press the 'Home' button to show the main folders within Archive.
  2. When navigating the Current Map text (top left) shows an excessive '/': e.g. Current map: //Pictures.
  3. When pressing the 'back' button from within the Archive or Home view filemanager still issues a request to the server to get folder information but with the path set to an empty string.
  4. When pressing the 'back' button from within a subfolder it sometimes happens that the current folder is opened again.

I corrected this by changing the following code:

$('#level-up').click(function() {
   var cpath = $('#uploader h1').attr('data-path'); // get path
   // console.log(' cpath : ' + cpath + ' - fileRoot : ' + fileRoot ); // @todo remove
   // MODIFIED: JH
   // remove trailing '/' (if any)
   cpath = cpath.replace(/\/$/, "");
   if (cpath &&
       cpath.length != 0 &&
       cpath != fileRoot) {
      // we get the parent folder - cpath.slice(0, - 1) removes last slash
      parent = cpath.substring(0, cpath.slice(0, - 1).lastIndexOf("/")) + '/';
      // console.log(' parent : ' + parent); // @todo remove
      var currentViewMode = $('#fileinfo').data('view');
      $('#fileinfo').data('view', currentViewMode);
      // MODIFIED: JH !!!!! Navigate back otherwise sometimes re-displays the current folder
//    $('#filetree').find('a[data-path="' + cpath + '"]').click(); // we close the previous folder
      getFolderInfo(parent);
   }
});

// Display Min Path
var displayPath = function(path, reduce) {
    reduce = (typeof reduce === "undefined") ? true : false;

    if(config.options.showFullPath == false) {
    // if a "displayPathDecorator" function is defined, use it to decorate path
    if('function' === typeof displayPathDecorator) {
        return displayPathDecorator(path.replace(fileRoot, "/"));
    } else {
        path = path.replace(fileRoot, "/");
        // MODIFIED: JH - Prevent "//" 
        path = path.replace("//", "/");
        if(path.length > 50 && reduce === true) {
            var n = path.split("/");
            path = '/' + n[1] + '/' + n[2] + '/(...)/' + n[n.length-2] + '/';
        }
        return path;
    }
  } else {
    return path;
  }
};

By the way: I had to modify the c# MVC controller code that comes with the bundle considerably. But that will be subject of another issue I will prepare as soon as I have finished my project.

Best regards,
Jos

@simogeo
Copy link
Owner

simogeo commented Mar 5, 2016

@JosHuybrighs : thanks for your feedback. @servocoder is working now on a new version, breaking the current API. See #456. You should maybe wait a little to propose mvc conn enhancements.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants