NEW Move the upload input on top right in ECM module

This commit is contained in:
Laurent Destailleur
2017-08-20 21:23:19 +02:00
parent d911749b17
commit 2321091170
9 changed files with 94 additions and 131 deletions

View File

@@ -68,7 +68,7 @@ class FormFile
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
* @param string $htmlname Name and id of HTML form * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile') function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile')
@@ -212,7 +212,7 @@ class FormFile
if (empty($res)) if (empty($res))
{ {
print '<div class="attacharea">'; print '<div class="attacharea attacharea'.$htmlname.'">';
print $out; print $out;
print '</div>'; print '</div>';
} }

View File

@@ -23,7 +23,7 @@
// Examples // Examples
$(document).ready(function() { $(document).ready(function() {
// override these in your code to change the default behavior and style // override these in your code to change the default behavior and style
$.blockUI.events = { /*$.blockUI.events = {
// styles applied when using $.growlUI // styles applied when using $.growlUI
dolEventValidCSS: { dolEventValidCSS: {
@@ -59,7 +59,7 @@ $(document).ready(function() {
'border-radius': '10px' 'border-radius': '10px'
} }
}; };*/
$.dolEventValid = function(title, message, timeout, onClose) { $.dolEventValid = function(title, message, timeout, onClose) {
var $m = $('<div class="dolEventValid"></div>'); var $m = $('<div class="dolEventValid"></div>');
@@ -67,7 +67,7 @@ $(document).ready(function() {
if (message) $m.append('<h2>'+message+'</h2>'); if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000; if (timeout == undefined) timeout = 3000;
$.blockUI({ $.blockUI({
message: $m, fadeIn: 200, fadeOut: 700, centerY: false, message: $m, fadeIn: 0, fadeOut: 0, centerY: false,
timeout: timeout, showOverlay: false, timeout: timeout, showOverlay: false,
onUnblock: onClose, onUnblock: onClose,
css: $.blockUI.events.dolEventValidCSS css: $.blockUI.events.dolEventValidCSS
@@ -80,7 +80,7 @@ $(document).ready(function() {
if (message) $m.append('<h2>'+message+'</h2>'); if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 0; if (timeout == undefined) timeout = 0;
$.blockUI({ $.blockUI({
message: $m, fadeIn: 200, centerY: false, message: $m, fadeIn: 0, centerY: false,
timeout: timeout, showOverlay: false, timeout: timeout, showOverlay: false,
onUnblock: onClose, onUnblock: onClose,
css: $.blockUI.events.dolEventErrorCSS css: $.blockUI.events.dolEventErrorCSS
@@ -98,7 +98,6 @@ $(document).ready(function() {
'-webkit-border-radius': '10px', '-webkit-border-radius': '10px',
'-moz-border-radius': '10px', '-moz-border-radius': '10px',
'border-radius': '10px', 'border-radius': '10px',
opacity: .5,
color: '#fff' color: '#fff'
} }
}); });

View File

@@ -47,10 +47,10 @@ $result = restrictedArea($user, 'ecm', 0);
// Get parameters // Get parameters
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
$action=GETPOST('action','aZ09'); $action=GETPOST('action','aZ09');
$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int"); $section=GETPOST('section','int')?GETPOST('section','int'):GETPOST('section_id','int');
$module=GETPOST("module"); $module=GETPOST('module','alpha');
if (! $section) $section=0; if (! $section) $section=0;
$section_dir=GETPOST('section_dir'); $section_dir=GETPOST('section_dir','alpha');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@@ -153,9 +153,10 @@ if ($action == 'confirm_deletefile')
dol_print_error($db,$ecmdir->error); dol_print_error($db,$ecmdir->error);
exit; exit;
} }
$relativepath=$ecmdir->getRelativePath();
} }
else $relativepath=''; else $relativepath='';
$upload_dir = $conf->ecm->dir_output; $upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:'');
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP). $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
$ret=dol_delete_file($file); $ret=dol_delete_file($file);
@@ -183,7 +184,6 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
// To refresh content of dir with cache, just open the dir in edit mode. // To refresh content of dir with cache, just open the dir in edit mode.
if ($action == 'refreshmanual') if ($action == 'refreshmanual')
{ {
$ecmdirtmp = new EcmDirectory($db); $ecmdirtmp = new EcmDirectory($db);
// This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
@@ -327,8 +327,9 @@ if ($action == 'refreshmanual')
//print $_SESSION["dol_screenheight"]; //print $_SESSION["dol_screenheight"];
$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index_auto.php file $maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index_auto.php file
$morejs=array(); //$morejs=array();
if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); $morejs=array('includes/jquery/plugins/blockUI/jquery.blockUI.js','core/js/blockUI.js'); // Used by ecm/tpl/enabledfiletreeajax.tpl.pgp
if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs[]="/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js";
llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,'',0,0); llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,'',0,0);
@@ -337,19 +338,6 @@ llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,
// Add sections to manage // Add sections to manage
$rowspan=0; $rowspan=0;
$sectionauto=array(); $sectionauto=array();
if (! empty($conf->global->ECM_AUTO_TREE_ENABLED))
{
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
if (! empty($conf->commande->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); }
if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); }
}
// Confirm remove file (for non javascript users) // Confirm remove file (for non javascript users)
if ($action == 'delete' && empty($conf->use_javascript_ajax)) if ($action == 'delete' && empty($conf->use_javascript_ajax))
@@ -363,9 +351,12 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax))
$classviewhide='inline-block'; $classviewhide='inline-block';
$head = ecm_prepare_dasboard_head(''); $head = ecm_prepare_dasboard_head('');
dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, ''); dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, '');
// Start container of all panels // Start container of all panels
?> ?>
<!-- Begin div id="containerlayout" --> <!-- Begin div id="containerlayout" -->
@@ -374,26 +365,55 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM
<?php <?php
// Start top panel, toolbar // Start top panel, toolbar
print '<div class="toolbarbutton">'; print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar // Toolbar
if ($user->rights->ecm->setup) if ($user->rights->ecm->setup)
{ {
print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create" class="toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">'; print '<a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>'; print '</a>';
} }
else else
{ {
print '<a href="#" class="toolbarbutton" title="'.$langs->trans("NotAllowed").'">'; print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">'; print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print '</a>'; print '</a>';
} }
$relativeurl=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:''))); $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$relativeurl.'" class="toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">'; print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">'; print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>'; print '</a>';
// Start Add new file area
$nameforformuserfile = 'formuserfileecm';
print '<div class="inline-block valignmiddle floatright">';
// To attach new file
if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section))
{
if (empty($section) || $section == -1)
{
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#<?php echo $nameforformuserfile ?>').hide();
});
</script>
<?php
}
$formfile=new FormFile($db);
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile);
}
else print '&nbsp;';
print '</div>';
// End Add new file area
print '</div>'; print '</div>';
// End top panel, toolbar // End top panel, toolbar
@@ -408,7 +428,6 @@ print '</div>';
if ($action == 'delete_section') if ($action == 'delete_section')
{ {
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1);
} }
// End confirm // End confirm
@@ -628,35 +647,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
?> ?>
</div> </div>
</div> </div>
<div class="pane-in ecm-in-layout-south layout-padding valignmiddle">
<?php
// Start Add new file area
// To attach new file
if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section))
{
if (empty($section) || $section == -1)
{
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#formuserfile').hide();
});
</script>
<?php
}
$formfile=new FormFile($db);
$formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, 'formuserfile');
}
else print '&nbsp;';
// End Add new file area
?>
</div>
</div> </div>
</div> <!-- End div id="containerlayout" --> </div> <!-- End div id="containerlayout" -->
<?php <?php

View File

@@ -51,6 +51,7 @@ $section=GETPOST('section','int')?GETPOST('section','int'):GETPOST('section_id',
$module=GETPOST('module','alpha'); $module=GETPOST('module','alpha');
if (! $section) $section=0; if (! $section) $section=0;
$section_dir=GETPOST('section_dir','alpha'); $section_dir=GETPOST('section_dir','alpha');
$search_doc_ref=GETPOST('search_doc_ref','alpha'); $search_doc_ref=GETPOST('search_doc_ref','alpha');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@@ -92,54 +93,6 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_doc_ref=''; $search_doc_ref='';
} }
// Upload file
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
// Define relativepath and upload_dir
$relativepath='';
if ($ecmdir->id) $relativepath=$ecmdir->getRelativePath();
else $relativepath=$section_dir;
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
if (empty($_FILES['userfile']['tmp_name']))
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
}
if (! $error)
{
if (dol_mkdir($upload_dir) >= 0)
{
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
$result=$ecmdir->changeNbOfFiles('+');
}
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
}
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
}
else // Known error
{
setEventMessages($langs->trans($resupload), null, 'errors');
}
}
}
else
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors');
}
}
}
@@ -158,7 +111,6 @@ if ($action == 'add' && $user->rights->ecm->setup)
} }
else else
{ {
//TODO: Translate
setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors'); setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
$action = "create"; $action = "create";
} }
@@ -207,6 +159,8 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
} }
// Refresh directory view // Refresh directory view
// This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized.
// To refresh content of dir with cache, just open the dir in edit mode.
if ($action == 'refreshmanual') if ($action == 'refreshmanual')
{ {
$ecmdirtmp = new EcmDirectory($db); $ecmdirtmp = new EcmDirectory($db);
@@ -352,8 +306,9 @@ if ($action == 'refreshmanual')
//print $_SESSION["dol_screenheight"]; //print $_SESSION["dol_screenheight"];
$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index.php file $maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index.php file
$morejs=array(); //$morejs=array();
if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); $morejs=array('includes/jquery/plugins/blockUI/jquery.blockUI.js','core/js/blockUI.js'); // Used by ecm/tpl/enabledfiletreeajax.tpl.pgp
if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs[]="/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js";
llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,'',0,0); llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,'',0,0);
@@ -399,6 +354,8 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax))
$classviewhide='inline-block'; $classviewhide='inline-block';
$head = ecm_prepare_dasboard_head(''); $head = ecm_prepare_dasboard_head('');
dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, ''); dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, '');
@@ -411,11 +368,11 @@ dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans
<?php <?php
// Start top panel, toolbar // Start top panel, toolbar
print '<div class="toolbarbutton">'; print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar // Toolbar
$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:''))); $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'')));
print '<a href="'.$url.'" class="toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">'; print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">'; print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print '</a>'; print '</a>';
@@ -501,7 +458,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
} }
// End left banner // End left panel
?> ?>
</div> </div>
<div id="ecm-layout-center" class="<?php echo $classviewhide; ?>"> <div id="ecm-layout-center" class="<?php echo $classviewhide; ?>">

