Changeset 1336


Ignore:
Timestamp:
Apr 11, 2011, 1:06:01 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #303: Automatic attachment of files to sample (Case) items

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/refform.jsp

    r1335 r1336  
    4040<script language="JavaScript">
    4141
    42 var debug = true;
     42var debug = false;
    4343var currentStep = 1;
    4444
     
    6161}
    6262
    63 
    64 function goNext(manual)
    65 {
    66   setInnerHTML('gonext.message', '');
    67   if (currentStep == 1)
    68   {
    69     if (step1IsValid())
    70     {
    71       gotoStep2();
    72     }
    73   }
    74 }
    7563
    7664function goNextOnTab(event)
     
    139127function selectDirectoryOnClick()
    140128{
     129  if (currentStep != 1) return;
    141130  var frm = document.forms['reggie'];
    142131  var url = '../../filemanager/directories/index.jsp?ID=<%=ID%>&mode=selectonedirectory&callback=setDirectoryCallback';
     
    161150}
    162151
    163 function gotoStep2()
    164 {
     152function goProcess()
     153{
     154  if (!step1IsValid()) return;
     155
     156  Main.hide('gocancel');
     157  Main.hide('goprocess');
     158 
    165159  var frm = document.forms['reggie'];
    166160 
    167161  frm.directoryId.disabled = true;
    168162  frm.pattern.disabled = true;
     163  Main.addClass(document.getElementById('directoryId'), 'disabled');
    169164 
    170165  var directoryId = frm.directoryId.value;
     
    186181 
    187182  currentStep = 2;
    188   Main.show('gocancel');
    189183  var files = response.files;
    190184 
     
    223217    if (numAlreadyLinked > 0)
    224218    {
    225       html += '<tr><td colspan="2" class="summary">' + numAlreadyLinked + ' file(s) was already linked to a case</td></tr>\n';
    226       html += htmlAlreadyLinked;
     219      html += '<tr><td colspan="2" class="summary" onclick="showHide(\'alreadyLinked\')" title="Click to show/hide details">';
     220      html += '<img src="../../images/show_section.gif" id="alreadyLinkedImg">';
     221      html += numAlreadyLinked + ' file(s) was already linked to a case</td></tr>\n';
     222      html += '<tbody id="alreadyLinked" style="display: none;">' + htmlAlreadyLinked + "</tbody>";
    227223    }
    228224    if (numLinkedNow > 0)
    229225    {
    230       html += '<tr><td colspan="2" class="summary">' + numLinkedNow + ' file(s) linked to a case</td></tr>\n';
    231       html += htmlLinkedNow;
     226      html += '<tr><td colspan="2" class="summary" onclick="showHide(\'linkCreated\')" title="Click to show/hide details">';
     227      html += '<img src="../../images/hide_section.gif" id="linkCreatedImg">';
     228      html += numLinkedNow + ' file(s) linked to a case</td></tr>\n';
     229      html += '<tbody id="linkCreated">' + htmlLinkedNow + "</tbody>";
    232230    }
    233231    if (numNotLinked > 0)
    234232    {
    235       html += '<tr><td colspan="2" class="summary">' + numNotLinked + ' file(s) could not be linked</td></tr>\n';
    236       html += htmlNotLinked;
     233      html += '<tr><td colspan="2" class="summary" onclick="showHide(\'notLinked\')" title="Click to show/hide details">';
     234      html += '<img src="../../images/hide_section.gif" id="notLinkedImg">';
     235      html += numNotLinked + ' file(s) could not be linked</td></tr>\n';
     236      html += '<tbody id="notLinked">' + htmlNotLinked + "</tbody>";
    237237    }
    238238   
    239239    setInnerHTML('filesProcessed', html);
    240240  }
    241  
    242  
    243241  Main.show('filesSection');
    244  
    245  
    246  
     242  Main.show('gorestart');
     243 
     244 
     245}
     246
     247function showHide(sectionId)
     248{
     249  Main.showHide(sectionId);
     250  var img = document.getElementById(sectionId + 'Img');
     251  img.src = img.src.indexOf('show') > 0 ? '../../images/hide_section.gif' : '../../images/show_section.gif';
    247252}
    248253
     
    358363}
    359364
     365.disabled .buttonclass_inner
     366{
     367  color: #666666;
     368}
     369
     370.disabled .buttonclass_hover
     371{
     372  color: #666666;
     373  background: #E0E0E0;
     374  cursor: default;
     375}
     376
    360377.linktable
    361378{
     
    368385  color: #333377;
    369386  border-bottom: 1px solid #999999;
     387  cursor: pointer;
    370388}
    371389
     
    422440        </td>
    423441        <td class="status" id="directory.status"></td>
    424         <td class="help"><span id="directory.message" class="message" style="display: none;"></span>The directory containing scanned referral forms.</td>
     442        <td class="help"><span id="directory.message" class="message" style="display: none;"></span>
     443          The directory containing scanned referral forms. Sub-directories are not searched.</td>
    425444      </tr>
    426445      <tr>
     
    458477  <tr>
    459478    <td><base:button id="gocancel" title="Cancel" onclick="goRestart(false)" style="display: none;"/></td>
    460     <td><base:button id="gonext" title="Next" image="gonext.gif" onclick="goNext(true)"/></td>
    461     <td><base:button id="gocreate" title="Create" image="gonext.gif" onclick="goCreate()" style="display: none;"/></td>
    462     <td><base:button id="goupdate" title="Update" image="gonext.gif" onclick="goCreate()" style="display: none;"/></td>
     479    <td><base:button id="goprocess" title="Process" image="gonext.gif" onclick="goProcess()"
     480      tooltip="Process the files in the selected directory"/></td>
    463481    <td><base:button id="gorestart" title="Restart" image="goback.gif" onclick="goRestart(true)" style="display: none;"/></td>
    464482    <td id="gonext.message" class="message"></td>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ReferralFormServlet.java

    r1335 r1336  
    2020import net.sf.basedb.core.ItemContext;
    2121import net.sf.basedb.core.ItemQuery;
     22import net.sf.basedb.core.Permission;
    2223import net.sf.basedb.core.SessionControl;
    2324import net.sf.basedb.core.Type;
     
    145146            {
    146147              link = AnyToAny.getNew(dc, theCase.getItem(), file, linkName, true);
     148              if (file.hasPermission(Permission.WRITE)) file.setWriteProtected(true);
    147149              dc.saveItem(link);
    148150            }
Note: See TracChangeset for help on using the changeset viewer.