Changeset 4588


Ignore:
Timestamp:
Oct 16, 2008, 12:13:47 PM (14 years ago)
Author:
Martin Svensson
Message:

Fixes #1136 Give away/set owner of items

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/src/docbook/admindoc/user_administration.xml

    r4587 r4588  
    953953              <simpara>
    954954                <guilabel>O</guilabel>
    955                 = Change owner
     955                = Set owner
    956956              </simpara>
    957957            </listitem>
  • trunk/doc/src/docbook/userdoc/webclient.xml

    r4587 r4588  
    12061206                <listitem><simpara><guilabel>W</guilabel> = Write</simpara></listitem>
    12071207                <listitem><simpara><guilabel>D</guilabel> = Delete</simpara></listitem>
    1208                 <listitem><simpara><guilabel>O</guilabel> = Change owner</simpara></listitem>
     1208                <listitem><simpara><guilabel>O</guilabel> = Set owner</simpara></listitem>
    12091209                <listitem><simpara><guilabel>P</guilabel> = Set permission</simpara></listitem>
    12101210                </itemizedlist>
     
    13321332        <title>Change owner of items</title>
    13331333        <para>
    1334           Sometime it may be necessary to change the owner of an item.
    1335           This can be done by everyone with <synopsis>Change owner</synopsis>
     1334          Sometimes it may be necessary to change the owner of an item.
     1335          This can be done by everyone with <emphasis>Set owner</emphasis>
    13361336          permission on the item.
    13371337          For a user to have the rights to change owner of an item, the item must
    1338           either be owned by or shared with <guilabel>Change owner</guilabel>
     1338          either be owned by or shared with <emphasis>Set owner</emphasis>
    13391339          permission to the user .
    13401340          See <xref linkend="webclient.items.share" />.
     
    13421342       
    13431343        <para>
    1344           An user with <synopsis>change owner</synopsis> permission can go to a list view
     1344          An user with <emphasis>Set owner</emphasis> permission can go to a list view
    13451345          (or the single-item view), mark the checkboxes for the items to change owner of,
    1346           and click on the <guibutton>Set owner</guibutton> button.
    1347           A dialog appears where the new owner can be selected. By default the logged in
    1348           user is selected in the drop-down list but another user can be choosen with the
    1349           <guibutton>Select</guibutton> button.
    1350         </para>
     1346          and click on the <guibutton>Set owner</guibutton> button. 
     1347          A dialog window, like the screen-shot below, will appear.
     1348        </para>
     1349        <helptext external_id="ownership.configure" title="Change owner">
     1350        <variablelist>
     1351        <varlistentry>
     1352          <term><guilabel>New owner</guilabel></term>
     1353          <listitem>
     1354          <para>
     1355            The user to be the new owner of selected item(s).
     1356            By default the current user will be selected but other
     1357            users can be picked from the <emphasis>currently used</emphasis> part of the drop-down
     1358            list or by clicking on <guibutton>Select</guibutton>.
     1359          </para>
     1360          </listitem>
     1361        </varlistentry>
     1362        </variablelist>
     1363        <para>
     1364          Use the &gbSave; button to set the new owner
     1365          or the &gbCancel; button to
     1366          close the pop-up without saving.
     1367        </para>
     1368        </helptext>
    13511369        <figure id="webclient.figures.selectowner">
    13521370          <title>Select a new owner</title>
  • trunk/www/views/items/index.jsp

    r4511 r4588  
    3030  import="net.sf.basedb.core.BasicItem"
    3131  import="net.sf.basedb.core.SharedItem"
     32  import="net.sf.basedb.core.OwnedItem"
    3233  import="net.sf.basedb.core.Removable"
    3334  import="net.sf.basedb.core.Permission"
     
    216217    redirect = "../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name()+"&subcontext="+subContext;
    217218  }
    218 
     219  else if ("SetOwnerOfItems".equals(cmd))
     220  {
     221    // Change owner of items selected on a list page
     222    dc = sc.newDbControl();
     223    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     224    Set<OwnedItem> items = new HashSet<OwnedItem>();
     225    Enumeration<String> names = (Enumeration<String>)request.getParameterNames();
     226    //User user = User.getById(dc, sc.getLoggedInUserId());
     227    while (names.hasMoreElements())
     228    {
     229      String name = names.nextElement();
     230      if (name.startsWith("item:"))
     231      {
     232        Item itemType = Item.valueOf(name.substring(5));
     233        Integer[] ids = Values.getInt(request.getParameterValues(name));
     234        for (int itemId : ids)
     235        {
     236          BasicItem item = itemType.getById(dc, itemId);
     237          if (item instanceof OwnedItem && item.hasPermission(Permission.SET_OWNER))
     238          {
     239            items.add((OwnedItem)item);
     240          }
     241        }
     242      }
     243    }
     244    dc.close();
     245    cc.setObject("OwnedItems", items);
     246    redirect = "../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name();
     247  }
    219248  else
    220249  {
  • trunk/www/views/items/list_items.jsp

    r4511 r4588  
    155155      Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems', /item:/);
    156156    }
     157    function setOwner()
     158    {
     159      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems', /item:/);
     160    }
    157161    function configureColumns()
    158162    {
     
    237241          tooltip="Share the selected items"
    238242          disabled="<%=totalCount <= 0%>"
     243        />
     244        <tbl:button
     245          image="take_ownership.png"
     246          onclick="setOwner()"
     247          title="Set owner&hellip;"
     248          tooltip="Change owner of the selected items"
    239249        />
    240250        <tbl:button
Note: See TracChangeset for help on using the changeset viewer.