parameters: (cls, layout, hidden=False, allow_email=True, show_task_process=False, refresh=True, on_submit_js="")
docstring: hidden means it's a hidden row table
docstring_summary: hidden means it's a hidden row table
docstring_tokens: hidden means it s a hidden row table
function: def add_layout_behaviors(cls, layout, hidden=False, allow_email=True, show_task_process=False, refresh=True, on_submit_js=""):
          '''hidden means it's a hidden row table'''
          
          layout.add_relay_behavior( {
              'type': 'mouseup',
              'bvr_match_class': 'spt_note_attachment',
              'cbjs_action': '''
              var code_str = bvr.src_el.getAttribute("spt_note_attachment_codes");
              var server = TacticServerStub.get();
              var codes = code_str.split("|");
              for (var i = 0; i < codes.length; i++) {
                  // get the files for this snapshot
                  var path = server.get_path_from_snapshot(codes[i], {mode:'web'});
                  window.open(path);
              }
              '''
          } )
  
  
  
          match_class = cls.get_note_class(hidden, 'spt_discussion_add')
          widget_kwargs={
              'hidden': hidden,
              'allow_email': allow_email,
              'show_task_process': show_task_process,
              'process': '__WIDGET_UNKNOWN__',
              'context': '__WIDGET_UNKNOWN__',
              'search_key': '__WIDGET_UNKNOWN__',
              'display': True,
          }
          widget_key = layout.generate_widget_key('tactic.ui.widget.DiscussionAddNoteWdg', inputs=widget_kwargs)
  
  
          layout.add_relay_behavior( {
              'type': 'mouseup',
              'bvr_match_class': match_class,
              'hidden': hidden,
              'allow_email': allow_email,
              'show_task_process': show_task_process,
              'widget_key': widget_key,
              'cbjs_action': '''
  
              var top = bvr.src_el.getParent(".spt_dialog_top");
              if (top == null) {
                  top = bvr.src_el.getParent(".spt_discussion_top");
              }
  
              var container = spt.get_element(top, ".spt_add_note_container");
              var add_note = spt.get_element(container, ".spt_discussion_add_note");
  
              if (! add_note) {
                  var kwargs = container.getAttribute("spt_kwargs");
                  kwargs = kwargs.replace(/'/g, '"');
                  kwargs = JSON.parse(kwargs);
  
                  if (spt.table) {
                      var layout = spt.table.get_layout();
                      var upload_id = layout.getAttribute('upload_id')
                      kwargs.upload_id = upload_id; 
                  }
  
                  var widget_kwargs = {
                          'hidden': bvr.hidden,
                          'allow_email': bvr.allow_email,
                          'show_task_process': bvr.show_task_process,
                      }
                  var class_name = bvr.widget_key;
                  spt.panel.load(container, class_name, kwargs, widget_kwargs,  {fade: false, async: false});
                  //add_note = top.getElement(".spt_discussion_add_note");
                  add_note = spt.get_element(top, ".spt_discussion_add_note");
                  spt.toggle_show_hide(add_note);
              }
              
              if (bvr.src_el.getAttribute('force_show') == 'true')
                  spt.show(add_note);
              else
                  spt.toggle_show_hide(add_note);
  
              // select the appropriate context or process
              var select = add_note.getElement(".spt_add_note_process");
              if (select) {
                  var process = bvr.src_el.getAttribute("spt_process");
                  var context = bvr.src_el.getAttribute("spt_context");
  
                  var match = process ? process : context;
                  for(var i = 0; i < select.options.length; i++) {
                    
                      if (select.options[i].value == match) {
                          select.selectedIndex = i;
                          break;
                      }
                  }
              }
  
              '''
              } )
  
  
          # DEPRECATED?
          # for expand note widget
          layout.add_relay_behavior( {
              'type': 'mouseup',
              'bvr_match_class': 'spt_discussion_expand',
              'cbjs_action': '''
              var top = bvr.src_el.getParent(".spt_discussion_top");
              var float = top.getElement(".spt_float");
              var clone = spt.behavior.clone(top);
  
              expand = clone.getElement(".spt_discussion_expand");
              spt.hide(expand);
  
              var code = bvr.src_el.getAttribute('code')
              var title = "Notes: " + code;
              var element_name = bvr.src_el.getAttribute('search_key')
  
              spt.tab.set_main_body_tab();
              spt.tab.add_new(element_name, title);
              spt.tab.load_node(element_name, clone);
              spt.tab.select(element_name);
  
  
              var notes = clone.getElements(".spt_note_content");
              for ( var i = 0; i < notes.length; i++ ) {
                  spt.show( notes[i] );
              }
  
              '''
              } )
