src/cm/media/js/site/f_text_view_frame.js
author Simon Descarpentries <sid@sopinspace.com>
Fri, 20 Sep 2013 16:28:40 +0200
changeset 536 0c625ce49a81
parent 534 2ee166f109ae
child 553 bf26fb47a14c
permissions -rw-r--r--
- updating jQuery (1.3.2 -> 1.10.2), jQuery UI, jQuery modules - [text_view_frame.html] Add some JS driven CSS tricks for iPad - [text_view_frame.html] move throbber's hiding-call in nested text_view_comments iframe onload signal (so it works with jQuery 1.10.2 and the hiding timing is good) - [text_view_frame.html][base.html] factorize req_yui.html et req_jquery.html - [main_tabs][text_tabs][f_client-min.js] rewrite jQuery UI Tabs API calls select in active - [base.css] CSS fix grey frame appearence for all tabs - hg remove bgiframe -> not loaded in templates anymore - hg remove header_custom.html -> the file has been empty since 4 years - hg remove controls.html -> the file has been empty since 4 years
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     1
var gResetOtherFieldsOnFilterFieldChange = true;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     2
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     3
var myDefaultOuterLayoutSettings = {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
     4
  center : {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
     5
    paneSelector :".outer-center"
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
     6
  },
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
     7
  north : {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
     8
    size :50,//30,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
     9
    spacing_open :0,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    10
    closable :false,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    11
    resizable :false
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    12
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    13
};
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    14
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    15
var innerNorthPaneDefaults = {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    16
  'innerNorthPaneOpened' :'0',
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    17
  'selectedTab' :'0'
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    18
};
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    19
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    20
onInnerNorthPaneClose = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    21
  _setCookie('innerNorthPaneOpened', '0');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    22
  $('#add_comment_btn').css('top', 63) ;
425
d70552fc1a66 Fix some javascript error with IE8 (getElementsByClassName() is unknown).
gibus
parents: 424
diff changeset
    23
  if (document.getElementById('text_view_comments').contentDocument != null)
d70552fc1a66 Fix some javascript error with IE8 (getElementsByClassName() is unknown).
gibus
parents: 424
diff changeset
    24
    document.getElementById('text_view_comments').contentDocument.getElementById('the-toc').style.height = (parseInt(document.getElementById('text_view_comments').clientHeight) - 50).toString() + 'px';
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    25
  return true;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    26
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    27
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    28
onInnerNorthPaneOpen = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    29
  _setCookie('innerNorthPaneOpened', '1');
534
2ee166f109ae Filter pane should have bigger height to display category dropdown list.
gibus
parents: 532
diff changeset
    30
  $('#add_comment_btn').css('top', 159) ;
425
d70552fc1a66 Fix some javascript error with IE8 (getElementsByClassName() is unknown).
gibus
parents: 424
diff changeset
    31
  if (document.getElementById('text_view_comments').contentDocument != null)
d70552fc1a66 Fix some javascript error with IE8 (getElementsByClassName() is unknown).
gibus
parents: 424
diff changeset
    32
    document.getElementById('text_view_comments').contentDocument.getElementById('the-toc').style.height = (parseInt(document.getElementById('text_view_comments').clientHeight) - 50).toString() + 'px';
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    33
  return true;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    34
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    35
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    36
// DEFAULT LAYOUT SETTINGS
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    37
var myDefaultInnerLayoutSettings = {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    38
  north : {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    39
    // size: 66, /* 66 for FF */
534
2ee166f109ae Filter pane should have bigger height to display category dropdown list.
gibus
parents: 532
diff changeset
    40
    size :98, /* 66 for FF */
383
661248a4ef4a add arrows on toggle bars
gibus
parents: 368
diff changeset
    41
    spacing_open :8,
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    42
    spacing_closed :8,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    43
    slidable :false,    
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    44
    resizable :false, /* important */
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    45
    togglerLength_closed :"100%",
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    46
    togglerLength_open :"100%",
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    47
    togglerAlign_closed :"center",
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    48
    /* togglerContent_closed :"options", */
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    49
    togglerTip_closed :gettext("click to show options"),
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    50
    togglerTip_open :gettext("click to hide options"),
385
c67ddb086074 better use images for arrows on toggle bar to avoid font size dofferences and ut8 non-compatible browsers
gibus
parents: 383
diff changeset
    51
    /*
383
661248a4ef4a add arrows on toggle bars
gibus
parents: 368
diff changeset
    52
    togglerContent_open :"&#9650;", // "▲"
661248a4ef4a add arrows on toggle bars
gibus
parents: 368
diff changeset
    53
    togglerContent_closed :"&#9660;", // "▼"
385
c67ddb086074 better use images for arrows on toggle bar to avoid font size dofferences and ut8 non-compatible browsers
gibus
parents: 383
diff changeset
    54
    */
c67ddb086074 better use images for arrows on toggle bar to avoid font size dofferences and ut8 non-compatible browsers
gibus
parents: 383
diff changeset
    55
    togglerContent_open :"<img alt='arrow up' src='" + sv_media_url + "img/arrow-up.png' />",
c67ddb086074 better use images for arrows on toggle bar to avoid font size dofferences and ut8 non-compatible browsers
gibus
parents: 383
diff changeset
    56
    togglerContent_closed :"<img alt='arrow down' src='" + sv_media_url + "img/arrow-down.png' />",
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    57
    initClosed :false,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    58
    paneSelector :".inner-north",
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    59
    onopen :"onInnerNorthPaneOpen",
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    60
    onclose :"onInnerNorthPaneClose"
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    61
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    62
};
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    63
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    64
var outerLayout, innerLayout;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    65
layoutFrames = function() {
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    66
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    67
  var innerNorthPaneOpened = $.cookie('innerNorthPaneOpened');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    68
  myDefaultInnerLayoutSettings.north.initClosed = (innerNorthPaneOpened === null) ? (innerNorthPaneDefaults['innerNorthPaneOpened'] == '0')
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    69
      : (innerNorthPaneOpened == "0");
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    70
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    71
  outerLayout = $('body').layout(myDefaultOuterLayoutSettings);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    72
  innerLayout = $('div.outer-center').layout(myDefaultInnerLayoutSettings);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    73
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    74
  // to trigger add_comment_btn positioning
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    75
  if (myDefaultInnerLayoutSettings.north.initClosed)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    76
    onInnerNorthPaneClose() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    77
  else 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    78
    onInnerNorthPaneOpen() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    79
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    80
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    81
fillFilterTab = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    82
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    83
  var tab = $('#c_filter');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    84
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    85
  var html = '<div style="float:right">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    86
        '<table>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    87
          '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    88
          '<td style="text-align:right;">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    89
          gettext('Text') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    90
        '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    91
        '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    92
          '<input id="filter_text" type="text"></input>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    93
          '<input id="c_filter_btn" type="button" value="' + gettext('Search') + '"></input>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    94
        '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    95
          '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    96
          '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    97
            '<td colspan="3" style="text-align:right;">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    98
              '<input id="c_filterreset_btn" type="button" value="' + gettext('Reset') + '"></input>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
    99
              '<input id="c_filterhideall_btn" type="button" value="' + gettext('Hide all Comments') + '"></input>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   100
            '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   101
          '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   102
        '</table>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   103
      '</div>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   104
      '<table>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   105
        '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   106
          '<td style="text-align:right;">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   107
          gettext('Authors') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   108
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   109
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   110
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   111
            '<select id="filter_name"></select>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   112
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   113
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   114
          '<td style="text-align:right;">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   115
          gettext('States') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   116
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   117
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   118
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   119
            '<select id="filter_state"></select>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   120
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   121
        '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   122
        '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   123
          '<td style="text-align:right;">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   124
            gettext('Dates') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   125
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   126
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   127
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   128
            '<select id="filter_date"></select>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   129
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   130
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   131
          '<td style="text-align:right;">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   132
            gettext('Tags') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   133
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   134
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   135
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   136
            '<select id="filter_tag"></select>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   137
          '</td>' +
528
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   138
        '<tr>' +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   139
          '<td style="text-align:right;"><span id="filter_cat_label">' +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   140
          gettext('Categories') +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   141
          '</span></td>' +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   142
          '<td>&nbsp;</td>' +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   143
          '<td>' +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   144
            '<select id="filter_cat"></select>' +
cbe216651b19 Resize filters for small screen.
Production Moz <dev@sopinspace.com>
parents: 525
diff changeset
   145
          '</td>' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   146
        '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   147
      '</table>';
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   148
  tab.append($(html));  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   149
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   150
  $("#c_filter input[type='text']").add("#c_filter select").addClass('c_filter_field') ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   151
504
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   152
  $("#filter_name").add("#filter_date").add("#filter_tag").add("#filter_cat").add("#filter_state").change(function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   153
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   154
      var elt = $(this) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   155
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   156
        //console.info($(this)) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   157
        //console.info(elt) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   158
        //applyFilter($(this)) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   159
        applyFilter(elt) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   160
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   161
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   162
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   163
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   164
  $("#c_filter_btn").click(function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   165
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   166
      var elt = $("#filter_text") ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   167
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   168
        applyFilter(elt) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   169
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   170
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   171
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   172
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   173
  $('#filter_text').keyup( function(e) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   174
    if (e.keyCode == 13) {$("#c_filter_btn").click();}
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   175
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   176
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   177
  $("#c_filterreset_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   178
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   179
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   180
        resetFilter();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   181
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   182
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   183
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   184
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   185
  $("#c_filterhideall_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   186
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   187
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   188
        frames['text_view_comments'].hideAll() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   189
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   190
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   191
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   192
  
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   193
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   194
fillTopToolbar = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   195
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   196
  var parent = $('#outer-north');
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   197
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   198
  var viewPrev = gettext('view previous comment') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   199
  var viewNext = gettext('view next comment') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   200
  var viewFirst = gettext('view first comment') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   201
  var viewLast = gettext('view last next comment') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   202
  var viewAll = gettext('view all comments') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   203
  var viewScopeRemoved = gettext('view all detached comments') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   204
  var advancedInterface = gettext('toggle advance interface') ;
421
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   205
  var toggleToc = gettext('toggle table of contents') ;
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   206
  var print = gettext('print document with/without comments') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   207
  var exportDoc = gettext('export document with/without comments') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   208
  var fullscreen = gettext('toggle full screen view') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   209
  var feed = gettext('text feed') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   210
  var addComment = gettext('add a comment') ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   211
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   212
  var html = '<div id="c-right-btn">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   213
            '<img id="c_fullscreen_btn" src="' + sv_media_url + '/img/arrow_out.png" title="'+ fullscreen +'" alt="'+ fullscreen +'"/>' +      
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   214
            '<img id="c_print_btn" src="' + sv_media_url + '/img/printer.png" title="'+ print +'" alt="'+ print +'"/>' +         
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   215
            '<img id="c_export_btn" src="' + sv_media_url + '/img/page_go.png" title="'+ exportDoc +'" alt="'+ exportDoc +'"/>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   216
            '<a target="_blank" href="' + frames['text_view_comments'].sv_text_feed_url + '"><img id="c_feed_btn" src="' + sv_media_url + '/img/feed.png" title="'+ feed +'" alt="'+ feed +'"/></a>' +         
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   217
          '</div>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   218
        '<div id="c-msg-wrapper">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   219
      '</div>' + 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   220
      '<table style="margin-bottom:.3em;">' + 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   221
      '<tbody>' + 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   222
      '<tr>' + 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   223
      '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   224
        '<span id="c_filter_results" >' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   225
          '<span id="c_browse_indx_scope">-</span>' +
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   226
          '<span id="c_browse_indx_modif_thread" style="display: none;">-</span>' +
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   227
          '/' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   228
        '<b>&nbsp;<span id="c_f_res_nb_dis"></span></b>&nbsp;<span id="c_f_res_nb_dis_txt"></span>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   229
        '<span id="c_f_res_details">&nbsp;(' + gettext('filter:') + '&nbsp;<span id="c_f_res_nb_com"></span>/<span id="c_f_res_nb_tot_com"></span>&nbsp;<span id="c_f_res_nb_com_txt"></span>&nbsp;<span id="c_f_res_nb_rep"></span>/<span id="c_f_res_nb_tot_rep"></span><span id="c_f_res_nb_rep_txt"></span>)</span>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   230
        '</span>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   231
      '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   232
      '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   233
      '<span id="browse_section">' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   234
      ', ' + gettext('browse by:') + ' ' + 
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   235
        '<select id="browse_by" style="margin-right: 7px;">' + 
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   236
        '<option value="scope">' + gettext('location') + '</option>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   237
        '<option value="modif_thread">' + gettext('modification') + '</option>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   238
        '</select>' + 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   239
      '</span>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   240
      '</td>' + 
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   241
      '<td style="width: 40px; text-align: right;">' + 
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   242
        '<a href="#" id="c_browse_first"><img title="'+ viewFirst +'" alt="'+ viewFirst +'" src="' + sv_media_url + '/img/control_fastbackward_blue.png"/></a>' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   243
        '<a href="#" id="c_browse_prev"><img title="'+ viewPrev +'" alt="'+ viewPrev +'" src="' + sv_media_url + '/img/control_playback_blue.png" style="margin-right: 3px;"/></a>' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   244
      '</td>' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   245
      '<td style="width: 44px; text-align: left; border-right: 1px dotted #b1b1b1;">' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   246
        '<a href="#" id="c_browse_next"><img title="'+ viewNext +'" alt="'+ viewNext +'" src="' + sv_media_url + '/img/control_play_blue.png"/></a>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   247
        '<a href="#" id="c_browse_last"><img title="'+ viewLast +'" alt="'+ viewLast +'" src="' + sv_media_url + '/img/control_fastforward_blue.png"/></a>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   248
      '</td>' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   249
      '<td style="width: 20px; text-align: left;">' +
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   250
      '<a href="#" id="c_browse_all"><img title="'+ viewAll +'" alt="'+ viewAll +'" src="' + sv_media_url + '/img/view_all.png" style="margin-left: 11px; margin-right: 8px;" /></a>' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   251
      '</td>' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   252
      '<td style="width: 20px; text-align: left;">' +
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   253
      '<a href="#" id="c_browse_scope_removed"><img title="'+ viewScopeRemoved +'" alt="'+ viewScopeRemoved +'" src="' + sv_media_url + '/img/view_scope_removed2.png" style="margin-top: -8px; margin-right: 3px;" /></a>' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   254
      '</td>' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   255
      '<td style="width: 20px; text-align: left;">' +
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   256
        '<a href="#" id="c_thread_unthread"><img id="c_thread_unthread_img" style="margin-right: 8px;"/></a>' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   257
      '</td>' +
485
af74b898d551 New icons.
gibus
parents: 474
diff changeset
   258
      '<td style="width: 20px; text-align: left;">' +
421
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   259
        '<a href="#" id="c_toc_btn"><img title="'+ toggleToc +'" alt="'+ toggleToc +'" src="' + sv_media_url + '/img/document_index.png"/></a>' +
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   260
      '</td>' +
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   261
      '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   262
      '</tbody>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   263
      '</table>' ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   264
  parent.prepend($(html));
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   265
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   266
  $("#add_comment_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   267
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   268
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   269
        frames['text_view_comments'].gSync.showCommentForm(null) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   270
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   271
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   272
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   273
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   274
  var showBrowseIndx = function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   275
    $("#browse_by option").each(function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   276
      $("#c_browse_indx_"+this.value).hide() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   277
    }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   278
    $('#c_browse_indx_' + $('#browse_by').val()).show() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   279
  };
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   280
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   281
  var first_browse_by_val = $.cookie('browse_by');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   282
  first_browse_by_val = (first_browse_by_val == null) ? "location" : first_browse_by_val ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   283
  _setCookie('browse_by', $('#browse_by').val());
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   284
  $("#browse_by option[value="+ first_browse_by_val +"]").attr("selected", true);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   285
  showBrowseIndx() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   286
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   287
  $("#browse_by").change(function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   288
    _setCookie('browse_by', $('#browse_by').val());
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   289
    showBrowseIndx() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   290
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   291
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   292
  var lBrowse = function(whereto) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   293
    if (frames['text_view_comments'].readyForAction()) 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   294
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   295
        frames['text_view_comments'].browse($('#browse_by').val(), whereto); 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   296
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   297
  };
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   298
  $("#c_browse_prev").click( function() {lBrowse("prev");});
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   299
  $("#c_browse_next").click( function() {lBrowse("next");});
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   300
  $("#c_browse_first").click( function() {lBrowse("first");});
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   301
  $("#c_browse_last").click( function() {lBrowse("last");});
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   302
  $("#c_browse_all").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   303
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   304
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   305
        frames['text_view_comments'].gSync.showAllComments() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   306
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   307
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   308
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   309
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   310
  $("#c_browse_scope_removed").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   311
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   312
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   313
        frames['text_view_comments'].gSync.showScopeRemovedComments() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   314
      }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   315
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   316
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   317
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   318
  $("#c_print_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   319
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   320
      var ids = frames['text_view_comments'].gDb.getFilteredCommentIdsAsString() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   321
      frames['text_view_comments'].CY.log($("#filteredIds").val(ids)) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   322
      openPrintDialog() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   323
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   324
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   325
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   326
  $("#c_export_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   327
    if (frames['text_view_comments'].readyForAction()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   328
      var ids = frames['text_view_comments'].gDb.getFilteredCommentIdsAsString() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   329
      frames['text_view_comments'].CY.log($("#filteredIds").val(ids)) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   330
      openExportDialog() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   331
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   332
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   333
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   334
  if (frames['text_view_comments'].gLayout.isInComentSite()) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   335
    $("#c_fullscreen_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   336
        toggleFrameSize();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   337
    });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   338
  } ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   339
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   340
  $("#c_advanced_btn").click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   341
    $('.ui-layout-toggler').click() ; // calling the layout method did not work well edo that instead   
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   342
  }) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   343
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   344
  setThreadPref = function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   345
    var v = frames['text_view_comments'].c_readPreference('comments', 'threadpad');
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   346
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   347
    var btn_src = sv_media_url + '/img/unthread_box.png' ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   348
    var btn_desc = gettext('unthread discussions') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   349
    if (v == '0') { 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   350
      btn_src = sv_media_url + '/img/thread_box.png' ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   351
      btn_desc = gettext('thread discussions') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   352
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   353
    $('#c_thread_unthread_img').attr('src', btn_src).attr('alt', btn_desc).attr('title', btn_desc) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   354
  };
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   355
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   356
  setThreadPref();  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   357
  $('#c_thread_unthread').click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   358
    var v = frames['text_view_comments'].c_readPreference('comments', 'threadpad');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   359
    var anti_v = (v == '0') ? '1' : '0';
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   360
    frames['text_view_comments'].c_persistPreference('comments', 'threadpad', anti_v);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   361
    setThreadPref();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   362
    frames['text_view_comments'].gSync.animateToTop() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   363
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   364
  
421
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   365
  $("#c_toc_btn").click( function() {
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   366
    if (frames['text_view_comments'].readyForAction()) {
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   367
      frames['text_view_comments'].checkForOpenedDialog(null, function() {
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   368
        frames['text_view_comments'].toggleTocFn() ;
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   369
      }) ;
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   370
    }
3ddbfa64f596 Adds a table of content.
gibus
parents: 385
diff changeset
   371
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   372
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   373
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   374
onSliderStop = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   375
  var slideVal = $("#c_slider").slider('value') ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   376
//  console.info("in onSliderStop slider val : " + slideVal) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   377
  if (slideVal > (frames['text_view_comments'].gConf['sliderFixedMin'] * 100)) 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   378
    $("#c_slider").slider('value', [90]) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   379
  if (slideVal < (frames['text_view_comments'].gConf['sliderFixedMax'] * 100)) 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   380
    $("#c_slider").slider('value', [10]) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   381
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   382
  frames['text_view_comments'].c_setCommentsColWidth(slideVal) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   383
  frames['text_view_comments'].c_persistPreference('layout', 'comments_col_width', slideVal);
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   384
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   385
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   386
fillTextPreferencesTab = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   387
  var tab = $('#c_text_preferences');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   388
  tab.append($(
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   389
      '<table>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   390
      '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   391
      '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   392
      gettext('Text style') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   393
      '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   394
      '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   395
      '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   396
      '<select id="c_textpref_style"></select>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   397
      '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   398
      '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   399
      '</table>')) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   400
  var styles = frames['text_view_comments'].gTextStyles ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   401
  for (var key in styles) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   402
    $("#c_textpref_style").append($("<option value='"+ key +"'>" + styles[key] + "</option>")) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   403
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   404
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   405
  var setTextStyle = function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   406
    var styles = frames['text_view_comments'].gTextStyles ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   407
    var wish = $('#c_textpref_style').val() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   408
    for (var key in styles) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   409
      if (key == wish)
532
0bad3613f59d Reverse to YUI 3.0.0 since with YUI.3.10.3, comment content including words 'paragraph' or 'section' do not show up on Firefox, this is weird and has to be investigated.
gibus
parents: 528
diff changeset
   410
        frames['text_view_comments'].CY.get("#textcontainer").addClass(key) ;
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   411
      else 
532
0bad3613f59d Reverse to YUI 3.0.0 since with YUI.3.10.3, comment content including words 'paragraph' or 'section' do not show up on Firefox, this is weird and has to be investigated.
gibus
parents: 528
diff changeset
   412
        frames['text_view_comments'].CY.get("#textcontainer").removeClass(key) ;
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   413
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   414
  };
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   415
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   416
  var setTextStyleField = function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   417
    var v = frames['text_view_comments'].c_readPreference('text', 'style');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   418
    $('#c_textpref_style').val(v);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   419
  };
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   420
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   421
  $("#c_textpref_style").change(function(v) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   422
    frames['text_view_comments'].c_persistPreference('text', 'style', $("#c_textpref_style").val());
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   423
    setTextStyle();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   424
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   425
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   426
  setTextStyleField();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   427
  setTextStyle();
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   428
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   429
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   430
fillPreferencesTab = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   431
  var tab = $('#c_preferences');
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   432
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   433
  var html = '<div style="float:right"><input id="c_pref_save_btn" type="button" value="' + gettext('Save') + '"></input><input id="c_pref_reset_btn" type="button" value="' + gettext('Reset') + '"></input></div>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   434
        '<table>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   435
        '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   436
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   437
            gettext('Animation duration') +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   438
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   439
          '<td>&nbsp;</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   440
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   441
            '<input id="c_pref_animduration" type="text" style="width:3em" value="" />' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   442
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   443
        '</tr>' + 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   444
        '<tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   445
          '<td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   446
            '<span class="frame_helptext">' + gettext('(0.001 to 1 second)') + '</span>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   447
          '</td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   448
          '<td></td><td></td>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   449
        '</tr>' +
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   450
        '</table>';
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   451
  tab.append($(html)) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   452
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   453
  setPreferencesFieldsValue = function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   454
    var v = frames['text_view_comments'].c_readPreference('general', 'animduration');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   455
    $('#c_pref_animduration').val(v);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   456
  };
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   457
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   458
  setPreferencesFieldsValue();
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   459
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   460
  $('#c_pref_animduration').blur( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   461
    var v = parseFloat($(this).val());
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   462
    if (isNaN(v) || (v <= 0) || (v > 1)) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   463
      v = frames['text_view_comments'].c_readDefaultPreference('general', 'animduration');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   464
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   465
    $(this).val(v);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   466
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   467
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   468
  $('#c_pref_reset_btn').click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   469
    frames['text_view_comments'].c_resetPreferences(['general']);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   470
    setPreferencesFieldsValue();
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   471
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   472
    enqueueMsg(gettext('preferences reset (will apply on next load)'));
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   473
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   474
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   475
  $('#c_pref_save_btn').click( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   476
    frames['text_view_comments'].c_persistPreference('general', 'animduration', $('#c_pref_animduration').val());
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   477
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   478
    enqueueMsg(gettext('preferences saved (will apply on next load)'));
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   479
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   480
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   481
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   482
initFrame = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   483
  _initYesNoDialog();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   484
  _initPrintDialog() ;  
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   485
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   486
  $(window).resize(function(){
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   487
    onSliderStop(); 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   488
//    console.log('in frame resize' +  $("#c_slider").slider('value')) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   489
//    console.log('in frame resize' + frames['text_view_comments'].CY.DOM.winWidth()) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   490
//    console.log('in frame resize' + $(window).width()) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   491
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   492
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   493
  //$('<div id="c_slider"></div>').appendTo("#c-btns").slider({ 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   494
  $('#c_slider').slider({ 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   495
  animate: true,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   496
  range: "min",
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   497
  value: frames['text_view_comments'].c_readPreference('layout','comments_col_width'),
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   498
  min: 1,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   499
  iframeFix: true,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   500
  max: 100,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   501
//  step: 5,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   502
  slide: function(event, ui) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   503
    var slideVal = ui.value ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   504
    frames['text_view_comments'].c_setCommentsColWidth(slideVal) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   505
  },
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   506
  stop:function(event, ui) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   507
    onSliderStop() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   508
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   509
  }) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   510
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   511
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   512
  _initTabs();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   513
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   514
  f_interfaceFreeze();
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   515
};
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   516
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   517
_initTabs = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   518
  $(".inner-north").tabs();
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   519
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   520
  var selectedTab = $.cookie('selectedTab');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   521
  selectedTab = (selectedTab === null) ? innerNorthPaneDefaults['selectedTab'] : parseInt(selectedTab);
536
0c625ce49a81 - updating jQuery (1.3.2 -> 1.10.2), jQuery UI, jQuery modules
Simon Descarpentries <sid@sopinspace.com>
parents: 534
diff changeset
   522
  $(".inner-north").tabs('option', 'active', selectedTab);
0c625ce49a81 - updating jQuery (1.3.2 -> 1.10.2), jQuery UI, jQuery modules
Simon Descarpentries <sid@sopinspace.com>
parents: 534
diff changeset
   523
  $(".inner-north").bind('tabsactivate', function(event, ui) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   524
    // // Objects available in the function context:
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   525
      // ui.tab // anchor element of the selected (clicked) tab
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   526
      // ui.panel // element, that contains the selected/clicked tab
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   527
      // contents
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   528
      // ui.index // zero-based index of the selected (clicked) tab
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   529
      _setCookie('selectedTab', ui.index);
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   530
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   531
    });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   532
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   533
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   534
_initYesNoDialog = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   535
  $('#dialog_h').dialog( {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   536
    // bgiframe: true, // why would we ?
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   537
    autoOpen :false,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   538
    modal :true
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   539
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   540
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   541
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   542
_setCookie = function(name, value) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   543
  var cookieExpire = new Date();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   544
  cookieExpire.setFullYear(2100, 0, 1);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   545
  $.cookie(name, value, {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   546
    'expires' :cookieExpire,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   547
    'path': '/'
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   548
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   549
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   550
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   551
//contains code thats offered by the text_view_comment_frame to its child frame text_view_comment
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   552
f_getFrameFilterData = function () {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   553
  var name = $('#filter_name').val(); ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   554
  var date_str = $('#filter_date').val(); ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   555
  var text = $('#filter_text').val(); ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   556
  var tag = $('#filter_tag').val(); ; 
504
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   557
  var cat = $('#filter_cat').val(); ; 
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   558
  var state = $('#filter_state').val(); ; 
504
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   559
  return {'name':name, 'date':date_str, 'text':text, 'tag':tag, 'cat':cat, 'state':state} ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   560
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   561
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   562
f_setFilterValue = function (obj) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   563
  for (key in obj) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   564
    if (key.indexOf('filter_') == 0) 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   565
      $('#'+key).val(obj[key]); // wont explode even if argument is silly
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   566
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   567
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   568
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   569
f_isFrameFilterFieldsInit = function () {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   570
  var obj = f_getFrameFilterData() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   571
  var ret = true ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   572
  for (key in obj) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   573
    ret = ret && (obj[key] == "") ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   574
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   575
  return ret ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   576
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   577
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   578
initFilterFields = function () {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   579
  $('.c_filter_field').val("") ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   580
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   581
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   582
resetFilter = function () {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   583
  initFilterFields() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   584
  frames['text_view_comments'].reinit() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   585
  enqueueMsg(gettext("filter reset")) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   586
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   587
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   588
applyFilter = function(self) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   589
  var val = self.val() ;  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   590
  if (gResetOtherFieldsOnFilterFieldChange) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   591
    initFilterFields() ;  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   592
    self.val(val) ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   593
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   594
  frames['text_view_comments'].reinit();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   595
  enqueueMsg(gettext("filter applied"));
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   596
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   597
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   598
f_updateFilterCountResult = function(nbDiscussions, nbComments, nbReplies, nbAllComments, nbAllReplies) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   599
  // update result counter message field.
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   600
  $("#c_f_res_nb_dis").html(nbDiscussions) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   601
  $("#c_f_res_nb_dis_txt").html(ngettext('discussion', 'discussions', nbDiscussions)) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   602
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   603
  $("#c_f_res_nb_com").html(nbComments) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   604
  $("#c_f_res_nb_tot_com").html(nbAllComments) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   605
  $("#c_f_res_nb_com_txt").html(ngettext('comment', 'comments', nbComments)) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   606
  $("#c_f_res_nb_rep").html(nbReplies) ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   607
  $("#c_f_res_nb_tot_rep").html(nbAllReplies) ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   608
  $("#c_f_res_nb_rep_txt").html('&nbsp;' + ngettext('reply', 'replies', nbReplies)) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   609
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   610
  //console.info('nbDiscussions + typeof nbDiscussions +nbComments + typeof nbComments) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   611
  $("#c_filter_results").show() ; 
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   612
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   613
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   614
f_updateFilterCountDetailed = function(detailed) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   615
  if (detailed) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   616
    $("#c_f_res_details").show() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   617
    $("c_browse_all").val('View all (filtered) comments')
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   618
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   619
  else {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   620
    $("#c_f_res_details").hide() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   621
    $("#c_browse_all").val('View all comments')
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   622
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   623
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   624
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   625
f_updateFilterData = function(newFilterData) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   626
//  console.info(newFilterData) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   627
  // users
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   628
  var selectedNameOption = $("#filter_name option:selected").attr("name") ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   629
  var all = gettext("all") ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   630
  $("#filter_name option").remove() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   631
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   632
  $("#filter_name").append($("<option name='c_f2_user_all' value=''>" + all + "</option>")) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   633
  for (var  i=0, ilen=newFilterData['names'].length; i < ilen ; i++) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   634
    var item = newFilterData['names'][i] ;
426
7c31b3a1284b Added 'me' and 'author' in filter by name.
gibus
parents: 425
diff changeset
   635
    $("#filter_name").append($("<option name='c_f2_user_"+ item.name +"' value='"+ item.name +"'>" + item.display +" ("+item.nb_comments+")</option>")) ;
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   636
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   637
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   638
  $("#filter_name option[name="+selectedNameOption+"]").attr("selected", true);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   639
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   640
  // dates
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   641
  var selectedDateOption = $("#filter_date option:selected").attr("name") ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   642
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   643
  $("#filter_date option").remove() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   644
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   645
  $("#filter_date").append($("<option name='c_f_date_all' value=''>" + all + "</option>")) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   646
  for (var  i=0, ilen=newFilterData['dates'].length; i < ilen ; i++) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   647
    var item = newFilterData['dates'][i] ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   648
    var ddd = ngettext('last 24 hours (%(nb_comments)s)', 'last %(nb_days)s days (%(nb_comments)s)', item.nb_day) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   649
    var ccc = interpolate(ddd,{'nb_days':item.nb_day, 'nb_comments':item.nb_comments}, true) ;    
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   650
    
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   651
    $("#filter_date").append($("<option name='c_f_date_"+ item.nb_day +"' value='"+ item.nb_day_date +"'>" + ccc + "</option>")) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   652
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   653
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   654
  $("#filter_date option[name="+selectedDateOption+"]").attr("selected", true);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   655
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   656
  // text : nothing to do
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   657
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   658
  // tags
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   659
  var selectedTagOption = $("#filter_tag option:selected").attr("name") ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   660
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   661
  $("#filter_tag option").remove() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   662
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   663
  $("#filter_tag").append($("<option name='c_f2_tag_all' value=''>" + all + "</option>")) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   664
  for (var  i=0, ilen=newFilterData['tags'].length; i < ilen ; i++) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   665
    var item = newFilterData['tags'][i] ;
368
7279252f7bd9 Add spaces before item.count(s) in lists of com state/author/tags/time in com filtering facilities.
Simon Descarpentries <sid1@sopinspace.com>
parents: 341
diff changeset
   666
    $("#filter_tag").append($("<option name='c_f2_tag_"+ item.name +"' value='"+ item.name +"'>" + item.name +" ("+item.nb_comments+")</option>")) ;
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   667
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   668
  $("#filter_tag option[name="+selectedTagOption+"]").attr("selected", true);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   669
  
504
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   670
  // categories
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   671
  var selectedCatOption = $("#filter_cat option:selected").attr("cat") ;
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   672
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   673
  $("#filter_cat option").remove() ;
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   674
  
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   675
  categories = frames['text_view_comments'].CY.JSON.parse(frames['text_view_comments'].sv_categories);
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   676
  if (categories.hasOwnProperty('0')) {
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   677
    $("#filter_cat").append($("<option name='c_f2_cat_all' value=''>" + all + "</option>")) ;
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   678
    for (var  i=0, ilen=newFilterData['categories'].length; i < ilen ; i++) {
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   679
      var item = newFilterData['categories'][i] ;
510
8bde4b6584eb Do not proposed undefined categories in filter.
gibus
parents: 504
diff changeset
   680
      if (categories[item.cat] != null) {
8bde4b6584eb Do not proposed undefined categories in filter.
gibus
parents: 504
diff changeset
   681
        $("#filter_cat").append($("<option name='c_f2_cat_"+ item.cat +"' value='"+ gettext(item.cat) +"'>" + categories[item.cat] +" ("+item.nb_comments+")</option>")) ;
8bde4b6584eb Do not proposed undefined categories in filter.
gibus
parents: 504
diff changeset
   682
      }
504
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   683
    }
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   684
    $("#filter_cat option[name="+selectedCatOption+"]").attr("selected", true);
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   685
  }
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   686
  else {
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   687
    $("#filter_cat").remove()
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   688
    $("#filter_cat_label").remove()
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   689
  }
b2e0186daa5b Adds a category to comments, painted with colored vertical bar.
gibus
parents: 485
diff changeset
   690
  
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   691
  // states
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   692
  var selectedStateOption = $("#filter_state option:selected").attr("state") ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   693
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   694
  $("#filter_state option").remove() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   695
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   696
  $("#filter_state").append($("<option name='c_f2_state_all' value=''>" + all + "</option>")) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   697
  for (var  i=0, ilen=newFilterData['states'].length; i < ilen ; i++) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   698
    var item = newFilterData['states'][i] ;
368
7279252f7bd9 Add spaces before item.count(s) in lists of com state/author/tags/time in com filtering facilities.
Simon Descarpentries <sid1@sopinspace.com>
parents: 341
diff changeset
   699
    $("#filter_state").append($("<option name='c_f2_state_"+ item.state +"' value='"+ item.state +"'>" + gettext(item.state) +" ("+item.nb_comments+")</option>")) ;
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   700
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   701
  $("#filter_state option[name="+selectedStateOption+"]").attr("selected", true);
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   702
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   703
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   704
f_interfaceUnfreeze = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   705
  // tabs headers
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   706
  for ( var i = 0, ilen = $(".c_tab").length; i < ilen; i++) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   707
    $(".inner-north").tabs("enable", i);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   708
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   709
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   710
  $(".inner-north select").add(".inner-north input").add("#outer-north select").add("#outer-north input").each( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   711
    $(this).attr("disabled", false);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   712
  });
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   713
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   714
  $("#c_slider").slider('enable') ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   715
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   716
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   717
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   718
f_interfaceFreeze = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   719
  // tabs headers
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   720
  for ( var i = 0, ilen = $(".c_tab").length; i < ilen; i++) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   721
    $(".inner-north").tabs("disable", i);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   722
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   723
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   724
  $(".inner-north select").add(".inner-north input").add("#outer-north select").add("#outer-north input").each( function() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   725
    $(this).attr("disabled", true);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   726
  });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   727
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   728
  $("#c_slider").slider('disable') ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   729
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   730
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   731
f_enqueueMsg = function(msg) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   732
  enqueueMsg(msg) ;   
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   733
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   734
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   735
f_enqueueErrorMsg = function(msg) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   736
  enqueueErrorMsg(msg) ;  
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   737
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   738
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   739
f_removeLoadingMsg = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   740
  removeLoadingMsg() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   741
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   742
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   743
f_initFrame = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   744
  initFrame() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   745
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   746
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   747
f_layoutFrames = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   748
  layoutFrames() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   749
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   750
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   751
f_fillTextPreferencesTab = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   752
  fillTextPreferencesTab() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   753
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   754
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   755
f_fillPreferencesTab = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   756
  fillPreferencesTab() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   757
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   758
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   759
f_fillBrowseSection = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   760
  fillBrowseSection() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   761
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   762
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   763
f_fillFilterTab = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   764
  fillFilterTab() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   765
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   766
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   767
f_fillTopToolbar = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   768
  fillTopToolbar() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   769
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   770
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   771
f_yesNoDialog = function(htmlContent, title, noFunction, noFunctionContext, noFunctionArgs, yesFunction, yesFunctionContext, yesFunctionArgs) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   772
  $('#dialog_h').html(htmlContent) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   773
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   774
  $('#dialog_h').dialog('option', 'title', title) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   775
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   776
  function onNo() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   777
    if (noFunction != null)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   778
      noFunction.call(noFunctionContext, noFunctionArgs) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   779
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   780
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   781
  function onYes() {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   782
    if (yesFunction != null)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   783
      yesFunction.call(yesFunctionContext, yesFunctionArgs) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   784
  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   785
  var buttons = {} ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   786
  buttons[gettext('No')] = function() {$(this).dialog('close');onNo();} ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   787
  buttons[gettext('Yes')] = function() {$(this).dialog('close');onYes();} ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   788
  $('#dialog_h').dialog('option', 'buttons', buttons) ;        
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   789
  $('#dialog_h').dialog('open') ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   790
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   791
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   792
f_setCookie = function(name, value) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   793
  _setCookie(name, value) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   794
}
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   795
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   796
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   797
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   798
/*****************************************************************************/
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   799
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   800
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   801
gInFullScreen = false;
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   802
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   803
_setFrameSize = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   804
  if (parent != window) { // (this condition is to enable accessing "comments_frame" view from top window) TODO test under IE   
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   805
    if (gInFullScreen) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   806
      var headerHeight = parent.$("#header").height();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   807
      var windowHeight = parent.$(parent).height();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   808
      var frameHeight = (windowHeight - headerHeight - 2) + 'px'; // - 2 to prevent scrollbars ? --> TODO test it without -2
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   809
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   810
      var windowWidth = parent.$(parent).width();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   811
      var frameWidth = (windowWidth - 2) + 'px'; // - 2 to prevent scrollbars ?// --> TODO test it without -2
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   812
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   813
      // TODO we should be embeded ! shouldn't work otherwise anyway (frame security concerns)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   814
      parent.$("#text_view_frame").css( {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   815
        'position' :'absolute',
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   816
        'left' :'0px',
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   817
        'top' :headerHeight,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   818
        'width' :frameWidth,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   819
        'height' :frameHeight
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   820
      });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   821
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   822
    else {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   823
      var frameTop = Math.ceil(parent.$("#autoexpand_text_view_frame_container").position()["top"]);
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   824
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   825
      var windowHeight = parent.$(parent).height();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   826
      var frameHeight = (windowHeight - frameTop - 2) + 'px'; // - 2 to prevent scrollbars // ? --> TODO test it without -2
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   827
      
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   828
      var windowWidth = parent.$(parent).width();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   829
      var frameWidth = (windowWidth - 2) + 'px'; // - 2 to prevent scrollbars ? // --> TODO test it without -2
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   830
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   831
      // TODO test if we're embeded ! wont work otherwise anyway (frame security)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   832
      parent.$("#text_view_frame").css( {
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   833
        'position' :'relative',
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   834
        'width' :'99.9%',
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   835
        'height' :frameHeight,
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   836
        'top' :'0px'
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   837
      });
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   838
    }
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   839
  }
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   840
}
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   841
_toFullScreenSize = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   842
  gInFullScreen = true;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   843
  _setFrameSize() ;
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   844
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   845
  $("#c_fullscreen_btn").attr('src', sv_media_url + '/img/arrow_in.png');
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   846
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   847
  f_setCookie('fullscreen', '1') ;
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   848
};
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   849
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   850
_toNormalSize = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   851
  gInFullScreen = false;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   852
  _setFrameSize() ;
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   853
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   854
  $("#c_fullscreen_btn").attr('src', sv_media_url + 'img/arrow_out.png');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   855
  
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   856
  f_setCookie('fullscreen', '0') ;
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   857
};
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   858
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   859
_toInitialSize = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   860
  //console.info('_toInitialSize') ; 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   861
  var fullscreen = ($.cookie('fullscreen') == '1');
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   862
  if (fullscreen)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   863
    _toFullScreenSize() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   864
  else 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   865
    _toNormalSize() ;
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   866
};
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   867
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   868
toInitialSize = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   869
  _toInitialSize() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   870
  parent.$(parent).resize(function(){
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   871
//    console.log('before setFramesize in top resize winwidth' +  frames['text_view_comments'].CY.DOM.winWidth()) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   872
    _setFrameSize();
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   873
//    console.log('after setFramesize in top resize winwidth' +   frames['text_view_frame'].frames['text_view_comments'].CY.DOM.winWidth()) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   874
  });
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   875
}
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   876
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   877
toggleFrameSize = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   878
  if (gInFullScreen)
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   879
    _toNormalSize() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   880
  else 
053551f213fb Coding style for js: expand tabs
gibus
parents: 206
diff changeset
   881
    _toFullScreenSize() ;
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   882
}
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
   883