Set to media type on upload. Music being default.
This commit is contained in:
parent
d5b04b30cc
commit
3338e9289a
|
@ -349,4 +349,20 @@ class FileDataHelper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Media Type
|
||||
*
|
||||
* @return string Media type key value
|
||||
*/
|
||||
public static function saveMediaType()
|
||||
{
|
||||
if (isset($_COOKIE['mt_upload'])) {
|
||||
$mt = $_COOKIE['mt_upload'];
|
||||
} else {
|
||||
// Use default media type
|
||||
$mt = "MUS";
|
||||
}
|
||||
return $mt;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -150,12 +150,14 @@ class CcFiles extends BaseCcFiles {
|
|||
$importedStorageDir = $storDir->getDirectory() . "imported/" . self::getOwnerId() . "/";
|
||||
$importedDbPath = "imported/" . self::getOwnerId() . "/";
|
||||
$artwork = FileDataHelper::saveArtworkData($filePath, $originalFilename, $importedStorageDir, $importedDbPath);
|
||||
$mediaType = FileDataHelper::saveMediaType();
|
||||
|
||||
$file->fromArray($fileArray);
|
||||
$file->setDbOwnerId(self::getOwnerId());
|
||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$file->setDbTrackTitle($originalFilename);
|
||||
$file->setDbArtwork($artwork);
|
||||
$file->setDbMediaType($mediaType);
|
||||
$file->setDbUtime($now);
|
||||
$file->setDbHidden(true);
|
||||
$file->save();
|
||||
|
|
|
@ -14,8 +14,59 @@
|
|||
$used = $disk->totalSpace-$disk->totalFreeSpace;
|
||||
$total = $disk->totalSpace;
|
||||
?>
|
||||
|
||||
<?php
|
||||
$media_type_options = array();
|
||||
$media_types = array(
|
||||
'MUS' => 'Music',
|
||||
'SID' => 'Station IDs',
|
||||
'INT' => 'Intros',
|
||||
'OUT' => 'Outros',
|
||||
'SWP' => 'Sweepers',
|
||||
'JIN' => 'Jingles',
|
||||
'PRO' => 'Promos',
|
||||
'SHO' => 'Shout Outs',
|
||||
'NWS' => 'News',
|
||||
'COM' => 'Commercials',
|
||||
'ITV' => 'Interviews',
|
||||
'VTR' => 'Voice Trackings',
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
if (isset($_COOKIE['mt_upload'])) {
|
||||
$mtsaved = $_COOKIE['mt_upload'];
|
||||
} else {
|
||||
// Use default media type
|
||||
$mtsaved = "MUS";
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="upload_wrapper">
|
||||
<H2>Upload Audio Files</H2>
|
||||
|
||||
<div id="media_type_selection">
|
||||
<form>
|
||||
<select id="select_type" class="form-control">
|
||||
<?php
|
||||
foreach ($media_types as $key => $mt) {
|
||||
$selected = "";
|
||||
if ($mtsaved == $key) {
|
||||
$selected = "selected";
|
||||
}
|
||||
echo "<option value='$key' $selected>$mt</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
foreach ($media_types as $key => $mt) {
|
||||
if ($mtsaved == $key) {
|
||||
$mtTitle = $mt;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<H2><?php echo _("Upload")?> <span id="upload_type" style="color:#ff611f"><?php echo $mtTitle; ?></span></H2>
|
||||
<form action="/rest/media" method="post" id="add-media-dropzone" class="dropzone dz-clickable">
|
||||
<?php echo $this->form->getElement('csrf') ?>
|
||||
<div class="dz-message">
|
||||
|
|
|
@ -640,3 +640,9 @@ table#recent_uploads_table td
|
|||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#media_type_selection {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
top: 0;
|
||||
}
|
||||
|
|
|
@ -203,4 +203,11 @@ $(document).ready(function () {
|
|||
self.recentUploadsTable = self.setupRecentUploadsTable();
|
||||
|
||||
//$("#recent_uploads_table.div.fg-toolbar").prepend('<b>Custom tool bar! Text/images etc.</b>');
|
||||
|
||||
$("#select_type").on("change",function(){
|
||||
var mtValue = $("#select_type").val();
|
||||
var mtText = $('#select_type option[value="'+mtValue+'"]').text();
|
||||
$("#upload_type").text(" " + mtText);
|
||||
Cookies.set('mt_upload', mtValue);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue