Skip to content

Commit

Permalink
OHMS-SPRINT-12 includes all the changes from sprint 11 as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfahadk committed Sep 23, 2019
1 parent f59be61 commit 8404026
Show file tree
Hide file tree
Showing 12 changed files with 577 additions and 18 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.0
3.7.1
474 changes: 474 additions & 0 deletions app/Ohms/CustomPdf.php

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions app/Ohms/Interview/Version3.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private function __construct($viewerconfig, $tmpDir, $cachefile)
'time_length' => (string)$ohfile->record->duration,
'collection' => (string)$ohfile->record->collection_name,
'series' => (string)$ohfile->record->series_name,
'series_link' => (string)$ohfile->record->series_link,
'fmt' => (string)$ohfile->record->fmt,
'media_url' => (string)$ohfile->record->media_url,
'file_name' => (string)$ohfile->record->file_name,
Expand All @@ -61,7 +62,11 @@ private function __construct($viewerconfig, $tmpDir, $cachefile)
'transcript_alt_lang' => (string)$ohfile->record->transcript_alt_lang,
'translate' => (string)$ohfile->record->translate,
'funding' => (string)$ohfile->record->funding,'avalon_target_domain' => (string)$ohfile->record->mediafile->avalon_target_domain,
'user_notes' => (string)$ohfile->record->user_notes
'user_notes' => (string)$ohfile->record->user_notes,
'collection_link' => (string)$ohfile->record->collection_link,
'transcript_alt_raw' => (string)$ohfile->record->transcript_alt,
'transcript_raw' => (string)$ohfile->record->transcript,

);

$collection_link = ($ohfile->record->collection_link != null) ? (string)$ohfile->record->collection_link : '';
Expand Down Expand Up @@ -93,6 +98,7 @@ private function __construct($viewerconfig, $tmpDir, $cachefile)
$this->Transcript = new Transcript($transcript, $this->data['chunks'], $ohfile->record->index, $translate);
$this->data['transcript'] = $this->Transcript->getTranscriptHTML();
$this->data['index'] = $this->Transcript->getIndexHTML();
$this->data['index_points'] = $ohfile->record->index;

// Video or audio-only
$fmt_info = explode(":", $this->data['fmt']);
Expand Down Expand Up @@ -127,7 +133,13 @@ private function __construct($viewerconfig, $tmpDir, $cachefile)
$pieces[] = $part;
}
$this->data['interviewer'] = implode($pieces, '');


$interviewee_info = $ohfile->record->interviewee;
$piecese = array();
foreach($interviewee_info as $parte) {
$piecese[] = $parte;
}
$this->data['interviewee'] = implode($piecese, '');
unset($this->cacheFile);
}

