76 |
{ |
{ |
77 |
$propref = sanitize_string($propal->ref); |
$propref = sanitize_string($propal->ref); |
78 |
$upload_dir = $conf->propal->dir_output.'/'.$propref; |
$upload_dir = $conf->propal->dir_output.'/'.$propref; |
79 |
|
|
80 |
if ( $error_msg ) |
if ( $error_msg ) |
81 |
{ |
{ |
82 |
echo '<B>'.$error_msg.'</B><BR><BR>'; |
echo '<B>'.$error_msg.'</B><BR><BR>'; |
106 |
$head[$h][1] = $langs->trans('AccountancyCard'); |
$head[$h][1] = $langs->trans('AccountancyCard'); |
107 |
$h++; |
$h++; |
108 |
|
|
109 |
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id; |
if ($conf->use_preview_tabs) |
110 |
$head[$h][1] = $langs->trans("Preview"); |
{ |
111 |
$h++; |
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id; |
112 |
|
$head[$h][1] = $langs->trans("Preview"); |
113 |
|
$h++; |
114 |
|
} |
115 |
|
|
116 |
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id; |
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id; |
117 |
$head[$h][1] = $langs->trans('Note'); |
$head[$h][1] = $langs->trans('Note'); |
118 |
$h++; |
$h++; |
130 |
|
|
131 |
print_titre($langs->trans('AssociatedDocuments').' '.$propal->ref_url); |
print_titre($langs->trans('AssociatedDocuments').' '.$propal->ref_url); |
132 |
|
|
133 |
|
print '<table width="100%" class="noborder">'; |
134 |
|
|
135 |
print '<form name="userfile" action="document.php?propalid='.$propal->id.'" enctype="multipart/form-data" method="POST">'; |
print '<form name="userfile" action="document.php?propalid='.$propal->id.'" enctype="multipart/form-data" method="POST">'; |
136 |
print '<input type="hidden" name="max_file_size" value="2000000">'; |
print '<input type="hidden" name="max_file_size" value="2000000">'; |
137 |
print '<input type="file" name="userfile" size="40" maxlength="80" class="flat"><br>'; |
print '<input type="file" name="userfile" size="40" maxlength="80" class="flat"><br>'; |
141 |
|
|
142 |
clearstatcache(); |
clearstatcache(); |
143 |
|
|
144 |
$errorlevel=error_reporting(); |
if (is_dir($upload_dir)) |
145 |
error_reporting(0); |
{ |
146 |
$handle=opendir($upload_dir); |
|
147 |
error_reporting($errorlevel); |
$handle=opendir($upload_dir); |
148 |
|
if ($handle) |
149 |
|
{ |
150 |
|
print '<tr class="liste_titre">'; |
151 |
|
print '<td>'.$langs->trans('Document').'</td>'; |
152 |
|
print '<td align="right">'.$langs->trans('Size').'</td>'; |
153 |
|
print '<td align="center">'.$langs->trans('Date').'</td>'; |
154 |
|
print '<td> </td>'; |
155 |
|
print '</tr>'; |
156 |
|
$var=true; |
157 |
|
while (($file = readdir($handle))!==false) |
158 |
|
{ |
159 |
|
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') |
160 |
|
{ |
161 |
|
$var=!$var; |
162 |
|
print '<tr '.$bc[$var].'>'; |
163 |
|
print '<td>'; |
164 |
|
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=propal&file='.$propref.'/'.urlencode($file).'">'.$file.'</a>'; |
165 |
|
print "</td>\n"; |
166 |
|
print '<td align="right">'.filesize($upload_dir.'/'.$file). ' bytes</td>'; |
167 |
|
print '<td align="center">'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).'</td>'; |
168 |
|
print '<td align="center">'; |
169 |
|
if ($file == $propref . '.pdf') |
170 |
|
{ |
171 |
|
echo '-'; |
172 |
|
} |
173 |
|
else |
174 |
|
{ |
175 |
|
echo '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id.'&action=delete&urlfile='.urlencode($file).'">'.img_delete($langs->trans('Delete')).'</a>'; |
176 |
|
} |
177 |
|
print "</td></tr>\n"; |
178 |
|
} |
179 |
|
} |
180 |
|
closedir($handle); |
181 |
|
} |
182 |
|
else |
183 |
|
{ |
184 |
|
print '<div class="error">'.$langs->trans('ErrorCantOpenDir').'<b> '.$upload_dir.'</b></div>'; |
185 |
|
} |
186 |
|
|
187 |
print '<table width="100%" class="noborder">'; |
} |
|
|
|
|
if ($handle) |
|
|
{ |
|
|
print '<tr class="liste_titre">'; |
|
|
print '<td>'.$langs->trans('Document').'</td>'; |
|
|
print '<td align="right">'.$langs->trans('Size').'</td>'; |
|
|
print '<td align="center">'.$langs->trans('Date').'</td>'; |
|
|
print '<td> </td>'; |
|
|
print '</tr>'; |
|
|
$var=true; |
|
|
while (($file = readdir($handle))!==false) |
|
|
{ |
|
|
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') |
|
|
{ |
|
|
$var=!$var; |
|
|
print '<tr '.$bc[$var].'>'; |
|
|
print '<td>'; |
|
|
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=propal&file='.$propref.'/'.urlencode($file).'">'.$file.'</a>'; |
|
|
print "</td>\n"; |
|
|
print '<td align="right">'.filesize($upload_dir.'/'.$file). ' bytes</td>'; |
|
|
print '<td align="center">'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).'</td>'; |
|
|
print '<td align="center">'; |
|
|
if ($file == $propref . '.pdf') |
|
|
{ |
|
|
echo '-'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
echo '<a href="'.DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id.'&action=delete&urlfile='.urlencode($file).'">'.$langs->trans('Delete').'</a>'; |
|
|
} |
|
|
print "</td></tr>\n"; |
|
|
} |
|
|
} |
|
|
closedir($handle); |
|
|
} |
|
|
else |
|
|
{ |
|
|
print '<div class="error">'.$langs->trans('ErrorCantOpenDir').'<b> '.$upload_dir.'</b></div>'; |
|
|
} |
|
188 |
print '</table>'; |
print '</table>'; |
189 |
|
|
190 |
print '</div>'; |
print '</div>'; |