Changeset 7851


Ignore:
Timestamp:
Oct 14, 2020, 2:23:30 PM (14 months ago)
Author:
Nicklas Nordborg
Message:

References #2222: Add support for manually adding any-to-any link column in table lists

Added a simple dialog for adding any-to-any columns. It is enabled on all lists by default and should be disabled in places were it is not supported (such as lists that mix different kinds of items).

Location:
trunk/www
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/common/columns/configure.js

    r7842 r7851  
    5959      Buttons.addClickHandler('selectRelatedItemColumn', configure.selectRelatedItemColumn);
    6060      Events.addEventHandler('selectRelatedItemColumn', 'base-selected', configure.relatedItemColumnSelected);
     61    }
     62    if (Doc.element('selectLinkedItemColumn'))
     63    {
     64      Buttons.addClickHandler('selectLinkedItemColumn', configure.selectLinkedItemColumn);
     65      Events.addEventHandler('selectLinkedItemColumn', 'base-selected', configure.linkedItemColumnSelected);
    6166    }
    6267   
     
    235240      if (frm.visible[i].value == data.property) return;
    236241    }
    237 
     242    frm.visible[frm.visible.length] = new Option(data.title, data.property);
     243  }
     244 
     245  configure.selectLinkedItemColumn = function(event)
     246  {
     247    var frm = document.forms['columns'];
     248    var url = 'add_linkeditem_column.jsp?ID='+App.getSessionId();
     249    url += '&item_type='+Data.get('page-data', 'item-type');
     250    Dialogs.openPopup(url, 'SelectLinkedItemColumn', 600, 400);
     251  }
     252
     253  configure.linkedItemColumnSelected = function(event)
     254  {
     255    var frm = document.forms['columns'];
     256    var data = event.detail;
     257    // Do not add duplicates
     258    for (var i = 0; i < frm.visible.length; i++)
     259    {
     260      if (frm.visible[i].value == data.property) return;
     261    }
    238262    frm.visible[frm.visible.length] = new Option(data.title, data.property);
    239263  }
  • trunk/www/common/columns/configure.jsp

    r7842 r7851  
    5555final boolean enableInheritedAnnotations = Values.getBoolean(request.getParameter("enableInheritedAnnotations"));
    5656final boolean enableRelatedItemColumns = Values.getBoolean(request.getParameter("enableRelatedItemColumns"));
     57final boolean enableLinkedItemColumns = Values.getBoolean(request.getParameter("enableLinkedItemColumns"));
    5758final ItemContext cc = sc.getCurrentContext(itemType, subContext);
    5859
     
    7778    <table style="width: 100%; height: 100%;">
    7879    <%
    79     if (enableInheritedAnnotations || enableRelatedItemColumns)
     80    if (enableInheritedAnnotations || enableRelatedItemColumns || enableLinkedItemColumns)
    8081    {
    8182      %>
     
    9697            tooltip="Add columns from parent or child items"
    9798            visible="<%=enableRelatedItemColumns %>"
     99           />
     100          <tbl:button
     101            id="selectLinkedItemColumn"
     102            image="add.png"
     103            title="Add linked columns&hellip;"
     104            tooltip="Add columns from linked items"
     105            visible="<%=enableLinkedItemColumns %>"
    98106           />
    99107        </tbl:toolbar>
  • trunk/www/include/scripts/table.js

    r7842 r7851  
    885885    var enableInheritedAnnotations = Data.get(tableDiv, 'inherited-annotations');
    886886    var enableRelatedItemColumns = Data.get(tableDiv, 'relateditem-columns');
     887    var disableLinkedItemColumns = Data.get(tableDiv, 'no-linkeditem-columns');
    887888   
    888889    var url = App.getRoot()+'common/columns/configure.jsp?ID='+App.getSessionId();
    889890    url += '&table_id='+tableDiv.id+'&item_type='+itemType+'&subcontext='+subContext;
    890     if (enableInheritedAnnotations)
    891     {
    892       url += '&enableInheritedAnnotations='+encodeURIComponent(enableInheritedAnnotations);
    893     }
    894     if (enableRelatedItemColumns)
    895     {
    896       url += '&enableRelatedItemColumns='+encodeURIComponent(enableRelatedItemColumns);
    897     }
     891    if (enableInheritedAnnotations) url += '&enableInheritedAnnotations=1';
     892    if (enableRelatedItemColumns) url += '&enableRelatedItemColumns=1';
     893    if (!disableLinkedItemColumns) url += '&enableLinkedItemColumns=1';
     894
    898895    if (settingName) url += '&settingName='+settingName;
    899896    Dialogs.openPopup(url, 'ConfigureColumns', 750, 450);
  • trunk/www/include/styles/table.css

    r7846 r7851  
    219219}
    220220
     221/* A column header defining a linked item value */
     222.itemlist div.data th.linkeditemcol::before
     223{
     224  margin-right: 2px;
     225  float: left;
     226  content: '›';
     227  color: #999999;
     228}
    221229
    222230/* Place property filters */
  • trunk/www/my_base/projects/items/list_items.jsp

    r7605 r7851  
    163163      subcontext="<%=subContext%>"
    164164      subclass="fulltable"
     165      data-no-linkeditem-columns="1"
    165166      >
    166167      <tbl:hidden
  • trunk/www/views/items/list_items.jsp

    r7605 r7851  
    150150      subcontext="<%=subContext%>"
    151151      subclass="fulltable"
     152      data-no-linkeditem-columns="1"
    152153      >
    153154      <tbl:columndef
  • trunk/www/views/trashcan/list_trash.jsp

    r7605 r7851  
    150150      subcontext="<%=subContext%>"
    151151      subclass="fulltable"
     152      data-no-linkeditem-columns="1"
    152153      >
    153154      <tbl:columndef
Note: See TracChangeset for help on using the changeset viewer.