-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtrash.list.records.inc.php
executable file
·96 lines (85 loc) · 3.37 KB
/
trash.list.records.inc.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* List contents of trash bin.
*
* @package dbEdit Table Editor
* @version 1.0
* @author Jelle Jager
* @copyright 2008 Jelle Jager
* @license GPL
*
*/
if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
foreach($dbConfig['fields'] as $fldname => $props){
if($props['use']) $select_fields[] = $fldname;
if($props['list']){
$col_fields[] = $fldname;
$col_headers[] = $props['heading']? $props['heading']:$fldname;
}
if($props['linked']) $linked_fields[] = $fldname;
}
$sql_fields = implode(',',$select_fields);
$ds = $modx->db->select($sql_fields, $dbConfig['tableName'],$dbConfig['deletedField']."='".$dbConfig['deletedValue']."'",str_replace('=',' ',$dbConfig['sort']));
include_once $manager_path."includes/controls/datagrid.class.php";
$col_count = count($col_fields);
$grd = new DataGrid('',$ds,25); // page size needs to be setting!
$grd->noRecordMsg = $_lang["no_records_found"];
$grd->cssClass="grid";
$grd->columnHeaderClass="gridHeader";
$grd->itemClass="gridItem";
$grd->altItemClass="gridAltItem";
$grd->fields= implode(',',$col_fields).',del';
$grd->columns = implode(',',$col_headers);
$grd->colTypes ="template:<input type='checkbox' name='chk[]' value='[+value+]' /> [+value+]";
$grd->colWidths="55".str_repeat(',',$col_count);
// render grid
$html = $grd->render();
?>
<script language="JavaScript" type="text/javascript">
function cancelEdit(){
document.location.href = '<?php echo $dbeHomeUrl ?>';
}
function restoreRecords(){
f = $('mutate');
if(f){
f.ra.value = "restore";
f.submit();
}
}
function purgeRecords(){
if(confirm("Are you sure you want permanently remove these reords?" )==false) return;
f = $('mutate');
if(f){
f.ra.value = "purge";
f.submit();
}
}
</script>
<form name="mutate" id="mutate" method="post" action="index.php">
<input type="hidden" name="a" value="<?php echo $_REQUEST['a']; ?>">
<input type="hidden" name="id" value="<?php echo $module_id; ?>">
<input type="hidden" name="db" value="<?php echo $db_id; ?>">
<input type="hidden" name="ra" value="">
<h1><?php echo $mod_name; ?></h1>
<div id="actions">
<ul class="actionButtons">
<li id="Button1">
<a onclick="restoreRecords();">
<img src="media/style/<?php echo $manager_theme; ?>images/icons/save.png" alt=""> Restore</a>
</li>
<li id="Button2">
<a onclick="purgeRecords();">
<img src="media/style/<?php echo $manager_theme; ?>images/icons/delete.gif" align="absmiddle"> Remove Permanently</a>
</li>
<li id="Button3">
<a onclick="cancelEdit();">
<img src="media/style/<?php echo $manager_theme; ?>images/icons/cancel.png" align="absmiddle"> Cancel</a>
</li>
</ul>
</div>
<div class="sectionHeader">Trash bin for <?php echo $dbConfig['title'];?></div><div class="sectionBody">
<p style="margin-bottom:15px;">Below is a listing of all records from "<?php echo $dbConfig['moduleName']; ?>" that have previously been deleted. You can select records using the checkboxes on their left. Selected records can either be restored or permanently be removed from the database.</p>
<?php echo $html; ?>
<input type="submit" name="save" style="display:none;">
</div>
</form>