View File

@@ -24,6 +24,8 @@
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
print 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working2.gif".'\';'."\n";
$openeddir='/'; $openeddir='/';
?> ?>
@@ -43,9 +45,9 @@ $(document).ready(function() {
// Called if we click on a dir (not a file) // Called if we click on a dir (not a file)
function(elem) { function(elem) {
id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx) id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx)
jQuery("#formuserfile_section_dir").val(elem.attr('rel')); jQuery("#<?php echo $nameforformuserfile ?>_section_dir").val(elem.attr('rel'));
jQuery("#formuserfile_section_id").val(id); jQuery("#<?php echo $nameforformuserfile ?>_section_id").val(id);
jQuery('#formuserfile').show(); jQuery('#<?php echo $nameforformuserfile ?>').show();
} }
); );

View File

@@ -7,10 +7,13 @@ WEBSITE_PAGENAME=Page name/alias
WEBSITE_HTML_HEADER=HTML Header WEBSITE_HTML_HEADER=HTML Header
WEBSITE_CSS_URL=URL of external CSS file WEBSITE_CSS_URL=URL of external CSS file
WEBSITE_CSS_INLINE=CSS content WEBSITE_CSS_INLINE=CSS content
WEBSITE_ROBOT=Robot file (robots.txt)
WEBSITE_HTACCESS=Web site .htaccess file
PageNameAliasHelp=Name or alias of the page.<br>This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "<strong>%s</strong>" to edit this alias. PageNameAliasHelp=Name or alias of the page.<br>This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "<strong>%s</strong>" to edit this alias.
MediaFiles=Media library MediaFiles=Media library
EditCss=Edit Style/CSS or HTML header EditCss=Edit Style/CSS or HTML header
EditMenu=Edit menu EditMenu=Edit menu
EditMedias=Edit medias
EditPageMeta=Edit Meta EditPageMeta=Edit Meta
EditPageSource=Edit HTML Source EditPageSource=Edit HTML Source
EditPageContent=Edit with CKEditor EditPageContent=Edit with CKEditor

View File

