+ // sets cell content and bgcolor in a div, for use as a draggable
+ // (draggable tds have border problems on FF/IE)
+ function set_cell_div ($cell,content,bgcolor) {
+ var $div = $cell.data('div');
+ if (!$div) {
+ $div = $(document.createElement('div'));
+ $div.data('cell',$cell);
+ $cell.data('div',$div);
+ $cell.append($div);
+ }
+ $div.css('white-space','nowrap');
+ $div.css('width','100%');
+ $div.css('background-color', bgcolor);
+ $div.html(content || ' <br> <br> ');
+ }
+
+ // gives cell the appearance dictated by its data
+ function set_data_cell ($cell) {
+ $cell.css('border', '1px solid #D7D7D7' );
+ $cell.css('background-color', $cell.data('bgcolor'));
+ set_cell_div($cell,$cell.data('content'),$cell.data('bgcolor'));
+ }
+
+ // sets cell data and appearance to schedulable
+ function set_schedulable_cell ($cell) {
+ $cell.data('bgcolor', '#FFFFFF' );
+ $cell.data('ticketid', 0 );
+ $cell.data('length', 0 );
+ $cell.data('cells', 0 );
+ $cell.data('offset', 0 );
+ $cell.data('label', '' );
+ $cell.data('content', '' );
+ set_data_cell($cell);
+ }
+
+ // sets cell data and appearance as an appointment
+ function set_appointment_cell ($cell,ticketid,bgcolor,labeltime,labeltitle,length,cells,offset) {
+ $cell.data('bgcolor', bgcolor );
+ $cell.data('ticketid', ticketid );
+ $cell.data('length', length );
+ $cell.data('cells', cells );
+ $cell.data('offset', offset );
+ var label = labeltime + ' <br>' + labeltitle + ' <br>';
+ $cell.data('label', label );
+ $cell.data('content', '');
+ if ( offset == 0 ) { // first row
+ var title =
+ label +
+ ' <A HREF="<%$RT::WebPath%>/Ticket/Display.html?id=' + ticketid + '" target="_blank">view</A> ' +
+ <% include('/elements/popup_link.html',
+ action=>$RT::WebPath.'/Ticket/ModifyCustomFieldsPopup.html?id=__MAGIC_TICKET_ID__',
+ label =>'edit',
+ actionlabel => 'Edit appointment',
+ height => 436, # better: A + B * (num_custom_fields)
+ ) |n,js_string
+ %>;
+ title = title.replace( /__MAGIC_TICKET_ID__/, ticketid );
+ $cell.data('content', title);
+ }
+ set_data_cell($cell);
+ }
+