Changeset 8013


Ignore:
Timestamp:
Aug 13, 2021, 8:17:14 AM (9 months ago)
Author:
Nicklas Nordborg
Message:

Merge pre-BASE 3.19 changes to the trunk.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/credits.txt

    r7926 r8013  
    11$Id$
    22
    3 The current BASE team is (at BASE 3.18 release)
     3The current BASE team is (at BASE 3.19 release)
    44{{{
    55Jari Häkkinen
  • trunk/src/core/net/sf/basedb/core/PropertyFilter.java

    r7926 r8013  
    12621262      else
    12631263      {
    1264         parameter = value == null ? null : Expressions.parameter(parameterName, getValueAsObject(unit, true));
     1264        parameter = value == null ? null : Expressions.parameter(parameterName, getValueAsObject(unit, true), getValueType());
    12651265      }
    12661266    }
  • trunk/www/common/annotations/batch_inherit.js

    r7604 r8013  
    9696   
    9797    var tr = document.createElement('tr');
    98     tr.className = 'highlight ' + (selectedAnnotationTypes.length % 2 == 0 ? 'bg-evenrow' : 'bg-oddrow');
     98    tr.className = 'row highlight ' + (selectedAnnotationTypes.length % 2 == 0 ? 'bg-evenrow' : 'bg-oddrow');
    9999    tr.id = 'at-'+item.id;
    100100
  • trunk/www/common/plugin/test_with_file.js

    r7656 r8013  
    120120   
    121121    var response = JSON.parse(request.responseText);
    122     var excelMode = response.excelMode;
     122    var excelMode = response.excelMode || false;
    123123
    124124    frm.filemode.value = excelMode ? 'excel' : 'csv';
  • trunk/www/filemanager/upload/drag_drop_upload.js

    r7992 r8013  
    2727{
    2828  var upload = {};
     29  var zipFormats = [];
    2930 
    3031  var filesAndFolders;
     
    5051  upload.initPage = function()
    5152  {
     53    zipFormats = Data.json('page-data', 'zip-formats');
     54
    5255    Buttons.addClickHandler('btnUpload', upload.beginFileUpload);
    5356    Buttons.addClickHandler('close', App.closeWindow);
     
    5760    filesAndFolders = window.opener.FileManager.getFilesToUpload();
    5861    upload.processFilesAndFolders();
     62  }
     63 
     64  /**
     65    Get the ID of the best matching compressed format
     66  */
     67  upload.getCompressedFormat = function(filename)
     68  {
     69    var longestMatch = 0;
     70    var bestFormat = null;
     71   
     72    for (var formatNo = 0; formatNo < zipFormats.length; formatNo++)
     73    {
     74      var zf = zipFormats[formatNo];
     75      for (var extNo = 0; extNo < zf.extensions.length; extNo++)
     76      {
     77        var ext = '.' + zf.extensions[extNo];
     78        var index = filename.lastIndexOf(ext);
     79        if (index > 0 && (index + ext.length == filename.length))
     80        {
     81          if (ext.length > longestMatch)
     82          {
     83            longestMatch = ext.length;
     84            bestFormat = zf;
     85          }
     86        }
     87      }
     88    }
     89    return bestFormat;
    5990  }
    6091 
     
    78109    var ff = filesAndFolders.splice(0, 1)[0];
    79110    currentFolder = ff.subfolder || '';
    80     if (ff.isFile)
    81     {
    82       // Get the file item as a 'File' object (its an async operation)
    83       ff.file(upload.gotFile);
    84     }
    85     else if (ff.isDirectory)
    86     {
    87       // Save the currentFolder for later use in 'upload.gotFolder'
    88       currentFolder += ff.name+'/';
    89       // Read files and subfolders (its an async operation)
    90       currentDirectoryReader = ff.createReader();
    91       currentDirectoryReader.readEntries(upload.gotFolder);
    92     }
    93     else
    94     {
    95       // Process next entry
    96       upload.processFilesAndFolders();
    97     }
     111    // Ignore files/directories inside subfolders starting with '.' unless
     112    // the top folder that was selected is also hidden
     113    var ignore = ff.name.charAt(0)=='.' && (currentFolder.length > 0 && currentFolder.charAt(0)!='.');
     114    if (!ignore)
     115    {
     116      if (ff.isFile)
     117      {
     118        // Get the file item as a 'File' object (its an async operation)
     119        ff.file(upload.gotFile);
     120        return;
     121      }
     122      else if (ff.isDirectory)
     123      {
     124        // Save the currentFolder for later use in 'upload.gotFolder'
     125        currentFolder += ff.name+'/';
     126        // Read files and subfolders (its an async operation)
     127        currentDirectoryReader = ff.createReader();
     128        currentDirectoryReader.readEntries(upload.gotFolder);
     129        return;
     130      }
     131    }
     132   
     133    // Process next entry
     134    upload.processFilesAndFolders();
    98135  }
    99136 
     
    133170    {
    134171      files.sort(upload.sortFilesByFolder);
    135       var html = '<table class="filelist">';
     172      var html = '<table class="filelist" style="width: 100%;">';
    136173      var lastSubfolder = '';
    137174      var pad = '<td colspan="2" class="name">';
    138175      var numFolders = 1;
     176      var numCompressedFiles = 0;
    139177      for (var i = 0; i < files.length; i++)
    140178      {
     
    142180        totalBytesToUpload += f.size;
    143181        totalFiles++;
     182        if (upload.getCompressedFormat(f.name)) numCompressedFiles++;
    144183        if (totalFiles <= 500)
    145184        {
     
    158197        html += '<tr><td colspan="3" class="morefiles">+'+(totalFiles-500)+' more files...</td></tr>';
    159198      }
     199      if (numCompressedFiles > 0) Doc.show('unpackSection');
    160200      var numFilesMsg = totalFiles==1?'1 file' : totalFiles+' files';
    161201      document.title = 'Uploading '+numFilesMsg+' to '+Data.get('page-data', 'directory-path');
     
    270310    upl.set('autoSelect', totalFiles == 1 ? 1 : 0); // No automatic selection if we upload more than one file
    271311    upl.set('replace_existing', overwrite);
     312    if (frm.unpackCompressed.checked)
     313    {
     314      var zipFormat = upload.getCompressedFormat(file.name);
     315      if (zipFormat)
     316      {
     317        upl.set('zip_format', zipFormat.id);
     318        upl.set('zip_unpack', 1);
     319        upl.set('zip_overwrite', overwrite);
     320        upl.set('zip_keep', 0);
     321      }
     322    }
    272323    upl.set('description', frm.description.value);
    273324    upl.set('the_file', file);
  • trunk/www/filemanager/upload/drag_drop_upload.jsp

    r7991 r8013  
    7575  String numFilesText = numFiles == 1 ? "1 file" : numFiles+" files";
    7676  final String title = HTML.encodeTags("Uploading "+numFilesText+" to " + dir.getName());
     77 
     78  JSONArray jsonZipFormats = new JSONArray();
     79  // Query to retreive FileUnpacker plugins
     80  final ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(null, "net.sf.basedb.util.zip.FileUnpacker");
     81  pluginQuery.order(Orders.asc(Hql.property("name")));
     82  pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
     83  List<PluginDefinition> plugins = pluginQuery.list(dc);
     84  for (PluginDefinition plugin : plugins)
     85  {
     86    FileUnpacker unpacker = plugin.newInstance(FileUnpacker.class, sc, null, null);
     87    JSONObject jsonZipFormat = new JSONObject();
     88    jsonZipFormat.put("id", plugin.getId());
     89    jsonZipFormat.put("name", unpacker.getFormatName());
     90    JSONArray jsonExtensions = new JSONArray();
     91    jsonExtensions.addAll(unpacker.getExtensions());
     92    jsonZipFormat.put("extensions", jsonExtensions);
     93    jsonZipFormats.add(jsonZipFormat);
     94  }
    7795  %>
    7896  <base:page type="popup" title="<%=title%>">
     
    121139    data-directory-id="<%=directoryId%>"
    122140    data-directory-path="<%=HTML.encodeTags(dir.getPath().toString()) %>"
     141    data-zip-formats="<%=HTML.encodeTags(jsonZipFormats.toJSONString()) %>"
    123142  ></div>
    124143
     
    128147    <div class="content">
    129148      <table class="fullform input100 bottomborder">
    130       <tr class="bottomborder" style="border-bottom-style: dotted;">
     149      <tr>
    131150        <th>Overwrite existing</th>
    132151        <td>
     
    137156        <td></td>
    138157      </tr>
    139       <tr class="big">
     158      <tr id="unpackSection" style="display: none;">
     159        <th class="subprompt"></th>
     160        <td>
     161          <label><input type="checkbox" name="unpackCompressed" id="unpackCompressed">Unpack compressed files</label>
     162        </td>
     163        <td></td>
     164      </tr>
     165      <tr class="big topborder" style="border-top-style: dotted;">
    140166        <th>Files</th>
    141167        <td colspan="2">
  • trunk/www/my_base/index.jsp

    r7999 r8013  
    391391      {
    392392        %>
     393        <div style="margin: 0.25em;">
    393394        Using quota from group: <%=Base.getLinkedName(ID, quotaGroup, false, true)%>
     395        </div>
    394396        <%
    395397      }
Note: See TracChangeset for help on using the changeset viewer.