Changeset 5964


Ignore:
Timestamp:
Feb 15, 2012, 2:59:24 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1614: Add option in edit dialog to add new items as project default items

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/test/roles/index.html

    r5886 r5964  
    593593 
    594594  <li>
    595     Create protocols:
     595    Create protocols (keep the 'Set as project default' option checked):
    596596    <table class="listing" cellspacing="0" cellpadding="2" border="0">
    597597    <tr>
     
    654654
    655655  <li>
    656     Create hardware:
     656    Create hardware (keep the 'Set as project default' option checked):
    657657    <table class="listing" cellspacing="0" cellpadding="2" border="0">
    658658    <tr>
     
    685685 
    686686  <li>
    687     Create software:
     687    Create software (keep the 'Set as project default' option checked):
    688688    <table class="listing" cellspacing="0" cellpadding="2" border="0">
    689689    <tr>
     
    12561256
    12571257  <li>
    1258     Create array designs and upload data files to them:
     1258    Create array designs and upload data files to them.  Keep the 'Set as project default' option checked
     1259    if doing this manually.
    12591260    <table class="listing" cellspacing="0" cellpadding="2" border="0">
    12601261    <tr>
     
    13271328    Set project defaults. Go to the projects page and edit the
    13281329    <code>Project A</code> project. On the <code>Defaults</code>
    1329     tab, set the following defaults:
     1330    tab, set the following defaults. NOTE! Most of the items in this
     1331    list should already be registered as default items if the
     1332    'Set as project default' option was used when creating the new items.
    13301333   
    13311334    <table class="listing" cellspacing="0" cellpadding="2" border="0">
  • trunk/src/core/net/sf/basedb/core/Keyring.java

    r5934 r5964  
    748748
    749749  /**
     750    Get the max project permission within the currently active project.
     751  */
     752  int getMaxProjectPermission()
     753  {
     754    return maxProjectPermission;
     755  }
     756 
     757  /**
    750758    Set the active project.
    751759    @param projectData The project to make active, or null to
  • trunk/src/core/net/sf/basedb/core/SessionControl.java

    r5829 r5964  
    894894 
    895895  /**
     896    Get the permissions that the logged in user has in the currently active project.
     897    @return A Set with the permissions
     898    @since 3.1
     899  */
     900  public Set<Permission> getActiveProjectPermissions()
     901  {
     902    return Permission.fromInt(loginInfo == null ? 0 : loginInfo.keyring.getMaxProjectPermission());
     903  }
     904 
     905
     906 
     907  /**
    896908    Create a new session control for executing a plugin.
    897909    @param plugin The plugin to execute
  • trunk/www/admin/hardware/edit_hardware.jsp

    r5946 r5964  
    217217        </td>
    218218      </tr>
     219      <%
     220      if (sc.getActiveProjectId() != 0 && hardware == null && sc.getActiveProjectPermissions().contains(Permission.WRITE))
     221      {
     222        %>
     223        <tr>
     224          <th></th>
     225          <td>
     226            <input type="checkbox" id="setAsProjectDefault" name="setAsProjectDefault" value="1"
     227              checked><label for="setAsProjectDefault">Set as project default</label>
     228          </td>
     229          <td></td>
     230        </tr>
     231        <%
     232      }
     233      %>
    219234      </table>
    220235    </t:tab>
  • trunk/www/admin/hardware/index.jsp

    r5643 r5964  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.Hardware"
     32  import="net.sf.basedb.core.Project"
    3233  import="net.sf.basedb.core.ItemSubtype"
    3334  import="net.sf.basedb.core.ItemQuery"
     
    140141      message = "Hardware created";
    141142      dc.saveItem(hardware);
     143      if (Values.getBoolean("setAsProjectDefault"))
     144      {
     145        Project.getById(dc, sc.getActiveProjectId()).addDefaultItem(hardware);
     146      }
    142147    }
    143148    else
  • trunk/www/admin/protocols/edit_protocol.jsp

    r5949 r5964  
    341341        </td>
    342342      </tr>
     343      <%
     344      if (sc.getActiveProjectId() != 0 && protocol == null && sc.getActiveProjectPermissions().contains(Permission.WRITE))
     345      {
     346        %>
     347        <tr>
     348          <th></th>
     349          <td>
     350            <input type="checkbox" id="setAsProjectDefault" name="setAsProjectDefault" value="1"
     351              checked><label for="setAsProjectDefault">Set as project default</label>
     352          </td>
     353          <td></td>
     354        </tr>
     355        <%
     356      }
     357      %>
    343358      </table>
    344359    </t:tab>
  • trunk/www/admin/protocols/index.jsp

    r5643 r5964  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.Protocol"
     32  import="net.sf.basedb.core.Project"
    3233  import="net.sf.basedb.core.ItemSubtype"
    3334  import="net.sf.basedb.core.AnnotationType"
     
    142143      message = "Protocol created";
    143144      dc.saveItem(protocol);
     145      if (Values.getBoolean("setAsProjectDefault"))
     146      {
     147        Project.getById(dc, sc.getActiveProjectId()).addDefaultItem(protocol);
     148      }
    144149    }
    145150    else
  • trunk/www/admin/software/edit_software.jsp

    r5946 r5964  
    218218        </td>
    219219      </tr>
     220      <%
     221      if (sc.getActiveProjectId() != 0 && software == null && sc.getActiveProjectPermissions().contains(Permission.WRITE))
     222      {
     223        %>
     224        <tr>
     225          <th></th>
     226          <td>
     227            <input type="checkbox" id="setAsProjectDefault" name="setAsProjectDefault" value="1"
     228              checked><label for="setAsProjectDefault">Set as project default</label>
     229          </td>
     230          <td></td>
     231        </tr>
     232        <%
     233      }
     234      %>
    220235      </table>
    221236    </t:tab>
  • trunk/www/admin/software/index.jsp

    r5643 r5964  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.Software"
     32  import="net.sf.basedb.core.Project"
    3233  import="net.sf.basedb.core.ItemSubtype"
    3334  import="net.sf.basedb.core.ItemQuery"
     
    139140      software = Software.getNew(dc);
    140141      message = "Software created";
     142      if (Values.getBoolean("setAsProjectDefault"))
     143      {
     144        Project.getById(dc, sc.getActiveProjectId()).addDefaultItem(software);
     145      }
    141146      dc.saveItem(software);
    142147    }
  • trunk/www/lims/arraydesigns/edit_design.jsp

    r5946 r5964  
    348348        </td>
    349349      </tr>
     350      <%
     351      if (sc.getActiveProjectId() != 0 && design == null && sc.getActiveProjectPermissions().contains(Permission.WRITE))
     352      {
     353        %>
     354        <tr>
     355          <th></th>
     356          <td>
     357            <input type="checkbox" id="setAsProjectDefault" name="setAsProjectDefault" value="1"
     358              checked><label for="setAsProjectDefault">Set as project default</label>
     359          </td>
     360          <td></td>
     361        </tr>
     362        <%
     363      }
     364      %>
    350365      </table>
    351366    </t:tab>
  • trunk/www/lims/arraydesigns/index.jsp

    r5630 r5964  
    3232  import="net.sf.basedb.core.ArrayBatch"
    3333  import="net.sf.basedb.core.ArrayDesign"
     34  import="net.sf.basedb.core.Project"
    3435  import="net.sf.basedb.core.Platform"
    3536  import="net.sf.basedb.core.PlatformVariant"
     
    184185      message = "Array design created";
    185186      dc.saveItem(design);
     187      if (Values.getBoolean("setAsProjectDefault"))
     188      {
     189        Project.getById(dc, sc.getActiveProjectId()).addDefaultItem(design);
     190      }
    186191    }
    187192    else
Note: See TracChangeset for help on using the changeset viewer.