mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
WIP to allow upload of files
This commit is contained in:
parent
8109c1f7e2
commit
26bb977006
|
|
@ -114,8 +114,6 @@ print '<body>'."\n";
|
|||
print '<div>';
|
||||
//print '<br>';
|
||||
|
||||
$nbofsearch = 0;
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
$hookmanager->initHooks(array('searchform'));
|
||||
|
||||
|
|
|
|||
138
htdocs/core/upload_page.php
Normal file
138
htdocs/core/upload_page.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This file is a modified version of datepicker.php from phpBSM to fix some
|
||||
* bugs, to add new features and to dramatically increase speed.
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/upload_page.php
|
||||
* \brief Page to show a generic upload file feature
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
/*
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', 1);
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1);
|
||||
}
|
||||
*/
|
||||
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
/*
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', 1);
|
||||
}
|
||||
*/
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
|
||||
require_once '../main.inc.php';
|
||||
|
||||
if (GETPOST('lang', 'aZ09')) {
|
||||
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("main", "other"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
/*$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
||||
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');*/
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'aaa') { // Test on permission not required here. Test will be done on the targeted page.
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||
if (empty($dolibarr_nocache) && GETPOSTINT('cache')) {
|
||||
header('Cache-Control: max-age='.GETPOSTINT('cache').', public');
|
||||
// For a .php, we must set an Expires to avoid to have it forced to an expired value by the web server
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + GETPOSTINT('cache')).' GMT');
|
||||
// HTTP/1.0
|
||||
header('Pragma: token=public');
|
||||
} else {
|
||||
// HTTP/1.0
|
||||
header('Cache-Control: no-cache');
|
||||
}
|
||||
|
||||
$title = $langs->trans("UploadFile");
|
||||
$help_url = '';
|
||||
|
||||
// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
|
||||
$head = '<!-- Upload file -->'."\n"; // This is used by DoliDroid to know page is a search page
|
||||
$arrayofjs = array();
|
||||
$arrayofcss = array();
|
||||
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', 'mod-upload page-card');
|
||||
//top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
print load_fiche_titre($title, '', 'user');
|
||||
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
$hookmanager->initHooks(array('searchform'));
|
||||
|
||||
// Define $uploadform
|
||||
$uploadform = '';
|
||||
|
||||
|
||||
// TODO
|
||||
print 'TODO';
|
||||
|
||||
|
||||
// Execute hook printSearchForm
|
||||
$parameters = array('uploadform'=>$uploadform);
|
||||
$reshook = $hookmanager->executeHooks('printUploadForm', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook)) {
|
||||
$uploadform .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$uploadform = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$uploadform .= '<br>';
|
||||
|
||||
|
||||
// Show all forms
|
||||
print "\n";
|
||||
print "<!-- Begin SearchForm -->\n";
|
||||
print '<div class="center"><div class="center" style="padding: 30px;">';
|
||||
print '<style>.menu_titre { padding-top: 7px; }</style>';
|
||||
print '<div id="blockvmenusearch" class="tagtable center searchpage">'."\n";
|
||||
print $uploadform;
|
||||
print '</div>'."\n";
|
||||
print '</div></div>';
|
||||
print "\n<!-- End SearchForm -->\n";
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
|
@ -2459,10 +2459,15 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
|
|||
}
|
||||
|
||||
if (getDolGlobalString('MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN')) {
|
||||
// Add search dropdown
|
||||
// Add the quick add object dropdown
|
||||
$toprightmenu .= top_menu_quickadd();
|
||||
}
|
||||
|
||||
if (getDolGlobalString('MAIN_USE_TOP_MENU_IMPORT_FILE')) {
|
||||
// Add the import file link
|
||||
$toprightmenu .= top_menu_importfile();
|
||||
}
|
||||
|
||||
// Add bookmark dropdown
|
||||
$toprightmenu .= top_menu_bookmark();
|
||||
|
||||
|
|
@ -2783,7 +2788,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
|||
}
|
||||
|
||||
/**
|
||||
* Build the tooltip on top menu quick add
|
||||
* Build the tooltip on top menu quick add.
|
||||
* Called when option MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN is set
|
||||
*
|
||||
* @return string HTML content
|
||||
*/
|
||||
|
|
@ -2866,6 +2872,50 @@ function top_menu_quickadd()
|
|||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build the tooltip on top menu quick add.
|
||||
* Called when MAIN_USE_TOP_MENU_IMPORT_FILE is set.
|
||||
*
|
||||
* @return string HTML content
|
||||
*/
|
||||
function top_menu_importfile()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// Button disabled on text browser
|
||||
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$html = '';
|
||||
|
||||
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
|
||||
// accesskey is for Mac: CTRL + key for all browsers
|
||||
$stringforfirstkey = $langs->trans("KeyboardShortcut");
|
||||
if ($conf->browser->os === 'macintosh') {
|
||||
$stringforfirstkey .= ' CTL +';
|
||||
} else {
|
||||
if ($conf->browser->name == 'chrome') {
|
||||
$stringforfirstkey .= ' ALT +';
|
||||
} elseif ($conf->browser->name == 'firefox') {
|
||||
$stringforfirstkey .= ' ALT + SHIFT +';
|
||||
} else {
|
||||
$stringforfirstkey .= ' CTL +';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
$html .= '<!-- div for upload file link -->
|
||||
<div id="topmenu-uploadfile-dropdown" class="atoplogin dropdown inline-block">
|
||||
<a accesskey="u" class="dropdown-togglex login-dropdown-a nofocusvisible" data-toggle="dropdown" href="'.DOL_URL_ROOT.'/core/upload_page.php" title="'.$langs->trans('UploadFile').' ('.$stringforfirstkey.' a)"><i class="fa fa-upload"></i></a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate list of quickadd items
|
||||
*
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ if ($id > 0) {
|
|||
$passwordismodified = false;
|
||||
$ldap = null;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user