Fix: Bad action reset

Qual: Removed useless code
This commit is contained in:
Laurent Destailleur 2012-05-23 17:49:41 +02:00
parent 1fec3b56d9
commit 7801749874

View File

@ -150,26 +150,29 @@ if ($action == 'add' && $user->rights->ecm->setup)
} }
// Remove file // Remove file
if ($action == 'confirm_deletefile' && GETPOST('confirm') == 'yes') if ($action == 'confirm_deletefile')
{ {
$result=$ecmdir->fetch($section); if (GETPOST('confirm') == 'yes')
if (! $result > 0) {
{ $result=$ecmdir->fetch($section);
dol_print_error($db,$ecmdir->error); if (! $result > 0)
exit; {
} dol_print_error($db,$ecmdir->error);
$relativepath=$ecmdir->getRelativePath(); exit;
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath; }
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $relativepath=$ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$result=dol_delete_file($file); $result=dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
$result=$ecmdir->changeNbOfFiles('-'); $result=$ecmdir->changeNbOfFiles('-');
$action='file_manager';
clearstatcache(); clearstatcache();
}
$action='file_manager';
} }
// Remove directory // Remove directory
@ -315,7 +318,7 @@ $moreheadcss="
_width: 700px; /* min-width for IE6 */ _width: 700px; /* min-width for IE6 */
} }
</style>"; </style>";
$moreheadjs=" $moreheadjs=empty($conf->use_javascript_ajax)?"":"
<script type=\"text/javascript\"> <script type=\"text/javascript\">
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery('#containerlayout').layout({ jQuery('#containerlayout').layout({
@ -381,19 +384,15 @@ if ($action == 'delete')
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden';
else $classviewhide='visible';
// Start container of all panels // Start container of all panels
if ($conf->use_javascript_ajax)
{
?> ?>
<div id="containerlayout"> <!-- begin div id="containerlayout" --> <div id="containerlayout"> <!-- begin div id="containerlayout" -->
<div id="ecm-layout-north" class="toolbar"> <div id="ecm-layout-north" class="toolbar">
<?php <?php
}
else
{
print '<table class="border" width="100%">';
print '<tr><td colspan="2" style="background: #FFFFFF" style="height: 34px !important">';
}
// Start top panel, toolbar // Start top panel, toolbar
print '<div class="toolbarbutton">'; print '<div class="toolbarbutton">';
@ -416,21 +415,12 @@ print '</a>';
print '</div>'; print '</div>';
// End top panel, toolbar // End top panel, toolbar
if ($conf->use_javascript_ajax)
{
?>
</div>
<div id="ecm-layout-west" class="hidden">
<?php
}
else
{
print '</td></tr>';
print '<tr>';
print '<td width="40%" valign="top" style="background: #FFFFFF" rowspan="2">';
}
// Start left area
?>
</div>
<div id="ecm-layout-west" class="<?php echo $classviewhide; ?>">
<?php
// Start left area
// Confirmation de la suppression d'une ligne categorie // Confirmation de la suppression d'une ligne categorie
@ -454,7 +444,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
$showonrightsize=''; $showonrightsize='';
// Auto section // Auto section
if (count($sectionauto)) if (count($sectionauto))
{ {
@ -586,15 +575,14 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
if (empty($conf->global->MAIN_ECM_DISABLE_JS)) if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
{ {
print '<tr><td colspan="6" style="padding-left: 20px">'; print '<tr><td colspan="6" style="padding-left: 20px">';
// Show filemanager tree // Show filemanager tree
print '<div id="filetree" class="ecmfiletree">'; print '<div id="filetree" class="ecmfiletree">';
print '</div>';
print '</td></tr>'; print '</div>';
$openeddir='/'; $openeddir='/';
?> ?>
@ -642,7 +630,9 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
</script> </script>
<?php <?php
print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
print '</td></tr>';
} }
else else
{ {
@ -834,20 +824,12 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
// End left banner // End left banner
if ($conf->use_javascript_ajax)
{
?> ?>
</div> </div>
<div id="ecm-layout-center" class="hidden"> <div id="ecm-layout-center" class="<?php echo $classviewhide; ?>">
<div class="pane-in ecm-in-layout-center"> <div class="pane-in ecm-in-layout-center">
<div id="ecmfileview" class="ecmfileview"> <div id="ecmfileview" class="ecmfileview">
<?php <?php
}
else
{
print '</td><td valign="top" style="background: #FFFFFF">';
}
// Start right panel // Start right panel
@ -856,20 +838,11 @@ include_once(DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php');
// End right panel // End right panel
if ($conf->use_javascript_ajax)
{
?> ?>
</div> </div>
</div> </div>
<div class="pane-in ecm-in-layout-south layout-padding valignmiddle"> <div class="pane-in ecm-in-layout-south layout-padding valignmiddle">
<?php <?php
}
else
{
print '</td></tr>';
print '<tr height="22">';
print '<td>';
}
// Start Add new file area // Start Add new file area
@ -884,23 +857,14 @@ else print '&nbsp;';
// End Add new file area // End Add new file area
if ($conf->use_javascript_ajax)
{
?> ?>
</div> </div>
</div> </div>
</div> <!-- end div id="containerlayout" --> </div> <!-- end div id="containerlayout" -->
<?php <?php
}
else
{
print '</td></tr>';
print '</table>';
}
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();