Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
various 3.3 upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucej committed Feb 13, 2015
1 parent b6ab6be commit 3d0a68c
Show file tree
Hide file tree
Showing 11 changed files with 217 additions and 128 deletions.
2 changes: 1 addition & 1 deletion ajaxsupplement.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
$move = move_uploaded_file($_FILES['form_new_file']['tmp_name'], $temp_dir . DIRECTORY_SEPARATOR . $_FILES['form_new_file']['name']);
if (PHP_OS == 'Linux' || PHP_OS == 'Darwin')
putenv('HOME=' . $temp_dir);
exec('soffice --headless --convert-to pdf --outdir "' . $temp_dir . '" "' . $temp_dir . DIRECTORY_SEPARATOR . $_FILES['form_new_file']['name'] . '"');
exec(select_soffice() . ' --headless --convert-to pdf --outdir "' . $temp_dir . '" "' . $temp_dir . DIRECTORY_SEPARATOR . $_FILES['form_new_file']['name'] . '"');
if (PHP_OS == 'Linux' || PHP_OS == 'Darwin')
putenv('HOME=""');
$converted_file = $temp_dir . DIRECTORY_SEPARATOR . basename($_FILES['form_new_file']['name'], '.' . $file_extension) . '.pdf';
Expand Down
2 changes: 1 addition & 1 deletion batchimport.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
if (in_array($file_extension, array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp'))) {
if (PHP_OS == 'Linux' || PHP_OS == 'Darwin')
putenv('HOME=' . $temp_dir);
exec('soffice --headless --convert-to pdf --outdir "' . $temp_dir . '" "' . $file . '"');
exec(select_soffice() . ' --headless --convert-to pdf --outdir "' . $temp_dir . '" "' . $file . '"');
if (PHP_OS == 'Linux' || PHP_OS == 'Darwin')
putenv('HOME=""');
//copy file to temp to add it to supplement later
Expand Down
19 changes: 10 additions & 9 deletions categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@

while (list($cat_key, $cat_name) = each($cat_all)) {
if (stristr("$paper[title] $paper[abstract]", $cat_name)) {
$checkbox = '<span data-catid="'.$cat_key.'" style="cursor: pointer">';

$checkbox = '<span data-catid="' . $cat_key . '" style="cursor: pointer">';

if (in_array($cat_key, $cat_paper)) {
$checkbox .= '<i class="fa fa-check-square"></i> ';
} else {
Expand All @@ -124,23 +124,24 @@
<table cellpadding="0" cellspacing="0" border="0" style="width: 100%;height:100%;margin-top: 0px">
<tr>
<td class="alternating_row" style="width: 190px;padding: 5px">
<input type="text" size="25" id="filtercategories" value="" placeholder="Filter categories" style="width:190px;margin-bottom:6px">
<div class="separator" style="margin:0"></div>
<input type="submit" value="Save" style="display:none">

<button id="newcatbutton" style="margin:0"><i class="fa fa-save"></i> Save</button><br>
<b>Add to new categories:</b><br>
<input type="text" size="25" name="category2[]" value="" style="width:190px"><br>
<input type="text" size="25" name="category2[]" value="" style="width:190px"><br>
<input type="text" size="25" name="category2[]" value="" style="width:190px"><br>
<input type="text" size="25" name="category2[]" value="" style="width:190px"><br>
<input type="text" size="25" name="category2[]" value="" style="width:190px"><br>
<button id="newcatbutton" style="margin:6px 0"><i class="fa fa-save"></i> Save</button><br>
<br>
<b>Suggestions:</b><br>
<span id="suggestions">
<?php if (!empty($suggested_categories)) print implode('<div style="clear:both"></div>', $suggested_categories); ?>
<?php if (!empty($suggested_categories)) print implode('<div style="clear:both"></div>', $suggested_categories); ?>
</span>
</td>
<td>
<div class="alternating_row">
<input type="text" id="filtercategories" value="" placeholder="Filter categories" style="width:300px;margin:0.75em 0">
</div>
<table class="categorieslist" style="width:49%;float:left;padding:2px">
<?php
$i = 1;
Expand All @@ -156,7 +157,7 @@

if (isset($cat_paper) && is_numeric(array_search($cat_key, $cat_paper)))
$cat_selected = true;
print PHP_EOL . '<tr><td data-catid="'.$cat_key.'" class="select_span';
print PHP_EOL . '<tr><td data-catid="' . $cat_key . '" class="select_span';
if ($cat_selected)
print ' alternating_row';
print '">';
Expand Down
2 changes: 1 addition & 1 deletion checkbinaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

if (PHP_OS == 'Linux' || PHP_OS == 'Darwin')
putenv('HOME=' . $temp_dir);
exec('soffice --headless --convert-to pdf --outdir "' . $temp_dir . '" "' . __DIR__ . DIRECTORY_SEPARATOR . 'test.odt"');
exec(select_soffice() . ' --headless --convert-to pdf --outdir "' . $temp_dir . '" "' . __DIR__ . DIRECTORY_SEPARATOR . 'test.odt"');
if (PHP_OS == 'Linux' || PHP_OS == 'Darwin')
putenv('HOME=""');
$converted_file = $temp_dir . DIRECTORY_SEPARATOR . 'test.pdf';
Expand Down
8 changes: 4 additions & 4 deletions files.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
<input type="hidden" name="file" value="<?php print htmlspecialchars($paper['id']) ?>">
<input type="hidden" name="filename" value="<?php print htmlspecialchars($paper['file']) ?>">
<button id="submituploadfiles"><i class="fa fa-save"></i> Save</button>
<div class="separator" style="margin:5px 0 1em 0"></div>
<strong>Add/replace PDF:</strong><br>
<br>
<strong>Add or replace PDF:</strong><br>
Local file:<br>
<input type="file" name="form_new_file"><br>
PDF from the Web:<br>
<input type="text" name="form_new_file_link" style="width: 99%"><br>
<div class="separator" style="margin:1em 0"></div>
<br>
<b>Add graphical abstract:</b><br>
<input type="file" name="form_graphical_abstract" accept="image/*"><br>
<div class="separator" style="margin:1em 0"></div>
<br>
<b>Add supplementary files:</b><br>
<input type="file" name="form_supplementary_file1"><br>
<input type="file" name="form_supplementary_file2"><br>
Expand Down
19 changes: 18 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ function select_tesseract() {
global $selected_tesseract;

if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$selected_tesseract = 'tesseract.exe';
$selected_tesseract = '"%PROGRAMFILES%\\Tesseract-OCR\\tesseract.exe"';
} elseif (PHP_OS == 'Linux') {
$selected_tesseract = 'tesseract';
} elseif (PHP_OS == 'Darwin') {
Expand All @@ -708,6 +708,23 @@ function select_tesseract() {
return $selected_tesseract;
}

/////////////select soffice//////////////////////

function select_soffice() {

global $selected_soffice;

if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$selected_soffice = '"%PROGRAMFILES%\\LibreOffice 4\\program\\soffice.exe"';
} elseif (PHP_OS == 'Linux') {
$selected_soffice = 'soffice';
} elseif (PHP_OS == 'Darwin') {
$selected_soffice = 'soffice';
}

return $selected_soffice;
}

/////////////proxy_file_get_contents//////////////////////

function proxy_file_get_contents($url, $proxy_name, $proxy_port, $proxy_username, $proxy_password) {
Expand Down
32 changes: 15 additions & 17 deletions js/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -1687,9 +1687,9 @@ var rename_category = {
var items = {
init: function(selfile) {
var lw = 233, sel = $('body').data('sel');
if ($('body').data('liwidth') !== undefined)
lw = $('body').data('liwidth');
if (lw === 0) {
if (localStorage.getItem('liwidth') !== undefined)
lw = localStorage.getItem('liwidth');
if (lw === '0') {
$('#items-left').hide();
$('#items-container .middle-panel i').removeClass('fa-caret-left').addClass('fa-caret-right');
}
Expand All @@ -1703,11 +1703,11 @@ var items = {
var $l = $(this).prev();
if ($l.is(':hidden')) {
$l.show();
$('body').data('liwidth', 233);
localStorage.setItem('liwidth', '233');
$(this).children().removeClass('fa-caret-right').addClass('fa-caret-left');
} else {
$l.hide();
$('body').data('liwidth', 0);
localStorage.setItem('liwidth', '0');
$(this).children().removeClass('fa-caret-left').addClass('fa-caret-right');
}
$(window).trigger('resize');
Expand Down Expand Up @@ -2041,7 +2041,6 @@ var items = {
if ($('#deletebutton').is(':visible'))
$('#deletebutton').click();
}).bind('keydown', 'q', function() {
if ($('.backbutton').is(':visible'))
$('.backbutton').click();
});
}
Expand Down Expand Up @@ -2447,9 +2446,9 @@ var desktop = {
firstid = openproj;
}
$('body').data('sel', 'desk').data('proj', firstid);
if ($('body').data('lwidth') !== undefined)
lw = $('body').data('lwidth');
if (lw === 0) {
if (localStorage.getItem('lwidth') !== undefined)
lw = localStorage.getItem('lwidth');
if (lw === '0') {
$('#leftindex-left').hide();
$('#bottom-panel .middle-panel i').removeClass('fa-caret-left').addClass('fa-caret-right');
}
Expand All @@ -2467,11 +2466,11 @@ var desktop = {
var $l = $(this).prev();
if ($l.is(':hidden')) {
$l.show();
$('body').data('lwidth', 233);
localStorage.setItem('lwidth', '233');
$(this).children().removeClass('fa-caret-right').addClass('fa-caret-left');
} else {
$l.hide();
$('body').data('lwidth', 0);
localStorage.setItem('lwidth', '0');
$(this).children().removeClass('fa-caret-left').addClass('fa-caret-right');
}
});
Expand Down Expand Up @@ -3031,7 +3030,6 @@ var displaywindow = {
}).bind('keydown', 'w', function() {
$('.prevrecord').click();
}).bind('keydown', 'q', function() {
if ($('.backbutton').is(':visible'))
$('.backbutton').click();
});
}
Expand Down Expand Up @@ -4207,9 +4205,9 @@ var leftindex = {
common.init();
$('body').data('sel', sel);
var lw = 233;
if ($('body').data('lwidth') !== undefined)
lw = $('body').data('lwidth');
if (lw === 0) {
if (localStorage.getItem('lwidth') !== undefined)
lw = localStorage.getItem('lwidth');
if (lw === '0') {
$('#leftindex-left').hide();
$('#bottom-panel .middle-panel i').removeClass('fa-caret-left').addClass('fa-caret-right');
}
Expand All @@ -4223,11 +4221,11 @@ var leftindex = {
var $l = $(this).prev();
if ($l.is(':hidden')) {
$l.show();
$('body').data('lwidth', 233);
localStorage.setItem('lwidth', '233');
$(this).children().removeClass('fa-caret-right').addClass('fa-caret-left');
} else {
$l.hide();
$('body').data('lwidth', 0);
localStorage.setItem('lwidth', '0');
$(this).children().removeClass('fa-caret-left').addClass('fa-caret-right');
}
});
Expand Down
Loading

0 comments on commit 3d0a68c

Please sign in to comment.