@@ -1133,6 +1133,10 @@ div.attacharea {
padding-top: 18px; padding-top: 18px;
padding-bottom: 10px; padding-bottom: 10px;
} }
div.attachareaformuserfileecm {
padding-top: 0;
padding-bottom: 0;
}
div.arearef { div.arearef {
padding-top: 2px; padding-top: 2px;

View File

@@ -1171,6 +1171,10 @@ div.attacharea {
padding-top: 18px; padding-top: 18px;
padding-bottom: 10px; padding-bottom: 10px;
} }
div.attachareaformuserfileecm {
padding-top: 0;
padding-bottom: 0;
}
div.arearef { div.arearef {
padding-top: 2px; padding-top: 2px;
padding-bottom: 5px; padding-bottom: 5px;

View File

@@ -96,7 +96,7 @@ $action=GETPOST('action','alpha');
if (GETPOST('delete')) { $action='delete'; } if (GETPOST('delete')) { $action='delete'; }
if (GETPOST('preview')) $action='preview'; if (GETPOST('preview')) $action='preview';
if (GETPOST('create')) { $action='create'; } if (GETPOST('create')) { $action='create'; }
if (GETPOST('editmedia')) { $action='editmedia'; } if (GETPOST('editmedias')) { $action='editmedias'; }
if (GETPOST('editcss')) { $action='editcss'; } if (GETPOST('editcss')) { $action='editcss'; }
if (GETPOST('editmenu')) { $action='editmenu'; } if (GETPOST('editmenu')) { $action='editmenu'; }
if (GETPOST('setashome')) { $action='setashome'; } if (GETPOST('setashome')) { $action='setashome'; }
@@ -573,7 +573,7 @@ if ($action == 'updatemeta')
} }
$aliascontent = '<?php'."\n"; $aliascontent = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n"; $aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
$aliascontent.= 'global $dolibarr_main_data_root;'."\n"; $aliascontent.= 'global $dolibarr_main_data_root;'."\n";
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; '; $aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n"; $aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
@@ -746,7 +746,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf
} }
$aliascontent = '<?php'."\n"; $aliascontent = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n"; $aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
$aliascontent.= 'global $dolibarr_main_data_root;'."\n"; $aliascontent.= 'global $dolibarr_main_data_root;'."\n";
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\';'; $aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\';';
$aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n"; $aliascontent.= 'else require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
@@ -899,10 +899,13 @@ if (count($object->records) > 0)
print ' &nbsp; '; print ' &nbsp; ';
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">'; print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">'; print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">'; print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
print ' &nbsp; ';
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedias">';
} }
print '</div>'; print '</div>';
@@ -930,10 +933,10 @@ if (count($object->records) > 0)
print '</a>'; print '</a>';
} }
if (in_array($action, array('editcss','editmenu'))) if (in_array($action, array('editcss','editmenu','editmedias')))
{ {
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">'; if (preg_match('/^create/',$action) && $action != 'editmedias') print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">'; if (preg_match('/^edit/',$action) && $action != 'editmedias') print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">'; if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
} }
@@ -942,7 +945,7 @@ if (count($object->records) > 0)
// ***** Part for pages // ***** Part for pages
if ($website && ! in_array($action, array('editcss','editmenu'))) if ($website && ! in_array($action, array('editcss','editmenu','editmedias')))
{ {
print '</div>'; // Close current websitebar to open a new one print '</div>'; // Close current websitebar to open a new one
@@ -1080,7 +1083,7 @@ if (count($object->records) > 0)
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext // TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
} }
if (! in_array($action, array('editcss','editmenu','create','createpagefromclone'))) if (! in_array($action, array('editcss','editmenu','editmedias','create','createpagefromclone')))
{ {
if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">'; if (preg_match('/^create/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">'; if (preg_match('/^edit/',$action)) print '<input type="submit" id="savefile" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
@@ -1172,8 +1175,8 @@ if ($action == 'editcss')
$htmlheader = @file_get_contents($filehtmlheader); $htmlheader = @file_get_contents($filehtmlheader);
// Clean the php htmlheader file to remove php code and get only html part // Clean the php htmlheader file to remove php code and get only html part
$htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htmlheader); $htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htmlheader);
if (! trim($htmlheader)) $htmlheader='<html>'."\n".'<!-- HTML header content (all pages) -->'."\n".'</html>'; if (! trim($htmlheader)) $htmlheader='<!-- HTML header content (common for all pages) -->';
else $htmlheader='<html>'."\n".$htmlheader."\n".'</html>'; else $htmlheader='<html>'."\n".trim($htmlheader)."\n".'</html>';
$robotcontent = @file_get_contents($filerobot); $robotcontent = @file_get_contents($filerobot);
// Clean the php htmlheader file to remove php code and get only html part // Clean the php htmlheader file to remove php code and get only html part
@@ -1378,7 +1381,7 @@ if ($action == 'editmeta' || $action == 'create')
print '<br>'; print '<br>';
} }
if ($action == 'editmedia') if ($action == 'editmedias')
{ {
print '<!-- Edit Media -->'."\n"; print '<!-- Edit Media -->'."\n";
print '<div class="center">'.$langs->trans("FeatureNotYetAvailable").'</center>'; print '<div class="center">'.$langs->trans("FeatureNotYetAvailable").'</center>';