Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
billy clark committed Oct 4, 2022
2 parents 7b16411 + 262bd5a commit d5d32ad
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 250 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
"phpcs.composerJsonPath": "src",
"php.suggest.basic": false,
"git.ignoreLimitWarning": true,
"makefile.makeDirectory": "docker",
}
29 changes: 23 additions & 6 deletions src/Api/Model/Languageforge/Lexicon/Command/LexUploadCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ public static function uploadAudioFile($projectId, $mediaType, $tmpFilePath)
$data->fileName = $fileNamePrefix . '_' . $fileName; //if the file has been converted, $fileName = converted file
$response->result = true;

//Uncomment to ensure that only one format for each audio file is stored in the assets. We want to keep up to two formats right now (09-2022): the original and if needed, a FLEx-compatible one
// if (array_key_exists('previousFilename', $_POST)) {
// $previousFilename = $_POST['previousFilename'];
// self::deleteMediaFile($projectId, $mediaType, $previousFilename);
// }
//If this audio upload is replacing old audio, the previous file(s) for the entry are deleted from the assets
if (array_key_exists('previousFilename', $_POST)) {
$previousFilename = $_POST['previousFilename'];
self::deleteMediaFile($projectId, $mediaType, $previousFilename);
}
} else {
$data = new ErrorResult();
$data->errorType = 'UserMessage';
Expand Down Expand Up @@ -279,8 +279,16 @@ public static function deleteMediaFile($projectId, $mediaType, $fileName) {
$data->errorMessage = $errorMsg;
return $response;
}
$filePath = $folderPath . '/' . $fileName;

//Path to the specific file the entry points to
$filePath = "$folderPath/$fileName";
//Put any other stored versions of the file (e.g. the same file saved in other formats) in an array
$fileNameWithoutExt = preg_replace('/\\.[^.\\s]{3,4}$/', '', $fileName);
$versionsOfTheSameFile = glob("$folderPath/$fileNameWithoutExt.*");

if (file_exists($filePath) and ! is_dir($filePath)) {

//Delete the file the entry points to and create the server response
if (unlink($filePath)) {
$data = new MediaResult();
$data->path = $folderPath;
Expand All @@ -291,8 +299,17 @@ public static function deleteMediaFile($projectId, $mediaType, $fileName) {
$data->errorType = 'UserMessage';
$data->errorMessage = "$fileName could not be deleted. Contact your Site Administrator.";
}

//Delete any other stored versions of the file
foreach ($versionsOfTheSameFile as $aVersionOfThisFile){
if($aVersionOfThisFile != $filePath){ //because $filePath, the one the entry points to, was already deleted above
unlink($aVersionOfThisFile);
}
}

return $response;
}

$data = new ErrorResult();
$data->errorType = 'UserMessage';
$data->errorMessage = "$fileName does not exist in this project. Contact your Site Administrator.";
Expand Down
12 changes: 10 additions & 2 deletions src/Site/views/languageforge/theme/default/sass/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@
}
}

// for very small devices such as iPhone 5
@media (max-width: 350px) {
// for small and extra small devices
@include media-breakpoint-down(sm) {
.btn span {
display: none;
}
#shareBtn, #settingsBtn {
padding-right: 0;

span {
display: none;
}
}
}

Expand Down Expand Up @@ -200,11 +204,15 @@
font-size: 25px;
line-height: 25px;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@include media-breakpoint-down(sm) {
font-size: 18px;
line-height: 18px;
}
}
overflow: hidden;
}
}
.breadcrumbs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ export class AudioRecorderController implements angular.IController {
}
);

//Stopping the media stream tracks releases the red recording indicator from browser tabs
this.mediaRecorder.addEventListener("stop",
() => {
stream.getTracks().forEach(function(track) {
track.stop();
});
}
);


this.recordingStartTime = new Date();

this.interval = this.$interval(() => {
Expand Down
187 changes: 19 additions & 168 deletions src/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d5d32ad

Please sign in to comment.