Changeset 468 in tmcsimulator for trunk/webapps/einotebook/scripts/Incident.js


Ignore:
Timestamp:
07/28/2019 05:27:26 AM (7 years ago)
Author:
jdalbey
Message:

einotebook - multifile commit. Redesign to fix timing problem on some machines as well as improve file naming. Fixed #176.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/einotebook/scripts/Incident.js

    r359 r468  
    1717        //========== public methods ==========// 
    1818        this.html = html; 
    19         this.expandAction = expandAction; 
     19    this.setSummary = setSummary; 
    2020         
    2121        //========== private methods ==========// 
    2222        this.formatHeader = formatHeader; 
    23         this.expandOption = expandOption; 
    24         this.expandOptionSymbol = expandOptionSymbol; 
    25          
     23 
     24    /** Setter for summary field */ 
     25        function setSummary(description) 
     26    { 
     27        this.summary = description; 
     28    } 
     29     
     30    /** 
    2631        /** 
    2732         * @return The html representation of this incident; 
     
    3540                           "<tr>" +  
    3641                           "<td class='incidentSummary' id='summary" + this.number + "'>" +  
    37                              (this.expanded ? this.summary : "") + "</td>" + 
     42                             this.summary + "</td>" + 
    3843                           "</tr>" +  
    3944                           "</table>"; 
     
    5055                return "<table class='incidentHeader'>" + 
    5156                                "<tr class='incidentHeader'>" + 
    52                                 "<td class='incidentExpandOption'>" + this.expandOption() + "</td>" + 
     57                                "<td class='incidentExpandOption'></td>" + 
    5358                                "<td class='incidentTime'>Time: " + this.time.format() + "</td>" + 
    5459                                "<td class='incidentNumber'>" + this.number + "</td>" + 
     
    5863        } 
    5964         
    60         /** 
    61          * @return The html that for the + or - symbol that expands or collapses the incident. 
    62          */ 
    63         function expandOption() 
    64         { 
    65                 return "<button class='incidentExpandButton' " + 
    66                                 "id='expandOption" + this.number + "' onclick='incidents.get(" +  
    67                                 this.number + ").expandAction()'>" + this.expandOptionSymbol() +  
    68                                 "</button>"; 
    69         } 
    7065         
    71         /** 
    72          * Returns the symbol for the expand option. 
    73          * @return Either "+" or "-" depending on whether this incidents is collapsed or  
    74          *         expanded. 
    75          */ 
    76         function expandOptionSymbol() 
    77         { 
    78                 return this.expanded == true ? "&ndash;" : "+"; 
    79         } 
    80          
    81         /** 
    82          * Performs the action of clicking on the + or - symbol that expands or collapses  
    83          * the incident. 
    84          */ 
    85         function expandAction() 
    86         { 
    87                 if (this.expanded) 
    88                 { 
    89                         incidents.doc.getElementById("summary" + this.number).innerHTML = ""; 
    90                         incidents.doc.getElementById("expandOption" + this.number).innerHTML = "+"; 
    91                 } 
    92                 else 
    93                 { 
    94                         incidents.doc.getElementById("summary" + this.number).innerHTML =  
    95                                 this.summary; 
    96                         incidents.doc.getElementById("expandOption" + this.number).innerHTML =  
    97                                 "&ndash;"; 
    98                 } 
    99                  
    100                 this.expanded = !this.expanded; 
    101                  
    102         } 
    10366} 
Note: See TracChangeset for help on using the changeset viewer.