Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

69 linhas
2.0 KiB

  1. /* standard page header
  2. + wrapper
  3. + [table]
  4. + [r1c1]
  5. + main_head
  6. + sub_head
  7. + [r1c2]
  8. + close_btn
  9. + toolbar_area
  10. + tag_area
  11. + seperator
  12. */
  13. var def_ph_style = {
  14. wrapper: {marginBottom:'16px', backgroundColor:'#EEE'}
  15. ,main_heading: { }
  16. ,sub_heading: { marginBottom:'8px', color:'#555', display:'none' }
  17. ,separator: { borderTop:'3px solid #444' } // show this when there is no toolbar
  18. ,toolbar_area: { padding:'3px 0px', display:'none',borderBottom:'1px solid #AAA'}
  19. }
  20. function PageHeader(parent, main_text, sub_text) {
  21. this.wrapper = $a(parent,'div','page_header');
  22. this.t1 = make_table($a(this.wrapper,'div','',def_ph_style.wrapper.backgroundColor), 1, 2, '100%', [null, '100px'], {padding: '2px'});
  23. $y(this.t1, {borderCollapse:'collapse'})
  24. this.lhs = $td(this.t1, 0, 0);
  25. this.main_head = $a(this.lhs, 'h1', '', def_ph_style.main_heading);
  26. this.sub_head = $a(this.lhs, 'h4', '', def_ph_style.sub_heading);
  27. this.separator = $a(this.wrapper, 'div', '', def_ph_style.separator);
  28. this.toolbar_area = $a(this.wrapper, 'div', '', def_ph_style.toolbar_area);
  29. this.padding_area = $a(this.wrapper, 'div', '', {padding:'3px'});
  30. // close btn
  31. $y($td(this.t1, 0, 1),{textAlign:'right', padding:'3px'});
  32. this.close_btn = $btn($td(this.t1, 0, 1), 'Close',function() { nav_obj.show_last_open(); },0);
  33. if(main_text) this.main_head.innerHTML = main_text;
  34. if(sub_text) this.sub_head.innerHTML = sub_text;
  35. this.buttons = {};
  36. this.buttons2 = {};
  37. }
  38. PageHeader.prototype.add_button = function(label, fn, bold, icon, green) {
  39. var tb = this.toolbar_area;
  40. if(this.buttons[label]) return;
  41. var btn = $btn(tb,label,fn,{marginRight:'4px'},(green ? 'green' : ''));
  42. if(bold) $y(btn,{fontWeight:'bold'});
  43. this.buttons[label]=btn;
  44. $ds(this.toolbar_area);
  45. return btn;
  46. }
  47. PageHeader.prototype.clear_toolbar = function() {
  48. this.toolbar_area.innerHTML = '';
  49. this.buttons = {};
  50. }
  51. PageHeader.prototype.make_buttonset = function() {
  52. $(this.toolbar_area).buttonset();
  53. }