/
import-subnets-preview.php
81 lines (66 loc) · 2.72 KB
/
import-subnets-preview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Preview data Subnets import data
************************************/
# include required scripts
require_once( dirname(__FILE__) . '/../../../functions/functions.php' );
# initialize required objects
$Database = new Database_PDO;
$Result = new Result;
$User = new User ($Database);
# verify that user is logged in
$User->check_user_session();
# load data from uploaded file
include 'import-load-data.php';
# check data and mark the entries to import/update
include 'import-subnets-check.php';
?>
<!-- header -->
<div class="pHeader"><?php print _("Subnets import data preview"); ?></div>
<!-- content -->
<div class="pContent">
<?php
print '<h4>'._("Uploaded data").'</h4><hr>';
print _("The entries marked with ")."<i class='fa ".$icons['add']."'></i>, "._("will be added,
the ones marked with ")."<i class='fa ".$icons['edit']."'></i>, "._("will be updated
and the ones marked with ")."<i class='fa ".$icons['skip']."'></i> "._("will be skipped.");
print "<b>"._("Summary: ")."</b>".($counters['add'] > 0 ? $counters['add'] : "no")._(" new entries.
").($counters['edit'] > 0 ? $counters['edit'] : "no")._(" updated entries.
").($counters['error'] > 0 ? $counters['error'] : "no")._(" entries skipped due to errors.
").($counters['skip'] > 0 ? $counters['skip'] : "no")._(" duplicate entries.
")._("Scroll down for details.");
print "<form id='selectImportFields'>";
print "<input name='expfields' type='hidden' value='".implode('|',$expfields)."' style='display:none;'>";
print "<input name='reqfields' type='hidden' value='".implode('|',$reqfields)."' style='display:none;'>";
print $hiddenfields;
print "<input name='filetype' id='filetype' type='hidden' value='".$filetype."' style='display:none;'>";
#print "<input name='rebuildmnr' id='rebuildmnr' type='hidden' value='".$rebuildmnr."' style='display:none;'>";
print "</form>";
print "<table class='table table-condensed table-hover' id='previewtable'><tbody>";
print "<tr class='active'>".$hrow."<th>Action</th></tr>";
print $rows;
print "</tbody></table><br>";
# add some spaces so we make pContent div larger and not overlap with the absolute pFooter div
print "<br><br><br>";
?>
</div>
<!-- footer -->
<div class="pFooter">
<div class="btn-group">
<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
<button class="btn btn-sm btn-default" id="dataImportSubmit" data-type="subnets" disabled><i class="fa fa-upload"></i> <?php print _('Import'); ?></button>
</div>
</div>
<?php
if (($counters['add'] > 0) || ($counters['edit'] > 0)) {
?>
<script>
$(function(){
$('#dataImportSubmit').removeAttr('disabled');
$('#dataImportSubmit').removeClass('btn-default');
$('#dataImportSubmit').addClass('btn-success');
});
</script>
<?php
}
?>