function_tokens: def add_layout_behaviors ( cls , layout , hidden = False , allow_email = True , show_task_process = False , refresh = True , on_submit_js = "" ) : layout . add_relay_behavior ( { 'type' : 'mouseup' , 'bvr_match_class' : 'spt_note_attachment' , 'cbjs_action' : '''
              var code_str = bvr.src_el.getAttribute("spt_note_attachment_codes");
              var server = TacticServerStub.get();
              var codes = code_str.split("|");
              for (var i = 0; i < codes.length; i++) {
                  // get the files for this snapshot
                  var path = server.get_path_from_snapshot(codes[i], {mode:'web'});
                  window.open(path);
              }
              ''' } ) match_class = cls . get_note_class ( hidden , 'spt_discussion_add' ) widget_kwargs = { 'hidden' : hidden , 'allow_email' : allow_email , 'show_task_process' : show_task_process , 'process' : '__WIDGET_UNKNOWN__' , 'context' : '__WIDGET_UNKNOWN__' , 'search_key' : '__WIDGET_UNKNOWN__' , 'display' : True , } widget_key = layout . generate_widget_key ( 'tactic.ui.widget.DiscussionAddNoteWdg' , inputs = widget_kwargs ) layout . add_relay_behavior ( { 'type' : 'mouseup' , 'bvr_match_class' : match_class , 'hidden' : hidden , 'allow_email' : allow_email , 'show_task_process' : show_task_process , 'widget_key' : widget_key , 'cbjs_action' : '''
  
              var top = bvr.src_el.getParent(".spt_dialog_top");
              if (top == null) {
                  top = bvr.src_el.getParent(".spt_discussion_top");
              }
  
              var container = spt.get_element(top, ".spt_add_note_container");
              var add_note = spt.get_element(container, ".spt_discussion_add_note");
  
              if (! add_note) {
                  var kwargs = container.getAttribute("spt_kwargs");
                  kwargs = kwargs.replace(/'/g, '"');
                  kwargs = JSON.parse(kwargs);
  
                  if (spt.table) {
                      var layout = spt.table.get_layout();
                      var upload_id = layout.getAttribute('upload_id')
                      kwargs.upload_id = upload_id; 
                  }
  
                  var widget_kwargs = {
                          'hidden': bvr.hidden,
                          'allow_email': bvr.allow_email,
                          'show_task_process': bvr.show_task_process,
                      }
                  var class_name = bvr.widget_key;
                  spt.panel.load(container, class_name, kwargs, widget_kwargs,  {fade: false, async: false});
                  //add_note = top.getElement(".spt_discussion_add_note");
                  add_note = spt.get_element(top, ".spt_discussion_add_note");
                  spt.toggle_show_hide(add_note);
              }
              
              if (bvr.src_el.getAttribute('force_show') == 'true')
                  spt.show(add_note);
              else
                  spt.toggle_show_hide(add_note);
  
              // select the appropriate context or process
              var select = add_note.getElement(".spt_add_note_process");
              if (select) {
                  var process = bvr.src_el.getAttribute("spt_process");
                  var context = bvr.src_el.getAttribute("spt_context");
  
                  var match = process ? process : context;
                  for(var i = 0; i < select.options.length; i++) {
                    
                      if (select.options[i].value == match) {
                          select.selectedIndex = i;
                          break;
                      }
                  }
              }
  
              ''' } ) # DEPRECATED? # for expand note widget layout . add_relay_behavior ( { 'type' : 'mouseup' , 'bvr_match_class' : 'spt_discussion_expand' , 'cbjs_action' : '''
              var top = bvr.src_el.getParent(".spt_discussion_top");
              var float = top.getElement(".spt_float");
              var clone = spt.behavior.clone(top);
  
              expand = clone.getElement(".spt_discussion_expand");
              spt.hide(expand);
  
              var code = bvr.src_el.getAttribute('code')
              var title = "Notes: " + code;
              var element_name = bvr.src_el.getAttribute('search_key')
  
              spt.tab.set_main_body_tab();
              spt.tab.add_new(element_name, title);
              spt.tab.load_node(element_name, clone);
              spt.tab.select(element_name);
  
  
              var notes = clone.getElements(".spt_note_content");
              for ( var i = 0; i < notes.length; i++ ) {
                  spt.show( notes[i] );
              }
  
              ''' } )