Expand Down
24 changes: 15 additions & 9 deletions app/Ohms/Transcript.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private function formatIndex($translate) {
$formattedKeywords = implode('; ', $keywords);
$formattedSubjects = implode('; ', $subjects);
$time = (int) $point->time;

$indexText = "";
if (!empty($nlPartialTranscript) && trim($nlPartialTranscript) != "") {
$indexText .= '<p><strong>Partial Transcript:</strong> <span>' . $nlPartialTranscript . '</span></p>';
Expand All @@ -90,10 +90,11 @@ private function formatIndex($translate) {
*/
$gpsHTML = '';
$gpsPoints = $point->gpspoints;
if(empty($gpsPoints)){
$point->gpspoints[0]->gps = $point->gps;
if (empty($gpsPoints)) {
$point->gpspoints[0]->gps = $point->gps;
$point->gpspoints[0]->gps_zoom = (empty($point->gps_zoom) ? '17' : $point->gps_zoom);
$point->gpspoints[0]->gps_text = $translate ? $point->gps_text_alt : $point->gps_text;
$point->gpspoints[0]->gps_text = $point->gps_text;
$point->gpspoints[0]->gps_text_alt = $point->gps_text_alt;
}
$gpsPoints = $point->gpspoints;
$gpsCounter = 0;
Expand Down Expand Up @@ -132,9 +133,10 @@ private function formatIndex($translate) {
*/
$hyperlinkHTML = '';
$hyperlinks = $point->hyperlinks;
if(empty($hyperlinks)){
$point->hyperlinks[0]->hyperlink = $point->hyperlink;
$point->hyperlinks[0]->hyperlink_text = $translate ? $point->hyperlink_text_alt : $point->hyperlink_text;
if (empty($hyperlinks)) {
$point->hyperlinks[0]->hyperlink = $point->hyperlink;
$point->hyperlinks[0]->hyperlink_text = $point->hyperlink_text;
$point->hyperlinks[0]->hyperlink_text_alt = $point->hyperlink_text_alt;
}
$hyperlinks = $point->hyperlinks;
$hyperlinkCounter = 0;
Expand Down Expand Up @@ -182,7 +184,7 @@ private function formatIndex($translate) {
</div>
POINT;
}

$this->indexHTML = $indexHTML . "</div>\n";
}
}
Expand Down Expand Up @@ -267,7 +269,11 @@ private function formatTranscript() {
if (in_array($key, $chunklines)) {
$foundkey = array_search($key, $chunklines);
$currentSyncSlot = $foundkey * $chunksize;
$currentSyncSlotSecs = $currentSyncSlot * (60 * $chunksize);
if ($chunksize != 1) {
$currentSyncSlotSecs = $currentSyncSlot * (60);
} else {
$currentSyncSlotSecs = $currentSyncSlot * (60 * $chunksize);
}
$nextSyncSlotSecs = $currentSyncSlotSecs + (60 * $chunksize);
$wordCountPerLine = 0;
} else {
Expand Down
5 changes: 5 additions & 0 deletions app/Ohms/ViewerController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Ohms;

use Ohms\Interview;
use Ohms\CustomPdf;

class ViewerController
{
Expand All @@ -18,6 +19,10 @@ public function __construct($interviewName)
public function route($action, $kw, $interviewName)
{
switch($action) {
case 'pdf':
CustomPdf::__prepare($this->interview,$this->config);
exit();
break;
case 'metadata':
header('Content-type: application/json');
echo $this->interview->toJSON();
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"psr-4": {
"Ohms\\": "app/Ohms"
}
},
"require": {
"tecnickcom/tcpdf": "^6.2"
}

}
1 change: 1 addition & 0 deletions config/config.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ tmpDir = /var/www/html/viewerfiles
players = other,brightcove,kaltura,youtube,soundcloud,avalon
timezone = America/New_York
exhibit_mode = false
print_mode = false

[Louie B. Nunn Center for Oral History, University of Kentucky Libraries]
css = custom_default.css
Expand Down
1 change: 1 addition & 0 deletions config/config.template.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ tmpDir =
players = other,brightcove,kaltura,youtube,soundcloud,vimeo,avalon
timezone =
exhibit_mode = false
print_mode = false

[Your Repository Name]
css = custom_default.css
Expand Down
32 changes: 31 additions & 1 deletion css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ Responsive Web Design
box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
background: #3c3c3c;
padding-top: 10px;
position:relative;
}

#headervid {
Expand All @@ -522,6 +523,7 @@ Responsive Web Design
padding-top: 10px;
display: inline-block;
padding-bottom: 12px;
position:relative;
}

#audio-panel {
Expand Down Expand Up @@ -1415,4 +1417,32 @@ p.bold {
}
.bbold{
font-weight: bold;
}
}
.printCustom{
background-image: url(../imgs/print_full.png);
background-repeat: no-repeat;
width: 38px;
height: 37px;
background-size: 38px 37px;
position: absolute;
right: 1%;
}
.printCustomMobile{
display:none;
background-image: url(../imgs/print_mobile.png);
background-repeat: no-repeat;
width: 27px;
height: 27px;
background-size: 27px 27px;
position: absolute;
right: 4%;
margin-top: 5px;
}
@media only screen and (max-width: 800px) {
.printCustomMobile{
display:block;
}
.printCustom{
display:none;
}
}
Binary file added imgs/print_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/print_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 31 additions & 5 deletions tmpl/viewer.tmpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
$site_url = "$protocol://$host";
$extraCss = null;
$exhibitMode = 0;

$printMode = 0;
if (isset($config['exhibit_mode']) && $config['exhibit_mode'] <> '') {
$exhibitMode = $config['exhibit_mode'];
}else {
$exhibitMode = 0;
}
if (isset($config['print_mode']) && $config['print_mode'] <> '') {
$printMode = $config['print_mode'];
}else {
$printMode = 0;
}

if (isset($config[$interview->repository])) {
$repoConfig = $config[$interview->repository];
Expand Down Expand Up @@ -114,8 +119,10 @@
?>
<div id="headervid">
<?php }
if($printMode){
?>
<?php if (isset($config[$interview->repository])): ?>
<a href="#" class="printCustom" ></a>
<?php } if (isset($config[$interview->repository])): ?>
<img id="headerimg"
src="<?php echo $config[$interview->repository]['footerimg']; ?>"
alt="<?php echo $config[$interview->repository]['footerimgalt']; ?>"/>
Expand Down Expand Up @@ -143,7 +150,7 @@
?>
<?php echo $interview->accession; ?><br/>

<?php if (isset($interview->collection_link) && (string)$interview->collection_link != '') { ?>
<?php if ((string)$interview->collection_link != '') { ?>
<a href="<?php echo $interview->collection_link ?>"><?php echo $interview->collection ?></a>
<?php } else {
?>
Expand All @@ -155,7 +162,7 @@
echo " | ";
}
?>
<?php if (isset($interview->series_link) && (string)$interview->series_link != '') { ?>
<?php if ((string)$interview->series_link != '') { ?>
<a href="<?php echo $interview->series_link ?>"><?php echo $interview->series ?></a>
<?php } else {
?>
Expand All @@ -171,7 +178,9 @@
</div>
</div>
<div id="main">
<?php if (!empty(trim($interview->user_notes))): ?>
<?php if($printMode){ ?>
<a href="#" class="printCustomMobile" ></a>
<?php } $userNotes = trim($interview->user_notes); if (!empty($userNotes)): ?>
<div class="user_notes"><?php echo $interview->user_notes ?>
<img src="imgs/button_close.png" onclick="$('.user_notes').slideToggle();"/>
</div>
Expand Down Expand Up @@ -286,6 +295,23 @@
<script>
var allToolTipInstances = {};
$(document).ready(function () {
$(".printCustom").click(function(){
window.location.href="viewer.php?action=pdf&cachefile=" + cachefile + "";
});
$(".transcript-line").each(function(){
var jumplinkElm = $(this).find('.jumpLink');
var numberOfIntervalsInLine = jumplinkElm.length;
if(numberOfIntervalsInLine > 1){
var marginToAdd = 13;
var totalMargin = 13 * numberOfIntervalsInLine;
jumplinkElm.each(function(index){
var currentMargin = totalMargin - (marginToAdd*(index+1));
$(this).css('margin-top',currentMargin);
});
}
});


setTimeout(function(){
var htmlTranscript = $('#transcript-panel').html().trim();
var htmlIndex = $('#index-panel').html().trim();
Expand Down

0 comments on commit 8404026

Please sign in to comment.