aggiunto supporto per local video

This commit is contained in:
Lorenzo Giacomelli
2017-02-16 21:50:53 +01:00
parent c78a9288b4
commit a62e0102ad
5 changed files with 53 additions and 13 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ $currentSystem->apache->user = "var-www";
$currentSystem->apache->group = "var-www";
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
$currentSystem->remoteLocationPath = "http://10.0.0.249/fdn2/";
$currentSystem->remoteLocationPath = "http://localhost/fdn2/";
$backupSystem = new stdClass();
$backupSystem->account = "40a911e14db8ad6faf0a0e7385e7c267";
@@ -13,8 +13,9 @@ class MediaLocalVideo extends MediaRenderer{
$size = $opt["size"];
}
return '<video width="'.$size["width"].'" height="'.$size["height"].'" controls >'.
'<source src="'.$this->getPath().'" type="video/'.$this->extension.'" >'.
$video = $this->getLocalVideoLinkAndType();
return '<video width="300" height="300" controls >'.
'<source src="'.$video["path"].'" type="video/'.$video["extension"].'" >'.
'</video>';
}
@@ -26,5 +27,20 @@ class MediaLocalVideo extends MediaRenderer{
$basepath = GlobalVariables::get("config")->paths->media;
return $basepath."/".$this->id.".".$this->extension;
}
public function getLocalVideoLinkAndType(){
$video = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$this->id));
if (!is_null($video)){
$basepath = GlobalVariables::get("config")->paths->media;
$videoPath= $basepath."/".$video->id.".".$video->extension;
$arr = array();
$arr["path"] = $videoPath;
$arr["extension"] = $video->extension;
return $arr;
}
}
}
?>
+8 -8
View File
@@ -55,10 +55,10 @@ try{
$media = DaoMediaHandler::createNewTextBasedMedia($saveable);
}
else {
$file = $_FILES['data']['tmp_name'];
$info = pathinfo($_FILES['data']['name']);
// $file = PostHandler::get("data");
$media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file,$info["extension"]);
$file = $_FILES['data']['tmp_name'];
$info = pathinfo($_FILES['data']['name']);
$media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file,$info["extension"]);
// var_dump($media);
}
if(!is_null($media)){
@@ -67,18 +67,18 @@ try{
GlobalVariables::get("dao")->save($notizia);
}
else{
throw new Exception("Cannot save a null media in the news with id '".$notiziaId."'");
throw new Exception("Cannot save a null media '".$media."' in the news with id '".$notiziaId."'");
}
}
else{
throw new Exception("Invalid mediaType '".$mediaType."' while trying to add the media in addMultimedia");
}
GUIHandler::redirectPost("admin/homeMultimedia.php",array("id"=>$notiziaId));
// GUIHandler::redirectPost("admin/homeMultimedia.php",array("id"=>$notiziaId));
}
}
$formFile = '<span class="label">Selezionare un file</span><input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
$formFile = '<span class="label">Selezionare un file</span><input type="hidden" name="MAX_FILE_SIZE" value="0" />
<input type="file" name="data"/>';
$formYoutube = '<span class="label">Link</span> <input type="text" name ="data"/>';
@@ -89,7 +89,7 @@ try{
$error = $ex->getMessage();
}catch (Exception $exec){
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_ERROR, $exec->getMessage());
$error = "Si è verificato un errore inaspettato durante l'esecuzione della pagina. Se l'errore persiste contattare il supporto tecnico.";
$error = "Si è verificato un errore inaspettato durante l'esecuzione della pagina. Se l'errore persiste contattare il supporto tecnico.".$exec->getMessage();
}
MenuGenerator::generateMenu();
+3 -2
View File
@@ -53,7 +53,7 @@ try{
$ansa = $notizia->isAnsa;
$delSondaggio = PostHandler::get("deleteSondaggio");
if(!is_null($delSondaggio) && strcmp($delSondaggio, "true")){
if(!is_null($delSondaggio) && strcmp($delSondaggio, "true")==0){
$notizia->sondaggio = null;
GlobalVariables::get("dao")->save($notizia);
}
@@ -82,6 +82,7 @@ try{
}
}
// var_dump($notizia);
MenuGenerator::generateMenu();
HTMLHelper::generateAdminHead();
@@ -218,7 +219,7 @@ try{
});
$("#notiziaMenu_deleteSondaggi").click(function(event){
$("form#notiziaForm").attr("action","homeSondaggi.php");
$("form#notiziaForm").attr("action","homeNotizie.php");
$("form#notiziaForm input[type=hidden][name=deleteSondaggio]").val("true");
$("form#notiziaForm").submit();
+23
View File
@@ -0,0 +1,23 @@
<?php
require_once(dirname(__FILE__)."/load.php");
// $sizes = array(
// "large"=>array("width"=>800,"height"=>600),
// "small"=>array("width"=>160,"height"=>120)
// );
if (array_key_exists("id",$_GET)) {
$video = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$_GET['id']));
if (!is_null($video)){
$basepath = GlobalVariables::get("config")->paths->media;
$videoPath= $basepath."/".$video->id.".".$video->extension;
$arr = array();
$arr["path"] = $videoPath;
$arr["extension"] = $video->extension;
return $arr;
}
}
?>