Changeset 2327
- Timestamp:
- Apr 8, 2014, 9:31:51 AM (9 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk/resources/admin
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/admin/install.jsp
r2214 r2327 25 25 %> 26 26 <base:page type="default" > 27 <base:head scripts="ajax.js" styles="path.css,table.css"> 28 <link rel="stylesheet" type="text/css" href="../css/reggie.css"> 29 <script language="JavaScript" src="../reggie.js" type="text/javascript" charset="UTF-8"></script> 27 <base:head scripts="ajax.js,~../reggie.js,~install.js" styles="path.css,table.css,~../css/reggie.css"> 30 28 31 <script language="JavaScript">32 33 function createMissingItems()34 {35 init('Install');36 }37 38 function init(cmd)39 {40 var request = Ajax.getXmlHttpRequest();41 var url = '../Install.servlet?ID=<%=ID%>&cmd='+cmd;42 request.open("GET", url, false);43 request.send(null);44 45 var response = JSON.parse(request.responseText);46 if (response.status != 'ok')47 {48 setFatalError(response.message);49 return false;50 }51 var COL_BREAKS = ['ANNOTATIONTYPE', 'PLUGINDEFINITION'];52 53 var numMissing = 0;54 var numWarnings = 0;55 var numErrors = 0;56 var numIncomplete = 0;57 var checks = response.checks;58 var html = '<table class="report">';59 var lastItemType = null;60 var index = 0;61 var topLines = []; // Top lines are for items with error/warning/special message62 var bottomLines = []; // Bottom lines are for all 'OK' items63 var allOk = true;64 65 for (var i = 0; i < checks.length; i++)66 {67 var check = checks[i];68 var icon = 'ok.png';69 check.ok = true;70 if (check.status == 'missing')71 {72 numMissing++;73 icon = 'error.png';74 check.ok = false;75 }76 if (check.status == 'incomplete')77 {78 numIncomplete++;79 icon = 'warning.png';80 check.ok = false;81 }82 if (check.status == 'error')83 {84 numErrors++;85 icon = 'error.png';86 check.ok = false;87 }88 if (check.status == 'warning')89 {90 numWarnings++;91 icon = 'warning.png';92 check.ok = false;93 }94 allOk &= check.ok;95 96 var sameSection = lastItemType == check.itemType;97 // Do not start new section when switching between plugin definition and configuration98 if (!sameSection) sameSection = lastItemType == 'PLUGINDEFINITION' && check.itemType == 'PLUGINCONFIGURATION';99 if (!sameSection) sameSection = lastItemType == 'PLUGINCONFIGURATION' && check.itemType == 'PLUGINDEFINITION';100 if (!sameSection)101 {102 html += topLines.join(''); // Always show the top-lines103 if ((topLines.length + bottomLines.length > 13) && bottomLines.length > 0)104 {105 // Show 10 lines and hide the rest106 var showMoreFrom = Math.max(0, 10 - topLines.length);107 if (showMoreFrom > 0)108 {109 html += bottomLines.slice(0, showMoreFrom).join('');110 }111 html += '<tr class="sameitemtype highlight" id="'+check.itemType+'" onclick="showMore(event)">';112 html += '<td class="link">… '+(bottomLines.length-showMoreFrom)+' more</td>';113 html += '<td><img src="../images/ok.png"></td><td>Ok</td></tr>';114 html += '<tbody id="'+check.itemType+'.more" style="display: none;">';115 html += bottomLines.slice(showMoreFrom).join('');116 html += '</tbody>';117 }118 else119 {120 html += bottomLines.join('');121 }122 123 topLines = [];124 bottomLines = [];125 allOk = true;126 index = 0;127 128 var col_break = COL_BREAKS.indexOf(check.itemType);129 if (col_break >= 0)130 {131 // End the left side and start on the right132 html += '</table>';133 setInnerHTML('validationResult'+col_break, html);134 html = '<table class="report">';135 }136 html += '<tr class="newitemtype"><td colspan="3">'+check.itemType+'</td></tr>';137 }138 139 var line = '<tr class="sameitemtype highlight '+check.itemType+' ' + (check.ok ? 'check-ok' : 'check-not-ok') + '">';140 lastItemType = check.itemType;141 var name = check.name;142 if (check.mainType) name += ' <span class="itemsubtype">[' + check.mainType + ']</span>';143 if (check.id)144 {145 line += '<td class="itemTypeCol"><div class="link" onclick="itemOnClick(event, \''+check.itemType+'\','+check.id+')"';146 line += ' title="View this item (use CTRL, ALT or SHIFT to edit)">'+name+'</div></td>';147 }148 else149 {150 line += '<td class="itemTypeCol"><i>' + name + '</i></td>';151 }152 line += '<td class="iconCol"><img src="../images/'+icon+'"></td>';153 line += '<td class="statusCol">';154 if (check.messages.length > 1)155 {156 for (var m = 0; m < check.messages.length; m++)157 {158 line += '• '+check.messages[m] + '<br>';159 }160 }161 else162 {163 line += check.messages;164 }165 line += '</td></tr>';166 167 if (!check.ok || check.messages != 'Ok')168 {169 topLines[topLines.length] = line;170 }171 else172 {173 bottomLines[bottomLines.length] = line;174 }175 index++;176 }177 178 html += topLines.join('');179 if ((topLines.length + bottomLines.length > 13) && bottomLines.length > 0)180 {181 // Show 10 lines and hide the rest182 var showMoreFrom = Math.max(0, 10 - topLines.length);183 if (showMoreFrom > 0)184 {185 html += bottomLines.slice(0, showMoreFrom).join('');186 }187 html += '<tr class="sameitemtype highlight" id="'+check.itemType+'" onclick="showMore(event)">';188 html += '<td class="link">… '+(bottomLines.length-showMoreFrom)+' more</td>';189 html += '<td><img src="../images/ok.png"></td><td>Ok</td></tr>';190 html += '<tbody id="'+check.itemType+'.more" style="display: none;">';191 html += bottomLines.slice(showMoreFrom).join('');192 html += '</tbody>';193 }194 else195 {196 html += bottomLines.join('');197 }198 199 html += '</table>';200 setInnerHTML('validationResult'+COL_BREAKS.length, html);201 202 if (numErrors > 0)203 {204 setFatalError(numErrors+' errors was detected. You need to fix those manually.');205 }206 else if (numWarnings > 0)207 {208 setWarningMessage(numWarnings+' warnings was detected. Reggie may still work. If not, you need to fix it manually.');209 }210 Main.showHide('createMissingItems', numMissing > 0);211 Main.showHide('fixIncompleteItems', numMissing == 0 && numIncomplete > 0);212 }213 214 function setWarningMessage(message)215 {216 setInnerHTML('warningMessage.message', message);217 Main.show('warningMessage');218 }219 220 function itemOnClick(event, itemType, itemId)221 {222 Main.itemOnClick(event, '<%=ID%>', itemType, itemId, true);223 }224 225 function showMore(event)226 {227 var target = event.currentTarget;228 Main.show(target.id + '.more');229 Main.hide(target.id);230 }231 232 </script>233 29 <style> 234 30 .report … … 303 99 </style> 304 100 </base:head> 305 <base:body onload="init('Validate')">101 <base:body> 306 102 307 103 <p:path><p:pathelement … … 331 127 <div id="createMissingItems" style="display:none; margin-top: 1em;"> 332 128 <base:buttongroup> 333 <base:button title="Create missing items" image="add.png" onclick="createMissingItems()"/>129 <base:button id="btnCreateMissingItems" title="Create missing items" image="add.png" /> 334 130 </base:buttongroup> 335 131 </div> … … 337 133 <div id="fixIncompleteItems" style="display:none; margin-top: 1em;"> 338 134 <base:buttongroup> 339 <base:button title="Fix items" image="fixit.png" onclick="createMissingItems()"/>135 <base:button id="btnFixItems" title="Fix items" image="fixit.png" /> 340 136 </base:buttongroup> 341 137 </div>
Note: See TracChangeset
for help on using the changeset viewer.