Changeset 4578


Ignore:
Timestamp:
Oct 13, 2008, 4:38:58 PM (14 years ago)
Author:
Martin Svensson
Message:

References #1136 Updated most of the index-, view- and list-jsp pages to implement the set-permission functionallity

Location:
trunk/www
Files:
72 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/admin/hardware/index.jsp

    r4510 r4578  
    219219    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    220220  }
    221   else if ("TakeOwnershipOfItem".equals(cmd))
    222   {
    223     // Take ownership a single item and then return to the view page
    224     dc = sc.newDbControl();
    225     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    226     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    227     dc.commit();
    228     redirect = viewPage;
    229   }
    230   else if ("TakeOwnershipOfItems".equals(cmd))
    231   {
    232     // Take ownership all selected items on the list page
    233     dc = sc.newDbControl();
    234     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    235     int numTotal = cc.getSelected().size();
    236     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    237     dc.commit();
    238     if (numTotal != numOwned)
    239     {
    240       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    241     }
    242     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     221  else if ("SetOwnerOfItem".equals(cmd))
     222  {
     223    // Change owner of items selected on a list page
     224    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     225    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     226    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     227  }
     228  else if ("SetOwnerOfItems".equals(cmd))
     229  {
     230    // Change owner of items selected on a list page
     231    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     232    cc.setObject("OwnedItems", cc.getSelected());
     233    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    243234  }
    244235  else if ("ExportItems".equals(cmd))
  • trunk/www/admin/hardware/list_hardware.jsp

    r4510 r4578  
    138138      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    139139    }
    140     function takeOwnership()
    141     {
    142       var frm = document.forms[formId];
    143       if (Forms.numChecked(frm) == 0)
    144       {
    145         alert('Please select at least one item in the list');
    146         return;
    147       }
    148       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    149       {
    150         frm.action = submitPage;
    151         frm.cmd.value = 'TakeOwnershipOfItems';
    152         frm.submit();
    153       }
     140    function setOwner()
     141    {
     142      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    154143    }
    155144    function shareItem(itemId)
     
    315304        <tbl:button
    316305          image="take_ownership.png"
    317           onclick="takeOwnership()"
    318           title="Take ownership&hellip;"
    319           tooltip="Take ownership of the selected items"
     306          onclick="setOwner()"
     307          title="Set owner&hellip;"
     308          tooltip="Change owner of the selected items"
    320309        />
    321310        <tbl:button
  • trunk/www/admin/hardware/view_hardware.jsp

    r4510 r4578  
    112112      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    113113    }
    114     function takeOwnership()
    115     {
    116       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    117       {
    118         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    119       }
     114    function setOwner()
     115    {
     116      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    120117    }
    121118    function runPlugin(cmd)
     
    170167        disabled="<%=setOwnerPermission ? false : true%>"
    171168        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    172         onclick="takeOwnership()"
    173         title="Take ownership&hellip;"
    174         visible="<%=!isOwner%>"
    175         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     169        onclick="setOwner()"
     170        title="Set owner&hellip;"
     171        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    176172      />
    177173      <tbl:button
  • trunk/www/admin/jobagents/index.jsp

    r4510 r4578  
    253253    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    254254  }
    255   else if ("TakeOwnershipOfItem".equals(cmd))
    256   {
    257     // Take ownership a single item and then return to the view page
    258     dc = sc.newDbControl();
    259     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    260     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    261     dc.commit();
    262     redirect = viewPage;
    263   }
    264   else if ("TakeOwnershipOfItems".equals(cmd))
    265   {
    266     // Take ownership all selected items on the list page
    267     dc = sc.newDbControl();
    268     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    269     int numTotal = cc.getSelected().size();
    270     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    271     dc.commit();
    272     if (numTotal != numOwned)
    273     {
    274       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    275     }
    276     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     255  else if ("SetOwnerOfItem".equals(cmd))
     256  {
     257    // Change owner of items selected on a list page
     258    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     259    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     260    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     261  }
     262  else if ("SetOwnerOfItems".equals(cmd))
     263  {
     264    // Change owner of items selected on a list page
     265    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     266    cc.setObject("OwnedItems", cc.getSelected());
     267    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    277268  }
    278269  else if ("ExportItems".equals(cmd))
  • trunk/www/admin/jobagents/list_agents.jsp

    r4510 r4578  
    144144      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    145145    }
    146     function takeOwnership()
    147     {
    148       var frm = document.forms[formId];
    149       if (Forms.numChecked(frm) == 0)
    150       {
    151         alert('Please select at least one item in the list');
    152         return;
    153       }
    154       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    155       {
    156         frm.action = submitPage;
    157         frm.cmd.value = 'TakeOwnershipOfItems';
    158         frm.submit();
    159       }
     146    function setOwner()
     147    {
     148      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    160149    }
    161150    function shareItem(itemId)
     
    349338        <tbl:button
    350339          image="take_ownership.png"
    351           onclick="takeOwnership()"
    352           title="Take ownership&hellip;"
    353           tooltip="Take ownership of the selected items"
     340          onclick="setOwner()"
     341          title="Set owner&hellip;"
     342          tooltip="Change owner of the selected items"
    354343        />
    355344        <tbl:button
  • trunk/www/admin/jobagents/view_agent.jsp

    r4510 r4578  
    128128      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    129129    }
    130     function takeOwnership()
    131     {
    132       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    133       {
    134         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    135       }
     130    function setOwner()
     131    {
     132      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    136133    }
    137134    function configurePlugin(pluginId)
     
    190187        disabled="<%=setOwnerPermission ? false : true%>"
    191188        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    192         onclick="takeOwnership()"
    193         title="Take ownership&hellip;"
    194         visible="<%=!isOwner%>"
    195         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     189        onclick="setOwner()"
     190        title="Set owner&hellip;"
     191        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    196192      />
    197193      <tbl:button
  • trunk/www/admin/pluginconfigurations/index.jsp

    r4510 r4578  
    245245    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    246246  }
    247   else if ("TakeOwnershipOfItem".equals(cmd))
    248   {
    249     // Take ownership a single item and then return to the view page
    250     dc = sc.newDbControl();
    251     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    252     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    253     dc.commit();
    254     redirect = viewPage;
    255   }
    256   else if ("TakeOwnershipOfItems".equals(cmd))
    257   {
    258     // Take ownership all selected items on the list page
    259     dc = sc.newDbControl();
    260     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    261     int numTotal = cc.getSelected().size();
    262     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    263     dc.commit();
    264     if (numTotal != numOwned)
    265     {
    266       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    267     }
    268     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     247  else if ("SetOwnerOfItem".equals(cmd))
     248  {
     249    // Change owner of items selected on a list page
     250    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     251    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     252    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     253  }
     254  else if ("SetOwnerOfItems".equals(cmd))
     255  {
     256    // Change owner of items selected on a list page
     257    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     258    cc.setObject("OwnedItems", cc.getSelected());
     259    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    269260  }
    270261  else if ("ExportItems".equals(cmd))
  • trunk/www/admin/pluginconfigurations/list_configurations.jsp

    r4560 r4578  
    176176      frm.submit();
    177177    }
    178     function takeOwnership()
    179     {
    180       var frm = document.forms[formId];
    181       if (Forms.numChecked(frm) == 0)
    182       {
    183         alert('Please select at least one item in the list');
    184         return;
    185       }
    186       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    187       {
    188         frm.action = submitPage;
    189         frm.cmd.value = 'TakeOwnershipOfItems';
    190         frm.submit();
    191       }
     178    function setOwner()
     179    {
     180      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    192181    }
    193182    function shareItem(itemId)
     
    362351        <tbl:button
    363352          image="take_ownership.png"
    364           onclick="takeOwnership()"
    365           title="Take ownership&hellip;"
    366           tooltip="Take ownership of the selected items"
     353          onclick="setOwner()"
     354          title="Set owner&hellip;"
     355          tooltip="Change owner of the selected items"
    367356        />
    368357        <tbl:button
  • trunk/www/admin/pluginconfigurations/view_configuration.jsp

    r4510 r4578  
    149149      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    150150    }
    151     function takeOwnership()
    152     {
    153       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    154       {
    155         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    156       }
     151    function setOwner()
     152    {
     153      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    157154    }
    158155    function runPlugin(cmd)
     
    217214        disabled="<%=setOwnerPermission ? false : true%>"
    218215        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    219         onclick="takeOwnership()"
    220         title="Take ownership&hellip;"
    221         visible="<%=!isOwner%>"
    222         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     216        onclick="setOwner()"
     217        title="Set owner&hellip;"
     218        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    223219      />
    224220      <tbl:button
  • trunk/www/admin/plugindefinitions/index.jsp

    r4510 r4578  
    406406    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    407407  }
    408   else if ("TakeOwnershipOfItem".equals(cmd))
    409   {
    410     // Take ownership a single item and then return to the view page
    411     dc = sc.newDbControl();
    412     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    413     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    414     dc.commit();
    415     redirect = viewPage;
    416   }
    417   else if ("TakeOwnershipOfItems".equals(cmd))
    418   {
    419     // Take ownership all selected items on the list page
    420     dc = sc.newDbControl();
    421     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    422     int numTotal = cc.getSelected().size();
    423     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    424     dc.commit();
    425     if (numTotal != numOwned)
    426     {
    427       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    428     }
    429     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     408  else if ("SetOwnerOfItem".equals(cmd))
     409  {
     410    // Change owner of items selected on a list page
     411    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     412    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     413    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     414  }
     415  else if ("SetOwnerOfItems".equals(cmd))
     416  {
     417    // Change owner of items selected on a list page
     418    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     419    cc.setObject("OwnedItems", cc.getSelected());
     420    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    430421  }
    431422  else if ("ExportItems".equals(cmd))
  • trunk/www/admin/plugindefinitions/list_plugins.jsp

    r4560 r4578  
    168168      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    169169    }
    170     function takeOwnership()
    171     {
    172       var frm = document.forms[formId];
    173       if (Forms.numChecked(frm) == 0)
    174       {
    175         alert('Please select at least one item in the list');
    176         return;
    177       }
    178       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    179       {
    180         frm.action = submitPage;
    181         frm.cmd.value = 'TakeOwnershipOfItems';
    182         frm.submit();
    183       }
     170    function setOwner()
     171    {
     172      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    184173    }
    185174    function unloadItems()
     
    498487        <tbl:button
    499488          image="take_ownership.png"
    500           onclick="takeOwnership()"
    501           title="Take ownership&hellip;"
    502           tooltip="Take ownership of the selected items"
     489          onclick="setOwner()"
     490          title="Set owner&hellip;"
     491          tooltip="Change owner of the selected items"
    503492        />
    504493        <tbl:button
  • trunk/www/admin/plugindefinitions/view_plugin.jsp

    r4510 r4578  
    155155      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    156156    }
    157     function takeOwnership()
    158     {
    159       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    160       {
    161         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    162       }
     157    function setOwner()
     158    {
     159      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    163160    }
    164161    function runPlugin(cmd)
     
    228225        disabled="<%=setOwnerPermission ? false : true%>"
    229226        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    230         onclick="takeOwnership()"
    231         title="Take ownership&hellip;"
    232         visible="<%=!isOwner%>"
    233         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     227        onclick="setOwner()"
     228        title="Set owner&hellip;"
     229        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    234230      />
    235231      <tbl:button
  • trunk/www/admin/protocols/index.jsp

    r4510 r4578  
    241241    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    242242  }
    243   else if ("TakeOwnershipOfItem".equals(cmd))
    244   {
    245     // Take ownership a single item and then return to the view page
    246     dc = sc.newDbControl();
    247     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    248     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    249     dc.commit();
    250     redirect = viewPage;
    251   }
    252   else if ("TakeOwnershipOfItems".equals(cmd))
    253   {
    254     // Take ownership all selected items on the list page
    255     dc = sc.newDbControl();
    256     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    257     int numTotal = cc.getSelected().size();
    258     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    259     dc.commit();
    260     if (numTotal != numOwned)
    261     {
    262       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    263     }
    264     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     243  else if ("SetOwnerOfItem".equals(cmd))
     244  {
     245    // Change owner of items selected on a list page
     246    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     247    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     248    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     249  }
     250  else if ("SetOwnerOfItems".equals(cmd))
     251  {
     252    // Change owner of items selected on a list page
     253    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     254    cc.setObject("OwnedItems", cc.getSelected());
     255    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    265256  }
    266257  else if ("ExportItems".equals(cmd))
  • trunk/www/admin/protocols/list_protocol.jsp

    r4510 r4578  
    138138      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    139139    }
    140     function takeOwnership()
    141     {
    142       var frm = document.forms[formId];
    143       if (Forms.numChecked(frm) == 0)
    144       {
    145         alert('Please select at least one item in the list');
    146         return;
    147       }
    148       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    149       {
    150         frm.action = submitPage;
    151         frm.cmd.value = 'TakeOwnershipOfItems';
    152         frm.submit();
    153       }
     140    function setOwner()
     141    {
     142      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    154143    }
    155144    function shareItem(itemId)
     
    315304        <tbl:button
    316305          image="take_ownership.png"
    317           onclick="takeOwnership()"
    318           title="Take ownership&hellip;"
    319           tooltip="Take ownership of the selected items"
     306          onclick="setOwner()"
     307          title="Set owner&hellip;"
     308          tooltip="Change owner of the selected items"
    320309        />
    321310        <tbl:button
  • trunk/www/admin/protocols/view_protocol.jsp

    r4510 r4578  
    119119      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    120120    }
    121     function takeOwnership()
    122     {
    123       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    124       {
    125         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    126       }
     121    function setOwner()
     122    {
     123      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    127124    }
    128125    function runPlugin(cmd)
     
    177174        disabled="<%=setOwnerPermission ? false : true%>"
    178175        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    179         onclick="takeOwnership()"
    180         title="Take ownership&hellip;"
    181         visible="<%=!isOwner%>"
    182         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     176        onclick="setOwner()"
     177        title="Set owner&hellip;"
     178        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    183179      />
    184180      <tbl:button
  • trunk/www/admin/software/index.jsp

    r4510 r4578  
    219219    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    220220  }
    221   else if ("TakeOwnershipOfItem".equals(cmd))
    222   {
    223     // Take ownership a single item and then return to the view page
    224     dc = sc.newDbControl();
    225     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    226     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    227     dc.commit();
    228     redirect = viewPage;
    229   }
    230   else if ("TakeOwnershipOfItems".equals(cmd))
    231   {
    232     // Take ownership all selected items on the list page
    233     dc = sc.newDbControl();
    234     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    235     int numTotal = cc.getSelected().size();
    236     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    237     dc.commit();
    238     if (numTotal != numOwned)
    239     {
    240       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    241     }
    242     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     221  else if ("SetOwnerOfItem".equals(cmd))
     222  {
     223    // Change owner of items selected on a list page
     224    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     225    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     226    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     227  }
     228  else if ("SetOwnerOfItems".equals(cmd))
     229  {
     230    // Change owner of items selected on a list page
     231    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     232    cc.setObject("OwnedItems", cc.getSelected());
     233    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    243234  }
    244235  else if ("ExportItems".equals(cmd))
  • trunk/www/admin/software/list_software.jsp

    r4510 r4578  
    138138      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    139139    }
    140     function takeOwnership()
    141     {
    142       var frm = document.forms[formId];
    143       if (Forms.numChecked(frm) == 0)
    144       {
    145         alert('Please select at least one item in the list');
    146         return;
    147       }
    148       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    149       {
    150         frm.action = submitPage;
    151         frm.cmd.value = 'TakeOwnershipOfItems';
    152         frm.submit();
    153       }
     140    function setOwner()
     141    {
     142      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    154143    }
    155144    function shareItem(itemId)
     
    315304        <tbl:button
    316305          image="take_ownership.png"
    317           onclick="takeOwnership()"
    318           title="Take ownership&hellip;"
    319           tooltip="Take ownership of the selected items"
     306          onclick="setOwner()"
     307          title="Set owner&hellip;"
     308          tooltip="Change owner of the selected items"
    320309        />
    321310        <tbl:button
  • trunk/www/admin/software/view_software.jsp

    r4510 r4578  
    112112      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    113113    }
    114     function takeOwnership()
    115     {
    116       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    117       {
    118         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    119       }
     114    function setOwner()
     115    {
     116      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    120117    }
    121118    function runPlugin(cmd)
     
    169166        disabled="<%=setOwnerPermission ? false : true%>"
    170167        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    171         onclick="takeOwnership()"
    172         title="Take ownership&hellip;"
    173         visible="<%=!isOwner%>"
    174         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     168        onclick="setOwner()"
     169        title="Set owner&hellip;"
     170        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    175171      />
    176172      <tbl:button
  • trunk/www/biomaterials/biosources/index.jsp

    r4510 r4578  
    213213    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    214214  }
    215   else if ("TakeOwnershipOfItem".equals(cmd))
    216   {
    217     // Take ownership a single item and then return to the view page
    218     dc = sc.newDbControl();
    219     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    220     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    221     dc.commit();
    222     redirect = viewPage;
    223   }
    224   else if ("TakeOwnershipOfItems".equals(cmd))
    225   {
    226     // Take ownership all selected items on the list page
    227     dc = sc.newDbControl();
    228     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    229     int numTotal = cc.getSelected().size();
    230     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    231     dc.commit();
    232     if (numTotal != numOwned)
    233     {
    234       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    235     }
    236     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     215  else if ("SetOwnerOfItem".equals(cmd))
     216  {
     217    // Change owner of items selected on a list page
     218    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     219    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     220    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     221  }
     222  else if ("SetOwnerOfItems".equals(cmd))
     223  {
     224    // Change owner of items selected on a list page
     225    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     226    cc.setObject("OwnedItems", cc.getSelected());
     227    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    237228  }
    238229  else if ("ExportItems".equals(cmd))
  • trunk/www/biomaterials/biosources/list_biosources.jsp

    r4560 r4578  
    153153      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    154154    }
    155     function takeOwnership()
    156     {
    157       var frm = document.forms[formId];
    158       if (Forms.numChecked(frm) == 0)
    159       {
    160         alert('Please select at least one item in the list');
    161         return;
    162       }
    163       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    164       {
    165         frm.action = submitPage;
    166         frm.cmd.value = 'TakeOwnershipOfItems';
    167         frm.submit();
    168       }
     155    function setOwner()
     156    {
     157      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    169158    }
    170159    function shareItem(itemId)
     
    351340        <tbl:button
    352341          image="take_ownership.png"
    353           onclick="takeOwnership()"
    354           title="Take ownership&hellip;"
    355           tooltip="Take ownership of the selected items"
     342          onclick="setOwner()"
     343          title="Set owner&hellip;"
     344          tooltip="Change owner of the selected items"
    356345        />
    357346        <tbl:button
  • trunk/www/biomaterials/biosources/view_biosource.jsp

    r4510 r4578  
    126126      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    127127    }
    128     function takeOwnership()
    129     {
    130       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    131       {
    132         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    133       }
     128    function setOwner()
     129    {
     130      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    134131    }
    135132    function runPlugin(cmd)
     
    188185        disabled="<%=setOwnerPermission ? false : true%>"
    189186        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    190         onclick="takeOwnership()"
    191         title="Take ownership&hellip;"
    192         visible="<%=!isOwner%>"
    193         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     187        onclick="setOwner()"
     188        title="Set owner&hellip;"
     189        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    194190      />
    195191      <tbl:button
  • trunk/www/biomaterials/extracts/index.jsp

    r4510 r4578  
    276276    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    277277  }
    278   else if ("TakeOwnershipOfItem".equals(cmd))
    279   {
    280     // Take ownership a single item and then return to the view page
    281     dc = sc.newDbControl();
    282     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    283     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    284     dc.commit();
    285     redirect = viewPage;
    286   }
    287   else if ("TakeOwnershipOfItems".equals(cmd))
    288   {
    289     // Take ownership all selected items on the list page
    290     dc = sc.newDbControl();
    291     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    292     int numTotal = cc.getSelected().size();
    293     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    294     dc.commit();
    295     if (numTotal != numOwned)
    296     {
    297       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    298     }
    299     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     278  else if ("SetOwnerOfItem".equals(cmd))
     279  {
     280    // Change owner of items selected on a list page
     281    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     282    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     283    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     284  }
     285  else if ("SetOwnerOfItems".equals(cmd))
     286  {
     287    // Change owner of items selected on a list page
     288    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     289    cc.setObject("OwnedItems", cc.getSelected());
     290    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    300291  }
    301292  else if ("ExportItems".equals(cmd))
  • trunk/www/biomaterials/extracts/list_extracts.jsp

    r4560 r4578  
    167167      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    168168    }
    169     function takeOwnership()
    170     {
    171       var frm = document.forms[formId];
    172       if (Forms.numChecked(frm) == 0)
    173       {
    174         alert('Please select at least one item in the list');
    175         return;
    176       }
    177       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    178       {
    179         frm.action = submitPage;
    180         frm.cmd.value = 'TakeOwnershipOfItems';
    181         frm.submit();
    182       }
     169    function setOwner()
     170    {
     171      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    183172    }
    184173    function shareItem(itemId)
     
    433422        <tbl:button
    434423          image="take_ownership.png"
    435           onclick="takeOwnership()"
    436           title="Take ownership&hellip;"
    437           tooltip="Take ownership of the selected items"
     424          onclick="setOwner()"
     425          title="Set owner&hellip;"
     426          tooltip="Change owner of the selected items"
    438427        />
    439428        <tbl:button
  • trunk/www/biomaterials/extracts/view_extract.jsp

    r4559 r4578  
    134134      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    135135    }
    136     function takeOwnership()
    137     {
    138       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    139       {
    140         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    141       }
     136    function setOwner()
     137    {
     138      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    142139    }
    143140    function runPlugin(cmd)
     
    211208        disabled="<%=setOwnerPermission ? false : true%>"
    212209        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    213         onclick="takeOwnership()"
    214         title="Take ownership&hellip;"
    215         visible="<%=!isOwner%>"
    216         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     210        onclick="setOwner()"
     211        title="Set owner&hellip;"
     212        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    217213      />
    218214      <tbl:button
  • trunk/www/biomaterials/labeledextracts/index.jsp

    r4510 r4578  
    290290    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    291291  }
    292   else if ("TakeOwnershipOfItem".equals(cmd))
    293   {
    294     // Take ownership a single item and then return to the view page
    295     dc = sc.newDbControl();
    296     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    297     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    298     dc.commit();
    299     redirect = viewPage;
    300   }
    301   else if ("TakeOwnershipOfItems".equals(cmd))
    302   {
    303     // Take ownership all selected items on the list page
    304     dc = sc.newDbControl();
    305     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    306     int numTotal = cc.getSelected().size();
    307     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    308     dc.commit();
    309     if (numTotal != numOwned)
    310     {
    311       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    312     }
    313     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     292  else if ("SetOwnerOfItem".equals(cmd))
     293  {
     294    // Change owner of items selected on a list page
     295    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     296    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     297    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     298  }
     299  else if ("SetOwnerOfItems".equals(cmd))
     300  {
     301    // Change owner of items selected on a list page
     302    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     303    cc.setObject("OwnedItems", cc.getSelected());
     304    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    314305  }
    315306  else if ("ExportItems".equals(cmd))
  • trunk/www/biomaterials/labeledextracts/list_labeledextracts.jsp

    r4560 r4578  
    163163      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    164164    }
    165     function takeOwnership()
    166     {
    167       var frm = document.forms[formId];
    168       if (Forms.numChecked(frm) == 0)
    169       {
    170         alert('Please select at least one item in the list');
    171         return;
    172       }
    173       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    174       {
    175         frm.action = submitPage;
    176         frm.cmd.value = 'TakeOwnershipOfItems';
    177         frm.submit();
    178       }
     165    function setOwner()
     166    {
     167      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    179168    }
    180169    function shareItem(itemId)
  • trunk/www/biomaterials/labeledextracts/view_labeledextract.jsp

    r4559 r4578  
    133133      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    134134    }
    135     function takeOwnership()
    136     {
    137       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    138       {
    139         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    140       }
     135    function setOwner()
     136    {
     137      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    141138    }
    142139    function runPlugin(cmd)
     
    210207        disabled="<%=setOwnerPermission ? false : true%>"
    211208        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    212         onclick="takeOwnership()"
    213         title="Take ownership&hellip;"
    214         visible="<%=!isOwner%>"
    215         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     209        onclick="setOwner()"
     210        title="Set owner&hellip;"
     211        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    216212      />
    217213      <tbl:button
  • trunk/www/biomaterials/labels/index.jsp

    r4510 r4578  
    210210    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    211211  }
    212   else if ("TakeOwnershipOfItem".equals(cmd))
    213   {
    214     // Take ownership a single item and then return to the view page
    215     dc = sc.newDbControl();
    216     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    217     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    218     dc.commit();
    219     redirect = viewPage;
    220   }
    221   else if ("TakeOwnershipOfItems".equals(cmd))
    222   {
    223     // Take ownership all selected items on the list page
    224     dc = sc.newDbControl();
    225     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    226     int numTotal = cc.getSelected().size();
    227     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    228     dc.commit();
    229     if (numTotal != numOwned)
    230     {
    231       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    232     }
    233     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     212  else if ("SetOwnerOfItem".equals(cmd))
     213  {
     214    // Change owner of items selected on a list page
     215    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     216    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     217    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     218  }
     219  else if ("SetOwnerOfItems".equals(cmd))
     220  {
     221    // Change owner of items selected on a list page
     222    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     223    cc.setObject("OwnedItems", cc.getSelected());
     224    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    234225  }
    235226  else if ("ExportItems".equals(cmd))
  • trunk/www/biomaterials/labels/list_labels.jsp

    r4510 r4578  
    131131      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    132132    }
    133     function takeOwnership()
    134     {
    135       var frm = document.forms[formId];
    136       if (Forms.numChecked(frm) == 0)
    137       {
    138         alert('Please select at least one item in the list');
    139         return;
    140       }
    141       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    142       {
    143         frm.action = submitPage;
    144         frm.cmd.value = 'TakeOwnershipOfItems';
    145         frm.submit();
    146       }
     133    function setOwner()
     134    {
     135      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    147136    }
    148137    function shareItem(itemId)
     
    284273        <tbl:button
    285274          image="take_ownership.png"
    286           onclick="takeOwnership()"
    287           title="Take ownership&hellip;"
    288           tooltip="Take ownership of the selected items"
     275          onclick="setOwner()"
     276          title="Set owner&hellip;"
     277          tooltip="Change owner of the selected items"
    289278        />
    290279        <tbl:button
  • trunk/www/biomaterials/labels/view_label.jsp

    r4510 r4578  
    118118      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    119119    }
    120     function takeOwnership()
    121     {
    122       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    123       {
    124         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    125       }
     120    function setOwner()
     121    {
     122      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    126123    }
    127124    function runPlugin(cmd)
     
    179176        disabled="<%=setOwnerPermission ? false : true%>"
    180177        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    181         onclick="takeOwnership()"
    182         title="Take ownership&hellip;"
    183         visible="<%=!isOwner%>"
    184         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     178        onclick="setOwner()"
     179        title="Set owner&hellip;"
     180        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    185181      />
    186182      <tbl:button
  • trunk/www/biomaterials/samples/index.jsp

    r4510 r4578  
    276276    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    277277  }
    278   else if ("TakeOwnershipOfItem".equals(cmd))
    279   {
    280     // Take ownership a single item and then return to the view page
    281     dc = sc.newDbControl();
    282     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    283     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    284     dc.commit();
    285     redirect = viewPage;
    286   }
    287   else if ("TakeOwnershipOfItems".equals(cmd))
    288   {
    289     // Take ownership all selected items on the list page
    290     dc = sc.newDbControl();
    291     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    292     int numTotal = cc.getSelected().size();
    293     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    294     dc.commit();
    295     if (numTotal != numOwned)
    296     {
    297       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    298     }
    299     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     278  else if ("SetOwnerOfItem".equals(cmd))
     279  {
     280    // Change owner of items selected on a list page
     281    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     282    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     283    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     284  }
     285  else if ("SetOwnerOfItems".equals(cmd))
     286  {
     287    // Change owner of items selected on a list page
     288    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     289    cc.setObject("OwnedItems", cc.getSelected());
     290    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    300291  }
    301292  else if ("ExportItems".equals(cmd))
  • trunk/www/biomaterials/samples/list_samples.jsp

    r4555 r4578  
    168168      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    169169    }
    170     function takeOwnership()
    171     {
    172       var frm = document.forms[formId];
    173       if (Forms.numChecked(frm) == 0)
    174       {
    175         alert('Please select at least one item in the list');
    176         return;
    177       }
    178       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    179       {
    180         frm.action = submitPage;
    181         frm.cmd.value = 'TakeOwnershipOfItems';
    182         frm.submit();
    183       }
     170    function setOwner()
     171    {
     172      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    184173    }
    185174    function shareItem(itemId)
     
    434423        <tbl:button
    435424          image="take_ownership.png"
    436           onclick="takeOwnership()"
    437           title="Take ownership&hellip;"
    438           tooltip="Take ownership of the selected items"
     425          onclick="setOwner()"
     426          title="Set owner&hellip;"
     427          tooltip="Change owner of the selected items"
    439428        />
    440429        <tbl:button
  • trunk/www/biomaterials/samples/view_sample.jsp

    r4559 r4578  
    135135      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    136136    }
    137     function takeOwnership()
    138     {
    139       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    140       {
    141         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    142       }
     137    function setOwner()
     138    {
     139      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    143140    }
    144141    function runPlugin(cmd)
     
    208205        disabled="<%=setOwnerPermission ? false : true%>"
    209206        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    210         onclick="takeOwnership()"
    211         title="Take ownership&hellip;"
    212         visible="<%=!isOwner%>"
    213         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     207        onclick="setOwner()"
     208        title="Set owner&hellip;"
     209        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    214210      />
    215211      <tbl:button
  • trunk/www/filemanager/directories/index.jsp

    r4510 r4578  
    114114    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    115115  }
    116   else if ("TakeOwnershipOfItem".equals(cmd))
     116  else if ("SetOwnerOfItem".equals(cmd))
    117117  {
    118     // Take ownership a single item and then return to the view page
    119     dc = sc.newDbControl();
     118    // Change owner of items selected on a list page
    120119    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    121     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    122     dc.commit();
    123     redirect = viewPage;
     120    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     121    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    124122  }
    125123  else if ("UpdateItem".equals(cmd))
  • trunk/www/lims/arraybatches/index.jsp

    r4511 r4578  
    233233    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    234234  }
    235   else if ("TakeOwnershipOfItem".equals(cmd))
    236   {
    237     // Take ownership a single item and then return to the view page
    238     dc = sc.newDbControl();
    239     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    240     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    241     dc.commit();
    242     redirect = viewPage;
    243   }
    244   else if ("TakeOwnershipOfItems".equals(cmd))
    245   {
    246     // Take ownership all selected items on the list page
    247     dc = sc.newDbControl();
    248     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    249     int numTotal = cc.getSelected().size();
    250     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    251     dc.commit();
    252     if (numTotal != numOwned)
    253     {
    254       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    255     }
    256     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     235  else if ("SetOwnerOfItem".equals(cmd))
     236  {
     237    // Change owner of items selected on a list page
     238    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     239    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     240    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     241  }
     242  else if ("SetOwnerOfItems".equals(cmd))
     243  {
     244    // Change owner of items selected on a list page
     245    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     246    cc.setObject("OwnedItems", cc.getSelected());
     247    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    257248  }
    258249  else if ("ExportItems".equals(cmd))
  • trunk/www/lims/arraybatches/list_batches.jsp

    r4560 r4578  
    155155      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    156156    }
    157     function takeOwnership()
    158     {
    159       var frm = document.forms[formId];
    160       if (Forms.numChecked(frm) == 0)
    161       {
    162         alert('Please select at least one item in the list');
    163         return;
    164       }
    165       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    166       {
    167         frm.action = submitPage;
    168         frm.cmd.value = 'TakeOwnershipOfItems';
    169         frm.submit();
    170       }
     157    function setOwner()
     158    {
     159      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    171160    }
    172161    function shareItem(itemId)
     
    375364        <tbl:button
    376365          image="take_ownership.png"
    377           onclick="takeOwnership()"
    378           title="Take ownership&hellip;"
    379           tooltip="Take ownership of the selected items"
     366          onclick="setOwner()"
     367          title="Set owner&hellip;"
     368          tooltip="Change owner of the selected items"
    380369        />
    381370        <tbl:button
  • trunk/www/lims/arraybatches/view_batch.jsp

    r4511 r4578  
    127127      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    128128    }
    129     function takeOwnership()
    130     {
    131       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    132       {
    133         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    134       }
     129    function setOwner()
     130    {
     131      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    135132    }
    136133    function runPlugin(cmd)
     
    206203        disabled="<%=setOwnerPermission ? false : true%>"
    207204        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    208         onclick="takeOwnership()"
    209         title="Take ownership&hellip;"
    210         visible="<%=!isOwner%>"
    211         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     205        onclick="setOwner()"
     206        title="Set owner&hellip;"
     207        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    212208      />
    213209      <tbl:button
  • trunk/www/lims/arraydesigns/index.jsp

    r4511 r4578  
    252252    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    253253  }
    254   else if ("TakeOwnershipOfItem".equals(cmd))
    255   {
    256     // Take ownership a single item and then return to the view page
    257     dc = sc.newDbControl();
    258     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    259     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    260     dc.commit();
    261     redirect = viewPage;
    262   }
    263   else if ("TakeOwnershipOfItems".equals(cmd))
    264   {
    265     // Take ownership all selected items on the list page
    266     dc = sc.newDbControl();
    267     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    268     int numTotal = cc.getSelected().size();
    269     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    270     dc.commit();
    271     if (numTotal != numOwned)
    272     {
    273       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    274     }
    275     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     254  else if ("SetOwnerOfItem".equals(cmd))
     255  {
     256    // Change owner of items selected on a list page
     257    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     258    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     259    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     260  }
     261  else if ("SetOwnerOfItems".equals(cmd))
     262  {
     263    // Change owner of items selected on a list page
     264    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     265    cc.setObject("OwnedItems", cc.getSelected());
     266    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    276267  }
    277268  else if ("ExportItems".equals(cmd))
  • trunk/www/lims/arraydesigns/list_designs.jsp

    r4560 r4578  
    184184      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    185185    }
    186     function takeOwnership()
    187     {
    188       var frm = document.forms[formId];
    189       if (Forms.numChecked(frm) == 0)
    190       {
    191         alert('Please select at least one item in the list');
    192         return;
    193       }
    194       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    195       {
    196         frm.action = submitPage;
    197         frm.cmd.value = 'TakeOwnershipOfItems';
    198         frm.submit();
    199       }
     186    function setOwner()
     187    {
     188      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    200189    }
    201190    function shareItem(itemId)
     
    472461        <tbl:button
    473462          image="take_ownership.png"
    474           onclick="takeOwnership()"
    475           title="Take ownership&hellip;"
    476           tooltip="Take ownership of the selected items"
     463          onclick="setOwner()"
     464          title="Set owner&hellip;"
     465          tooltip="Change owner of the selected items"
    477466        />
    478467        <tbl:button
  • trunk/www/lims/arraydesigns/view_design.jsp

    r4511 r4578  
    147147      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    148148    }
    149     function takeOwnership()
    150     {
    151       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    152       {
    153         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    154       }
     149    function setOwner()
     150    {
     151      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    155152    }
    156153    function runPlugin(cmd)
     
    231228        disabled="<%=setOwnerPermission ? false : true%>"
    232229        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    233         onclick="takeOwnership()"
    234         title="Take ownership&hellip;"
    235         visible="<%=!isOwner%>"
    236         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     230        onclick="setOwner()"
     231        title="Set owner&hellip;"
     232        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    237233      />
    238234      <tbl:button
  • trunk/www/lims/arrayslides/index.jsp

    r4511 r4578  
    281281    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    282282  }
    283   else if ("TakeOwnershipOfItem".equals(cmd))
    284   {
    285     // Take ownership a single item and then return to the view page
    286     dc = sc.newDbControl();
    287     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    288     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    289     dc.commit();
    290     redirect = viewPage;
    291   }
    292   else if ("TakeOwnershipOfItems".equals(cmd))
    293   {
    294     // Take ownership all selected items on the list page
    295     dc = sc.newDbControl();
    296     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    297     int numTotal = cc.getSelected().size();
    298     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    299     dc.commit();
    300     if (numTotal != numOwned)
    301     {
    302       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    303     }
    304     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     283  else if ("SetOwnerOfItem".equals(cmd))
     284  {
     285    // Change owner of items selected on a list page
     286    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     287    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     288    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     289  }
     290  else if ("SetOwnerOfItems".equals(cmd))
     291  {
     292    // Change owner of items selected on a list page
     293    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     294    cc.setObject("OwnedItems", cc.getSelected());
     295    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    305296  }
    306297  else if ("ExportItems".equals(cmd))
  • trunk/www/lims/arrayslides/list_slides.jsp

    r4560 r4578  
    148148      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    149149    }
    150     function takeOwnership()
    151     {
    152       var frm = document.forms[formId];
    153       if (Forms.numChecked(frm) == 0)
    154       {
    155         alert('Please select at least one item in the list');
    156         return;
    157       }
    158       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    159       {
    160         frm.action = submitPage;
    161         frm.cmd.value = 'TakeOwnershipOfItems';
    162         frm.submit();
    163       }
     150    function setOwner()
     151    {
     152      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    164153    }
    165154    function shareItem(itemId)
     
    390379        <tbl:button
    391380          image="take_ownership.png"
    392           onclick="takeOwnership()"
    393           title="Take ownership&hellip;"
    394           tooltip="Take ownership of the selected items"
     381          onclick="setOwner()"
     382          title="Set owner&hellip;"
     383          tooltip="Change owner of the selected items"
    395384        />
    396385        <tbl:button
  • trunk/www/lims/arrayslides/view_slide.jsp

    r4511 r4578  
    125125      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    126126    }
    127     function takeOwnership()
    128     {
    129       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    130       {
    131         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    132       }
     127    function setOwner()
     128    {
     129      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    133130    }
    134131    function runPlugin(cmd)
     
    182179        disabled="<%=setOwnerPermission ? false : true%>"
    183180        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    184         onclick="takeOwnership()"
    185         title="Take ownership&hellip;"
    186         visible="<%=!isOwner%>"
    187         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     181        onclick="setOwner()"
     182        title="Set owner&hellip;"
     183        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    188184      />
    189185      <tbl:button
  • trunk/www/lims/platemappings/index.jsp

    r4511 r4578  
    219219    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    220220  }
    221   else if ("TakeOwnershipOfItem".equals(cmd))
    222   {
    223     // Take ownership a single item and then return to the view page
    224     dc = sc.newDbControl();
    225     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    226     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    227     dc.commit();
    228     redirect = viewPage;
    229   }
    230   else if ("TakeOwnershipOfItems".equals(cmd))
    231   {
    232     // Take ownership all selected items on the list page
    233     dc = sc.newDbControl();
    234     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    235     int numTotal = cc.getSelected().size();
    236     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    237     dc.commit();
    238     if (numTotal != numOwned)
    239     {
    240       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    241     }
    242     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     221  else if ("SetOwnerOfItem".equals(cmd))
     222  {
     223    // Change owner of items selected on a list page
     224    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     225    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     226    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     227  }
     228  else if ("SetOwnerOfItems".equals(cmd))
     229  {
     230    // Change owner of items selected on a list page
     231    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     232    cc.setObject("OwnedItems", cc.getSelected());
     233    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    243234  }
    244235  else if ("ExportItems".equals(cmd))
  • trunk/www/lims/platemappings/list_mappings.jsp

    r4511 r4578  
    141141      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    142142    }
    143     function takeOwnership()
    144     {
    145       var frm = document.forms[formId];
    146       if (Forms.numChecked(frm) == 0)
    147       {
    148         alert('Please select at least one item in the list');
    149         return;
    150       }
    151       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    152       {
    153         frm.action = submitPage;
    154         frm.cmd.value = 'TakeOwnershipOfItems';
    155         frm.submit();
    156       }
     143    function setOwner()
     144    {
     145      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    157146    }
    158147    function shareItem(itemId)
     
    342331        <tbl:button
    343332          image="take_ownership.png"
    344           onclick="takeOwnership()"
    345           title="Take ownership&hellip;"
    346           tooltip="Take ownership of the selected items"
     333          onclick="setOwner()"
     334          title="Set owner&hellip;"
     335          tooltip="Change owner of the selected items"
    347336        />
    348337        <tbl:button
  • trunk/www/lims/platemappings/view_mapping.jsp

    r4511 r4578  
    128128      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    129129    }
    130     function takeOwnership()
    131     {
    132       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    133       {
    134         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    135       }
     130    function setOwner()
     131    {
     132      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    136133    }
    137134    function runPlugin(cmd)
     
    185182        disabled="<%=setOwnerPermission ? false : true%>"
    186183        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    187         onclick="takeOwnership()"
    188         title="Take ownership&hellip;"
    189         visible="<%=!isOwner%>"
    190         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     184        onclick="setOwner()"
     185        title="Set owner&hellip;"
     186        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    191187      />
    192188      <tbl:button
  • trunk/www/lims/plates/index.jsp

    r4511 r4578  
    216216    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    217217  }
    218   else if ("TakeOwnershipOfItem".equals(cmd))
    219   {
    220     // Take ownership a single item and then return to the view page
    221     dc = sc.newDbControl();
    222     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    223     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    224     dc.commit();
    225     redirect = viewPage;
    226   }
    227   else if ("TakeOwnershipOfItems".equals(cmd))
    228   {
    229     // Take ownership all selected items on the list page
    230     dc = sc.newDbControl();
    231     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    232     int numTotal = cc.getSelected().size();
    233     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    234     dc.commit();
    235     if (numTotal != numOwned)
    236     {
    237       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    238     }
    239     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     218  else if ("SetOwnerOfItem".equals(cmd))
     219  {
     220    // Change owner of items selected on a list page
     221    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     222    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     223    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     224  }
     225  else if ("SetOwnerOfItems".equals(cmd))
     226  {
     227    // Change owner of items selected on a list page
     228    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     229    cc.setObject("OwnedItems", cc.getSelected());
     230    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    240231  }
    241232  else if ("ExportItems".equals(cmd))
  • trunk/www/lims/plates/list_plates.jsp

    r4560 r4578  
    165165      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    166166    }
    167     function takeOwnership()
    168     {
    169       var frm = document.forms[formId];
    170       if (Forms.numChecked(frm) == 0)
    171       {
    172         alert('Please select at least one item in the list');
    173         return;
    174       }
    175       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    176       {
    177         frm.action = submitPage;
    178         frm.cmd.value = 'TakeOwnershipOfItems';
    179         frm.submit();
    180       }
     167    function setOwner()
     168    {
     169      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    181170    }
    182171    function shareItem(itemId)
     
    414403        <tbl:button
    415404          image="take_ownership.png"
    416           onclick="takeOwnership()"
    417           title="Take ownership&hellip;"
    418           tooltip="Take ownership of the selected items"
     405          onclick="setOwner()"
     406          title="Set owner&hellip;"
     407          tooltip="Change owner of the selected items"
    419408        />
    420409        <tbl:button
  • trunk/www/lims/plates/view_plate.jsp

    r4511 r4578  
    132132      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    133133    }
    134     function takeOwnership()
    135     {
    136       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    137       {
    138         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    139       }
     134    function setOwner()
     135    {
     136      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    140137    }
    141138    function runPlugin(cmd)
     
    212209        disabled="<%=setOwnerPermission ? false : true%>"
    213210        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    214         onclick="takeOwnership()"
    215         title="Take ownership&hellip;"
    216         visible="<%=!isOwner%>"
    217         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     211        onclick="setOwner()"
     212        title="Set owner&hellip;"
     213        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    218214      />
    219215      <tbl:button
  • trunk/www/lims/platetypes/index.jsp

    r4511 r4578  
    215215    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    216216  }
    217   else if ("TakeOwnershipOfItem".equals(cmd))
    218   {
    219     // Take ownership a single item and then return to the view page
    220     dc = sc.newDbControl();
    221     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    222     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    223     dc.commit();
    224     redirect = viewPage;
    225   }
    226   else if ("TakeOwnershipOfItems".equals(cmd))
    227   {
    228     // Take ownership all selected items on the list page
    229     dc = sc.newDbControl();
    230     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    231     int numTotal = cc.getSelected().size();
    232     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    233     dc.commit();
    234     if (numTotal != numOwned)
    235     {
    236       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    237     }
    238     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     217  else if ("SetOwnerOfItem".equals(cmd))
     218  {
     219    // Change owner of items selected on a list page
     220    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     221    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     222    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     223  }
     224  else if ("SetOwnerOfItems".equals(cmd))
     225  {
     226    // Change owner of items selected on a list page
     227    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     228    cc.setObject("OwnedItems", cc.getSelected());
     229    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    239230  }
    240231  else if ("ExportItems".equals(cmd))
  • trunk/www/lims/platetypes/list_platetypes.jsp

    r4511 r4578  
    150150      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    151151    }
    152     function takeOwnership()
    153     {
    154       var frm = document.forms[formId];
    155       if (Forms.numChecked(frm) == 0)
    156       {
    157         alert('Please select at least one item in the list');
    158         return;
    159       }
    160       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    161       {
    162         frm.action = submitPage;
    163         frm.cmd.value = 'TakeOwnershipOfItems';
    164         frm.submit();
    165       }
     152    function setOwner()
     153    {
     154      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    166155    }
    167156    function shareItem(itemId)
     
    319308        <tbl:button
    320309          image="take_ownership.png"
    321           onclick="takeOwnership()"
    322           title="Take ownership&hellip;"
    323           tooltip="Take ownership of the selected items"
     310          onclick="setOwner()"
     311          title="Set owner&hellip;"
     312          tooltip="Change owner of the selected items"
    324313        />
    325314        <tbl:button
  • trunk/www/lims/platetypes/view_platetype.jsp

    r4511 r4578  
    122122      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    123123    }
    124     function takeOwnership()
    125     {
    126       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    127       {
    128         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    129       }
     124    function setOwner()
     125    {
     126      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    130127    }
    131128    function runPlugin(cmd)
     
    195192          disabled="<%=setOwnerPermission ? false : true%>"
    196193          image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    197           onclick="takeOwnership()"
    198           title="Take ownership&hellip;"
    199           visible="<%=!isOwner%>"
    200           tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     194          onclick="setOwner()"
     195          title="Set owner&hellip;"
     196          tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    201197        />
    202198        <tbl:button
  • trunk/www/my_base/projects/index.jsp

    r4511 r4578  
    254254    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
    255255  }
    256   else if ("TakeOwnershipOfItem".equals(cmd))
    257   {
    258     // Take ownership a single item and then return to the view page
    259     dc = sc.newDbControl();
    260     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    261     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    262     dc.commit();
    263     redirect = viewPage;
    264   }
    265   else if ("TakeOwnershipOfItems".equals(cmd))
    266   {
    267     // Take ownership all selected items on the list page
    268     dc = sc.newDbControl();
    269     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    270     int numTotal = cc.getSelected().size();
    271     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    272     dc.commit();
    273     if (numTotal != numOwned)
    274     {
    275       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    276     }
    277     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     256  else if ("SetOwnerOfItem".equals(cmd))
     257  {
     258    // Change owner of items selected on a list page
     259    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     260    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     261    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     262  }
     263  else if ("SetOwnerOfItems".equals(cmd))
     264  {
     265    // Change owner of items selected on a list page
     266    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     267    cc.setObject("OwnedItems", cc.getSelected());
     268    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    278269  }
    279270  else if ("ExportItems".equals(cmd))
  • trunk/www/my_base/projects/list_projects.jsp

    r4511 r4578  
    131131      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    132132    }
    133     function takeOwnership()
    134     {
    135       var frm = document.forms[formId];
    136       if (Forms.numChecked(frm) == 0)
    137       {
    138         alert('Please select at least one item in the list');
    139         return;
    140       }
    141       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    142       {
    143         frm.action = submitPage;
    144         frm.cmd.value = 'TakeOwnershipOfItems';
    145         frm.submit();
    146       }
     133    function setOwner()
     134    {
     135      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    147136    }
    148137    function configureColumns()
     
    271260        <tbl:button
    272261          image="take_ownership.png"
    273           onclick="takeOwnership()"
    274           title="Take ownership&hellip;"
    275           tooltip="Take ownership of the selected items"
    276           visible="<%=sc.hasPermission(Permission.SET_OWNER, Item.PROJECT)%>"
     262          onclick="setOwner()"
     263          title="Set owner&hellip;"
     264          tooltip="Change owner of the selected items"
    277265        />
    278266        <tbl:button
  • trunk/www/my_base/projects/view_project.jsp

    r4511 r4578  
    114114      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    115115    }
    116     function takeOwnership()
    117     {
    118       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    119       {
    120         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    121       }
     116    function setOwner()
     117    {
     118      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    122119    }
    123120    function runPlugin(cmd)
     
    184181        disabled="<%=setOwnerPermission ? false : true%>"
    185182        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    186         onclick="takeOwnership()"
    187         title="Take ownership&hellip;"
    188         visible="<%=!isOwner%>"
    189         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     183        onclick="setOwner()"
     184        title="Set owner&hellip;"
     185        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    190186      />
    191187      <tbl:button
  • trunk/www/views/experiments/index.jsp

    r4511 r4578  
    272272    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    273273  }
    274   else if ("TakeOwnershipOfItem".equals(cmd))
    275   {
    276     // Take ownership a single item and then return to the view page
    277     dc = sc.newDbControl();
    278     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    279     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    280     dc.commit();
    281     redirect = viewPage;
    282   }
    283   else if ("TakeOwnershipOfItems".equals(cmd))
    284   {
    285     // Take ownership all selected items on the list page
    286     dc = sc.newDbControl();
    287     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    288     int numTotal = cc.getSelected().size();
    289     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    290     dc.commit();
    291     if (numTotal != numOwned)
    292     {
    293       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    294     }
    295     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     274  else if ("SetOwnerOfItem".equals(cmd))
     275  {
     276    // Change owner of items selected on a list page
     277    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     278    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     279    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     280  }
     281  else if ("SetOwnerOfItems".equals(cmd))
     282  {
     283    // Change owner of items selected on a list page
     284    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     285    cc.setObject("OwnedItems", cc.getSelected());
     286    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    296287  }
    297288  else if ("ExportItems".equals(cmd))
  • trunk/www/views/experiments/list_experiments.jsp

    r4511 r4578  
    135135      frm.submit();
    136136    }
    137     function takeOwnership()
    138     {
    139       var frm = document.forms[formId];
    140       if (Forms.numChecked(frm) == 0)
    141       {
    142         alert('Please select at least one item in the list');
    143         return;
    144       }
    145       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    146       {
    147         frm.action = submitPage;
    148         frm.cmd.value = 'TakeOwnershipOfItems';
    149         frm.submit();
    150       }
     137    function setOwner()
     138    {
     139      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    151140    }
    152141    function deleteItemPermanently(itemId)
     
    410399        <tbl:button
    411400          image="take_ownership.png"
    412           onclick="takeOwnership()"
    413           title="Take ownership&hellip;"
    414           tooltip="Take ownership of the selected items"
     401          onclick="setOwner()"
     402          title="Set owner&hellip;"
     403          tooltip="Change owner of the selected items"
    415404        />
    416405        <tbl:button
  • trunk/www/views/experiments/view_experiment.jsp

    r4548 r4578  
    135135    {
    136136      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    137     }
    138    
    139     function takeOwnership()
    140     {
    141       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    142       {
    143         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    144       }
     137    }   
     138    function setOwner()
     139    {
     140      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    145141    }
    146142    function runPlugin(cmd)
     
    245241        disabled="<%=setOwnerPermission ? false : true%>"
    246242        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    247         onclick="takeOwnership()"
    248         title="Take ownership&hellip;"
    249         visible="<%=!isOwner%>"
    250         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     243        onclick="setOwner()"
     244        title="Set owner&hellip;"
     245        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    251246      />
    252247      <tbl:button
  • trunk/www/views/formulas/index.jsp

    r4511 r4578  
    233233    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    234234  }
    235   else if ("TakeOwnershipOfItem".equals(cmd))
    236   {
    237     // Take ownership a single item and then return to the view page
    238     dc = sc.newDbControl();
    239     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    240     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    241     dc.commit();
    242     redirect = viewPage;
    243   }
    244   else if ("TakeOwnershipOfItems".equals(cmd))
    245   {
    246     // Take ownership all selected items on the list page
    247     dc = sc.newDbControl();
    248     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    249     int numTotal = cc.getSelected().size();
    250     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    251     dc.commit();
    252     if (numTotal != numOwned)
    253     {
    254       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    255     }
    256     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     235  else if ("SetOwnerOfItem".equals(cmd))
     236  {
     237    // Change owner of items selected on a list page
     238    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     239    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     240    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     241  }
     242  else if ("SetOwnerOfItems".equals(cmd))
     243  {
     244    // Change owner of items selected on a list page
     245    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     246    cc.setObject("OwnedItems", cc.getSelected());
     247    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    257248  }
    258249  else if ("ExportItems".equals(cmd))
  • trunk/www/views/formulas/list_formulas.jsp

    r4511 r4578  
    156156      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    157157    }
    158     function takeOwnership()
    159     {
    160       var frm = document.forms[formId];
    161       if (Forms.numChecked(frm) == 0)
    162       {
    163         alert('Please select at least one item in the list');
    164         return;
    165       }
    166       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    167       {
    168         frm.action = submitPage;
    169         frm.cmd.value = 'TakeOwnershipOfItems';
    170         frm.submit();
    171       }
     158    function setOwner()
     159    {
     160      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    172161    }
    173162    function shareItem(itemId)
     
    408397        <tbl:button
    409398          image="take_ownership.png"
    410           onclick="takeOwnership()"
    411           title="Take ownership&hellip;"
    412           tooltip="Take ownership of the selected items"
     399          onclick="setOwner()"
     400          title="Set owner&hellip;"
     401          tooltip="Change owner of the selected items"
    413402        />
    414403        <tbl:button
  • trunk/www/views/formulas/view_formula.jsp

    r4511 r4578  
    118118      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    119119    }
    120     function takeOwnership()
    121     {
    122       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    123       {
    124         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    125       }
     120    function setOwner()
     121    {
     122      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    126123    }
    127124    function runPlugin(cmd)
     
    175172        disabled="<%=setOwnerPermission ? false : true%>"
    176173        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    177         onclick="takeOwnership()"
    178         title="Take ownership&hellip;"
    179         visible="<%=!isOwner%>"
    180         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     174        onclick="setOwner()"
     175        title="Set owner&hellip;"
     176        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    181177      />
    182178      <tbl:button
  • trunk/www/views/hybridizations/index.jsp

    r4511 r4578  
    273273    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    274274  }
    275   else if ("TakeOwnershipOfItem".equals(cmd))
    276   {
    277     // Take ownership a single item and then return to the view page
    278     dc = sc.newDbControl();
    279     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    280     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    281     dc.commit();
    282     redirect = viewPage;
    283   }
    284   else if ("TakeOwnershipOfItems".equals(cmd))
    285   {
    286     // Take ownership all selected items on the list page
    287     dc = sc.newDbControl();
    288     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    289     int numTotal = cc.getSelected().size();
    290     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    291     dc.commit();
    292     if (numTotal != numOwned)
    293     {
    294       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    295     }
    296     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     275  else if ("SetOwnerOfItem".equals(cmd))
     276  {
     277    // Change owner of items selected on a list page
     278    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     279    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     280    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     281  }
     282  else if ("SetOwnerOfItems".equals(cmd))
     283  {
     284    // Change owner of items selected on a list page
     285    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     286    cc.setObject("OwnedItems", cc.getSelected());
     287    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    297288  }
    298289  else if ("ExportItems".equals(cmd))
  • trunk/www/views/hybridizations/list_hybridizations.jsp

    r4560 r4578  
    168168      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    169169    }
    170     function takeOwnership()
    171     {
    172       var frm = document.forms[formId];
    173       if (Forms.numChecked(frm) == 0)
    174       {
    175         alert('Please select at least one item in the list');
    176         return;
    177       }
    178       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    179       {
    180         frm.action = submitPage;
    181         frm.cmd.value = 'TakeOwnershipOfItems';
    182         frm.submit();
    183       }
     170    function setOwner()
     171    {
     172      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    184173    }
    185174    function shareItem(itemId)
     
    420409        <tbl:button
    421410          image="take_ownership.png"
    422           onclick="takeOwnership()"
    423           title="Take ownership&hellip;"
    424           tooltip="Take ownership of the selected items"
     411          onclick="setOwner()"
     412          title="Set owner&hellip;"
     413          tooltip="Change owner of the selected items"
    425414        />
    426415        <tbl:button
  • trunk/www/views/hybridizations/view_hybridization.jsp

    r4511 r4578  
    134134      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    135135    }
    136     function takeOwnership()
    137     {
    138       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    139       {
    140         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    141       }
     136    function setOwner()
     137    {
     138      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    142139    }
    143140    function runPlugin(cmd)
     
    196193        disabled="<%=setOwnerPermission ? false : true%>"
    197194        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    198         onclick="takeOwnership()"
    199         title="Take ownership&hellip;"
    200         visible="<%=!isOwner%>"
    201         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     195        onclick="setOwner()"
     196        title="Set owner&hellip;"
     197        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    202198      />
    203199      <tbl:button
  • trunk/www/views/jobs/index.jsp

    r4511 r4578  
    160160    redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
    161161  }
    162   else if ("TakeOwnershipOfItem".equals(cmd))
    163   {
    164     // Take ownership a single item and then return to the view page
    165     dc = sc.newDbControl();
    166     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    167     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    168     dc.commit();
    169     redirect = viewPage;
    170   }
    171   else if ("TakeOwnershipOfItems".equals(cmd))
    172   {
    173     // Take ownership all selected items on the list page
    174     dc = sc.newDbControl();
    175     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    176     int numTotal = cc.getSelected().size();
    177     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    178     dc.commit();
    179     if (numTotal != numOwned)
    180     {
    181       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    182     }
    183     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     162  else if ("SetOwnerOfItem".equals(cmd))
     163  {
     164    // Change owner of items selected on a list page
     165    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     166    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     167    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     168  }
     169  else if ("SetOwnerOfItems".equals(cmd))
     170  {
     171    // Change owner of items selected on a list page
     172    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     173    cc.setObject("OwnedItems", cc.getSelected());
     174    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    184175  }
    185176  else if ("ExportItems".equals(cmd))
  • trunk/www/views/jobs/list_jobs.jsp

    r4511 r4578  
    160160      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    161161    }
    162     function takeOwnership()
    163     {
    164       var frm = document.forms[formId];
    165       if (Forms.numChecked(frm) == 0)
    166       {
    167         alert('Please select at least one item in the list');
    168         return;
    169       }
    170       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    171       {
    172         frm.action = submitPage;
    173         frm.cmd.value = 'TakeOwnershipOfItems';
    174         frm.submit();
    175       }
     162    function setOwner()
     163    {
     164      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    176165    }
    177166    function configureColumns()
     
    447436        <tbl:button
    448437          image="take_ownership.png"
    449           onclick="takeOwnership()"
    450           title="Take ownership&hellip;"
    451           tooltip="Take ownership of the selected items"
    452           visible="<%=sc.hasPermission(Permission.SET_OWNER, Item.JOB)%>"
     438          onclick="setOwner()"
     439          title="Set owner&hellip;"
     440          tooltip="Change owner of the selected items"
    453441        />
    454442        <tbl:button
  • trunk/www/views/reporterlists/index.jsp

    r4511 r4578  
    298298    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    299299  }
    300   else if ("TakeOwnershipOfItem".equals(cmd))
    301   {
    302     // Take ownership a single item and then return to the view page
    303     dc = sc.newDbControl();
    304     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    305     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    306     dc.commit();
    307     redirect = viewPage;
    308   }
    309   else if ("TakeOwnershipOfItems".equals(cmd))
    310   {
    311     // Take ownership all selected items on the list page
    312     dc = sc.newDbControl();
    313     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    314     int numTotal = cc.getSelected().size();
    315     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    316     dc.commit();
    317     if (numTotal != numOwned)
    318     {
    319       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    320     }
    321     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     300  else if ("SetOwnerOfItem".equals(cmd))
     301  {
     302    // Change owner of items selected on a list page
     303    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     304    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     305    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     306  }
     307  else if ("SetOwnerOfItems".equals(cmd))
     308  {
     309    // Change owner of items selected on a list page
     310    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     311    cc.setObject("OwnedItems", cc.getSelected());
     312    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    322313  }
    323314  else if ("ExportItems".equals(cmd))
  • trunk/www/views/reporterlists/list_reporterlists.jsp

    r4511 r4578  
    131131      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    132132    }
    133     function takeOwnership()
    134     {
    135       var frm = document.forms[formId];
    136       if (Forms.numChecked(frm) == 0)
    137       {
    138         alert('Please select at least one item in the list');
    139         return;
    140       }
    141       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    142       {
    143         frm.action = submitPage;
    144         frm.cmd.value = 'TakeOwnershipOfItems';
    145         frm.submit();
    146       }
     133    function setOwner()
     134    {
     135      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    147136    }
    148137    function shareItem(itemId)
     
    307296        <tbl:button
    308297          image="take_ownership.png"
    309           onclick="takeOwnership()"
    310           title="Take ownership&hellip;"
    311           tooltip="Take ownership of the selected items"
     298          onclick="setOwner()"
     299          title="Set owner&hellip;"
     300          tooltip="Change owner of the selected items"
    312301        />
    313302        <tbl:button
  • trunk/www/views/reporterlists/view_reporterlist.jsp

    r4511 r4578  
    113113      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    114114    }
    115     function takeOwnership()
    116     {
    117       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    118       {
    119         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    120       }
     115    function setOwner()
     116    {
     117      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    121118    }
    122119    function runPlugin(cmd)
     
    189186        disabled="<%=setOwnerPermission ? false : true%>"
    190187        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    191         onclick="takeOwnership()"
    192         title="Take ownership&hellip;"
    193         visible="<%=!isOwner%>"
    194         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     188        onclick="setOwner()"
     189        title="Set owner&hellip;"
     190        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    195191      />
    196192      <tbl:button
  • trunk/www/views/scans/index.jsp

    r4511 r4578  
    237237    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name();
    238238  }
    239   else if ("TakeOwnershipOfItem".equals(cmd))
    240   {
    241     // Take ownership a single item and then return to the view page
    242     dc = sc.newDbControl();
    243     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    244     OwnableUtil.setOwner(dc, itemType, Collections.singleton(cc.getId()), null);
    245     dc.commit();
    246     redirect = viewPage;
    247   }
    248   else if ("TakeOwnershipOfItems".equals(cmd))
    249   {
    250     // Take ownership all selected items on the list page
    251     dc = sc.newDbControl();
    252     ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
    253     int numTotal = cc.getSelected().size();
    254     int numOwned = OwnableUtil.setOwner(dc, itemType, cc.getSelected(), null);
    255     dc.commit();
    256     if (numTotal != numOwned)
    257     {
    258       message = (numOwned == 0 ? "No" : "Only "+numOwned+" of "+numTotal) + " items could be taken, because you have no SET_OWNER permission";
    259     }
    260     redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : "");
     239  else if ("SetOwnerOfItem".equals(cmd))
     240  {
     241    // Change owner of items selected on a list page
     242    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     243    cc.setObject("OwnedItems", Collections.singleton(cc.getId()));
     244    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     245  }
     246  else if ("SetOwnerOfItems".equals(cmd))
     247  {
     248    // Change owner of items selected on a list page
     249    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     250    cc.setObject("OwnedItems", cc.getSelected());
     251    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
    261252  }
    262253  else if ("ExportItems".equals(cmd))
  • trunk/www/views/scans/list_scans.jsp

    r4560 r4578  
    154154      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
    155155    }
    156     function takeOwnership()
    157     {
    158       var frm = document.forms[formId];
    159       if (Forms.numChecked(frm) == 0)
    160       {
    161         alert('Please select at least one item in the list');
    162         return;
    163       }
    164       if (confirm('Are you sure that you want to take ownership of the selected items? It can\'t be undone.'))
    165       {
    166         frm.action = submitPage;
    167         frm.cmd.value = 'TakeOwnershipOfItems';
    168         frm.submit();
    169       }
     156    function setOwner()
     157    {
     158      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
    170159    }
    171160    function shareItem(itemId)
     
    374363        <tbl:button
    375364          image="take_ownership.png"
    376           onclick="takeOwnership()"
    377           title="Take ownership&hellip;"
    378           tooltip="Take ownership of the selected items"
     365          onclick="setOwner()"
     366          title="Set owner&hellip;"
     367          tooltip="Change owner of the selected items"
    379368        />
    380369        <tbl:button
  • trunk/www/views/scans/view_scan.jsp

    r4511 r4578  
    127127      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
    128128    }
    129     function takeOwnership()
    130     {
    131       if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
    132       {
    133         location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
    134       }
     129    function setOwner()
     130    {
     131      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 150);
    135132    }
    136133    function runPlugin(cmd)
     
    204201        disabled="<%=setOwnerPermission ? false : true%>"
    205202        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
    206         onclick="takeOwnership()"
    207         title="Take ownership&hellip;"
    208         visible="<%=!isOwner%>"
    209         tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
     203        onclick="setOwner()"
     204        title="Set owner&hellip;"
     205        tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
    210206      />
    211207      <tbl:button
Note: See TracChangeset for help on using the changeset viewer.