doif.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. FW_version["doif.js"] = "$Id: doif.js 15546 2017-12-03 09:57:42Z Ellert $";
  2. function doifUpdateCell(doifname,attrname,attrcont,content,style) {
  3. $("table[uitabid='DOIF-"+doifname+"']").find("div["+attrname+"='"+attrcont+"']").each(function() {
  4. if(this.setValueFn) { // change widget value
  5. this.setValueFn(content.replace(/\n/g, '\u2424'));
  6. } else {
  7. $(this).html(content+"");
  8. if(style)
  9. $(this).attr("style",style);
  10. }
  11. });
  12. }
  13. /*function doifUpdateIconColor(doifname,doifid,fillcolor) {
  14. $("table[uitabid='DOIF-"+doifname+"']").find("svg."+doifid).each(function() {
  15. if(fillcolor.length>0) {
  16. var html = $(this).html().replace(/fill=\".*?\"/gi,'fill="'+fillcolor+'"')
  17. .replace(/fill:.*?[;\s]/gi,'fill:'+fillcolor+';');
  18. $(this).html(html);
  19. }
  20. });
  21. }*/
  22. function doifTablePopUp(hash,name,doif,table) {
  23. FW_cmd(FW_root+"?cmd={DOIF_RegisterEvalAll(\$defs{"+name+"},\""+name+"\",\""+table+"\")}&XHR=1", function(data){
  24. var uit = $("[uitabid='DOIF-"+doif+"']");
  25. if(uit.html() !== undefined){
  26. FW_okDialog(data,uit);
  27. } else {
  28. FW_okDialog(data);
  29. }
  30. });
  31. }
  32. $(window).ready(function(){
  33. var room = $("#content").attr("room");
  34. $("table[uitabid]").each(function() {
  35. var uitabid = $(this).attr("uitabid").replace(/DOIF-/, '');
  36. var nodl = $(this).attr("doifnodevline");
  37. var atfi = $(this).attr("doifattrfirst");
  38. var tabl = "uiTable", t = $(this).attr("class").match(/(uiTable|uiState)doif/);
  39. if (t && t[1])
  40. tabl = t[1];
  41. // console.log("[readyFn] room",room,"nodl",nodl,"atfi",atfi,"tabl",tabl);
  42. if(room === undefined && atfi !== undefined && atfi != "" && atfi != "0" ) {
  43. $('.makeTable.wide.internals').before($('.makeTable.wide.attributes'));
  44. $('.makeTable.wide.attributes').before($('[cmd="attr"]'));
  45. $("div>a:contains("+tabl+")").closest('td').attr('valign','top');
  46. }
  47. if(room !== undefined && nodl !== undefined && nodl != "") {
  48. var re1 = new RegExp(nodl);
  49. if (room !="all" && room.match(re1))
  50. $('#'+uitabid).closest('tr').css('display','none');
  51. }
  52. if($(this).attr("doifnostate") == 1) {
  53. $('#'+uitabid).remove();
  54. }
  55. });
  56. });