Revision 89053468
Added by Steve Beaver over 7 years ago
src/usr/local/www/pkg_mgr_install.php | ||
---|---|---|
54 | 54 |
// log: |
55 | 55 |
// exitcode: |
56 | 56 |
// data:{current:, total} |
57 |
// notice: |
|
57 | 58 |
// |
58 | 59 |
// Todo: |
59 | 60 |
// Respect next_log_line and append log to output window rather than writing it |
... | ... | |
100 | 101 |
$resparray = array(); |
101 | 102 |
$statusarray = array(); |
102 | 103 |
$code = array(); |
104 |
$notice = array('notice' => ""); |
|
103 | 105 |
|
104 | 106 |
// Log file is read a line at a time so that we can detect/modify certain entries |
105 | 107 |
while (($logline = fgets($logfile)) !== false) { |
... | ... | |
134 | 136 |
} else { |
135 | 137 |
$resparray['log'] = "not_ready"; |
136 | 138 |
print(json_encode($resparray)); |
137 |
// file_put_contents("/root/update.log", json_encode($resparray), FILE_APPEND); |
|
138 |
// file_put_contents("/root/update.log", "\r\n---------------------------------------------------------------\r\n", FILE_APPEND); |
|
139 | 139 |
exit; |
140 | 140 |
} |
141 | 141 |
|
... | ... | |
161 | 161 |
} |
162 | 162 |
} |
163 | 163 |
|
164 |
// |
|
165 |
$ui_notice = "/tmp/package_ui_notice"; |
|
166 |
|
|
167 |
if (file_exists($ui_notice)) { |
|
168 |
$notice['notice'] = file_get_contents($ui_notice); |
|
169 |
} |
|
170 |
|
|
164 | 171 |
// Glob all the arrays we have made together, and convert to JSON |
165 |
print(json_encode($resparray + $pidarray + $statusarray + $progarray)); |
|
166 |
// file_put_contents("/root/update.log", json_encode($resparray + $pidarray + $statusarray + $progarray), FILE_APPEND); |
|
167 |
// file_put_contents("/root/update.log", "\r\n---------------------------------------------------------------\r\n", FILE_APPEND); |
|
172 |
print(json_encode($resparray + $pidarray + $statusarray + $progarray + $notice)); |
|
168 | 173 |
|
169 | 174 |
exit; |
170 | 175 |
} |
... | ... | |
503 | 508 |
<textarea rows="15" class="form-control" id="output" name="output"><?=($completed ? $_POST['output'] : gettext("Please wait while the update system initializes"))?></textarea> |
504 | 509 |
</div> |
505 | 510 |
</div> |
511 |
|
|
512 |
|
|
513 |
<!-- Modal used to display installation notices --> |
|
514 |
<div id="notice" name="notice" class="modal fade" role="dialog"> |
|
515 |
<div class="modal-dialog"> |
|
516 |
<div class="modal-content"> |
|
517 |
<div class="modal-body" id="noticebody" name="noticebody" style="background-color:#1e3f75; color:white;"> |
|
518 |
</div> |
|
519 |
<div class="modal-footer" style="background-color:#1e3f75; color:white;"> |
|
520 |
<button type="button" id="modalbtn" name="modalbtn" class="btn btn-xs btn-success" data-dismiss="modal" aria-label="Close"> |
|
521 |
<span aria-hidden="true">Accept</span> |
|
522 |
</button> |
|
523 |
</div> |
|
524 |
</div> |
|
525 |
</div> |
|
526 |
</div> |
|
506 | 527 |
<?php |
507 | 528 |
endif; |
508 | 529 |
?> |
... | ... | |
739 | 760 |
$('#reboot_needed').val("yes"); |
740 | 761 |
} |
741 | 762 |
|
742 |
$('form').submit(); |
|
763 |
// Display any UI notice the package installer may have created |
|
764 |
if (json.notice.length > 0) { |
|
765 |
$('#noticebody').html("<div align=\"center\" style=\"font-size:24px;\"><strong>NOTICE</strong></div><br>" + json.notice); |
|
766 |
$('#notice').modal('show'); |
|
767 |
} else { |
|
768 |
$('form').submit(); |
|
769 |
} |
|
743 | 770 |
} |
744 | 771 |
|
745 | 772 |
if ((json.pid == "stopped") && ((progress != 0) || (json.exitstatus != 0))) { |
... | ... | |
820 | 847 |
|
821 | 848 |
$('form').submit(); |
822 | 849 |
}); |
850 |
|
|
851 |
$('#modalbtn').click(function() { |
|
852 |
$('form').submit(); |
|
853 |
}); |
|
823 | 854 |
}); |
824 | 855 |
|
825 | 856 |
//]]> |
Also available in: Unified diff
Provide a simple mechanism for pakage installer to display a notice to the user. (Such as: Firewall must be rebooted before this package becomes available")