forked from opendocman/opendocman
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rejects.php
154 lines (130 loc) · 4.51 KB
/
rejects.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/*
rejects.php - Show rejected files
Copyright (C) 2002, 2003, 2004 Stephen Lawrence Jr., Khoa Nguyen
Copyright (C) 2005-2011 Stephen Lawrence Jr.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//print_r($_REQUEST);
session_start();
include('./odm-load.php');
if (!isset($_SESSION['uid'])) {
redirect_visitor();
}
// includes
$with_caption = false;
$last_message = (isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : '');
if (!isset($_POST['submit'])) {
draw_header(msg('message_documents_rejected'), $last_message);
$user_obj = new User($_SESSION['uid'], $pdo);
$user_perms_obj = new UserPermission($_SESSION['uid'], $pdo);
if ($user_obj->isAdmin() && @$_REQUEST['mode'] == 'root') {
$fileid_array = $user_obj->getAllRejectedFileIds();
} else {
$fileid_array = $user_obj->getRejectedFileIds();
}
if (@$_REQUEST['mode']=='root') {
echo '<form name="author_note_form" action="rejects.php?mode=root" method="post">';
} else {
echo '<form name="author_note_form" action="rejects.php" method="post">';
}
?>
<table border="0">
<tr>
<td>
<?php
$list_status = list_files($fileid_array, $user_perms_obj, $GLOBALS['CONFIG']['dataDir'], true, true);
?>
</td>
</tr>
<?php
if ($list_status != -1) {
?>
<tr>
<td>
<div class="buttons">
<button class="positive" type="submit" name="submit" value="resubmit"><?php echo msg('button_resubmit_for_review');
?></button>
<button class="negative" type="submit" name="submit" value="delete"><?php echo msg('button_delete');
?></button>
</div>
<?php
}
?>
</table>
</form>
<?php
draw_footer();
} elseif (isset($_POST['submit']) && $_POST['submit'] == 'resubmit') {
if (!isset($_REQUEST['checkbox'])) {
header('Location:rejects.php?last_message=' . urlencode(msg('message_you_did_not_enter_value')));
exit;
}
if (isset($_POST["checkbox"])) {
foreach ($_POST['checkbox'] as $cbox) {
$fileid = $cbox;
$file_obj = new FileData($fileid, $pdo);
$file_obj->Publishable(0);
}
}
header('Location:rejects.php?mode=' . urlencode(@$_REQUEST['mode']) . '&last_message='. urlencode(msg('message_file_authorized')));
} elseif ($_POST['submit'] == 'delete') {
if (!isset($_REQUEST['checkbox'])) {
header('Location: rejects.php?last_message=' . urlencode(msg('message_you_did_not_enter_value')));
exit;
}
$url = 'delete.php?mode=tmpdel&';
$id = 0;
if (isset($_POST["checkbox"])) {
$loop = 0;
foreach ($_POST['checkbox'] as $num=>$cbox) {
$fileid = $cbox;
$url .= 'id'. $num . '='.$fileid.'&';
$id ++;
$loop++;
}
$url = substr($url, 0, strlen($url)-1);
}
header('Location:'. urlencode($url) .'&num_checkboxes=' . urlencode($loop));
}
?>
<script type="text/javascript">
function closeWindow(close_window_in_ms)
{
setTimeout(window.close, close_window_in_ms);
}
function checkedBoxesNumber()
{
counter=0;
record="";
for(j=0; j<document.forms[0].elements.length; j++)
{
if(document.forms[0].elements[j].type == "checkbox")
{
counter++;
}
}
for(i=1; i<counter; i++)
{
if(eval('document.forms[0].checkbox' + i + '.checked') == true)
{
id=(eval('document.forms[0].checkbox' + i + '.value'));
document.table.fileid.value +="" + id +" ";
record +="" + i +" ";
}
}
document.table.checkedboxes.value = record;
document.table.checkednumber.value = counter;
alert("boxes " + document.table.checkedboxes.value + " are selected");
}
</script>