Skip to content
Snippets Groups Projects
Commit 49f8e676 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #6023 fix button editing in progress + view pdf format

parent a0c1e51d
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ $the_ext = $extension[$count_level]; ...@@ -42,6 +42,7 @@ $the_ext = $extension[$count_level];
$_SESSION['upfile']['format'] = $the_ext; $_SESSION['upfile']['format'] = $the_ext;
$extList = $is->filetypes_showed_indexation(); $extList = $is->filetypes_showed_indexation();
if (isset($_SESSION['upfile']['format'])) { if (isset($_SESSION['upfile']['format'])) {
$showFile = $is->show_index_frame($_SESSION['upfile']['format']); $showFile = $is->show_index_frame($_SESSION['upfile']['format']);
$ext = strtolower($_SESSION['upfile']['format']); $ext = strtolower($_SESSION['upfile']['format']);
...@@ -74,6 +75,27 @@ if ($_SESSION['origin'] == "scan") { ...@@ -74,6 +75,27 @@ if ($_SESSION['origin'] == "scan") {
echo "<br/>PROBLEM DURING FILE SEND"; echo "<br/>PROBLEM DURING FILE SEND";
} }
exit(); exit();
}else if (!empty($_SESSION['upfile']['fileNamePdfOnTmp'])) {
$mimeType = $is->get_mime_type('pdf');
//print_r($_SESSION['upfile']);exit;
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: ".$mimeType);
header(
"Content-Disposition: inline; filename=" . basename('maarch') . "."
. $ext . ";"
);
header("Content-Transfer-Encoding: binary");
$ext = strtolower('pdf');
if (file_exists($_SESSION['upfile']['local_path'])) {
$loc = $_SESSION['config']['tmppath'] . $_SESSION['upfile']['fileNamePdfOnTmp'];
readfile($loc);
}
exit();
} else if (isset($_SESSION['upfile']['mime']) } else if (isset($_SESSION['upfile']['mime'])
&& ! empty($_SESSION['upfile']['mime']) && ! empty($_SESSION['upfile']['mime'])
&& isset($_SESSION['upfile']['format']) && isset($_SESSION['upfile']['format'])
......
...@@ -1532,6 +1532,7 @@ if (isset($_REQUEST['id'])) { ...@@ -1532,6 +1532,7 @@ if (isset($_REQUEST['id'])) {
$_SESSION['upfile']['format'] = $viewResourceArr['ext']; $_SESSION['upfile']['format'] = $viewResourceArr['ext'];
$fileNameOnTmp = str_replace($viewResourceArr['tmp_path'].DIRECTORY_SEPARATOR, '', $viewResourceArr['file_path']); $fileNameOnTmp = str_replace($viewResourceArr['tmp_path'].DIRECTORY_SEPARATOR, '', $viewResourceArr['file_path']);
$_SESSION['upfile']['fileNameOnTmp'] = $fileNameOnTmp; $_SESSION['upfile']['fileNameOnTmp'] = $fileNameOnTmp;
$_SESSION['upfile']['fileNamePdfOnTmp'] = $viewResourceArr['filenamePdf'];
} else { } else {
$_SESSION['targetAttachment'] = 'add'; $_SESSION['targetAttachment'] = 'add';
......
<?php <?php
/*
* Copyright 2008-2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework 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.
*
* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
/** /**
* @brief Frame to choose a file to index * Copyright Maarch since 2008 under licence GPLv3.
* * See LICENCE.txt file at the root folder for more details.
* @file choose_attachment.php * This file is part of Maarch software.
* @date $date$
* @version $Revision$ * @brief choose_attachment
* @author dev <dev@maarch.org>
* @ingroup core
*/ */
$core_tools = new core_tools(); $core_tools = new core_tools();
...@@ -34,18 +16,18 @@ $core_tools->load_html(); ...@@ -34,18 +16,18 @@ $core_tools->load_html();
$core_tools->load_header('', true, false); $core_tools->load_header('', true, false);
$upFileOK = false; $upFileOK = false;
?> ?>
<body>
<?php <?php
$_SESSION['upfile']['error'] = 0; $_SESSION['upfile']['error'] = 0;
if (isset($_FILES['file']['error']) && $_FILES['file']['error'] == 1) { if (isset($_FILES['file']['error']) && $_FILES['file']['error'] == 1) {
$_SESSION['upfile']['error'] = $_FILES['file']['error']; $_SESSION['upfile']['error'] = $_FILES['file']['error'];
if ($_SESSION['upfile']['error'] == 1) { if ($_SESSION['upfile']['error'] == 1) {
$_SESSION['error'] = 'La taille du fichier telecharge excede la valeur de upload_max_filesize'; $_SESSION['error'] = 'La taille du fichier telecharge excede la valeur de upload_max_filesize';
} }
} elseif (!empty($_FILES['file']['tmp_name']) && $_FILES['file']['error'] <> 1) { } elseif (!empty($_FILES['file']['tmp_name']) && $_FILES['file']['error'] <> 1) {
$_SESSION['error'] = ''; $_SESSION['error'] = '';
$_SESSION['upfile']['tmp_name'] = $_FILES['file']['tmp_name']; $_SESSION['upfile']['tmp_name'] = $_FILES['file']['tmp_name'];
$extension = explode(".",$_FILES['file']['name']); $extension = explode(".", $_FILES['file']['name']);
$name_without_ext = substr($_FILES['file']['name'], 0, strrpos($_FILES['file']['name'], ".")); $name_without_ext = substr($_FILES['file']['name'], 0, strrpos($_FILES['file']['name'], "."));
echo '<script>window.parent.document.getElementById(\'title\').value=\''.$name_without_ext.'\';</script>'; echo '<script>window.parent.document.getElementById(\'title\').value=\''.$name_without_ext.'\';</script>';
$count_level = count($extension)-1; $count_level = count($extension)-1;
...@@ -61,7 +43,7 @@ $upFileOK = false; ...@@ -61,7 +43,7 @@ $upFileOK = false;
. $_SESSION['config']['adminmail'] . "\">" . $_SESSION['config']['adminmail'] . "\">"
. $_SESSION['config']['adminname'] . "</a>)"; . $_SESSION['config']['adminname'] . "</a>)";
} else { } else {
require_once 'core/docservers_tools.php'; include_once 'core/docservers_tools.php';
$arrayIsAllowed = array(); $arrayIsAllowed = array();
$arrayIsAllowed = Ds_isFileTypeAllowed($_FILES['file']['tmp_name'], strtolower($the_ext)); $arrayIsAllowed = Ds_isFileTypeAllowed($_FILES['file']['tmp_name'], strtolower($the_ext));
if ($arrayIsAllowed['status'] == false) { if ($arrayIsAllowed['status'] == false) {
...@@ -80,11 +62,14 @@ $upFileOK = false; ...@@ -80,11 +62,14 @@ $upFileOK = false;
$_SESSION['upfile']['name'] = $fileNameOnTmp; $_SESSION['upfile']['name'] = $fileNameOnTmp;
$_SESSION['upfile']['format'] = $the_ext; $_SESSION['upfile']['format'] = $the_ext;
$upFileOK = true; $upFileOK = true;
echo '<script>window.parent.document.getElementById(\'viewframevalid_attachment\').src=\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=file_iframe&#navpanes=0'.$_SESSION['upfile']['local_path'].'\';</script>'; if (strtolower($_SESSION['upfile']['format']) == 'pdf') {
echo '<script>window.parent.document.getElementById(\'viewframevalid_attachment\').src=\''.$_SESSION['config']['businessappurl'].'index.php?display=true&dir=indexing_searching&page=file_iframe&#navpanes=0'.$_SESSION['upfile']['local_path'].'\';</script>';
}
} }
} }
} }
?> ?>
<body>
<form name="select_file_form" id="select_file_form" method="get" enctype="multipart/form-data" action="<?php <form name="select_file_form" id="select_file_form" method="get" enctype="multipart/form-data" action="<?php
echo $_SESSION['config']['businessappurl']; echo $_SESSION['config']['businessappurl'];
?>index.php?display=true&module=attachments&page=choose_attachment" class="forms"> ?>index.php?display=true&module=attachments&page=choose_attachment" class="forms">
...@@ -92,54 +77,7 @@ $upFileOK = false; ...@@ -92,54 +77,7 @@ $upFileOK = false;
<input type="hidden" name="dir" value="indexing_searching" /> <input type="hidden" name="dir" value="indexing_searching" />
<input type="hidden" name="page" value="choose_attachment" /> <input type="hidden" name="page" value="choose_attachment" />
<?php <?php
if (!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'])) { if (!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'])) {
//launch auto convert in PDF
if (
strtolower($_SESSION['upfile']['format']) == 'odt' ||
strtolower($_SESSION['upfile']['format']) == 'docx'
) {
require_once 'modules/content_management/class/class_content_manager_tools.php';
$cM = new content_management_tools();
if (
file_exists('custom'.DIRECTORY_SEPARATOR. $_SESSION['custom_override_id']
. DIRECTORY_SEPARATOR . 'modules'. DIRECTORY_SEPARATOR . 'content_management'
. DIRECTORY_SEPARATOR . 'applet_controller.php'
)
) {
$path = 'custom/'. $_SESSION['custom_override_id'] .'/modules/content_management/applet_controller.php';
} else {
$path = 'modules/content_management/applet_controller.php';
}
$path_appli = explode('/', $_SESSION['config']['coreurl']);
if(count($path_appli) <> 5){
$path_appli = array_slice($path_appli, 0, 4);
$path_appli = implode('/', $path_appli);
}else{
$path_appli = implode('/', $path_appli);
}
// require_once 'core/class/class_db_pdo.php';
// $database = new Database();
// $query = "select template_id from templates where template_type = 'OFFICE' and template_target = 'attachments'";
// $stmt = $database->query($query);
// $aTemplateId = $stmt->fetchObject()->template_id;
$cookieKey = $_SESSION['sessionName'] . '=' . $_COOKIE[$_SESSION['sessionName']];
$onlyConvert = "true";
$cM->generateJNLP(
$path_appli,
$path_appli . '/' . $path,
'newAttachment',
'res_letterbox',
//$aTemplateId,
$_SESSION['doc_id'],
'',
$cookieKey,
$_SESSION['user']['UserId'],
$_SESSION['clientSideCookies'],
$_SESSION['modules_loaded']['attachments']['convertPdf'],
$onlyConvert
);
}
?> ?>
<i class="fa fa-check-square fa-2x" title="<?php echo _DOWNLOADED_FILE; ?>"></i> <i class="fa fa-check-square fa-2x" title="<?php echo _DOWNLOADED_FILE; ?>"></i>
...@@ -163,11 +101,61 @@ $upFileOK = false; ...@@ -163,11 +101,61 @@ $upFileOK = false;
</p> </p>
<p style="display:none"> <p style="display:none">
<div align="center"> <div align="center">
<input type="radio" name="with_file" id="with_file" value="false" onclick="this.form.method = 'post';this.form.submit();" /> <input type="radio" name="with_file" id="with_file" value="false" onclick="this.form.method = 'post';this.form.submit();" />
</div> </div>
</p> </p>
</form> </form>
<?php $core_tools->load_js();?> <?php
if (!empty($_SESSION['upfile']['local_path']) && empty($_SESSION['error'])) {
//launch auto convert in PDF
if (in_array(strtolower($_SESSION['upfile']['format']), array('odt','docx','doc','docm'))) {
//if (strtolower($_SESSION['upfile']['format']) == 'odt' || strtolower($_SESSION['upfile']['format']) == 'docx') {
echo "<script>window.parent.$('add').value='Edition en cours ...';window.parent.editingDoc('superadmin');window.parent.$('add').disabled='disabled';window.parent.$('add').style.opacity='0.5';</script>";
include_once 'modules/content_management/class/class_content_manager_tools.php';
$cM = new content_management_tools();
if (
file_exists('custom'.DIRECTORY_SEPARATOR. $_SESSION['custom_override_id']
. DIRECTORY_SEPARATOR . 'modules'. DIRECTORY_SEPARATOR . 'content_management'
. DIRECTORY_SEPARATOR . 'applet_controller.php'
)
) {
$path = 'custom/'. $_SESSION['custom_override_id'] .'/modules/content_management/applet_controller.php';
} else {
$path = 'modules/content_management/applet_controller.php';
}
$path_appli = explode('/', $_SESSION['config']['coreurl']);
if (count($path_appli) <> 5) {
$path_appli = array_slice($path_appli, 0, 4);
$path_appli = implode('/', $path_appli);
} else {
$path_appli = implode('/', $path_appli);
}
// require_once 'core/class/class_db_pdo.php';
// $database = new Database();
// $query = "select template_id from templates where template_type = 'OFFICE' and template_target = 'attachments'";
// $stmt = $database->query($query);
// $aTemplateId = $stmt->fetchObject()->template_id;
$cookieKey = $_SESSION['sessionName'] . '=' . $_COOKIE[$_SESSION['sessionName']];
$onlyConvert = "true";
$cM->generateJNLP(
$path_appli,
$path_appli . '/' . $path,
'newAttachment',
'res_letterbox',
//$aTemplateId,
$_SESSION['doc_id'],
'',
$cookieKey,
$_SESSION['user']['UserId'],
$_SESSION['clientSideCookies'],
$_SESSION['modules_loaded']['attachments']['convertPdf'],
$onlyConvert
);
}
}
$core_tools->load_js();?>
</body> </body>
</html> </html>
! !
\ No newline at end of file
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
if (!empty($_SESSION['cm_applet'][$_SESSION['user']['UserId']])) { if (!empty($_SESSION['cm_applet'][$_SESSION['user']['UserId']])) {
echo "{\"status\" : 1, \"status_txt\" : \"LCK FOUND !\"}"; echo "{\"status\" : 1, \"status_txt\" : \"LCK FOUND !\"}";
} else { } else {
echo "{\"status\" : 0, \"status_txt\" : \"LCK NOT FOUND !\"}"; echo "{\"status\" : 0, \"status_txt\" : \"LCK NOT FOUND !\", \"pdf_version\" : \"".$_SESSION['config']['tmppath'].$_SESSION['upfile']['fileNamePdfOnTmp']."\"}";
} }
\ No newline at end of file
...@@ -598,7 +598,6 @@ abstract class content_management_tools_Abstract ...@@ -598,7 +598,6 @@ abstract class content_management_tools_Abstract
//echo '<a id="jnlp_file" href="'.$file.'" onclick="window.location.href=\''.$file.'\';self.close();"></a>'; //echo '<a id="jnlp_file" href="'.$file.'" onclick="window.location.href=\''.$file.'\';self.close();"></a>';
echo '<script>window.location.href=\''.$file.'\';if($(\'CMApplet\')) {destroyModal(\'CMApplet\');};if($(\'CMApplet\')) {destroyModal(\'CMApplet\');};</script>'; echo '<script>window.location.href=\''.$file.'\';if($(\'CMApplet\')) {destroyModal(\'CMApplet\');};if($(\'CMApplet\')) {destroyModal(\'CMApplet\');};</script>';
exit();
/*echo '<a id="jnlp_file" href="'.$_SESSION['config']['businessappurl'].'index.php?page=get_jnlp_file&module=content_management&display=true&filename='.$_SESSION['user']['UserId'].'_maarchCM"></a>'; /*echo '<a id="jnlp_file" href="'.$_SESSION['config']['businessappurl'].'index.php?page=get_jnlp_file&module=content_management&display=true&filename='.$_SESSION['user']['UserId'].'_maarchCM"></a>';
echo '<script>setTimeout(function() {this.window.close();}, 5000);document.getElementById("jnlp_file").click();</script>'; echo '<script>setTimeout(function() {this.window.close();}, 5000);document.getElementById("jnlp_file").click();</script>';
exit();*/ exit();*/
......
...@@ -226,6 +226,8 @@ function checkEditingDoc(userId) { ...@@ -226,6 +226,8 @@ function checkEditingDoc(userId) {
//END OF CHECKING APPLET //END OF CHECKING APPLET
console.log('clearInterval'); console.log('clearInterval');
document.getElementById('viewframevalid_attachment').src='index.php?display=true&dir=indexing_searching&page=file_iframe&#navpanes=0'+response.pdf_version;
//console.log(response.pdf_version);
clearInterval(editing); clearInterval(editing);
} else { } else {
console.log('lck found! Editing in progress !'); console.log('lck found! Editing in progress !');
......
<?php <?php
//FOR ADD NEW ATTACHMENTS //FOR ADD NEW ATTACHMENTS
$sec = new security();
// case onlyConvert // case onlyConvert
if ( if (
$_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $_SESSION['modules_loaded']['attachments']['convertPdf'] == true &&
...@@ -19,6 +19,9 @@ if (isset($_SESSION['cm']['resMaster']) && $_SESSION['cm']['resMaster'] <> '') { ...@@ -19,6 +19,9 @@ if (isset($_SESSION['cm']['resMaster']) && $_SESSION['cm']['resMaster'] <> '') {
$_SESSION['cm']['resMaster'] = ''; $_SESSION['cm']['resMaster'] = '';
if (empty($_SESSION['cm']['collId'])) {
$_SESSION['cm']['collId'] = $sec->retrieve_coll_id_from_table($objectTable);
}
$docserverControler = new docservers_controler(); $docserverControler = new docservers_controler();
$docserver = $docserverControler->getDocserverToInsert( $docserver = $docserverControler->getDocserverToInsert(
$_SESSION['cm']['collId'] $_SESSION['cm']['collId']
...@@ -161,7 +164,6 @@ if (empty($docserver)) { ...@@ -161,7 +164,6 @@ if (empty($docserver)) {
} else { } else {
if ($_SESSION['history']['attachadd'] == "true") { if ($_SESSION['history']['attachadd'] == "true") {
$hist = new history(); $hist = new history();
$sec = new security();
$view = $sec->retrieve_view_from_coll_id( $view = $sec->retrieve_view_from_coll_id(
$collId $collId
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment