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() . "/";
|
$importedStorageDir = $storDir->getDirectory() . "imported/" . self::getOwnerId() . "/";
|
||||||
$importedDbPath = "imported/" . self::getOwnerId() . "/";
|
$importedDbPath = "imported/" . self::getOwnerId() . "/";
|
||||||
$artwork = FileDataHelper::saveArtworkData($filePath, $originalFilename, $importedStorageDir, $importedDbPath);
|
$artwork = FileDataHelper::saveArtworkData($filePath, $originalFilename, $importedStorageDir, $importedDbPath);
|
||||||
|
$mediaType = FileDataHelper::saveMediaType();
|
||||||
|
|
||||||
$file->fromArray($fileArray);
|
$file->fromArray($fileArray);
|
||||||
$file->setDbOwnerId(self::getOwnerId());
|
$file->setDbOwnerId(self::getOwnerId());
|
||||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$file->setDbTrackTitle($originalFilename);
|
$file->setDbTrackTitle($originalFilename);
|
||||||
$file->setDbArtwork($artwork);
|
$file->setDbArtwork($artwork);
|
||||||
|
$file->setDbMediaType($mediaType);
|
||||||
$file->setDbUtime($now);
|
$file->setDbUtime($now);
|
||||||
$file->setDbHidden(true);
|
$file->setDbHidden(true);
|
||||||
$file->save();
|
$file->save();
|
||||||
|
|
|
@ -14,8 +14,59 @@
|
||||||
$used = $disk->totalSpace-$disk->totalFreeSpace;
|
$used = $disk->totalSpace-$disk->totalFreeSpace;
|
||||||
$total = $disk->totalSpace;
|
$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">
|
<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">
|
<form action="/rest/media" method="post" id="add-media-dropzone" class="dropzone dz-clickable">
|
||||||
<?php echo $this->form->getElement('csrf') ?>
|
<?php echo $this->form->getElement('csrf') ?>
|
||||||
<div class="dz-message">
|
<div class="dz-message">
|
||||||
|
@ -53,7 +104,7 @@
|
||||||
<input type="radio" name="upload_status" id="upload_status_all" checked /><label for="upload_status_all"><?php echo _("All")?></label>
|
<input type="radio" name="upload_status" id="upload_status_all" checked /><label for="upload_status_all"><?php echo _("All")?></label>
|
||||||
<input type="radio" name="upload_status" id="upload_status_failed" /><label for="upload_status_failed"><?php echo _("Failed")?></label>
|
<input type="radio" name="upload_status" id="upload_status_failed" /><label for="upload_status_failed"><?php echo _("Failed")?></label>
|
||||||
<input type="radio" name="upload_status" id="upload_status_pending" /><label for="upload_status_pending"><?php echo _("Pending")?></label>
|
<input type="radio" name="upload_status" id="upload_status_pending" /><label for="upload_status_pending"><?php echo _("Pending")?></label>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<H2><?php echo _("Recent Uploads")?></H2>
|
<H2><?php echo _("Recent Uploads")?></H2>
|
||||||
<table id="recent_uploads_table" class="datatable lib-content ui-widget ui-widget-content block-shadow"
|
<table id="recent_uploads_table" class="datatable lib-content ui-widget ui-widget-content block-shadow"
|
||||||
|
|
|
@ -640,3 +640,9 @@ table#recent_uploads_table td
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#media_type_selection {
|
||||||
|
position: absolute;
|
||||||
|
right: 2px;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
|
@ -203,4 +203,11 @@ $(document).ready(function () {
|
||||||
self.recentUploadsTable = self.setupRecentUploadsTable();
|
self.recentUploadsTable = self.setupRecentUploadsTable();
|
||||||
|
|
||||||
//$("#recent_uploads_table.div.fg-toolbar").prepend('<b>Custom tool bar! Text/images etc.</b>');
|
//$("#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