ArasLabs / set-tab-color

Allows configuration of relationship tab color.
3 stars 3 forks source link

Update to SP11 or equal #2

Closed AngelaIp closed 6 years ago

AngelaIp commented 6 years ago

Hi,

the current version does not work for newer Aras versions (I used SP11 for testing). The code returns erros on various places. This is my last version. It fixes most of the issues, but unfortunately still doesn´t color anything:

var maxCheck = 30;
function changeCelColor()
{

  if(!parent.relationships)
  {
   if(--maxCheck===0) { return; }
   setTimeout(changeCelColor,50);
   return;
  }

  var tabbar= parent.relationships.relTabbar;
  var dom = tabbar.domNode;

  //タブカラーマスタの取得
  var inn = Innovator();
  var itemName = document.thisItem.getType();
  var itm_color = inn.newItem("Ext_SetTabColor");
  var itm_ItemType = inn.newItem("ItemType");
  itm_ItemType.setProperty("name", itemName);
  itm_color.setPropertyItem("ext_item", itm_ItemType);
  itm_color.setAttribute("select","ext_item,ext_tab_color,ext_tab_name(name,label),ext_tab_font_color");
  itm_color = itm_color.apply("get");
  if( itm_color.isError() || itm_color.getItemCount() === 0) {return this;}

  //dijitオブジェクトを利用して、"widgetid"をKeyに情報を取得
  for (var i = 0; i < itm_color.getItemCount(); i++){
      var itm = itm_color.getItemByIndex(i);
      var style ="";
      style = "background-Color:" + itm.getProperty("ext_tab_color","#FFFFFF") + ";";
      style += "color: " + itm.getProperty("ext_tab_font_color","") + ";";
      //  var tabId = tabbar._getTab(aras.getRelationshipTypeId(itm.getPropertyItem("ext_tab_name").getProperty("name",""))).id; // <- returns nothing

// I used the label instead of name to find the tabs. But I am not sure if this the right approach:
      var tabname = itm.getPropertyItem("ext_tab_name").getProperty("label","");
      var tabId = tabbar.GetTabId(tabname);

      parent.dijit.byId("centerMiddle_relTabbar_tablist_" + tabId).setAttribute("style",style); // <- doesn´t color anything

   }
}
changeCelColor();
EliJDonahue commented 6 years ago

Thanks for sharing your code, Angela! I'll take a look at this project to see if I can help with the upgrade, but I'm on vacation next week, so it may be a little while before I have a chance to dig in.

EliJDonahue commented 6 years ago

Hi Angela, release v3.0.0 resolves the error/functionality issues for Aras 11 SP12 and SP14. I expect it will also work for 11 SP11, but I have not tried it. Let me know if you run into any further issues.

EliJDonahue commented 6 years ago

Release v3.1.0 is actually the most current now, but the form method logic is the same.

AngelaIp commented 6 years ago

Thanks for the quick fix! I can confirm, that the latest version works also fine under 11 SP11.