resolve conflict

This commit is contained in:
Mike Ng
2018-01-08 15:57:13 +04:00
parent bddc3781ba
commit 30f49bdd35
27 changed files with 564 additions and 467 deletions

View File

@@ -1,4 +1,3 @@
{ {
"directory" : "www/bower_components", "directory": "www/bower_components"
"timeout": 1200000
} }

View File

@@ -68,7 +68,8 @@ class SubdefsController extends Controller
$name = $delete_subef[1]; $name = $delete_subef[1];
$subdefs = $databox->get_subdef_structure(); $subdefs = $databox->get_subdef_structure();
$subdefs->delete_subdef($group, $name); $subdefs->delete_subdef($group, $name);
} elseif (count($add_subdef) === 5) { }
elseif (count($add_subdef) === 5) {
$subdefs = $databox->get_subdef_structure(); $subdefs = $databox->get_subdef_structure();
$group = $add_subdef['group']; $group = $add_subdef['group'];
@@ -87,7 +88,7 @@ class SubdefsController extends Controller
$config = $this->getConfiguration(); $config = $this->getConfiguration();
//On applique directement les valeurs du preset à la sous def //On applique directement les valeurs du preset à la sous def
switch($mediatype) { switch ($mediatype) {
case Subdef::TYPE_IMAGE : case Subdef::TYPE_IMAGE :
$options["path"] = ""; $options["path"] = "";
$options["meta"] = true; $options["meta"] = true;
@@ -98,7 +99,7 @@ class SubdefsController extends Controller
$options[Image::OPTION_FLATTEN] = $config["image"]["definitions"][$preset][Image::OPTION_FLATTEN]; $options[Image::OPTION_FLATTEN] = $config["image"]["definitions"][$preset][Image::OPTION_FLATTEN];
$options[Image::OPTION_QUALITY] = $config["image"]["definitions"][$preset][Image::OPTION_QUALITY]; $options[Image::OPTION_QUALITY] = $config["image"]["definitions"][$preset][Image::OPTION_QUALITY];
$options[Image::OPTION_ICODEC] = $config["image"]["definitions"][$preset][Image::OPTION_ICODEC]; $options[Image::OPTION_ICODEC] = $config["image"]["definitions"][$preset][Image::OPTION_ICODEC];
foreach($config["image"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) { foreach ($config["image"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) {
$options[Subdef::OPTION_DEVICE][] = $devices; $options[Subdef::OPTION_DEVICE][] = $devices;
} }
break; break;
@@ -114,7 +115,7 @@ class SubdefsController extends Controller
$options[Video::OPTION_FRAMERATE] = $config["video"]["definitions"][$preset][Video::OPTION_FRAMERATE]; $options[Video::OPTION_FRAMERATE] = $config["video"]["definitions"][$preset][Video::OPTION_FRAMERATE];
$options[Video::OPTION_VCODEC] = $config["video"]["definitions"][$preset][Video::OPTION_VCODEC]; $options[Video::OPTION_VCODEC] = $config["video"]["definitions"][$preset][Video::OPTION_VCODEC];
$options[Video::OPTION_ACODEC] = $config["video"]["definitions"][$preset][Video::OPTION_ACODEC]; $options[Video::OPTION_ACODEC] = $config["video"]["definitions"][$preset][Video::OPTION_ACODEC];
foreach($config["video"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) { foreach ($config["video"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) {
$options[Subdef::OPTION_DEVICE][] = $devices; $options[Subdef::OPTION_DEVICE][] = $devices;
} }
break; break;
@@ -122,7 +123,7 @@ class SubdefsController extends Controller
$options["path"] = ""; $options["path"] = "";
$options["meta"] = true; $options["meta"] = true;
$options["mediatype"] = $mediatype; $options["mediatype"] = $mediatype;
foreach($config["document"]["definitions"][$preset]["devices"] as $devices) { foreach ($config["document"]["definitions"][$preset]["devices"] as $devices) {
$options["devices"][] = $devices; $options["devices"][] = $devices;
} }
break; break;
@@ -132,7 +133,7 @@ class SubdefsController extends Controller
$options["mediatype"] = $mediatype; $options["mediatype"] = $mediatype;
$options[Gif::OPTION_SIZE] = $config["gif"]["definitions"][$preset][Gif::OPTION_SIZE]; $options[Gif::OPTION_SIZE] = $config["gif"]["definitions"][$preset][Gif::OPTION_SIZE];
$options[Gif::OPTION_DELAY] = $config["gif"]["definitions"][$preset][Gif::OPTION_DELAY]; $options[Gif::OPTION_DELAY] = $config["gif"]["definitions"][$preset][Gif::OPTION_DELAY];
foreach($config["gif"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) { foreach ($config["gif"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) {
$options[Subdef::OPTION_DEVICE][] = $devices; $options[Subdef::OPTION_DEVICE][] = $devices;
} }
break; break;
@@ -143,7 +144,7 @@ class SubdefsController extends Controller
$options[Audio::OPTION_AUDIOBITRATE] = $config["audio"]["definitions"][$preset][Audio::OPTION_AUDIOBITRATE]; $options[Audio::OPTION_AUDIOBITRATE] = $config["audio"]["definitions"][$preset][Audio::OPTION_AUDIOBITRATE];
$options[Audio::OPTION_AUDIOSAMPLERATE] = $config["audio"]["definitions"][$preset][Audio::OPTION_AUDIOSAMPLERATE]; $options[Audio::OPTION_AUDIOSAMPLERATE] = $config["audio"]["definitions"][$preset][Audio::OPTION_AUDIOSAMPLERATE];
$options[Audio::OPTION_ACODEC] = $config["audio"]["definitions"][$preset][Audio::OPTION_ACODEC]; $options[Audio::OPTION_ACODEC] = $config["audio"]["definitions"][$preset][Audio::OPTION_ACODEC];
foreach($config["audio"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) { foreach ($config["audio"]["definitions"][$preset][Subdef::OPTION_DEVICE] as $devices) {
$options[Subdef::OPTION_DEVICE][] = $devices; $options[Subdef::OPTION_DEVICE][] = $devices;
} }
break; break;
@@ -206,13 +207,13 @@ class SubdefsController extends Controller
*/ */
protected function getSubviewsMapping() protected function getSubviewsMapping()
{ {
$mapping = array( $mapping = [
Type::TYPE_IMAGE => array(Subdef::TYPE_IMAGE), Type::TYPE_IMAGE => [Subdef::TYPE_IMAGE],
Type::TYPE_VIDEO => array(Subdef::TYPE_IMAGE, Subdef::TYPE_VIDEO, Subdef::TYPE_ANIMATION), Type::TYPE_VIDEO => [Subdef::TYPE_IMAGE, Subdef::TYPE_VIDEO, Subdef::TYPE_ANIMATION],
Type::TYPE_AUDIO => array(Subdef::TYPE_IMAGE, Subdef::TYPE_AUDIO), Type::TYPE_AUDIO => [Subdef::TYPE_IMAGE, Subdef::TYPE_AUDIO],
Type::TYPE_DOCUMENT => array(Subdef::TYPE_IMAGE, Subdef::TYPE_FLEXPAPER), Type::TYPE_DOCUMENT => [Subdef::TYPE_IMAGE, Subdef::TYPE_FLEXPAPER],
Type::TYPE_FLASH => array(Subdef::TYPE_IMAGE) Type::TYPE_FLASH => [Subdef::TYPE_IMAGE]
); ];
return $mapping; return $mapping;
} }
@@ -222,11 +223,11 @@ class SubdefsController extends Controller
*/ */
protected function getConfiguration() protected function getConfiguration()
{ {
$config = array( $config = [
Subdef::TYPE_IMAGE => array( Subdef::TYPE_IMAGE => [
"definitions" => array( "definitions" => [
"JPG" => null, "JPG" => null,
"160px JPG" => array( "160px JPG" => [
Image::OPTION_SIZE => "160", Image::OPTION_SIZE => "160",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -234,8 +235,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "jpeg", Image::OPTION_ICODEC => "jpeg",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"320 px JPG (thumbnail Phraseanet)" => array( "320 px JPG (thumbnail Phraseanet)" => [
Image::OPTION_SIZE => "320", Image::OPTION_SIZE => "320",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -243,8 +244,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "jpeg", Image::OPTION_ICODEC => "jpeg",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"640px JPG" => array( "640px JPG" => [
Image::OPTION_SIZE => "640", Image::OPTION_SIZE => "640",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -252,8 +253,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "jpeg", Image::OPTION_ICODEC => "jpeg",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"1280px JPG (preview Phraseanet)" => array( "1280px JPG (preview Phraseanet)" => [
Image::OPTION_SIZE => "1280", Image::OPTION_SIZE => "1280",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -261,8 +262,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "jpeg", Image::OPTION_ICODEC => "jpeg",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"2560px JPG" => array( "2560px JPG" => [
Image::OPTION_SIZE => "2560", Image::OPTION_SIZE => "2560",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -270,9 +271,9 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "jpeg", Image::OPTION_ICODEC => "jpeg",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"PNG" => null, "PNG" => null,
"160px PNG 8 bits" => array( "160px PNG 8 bits" => [
Image::OPTION_SIZE => "160", Image::OPTION_SIZE => "160",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -280,8 +281,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "png", Image::OPTION_ICODEC => "png",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"320px PNG 8 bits" => array( "320px PNG 8 bits" => [
Image::OPTION_SIZE => "320", Image::OPTION_SIZE => "320",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -289,8 +290,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "png", Image::OPTION_ICODEC => "png",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"640px PNG 8 bits" => array( "640px PNG 8 bits" => [
Image::OPTION_SIZE => "640", Image::OPTION_SIZE => "640",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -298,8 +299,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "png", Image::OPTION_ICODEC => "png",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"1280px PNG 8 bits" => array( "1280px PNG 8 bits" => [
Image::OPTION_SIZE => "1280", Image::OPTION_SIZE => "1280",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -307,8 +308,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "png", Image::OPTION_ICODEC => "png",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"2560px PNG 8 bits" => array( "2560px PNG 8 bits" => [
Image::OPTION_SIZE => "2560", Image::OPTION_SIZE => "2560",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -316,9 +317,9 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "png", Image::OPTION_ICODEC => "png",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"TIFF" => null, "TIFF" => null,
"1280 TIFF" => array( "1280 TIFF" => [
Image::OPTION_SIZE => "1280", Image::OPTION_SIZE => "1280",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -326,8 +327,8 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "tiff", Image::OPTION_ICODEC => "tiff",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"2560px TIFF" => array( "2560px TIFF" => [
Image::OPTION_SIZE => "2560", Image::OPTION_SIZE => "2560",
Image::OPTION_RESOLUTION => "75", Image::OPTION_RESOLUTION => "75",
Image::OPTION_STRIP => "yes", Image::OPTION_STRIP => "yes",
@@ -335,9 +336,9 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "75", Image::OPTION_QUALITY => "75",
Image::OPTION_ICODEC => "tiff", Image::OPTION_ICODEC => "tiff",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
), ],
"form" => array( "form" => [
Image::OPTION_SIZE => "slide", Image::OPTION_SIZE => "slide",
Image::OPTION_RESOLUTION => "slide", Image::OPTION_RESOLUTION => "slide",
Image::OPTION_STRIP => "radio", Image::OPTION_STRIP => "radio",
@@ -345,12 +346,12 @@ class SubdefsController extends Controller
Image::OPTION_QUALITY => "slide", Image::OPTION_QUALITY => "slide",
Image::OPTION_ICODEC => "select", Image::OPTION_ICODEC => "select",
Subdef::OPTION_DEVICE => "checkbox", Subdef::OPTION_DEVICE => "checkbox",
), ],
), ],
Subdef::TYPE_VIDEO => array( Subdef::TYPE_VIDEO => [
"definitions" => array( "definitions" => [
"video codec H264" => null, "video codec H264" => null,
"144P H264 128 kbps ACC 128kbps" => array( "144P H264 128 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "128", Video::OPTION_BITRATE => "128",
@@ -360,8 +361,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libx264", Video::OPTION_VCODEC => "libx264",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"240P H264 256 kbps ACC 128kbps" => array( "240P H264 256 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "256", Video::OPTION_BITRATE => "256",
@@ -371,8 +372,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libx264", Video::OPTION_VCODEC => "libx264",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"360P H264 576 kbps ACC 128kbps" => array( "360P H264 576 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "576", Video::OPTION_BITRATE => "576",
@@ -382,8 +383,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libtheora", Video::OPTION_VCODEC => "libtheora",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"480P H264 750 kbps ACC 128kbps" => array( "480P H264 750 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "750", Video::OPTION_BITRATE => "750",
@@ -393,8 +394,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libx264", Video::OPTION_VCODEC => "libx264",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"720P H264 1492 kbps ACC 128kbps" => array( "720P H264 1492 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "1492", Video::OPTION_BITRATE => "1492",
@@ -404,8 +405,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libx264", Video::OPTION_VCODEC => "libx264",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"1080P H264 2420 kbps ACC 128kbps" => array( "1080P H264 2420 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "2420", Video::OPTION_BITRATE => "2420",
@@ -415,9 +416,9 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libx264", Video::OPTION_VCODEC => "libx264",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"video codec libvpx" => null, "video codec libvpx" => null,
"144P webm 128 kbps ACC 128kbps" => array( "144P webm 128 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "128", Video::OPTION_BITRATE => "128",
@@ -427,8 +428,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libvpx", Video::OPTION_VCODEC => "libvpx",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"240P webm 256 kbps ACC 128kbps" => array( "240P webm 256 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "256", Video::OPTION_BITRATE => "256",
@@ -438,8 +439,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libvpx", Video::OPTION_VCODEC => "libvpx",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"360P webm 576 kbps ACC 128kbps" => array( "360P webm 576 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "576", Video::OPTION_BITRATE => "576",
@@ -449,8 +450,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libvpx", Video::OPTION_VCODEC => "libvpx",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"480P webm 750 kbps ACC 128kbps" => array( "480P webm 750 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "750", Video::OPTION_BITRATE => "750",
@@ -460,8 +461,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libvpx", Video::OPTION_VCODEC => "libvpx",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"720P webm 1492 kbps ACC 128kbps" => array( "720P webm 1492 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "1492", Video::OPTION_BITRATE => "1492",
@@ -471,8 +472,8 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libvpx", Video::OPTION_VCODEC => "libvpx",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"1080P webm 2420 kbps ACC 128kbps" => array( "1080P webm 2420 kbps ACC 128kbps" => [
Video::OPTION_AUDIOBITRATE => "128", Video::OPTION_AUDIOBITRATE => "128",
Video::OPTION_AUDIOSAMPLERATE => "44100", Video::OPTION_AUDIOSAMPLERATE => "44100",
Video::OPTION_BITRATE => "2420", Video::OPTION_BITRATE => "2420",
@@ -482,9 +483,9 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "libvpx", Video::OPTION_VCODEC => "libvpx",
Video::OPTION_ACODEC => "libfaac", Video::OPTION_ACODEC => "libfaac",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
), ],
"form" => array( "form" => [
Video::OPTION_AUDIOBITRATE => "slide", Video::OPTION_AUDIOBITRATE => "slide",
Video::OPTION_AUDIOSAMPLERATE => "select", Video::OPTION_AUDIOSAMPLERATE => "select",
Video::OPTION_BITRATE => "slide", Video::OPTION_BITRATE => "slide",
@@ -494,66 +495,66 @@ class SubdefsController extends Controller
Video::OPTION_VCODEC => "select", Video::OPTION_VCODEC => "select",
Video::OPTION_ACODEC => "select", Video::OPTION_ACODEC => "select",
Subdef::OPTION_DEVICE => "checkbox", Subdef::OPTION_DEVICE => "checkbox",
), ],
), ],
Subdef::TYPE_ANIMATION => array( Subdef::TYPE_ANIMATION => [
"definitions" => array( "definitions" => [
"256 px fast 200 ms" => array( "256 px fast 200 ms" => [
Gif::OPTION_SIZE => "256", Gif::OPTION_SIZE => "256",
Gif::OPTION_DELAY => "200", Gif::OPTION_DELAY => "200",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"256 px very fast 120 ms" => array( "256 px very fast 120 ms" => [
Gif::OPTION_SIZE => "256", Gif::OPTION_SIZE => "256",
Gif::OPTION_DELAY => "120", Gif::OPTION_DELAY => "120",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"320 px fast 200 ms" => array( "320 px fast 200 ms" => [
Gif::OPTION_SIZE => "320", Gif::OPTION_SIZE => "320",
Gif::OPTION_DELAY => "200", Gif::OPTION_DELAY => "200",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
), ],
"form" => array( "form" => [
Gif::OPTION_SIZE => "slide", Gif::OPTION_SIZE => "slide",
Gif::OPTION_DELAY => "slide", Gif::OPTION_DELAY => "slide",
Subdef::OPTION_DEVICE => "checkbox", Subdef::OPTION_DEVICE => "checkbox",
), ],
), ],
Subdef::TYPE_AUDIO => array( Subdef::TYPE_AUDIO => [
"definitions" => array( "definitions" => [
"Low AAC 96 kbit/s" => array( "Low AAC 96 kbit/s" => [
Audio::OPTION_AUDIOBITRATE => "100", Audio::OPTION_AUDIOBITRATE => "100",
Audio::OPTION_AUDIOSAMPLERATE => "8000", Audio::OPTION_AUDIOSAMPLERATE => "8000",
Audio::OPTION_ACODEC => "libmp3lame", Audio::OPTION_ACODEC => "libmp3lame",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"Normal AAC 128 kbit/s" => array( "Normal AAC 128 kbit/s" => [
Audio::OPTION_AUDIOBITRATE => "180", Audio::OPTION_AUDIOBITRATE => "180",
Audio::OPTION_AUDIOSAMPLERATE => "44100", Audio::OPTION_AUDIOSAMPLERATE => "44100",
Audio::OPTION_ACODEC => "libmp3lame", Audio::OPTION_ACODEC => "libmp3lame",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
"High AAC 320 kbit/s" => array( "High AAC 320 kbit/s" => [
Audio::OPTION_AUDIOBITRATE => "230", Audio::OPTION_AUDIOBITRATE => "230",
Audio::OPTION_AUDIOSAMPLERATE => "50000", Audio::OPTION_AUDIOSAMPLERATE => "50000",
Audio::OPTION_ACODEC => "libmp3lame", Audio::OPTION_ACODEC => "libmp3lame",
Subdef::OPTION_DEVICE => ["all"] Subdef::OPTION_DEVICE => ["all"]
), ],
), ],
"form" => array( "form" => [
Audio::OPTION_AUDIOBITRATE => "slide", Audio::OPTION_AUDIOBITRATE => "slide",
Audio::OPTION_AUDIOSAMPLERATE => "select", Audio::OPTION_AUDIOSAMPLERATE => "select",
Audio::OPTION_ACODEC => "select", Audio::OPTION_ACODEC => "select",
Subdef::OPTION_DEVICE => "checkbox", Subdef::OPTION_DEVICE => "checkbox",
), ],
), ],
Subdef::TYPE_FLEXPAPER => array( Subdef::TYPE_FLEXPAPER => [
"definitions" => array( "definitions" => [
), ],
"form" => array(), "form" => [],
), ],
); ];
return $config; return $config;
} }

View File

@@ -41,7 +41,7 @@ class MoveCollectionController extends Controller
$settings = $this->app['settings']; $settings = $this->app['settings'];
$userOrderSetting = $settings->getUserSetting($this->app->getAuthenticatedUser(), 'order_collection_by'); $userOrderSetting = $settings->getUserSetting($this->app->getAuthenticatedUser(), 'order_collection_by');
// a temporary array to sort the collections // a temporary array to sort the collections
$aName = array(); $aName = [];
list($ukey, $uorder) = ["order", SORT_ASC]; // default ORDER_BY_ADMIN list($ukey, $uorder) = ["order", SORT_ASC]; // default ORDER_BY_ADMIN
switch ($userOrderSetting) { switch ($userOrderSetting) {
case $settings::ORDER_ALPHA_ASC : case $settings::ORDER_ALPHA_ASC :
@@ -52,9 +52,10 @@ class MoveCollectionController extends Controller
break; break;
} }
foreach ($collections as $key => $row) { foreach ($collections as $key => $row) {
if($ukey == "order") { if ($ukey == "order") {
$aName[$key] = $row->get_ord(); $aName[$key] = $row->get_ord();
}else { }
else {
$aName[$key] = $row->get_name(); $aName[$key] = $row->get_name();
} }
} }

View File

@@ -55,7 +55,7 @@ class ShareController extends Controller
$defaultKey = $value; // will set a default option if neither preview,thumbnail or document is present $defaultKey = $value; // will set a default option if neither preview,thumbnail or document is present
if ( ($previewLink = $preview->get_permalink()) !== null ) { if (($previewLink = $preview->get_permalink()) !== null) {
$permalinkUrl = $previewLink->get_url()->__toString(); $permalinkUrl = $previewLink->get_url()->__toString();
$permaviewUrl = $previewLink->get_page(); $permaviewUrl = $previewLink->get_page();
$previewWidth = $preview->get_width(); $previewWidth = $preview->get_width();
@@ -74,7 +74,7 @@ class ShareController extends Controller
} }
// candidates as best default selected option // candidates as best default selected option
foreach(["preview", "thumbnail", "document"] as $k) { foreach (["preview", "thumbnail", "document"] as $k) {
if (array_key_exists($k, $subdefList)) { if (array_key_exists($k, $subdefList)) {
$defaultKey = $k; $defaultKey = $k;
break; break;

View File

@@ -247,7 +247,7 @@ class UploadController extends Controller
$sbasId = $databox->get_sbas_id(); $sbasId = $databox->get_sbas_id();
foreach ($acl->get_granted_base([\ACL::CANADDRECORD], [$sbasId]) as $collection) { foreach ($acl->get_granted_base([\ACL::CANADDRECORD], [$sbasId]) as $collection) {
$databox = $collection->get_databox(); $databox = $collection->get_databox();
if ( ! isset($collections[$sbasId])) { if (!isset($collections[$sbasId])) {
$collections[$databox->get_sbas_id()] = [ $collections[$databox->get_sbas_id()] = [
'databox' => $databox, 'databox' => $databox,
'databox_collections' => [] 'databox_collections' => []

View File

@@ -48,13 +48,13 @@ class Share implements ControllerProviderInterface, ServiceProviderInterface
$controllers->get('/record/{base_id}/{record_id}/', 'controller.prod.share:shareRecord') $controllers->get('/record/{base_id}/{record_id}/', 'controller.prod.share:shareRecord')
->before(function (Request $request) use ($app, $firewall) { ->before(function (Request $request) use ($app, $firewall) {
$socialTools = $app['conf']->get(['registry', 'actions', 'social-tools']); $socialTools = $app['conf']->get(['registry', 'actions', 'social-tools']);
if($socialTools === "all") { if ($socialTools === "all") {
return; return;
} }
elseif($socialTools === "none") { elseif ($socialTools === "none") {
$app->abort(403, 'social tools disabled'); $app->abort(403, 'social tools disabled');
} }
elseif($socialTools === "publishers") { elseif ($socialTools === "publishers") {
$firewall->requireRightOnSbas( $firewall->requireRightOnSbas(
\phrasea::sbasFromBas($app, $request->attributes->get('base_id')), \phrasea::sbasFromBas($app, $request->attributes->get('base_id')),
\ACL::BAS_CHUPUB \ACL::BAS_CHUPUB

View File

@@ -7,9 +7,11 @@
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Alchemy\Phrasea\Core\Configuration; namespace Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
/** /**
* Class StructureTemplate * Class StructureTemplate
* @package Alchemy\Phrasea\Core\Configuration * @package Alchemy\Phrasea\Core\Configuration
@@ -23,6 +25,7 @@ class StructureTemplate
{ {
$this->app = $app; $this->app = $app;
} }
/** /**
* @return $this * @return $this
* @throws \Exception * @throws \Exception
@@ -30,59 +33,72 @@ class StructureTemplate
public function getAvailable() public function getAvailable()
{ {
$templateList = new \DirectoryIterator($this->app['root.path'] . '/lib/conf.d/data_templates'); $templateList = new \DirectoryIterator($this->app['root.path'] . '/lib/conf.d/data_templates');
if(empty($templateList)) throw new \Exception('No available structure template'); if (empty($templateList)) {
throw new \Exception('No available structure template');
}
$templates = []; $templates = [];
$abbreviationLength = 2; $abbreviationLength = 2;
foreach ($templateList as $template) foreach ($templateList as $template) {
{ if ($template->isDot()
if($template->isDot()
|| !$template->isFile() || !$template->isFile()
|| $template->getExtension() !== self::TEMPLATE_EXTENSION) continue; || $template->getExtension() !== self::TEMPLATE_EXTENSION
$name = $template->getFilename(); ) {
$abbreviation = strtolower(substr($name,0,$abbreviationLength)); continue;
if(array_key_exists($abbreviation,$templates) ){
$abbreviation = strtolower(substr($name,0,++$abbreviationLength));
} }
$templates[$abbreviation] = $template->getBasename('.'.self::TEMPLATE_EXTENSION); $name = $template->getFilename();
$abbreviation = strtolower(substr($name, 0, $abbreviationLength));
if (array_key_exists($abbreviation, $templates)) {
$abbreviation = strtolower(substr($name, 0, ++$abbreviationLength));
}
$templates[$abbreviation] = $template->getBasename('.' . self::TEMPLATE_EXTENSION);
} }
$this->templates = $templates; $this->templates = $templates;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function __toString() public function __toString()
{ {
if(!$this->templates){ if (!$this->templates) {
return ''; return '';
} }
$templateToString = ''; $templateToString = '';
$cpt = 1; $cpt = 1;
$templateLength = count($this->templates); $templateLength = count($this->templates);
foreach ($this->templates as $key => $value){ foreach ($this->templates as $key => $value) {
if (($templateLength - 1) == $cpt) { if (($templateLength - 1) == $cpt) {
$separator = ' and '; $separator = ' and ';
}elseif(end($this->templates) == $value){ }
elseif (end($this->templates) == $value) {
$separator = ''; $separator = '';
}else{ }
else {
$separator = ', '; $separator = ', ';
} }
$templateToString .= $key.' ('.$value.')'. $separator; $templateToString .= $key . ' (' . $value . ')' . $separator;
$cpt++; $cpt++;
} }
return $templateToString; return $templateToString;
} }
/** /**
* @param $template * @param $template
* @return mixed * @return mixed
* @throws \Exception * @throws \Exception
*/ */
public function getTemplateName($template = 'en'){ public function getTemplateName($template = 'en')
if(!array_key_exists($template,$this->templates)){ {
throw new \Exception('Not found template : '.$template); if (!array_key_exists($template, $this->templates)) {
throw new \Exception('Not found template : ' . $template);
} }
return $this->templates[$template]; return $this->templates[$template];
} }
/** /**
* @return mixed * @return mixed
*/ */

View File

@@ -16,6 +16,7 @@ class SubdefPreset
* @var array * @var array
*/ */
private $definitions; private $definitions;
/** /**
* @param string $mediaType * @param string $mediaType
* @param array $definitions * @param array $definitions
@@ -23,12 +24,13 @@ class SubdefPreset
public function __construct($mediaType, array $definitions) public function __construct($mediaType, array $definitions)
{ {
foreach ($definitions as $definition) { foreach ($definitions as $definition) {
if (! $definition instanceof Subdef) { if (!$definition instanceof Subdef) {
} }
} }
$this->mediaType = (string) $mediaType; $this->mediaType = (string)$mediaType;
$this->definitions = $definitions; $this->definitions = $definitions;
} }
/** /**
* @return string * @return string
*/ */
@@ -36,6 +38,7 @@ class SubdefPreset
{ {
return $this->label; return $this->label;
} }
/** /**
* @return array * @return array
*/ */

View File

@@ -5,15 +5,17 @@ namespace Alchemy\Phrasea\Databox\Subdef;
class SubdefPresetProvider class SubdefPresetProvider
{ {
private $presets = []; private $presets = [];
/** /**
* @param string $type Type of media for which to get presets * @param string $type Type of media for which to get presets
* @return SubdefPreset[] * @return SubdefPreset[]
*/ */
public function getPresets($type) public function getPresets($type)
{ {
if (! isset($this->presets[$type])) { if (!isset($this->presets[$type])) {
throw new \InvalidArgumentException('Invalid type'); throw new \InvalidArgumentException('Invalid type');
} }
return $this->presets[$type]; return $this->presets[$type];
} }
} }

View File

@@ -57,7 +57,7 @@ class Prod extends Helper
$userOrderSetting = $settings->getUserSetting($this->app->getAuthenticatedUser(), 'order_collection_by'); $userOrderSetting = $settings->getUserSetting($this->app->getAuthenticatedUser(), 'order_collection_by');
// a temporary array to sort the collections // a temporary array to sort the collections
$aName = array(); $aName = [];
list($ukey, $uorder) = ["order", SORT_ASC]; // default ORDER_BY_ADMIN list($ukey, $uorder) = ["order", SORT_ASC]; // default ORDER_BY_ADMIN
switch ($userOrderSetting) { switch ($userOrderSetting) {
case $settings::ORDER_ALPHA_ASC : case $settings::ORDER_ALPHA_ASC :

View File

@@ -12,7 +12,7 @@ main:
port: 3306 port: 3306
user: '{{ mariadb.user }}' user: '{{ mariadb.user }}'
password: '{{ mariadb.password }}' password: '{{ mariadb.password }}'
dbname: '{{ mariadb.appbox_db }}' dbname: '{{ mariadb.appbox_db }}'
driver: pdo_mysql driver: pdo_mysql
charset: UTF8 charset: UTF8
database-test: database-test:

View File

@@ -350,6 +350,7 @@ div.switch_right.unchecked {
right: 40px; right: 40px;
z-index: 1; z-index: 1;
} }
h2.subdefName { h2.subdefName {
display: inline-block; display: inline-block;
margin-right: 1.5rem; margin-right: 1.5rem;
@@ -364,7 +365,7 @@ h2.subdefName {
vertical-align: top; vertical-align: top;
} }
.langTab h3{ .langTab h3 {
font-weight: 700; font-weight: 700;
font-size: 13px; font-size: 13px;
margin: 4px 0; margin: 4px 0;
@@ -372,13 +373,14 @@ h2.subdefName {
text-align: center; text-align: center;
} }
.toggle{ .toggle {
display: block; display: block;
margin: 15px 0; margin: 15px 0;
color: #08c; color: #08c;
cursor: pointer; cursor: pointer;
} }
.subdefTab input, .langTab input{
.subdefTab input, .langTab input {
margin: 0; margin: 0;
} }
@@ -387,6 +389,7 @@ label[for="elasticsearch_settings_highlight"] {
margin-left: 0.5rem; margin-left: 0.5rem;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
input[id="elasticsearch_settings_highlight"] { input[id="elasticsearch_settings_highlight"] {
float: left; float: left;
} }
@@ -394,6 +397,7 @@ input[id="elasticsearch_settings_highlight"] {
#downbutton { #downbutton {
margin: 1rem 0; margin: 1rem 0;
} }
#upbutton { #upbutton {
width: 100%; width: 100%;
text-align: left; text-align: left;
@@ -521,7 +525,7 @@ span.simplecolorpicker.picker {
} }
@media screen and (max-width: 1150px) { @media screen and (max-width: 1150px) {
.langTab{ .langTab {
display: block; display: block;
} }
} }

View File

@@ -16,16 +16,16 @@
<script type="text/javascript" src="/assets/vendors/jquery-ui/jquery-ui{% if not app.debug %}.min{% endif %}.js"></script> <script type="text/javascript" src="/assets/vendors/jquery-ui/jquery-ui{% if not app.debug %}.min{% endif %}.js"></script>
<script type="text/javascript" src="/assets/vendors/jquery-test-paths/jquery.test-paths{% if not app.debug %}.min{% endif %}.js"></script>#} <script type="text/javascript" src="/assets/vendors/jquery-test-paths/jquery.test-paths{% if not app.debug %}.min{% endif %}.js"></script>#}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function () {
$('.path_testable').path_file_test(); $('.path_testable').path_file_test();
$('.url_testable').url_test(); $('.url_testable').url_test();
$('.tabs').tabs({ $('.tabs').tabs({
beforeActivate:function(event, ui){ beforeActivate: function (event, ui) {
$('.path_testable:visible, .url_testable:visible').trigger('keyup'); $('.path_testable:visible, .url_testable:visible').trigger('keyup');
} }
}); });
$(".toggle").on("click", function() { $(".toggle").on("click", function () {
var box = $(this).data("toggle"); var box = $(this).data("toggle");
$(box).toggle("500"); $(box).toggle("500");
}); });
@@ -40,26 +40,26 @@
function fillCheckbox(section, name, defType, fieldname, values) { function fillCheckbox(section, name, defType, fieldname, values) {
$("[name='"+section+"_"+name+"_"+defType+"["+fieldname+"][]']").each(function(){ $("[name='" + section + "_" + name + "_" + defType + "[" + fieldname + "][]']").each(function () {
$(this).removeAttr("checked"); $(this).removeAttr("checked");
for(var key in values){ for (var key in values) {
if($(this).val() == values[key]) if ($(this).val() == values[key])
$(this).prop("checked", "true"); $(this).prop("checked", "true");
} }
}); });
} }
function fillRadio(section, name, defType, fieldname, value) { function fillRadio(section, name, defType, fieldname, value) {
$("[name='"+section+"_"+name+"_"+defType+"["+fieldname+"]'][value='"+value+"']").prop( "checked", true ); $("[name='" + section + "_" + name + "_" + defType + "[" + fieldname + "]'][value='" + value + "']").prop("checked", true);
} }
function fillSelect(section, name, defType, fieldname, value) { function fillSelect(section, name, defType, fieldname, value) {
$("[name='"+section+"_"+name+"_"+defType+"["+fieldname+"]']").val(value) $("[name='" + section + "_" + name + "_" + defType + "[" + fieldname + "]']").val(value)
} }
function fillSlide(section, name, defType, fieldname, value) { function fillSlide(section, name, defType, fieldname, value) {
$("#slider"+section+name+defType+fieldname).slider({value:value}); $("#slider" + section + name + defType + fieldname).slider({value: value});
$("#slidervalue"+section+name+defType+fieldname).val(value); $("#slidervalue" + section + name + defType + fieldname).val(value);
} }
@@ -67,50 +67,49 @@
var config = JSON.parse('{{ config |json_encode|raw }}'), var config = JSON.parse('{{ config |json_encode|raw }}'),
i = 0, i = 0,
defType = $('[name="'+section+'_'+name+'_mediatype"]').val(), defType = $('[name="' + section + '_' + name + '_mediatype"]').val(),
preset = $('[name="'+section+'_'+name+'_presets"]').val(), preset = $('[name="' + section + '_' + name + '_presets"]').val(),
optionValue = $('[name="'+section+'_'+name+'_presets"] option:selected').attr("value"); optionValue = $('[name="' + section + '_' + name + '_presets"] option:selected').attr("value");
if(typeof optionValue === 'undefined'){ if (typeof optionValue === 'undefined') {
return; return;
} }
for (var input in config[defType].form) { for (var input in config[defType].form) {
if(config[defType].form[input] == "slide"){ if (config[defType].form[input] == "slide") {
fillSlide(section, name, defType, input, config[defType].definitions[preset][input]); fillSlide(section, name, defType, input, config[defType].definitions[preset][input]);
} }
if(config[defType].form[input] == "radio"){ if (config[defType].form[input] == "radio") {
fillRadio(section, name, defType, input, config[defType].definitions[preset][input]); fillRadio(section, name, defType, input, config[defType].definitions[preset][input]);
} }
if(config[defType].form[input] == "select"){ if (config[defType].form[input] == "select") {
fillSelect(section, name, defType, input, config[defType].definitions[preset][input]); fillSelect(section, name, defType, input, config[defType].definitions[preset][input]);
} }
if(config[defType].form[input] == "checkbox"){ if (config[defType].form[input] == "checkbox") {
fillCheckbox(section, name, defType, input, config[defType].definitions[preset][input]); fillCheckbox(section, name, defType, input, config[defType].definitions[preset][input]);
} }
i++; i++;
} }
} }
function select_mediatype(type, name, selector) function select_mediatype(type, name, selector) {
{
var config = JSON.parse('{{ config |json_encode|raw }}'), var config = JSON.parse('{{ config |json_encode|raw }}'),
inputPresets = '[name="'+type+'_'+name+'_presets"]', inputPresets = '[name="' + type + '_' + name + '_presets"]',
defType = $(selector).val(); defType = $(selector).val();
$('.'+type+name).hide(); $('.' + type + name).hide();
$('[data-toggle^="#box'+type+name+'"]').hide(); $('[data-toggle^="#box' + type + name + '"]').hide();
$('[data-toggle="#box'+type+name+defType+'"]').show(); $('[data-toggle="#box' + type + name + defType + '"]').show();
$('#box'+type+name+$(selector).val()).show(); $('#box' + type + name + $(selector).val()).show();
if(defType == 'flexpaper'){ if (defType == 'flexpaper') {
$(inputPresets).closest("tr").hide(); $(inputPresets).closest("tr").hide();
return; return;
}else{ } else {
$(inputPresets).closest("tr").show(); $(inputPresets).closest("tr").show();
} }
@@ -120,18 +119,18 @@
.end() .end()
.append($("<option value='custom'></option>").text('{{ 'Custom' | trans }}')); .append($("<option value='custom'></option>").text('{{ 'Custom' | trans }}'));
if(typeof config[defType] === 'undefined'){ if (typeof config[defType] === 'undefined') {
return; return;
} }
for (var key in config[defType].definitions) { for (var key in config[defType].definitions) {
if (config[defType].definitions[key] == null){ if (config[defType].definitions[key] == null) {
$(inputPresets).append($("<option></option>") $(inputPresets).append($("<option></option>")
.attr("disabled", "disabled") .attr("disabled", "disabled")
.text(key) .text(key)
); );
}else{ } else {
$(inputPresets).append($("<option></option>") $(inputPresets).append($("<option></option>")
.attr("value", key) .attr("value", key)
.text(key) .text(key)
@@ -158,7 +157,7 @@
} }
} }
function media_type(selector){ function media_type(selector) {
var config = JSON.parse('{{ config |json_encode|raw }}'), var config = JSON.parse('{{ config |json_encode|raw }}'),
defType = $(selector).val(); defType = $(selector).val();
@@ -168,18 +167,18 @@
.end() .end()
.append($("<option></option>").text('{{ 'Choisir' | trans }}')); .append($("<option></option>").text('{{ 'Choisir' | trans }}'));
if(typeof config[defType] === 'undefined'){ if (typeof config[defType] === 'undefined') {
return; return;
} }
for (var key in config[defType].definitions) { for (var key in config[defType].definitions) {
if (config[defType].definitions[key] == null){ if (config[defType].definitions[key] == null) {
$("#presets").append($("<option></option>") $("#presets").append($("<option></option>")
.attr("disabled", "disabled") .attr("disabled", "disabled")
.text(key) .text(key)
); );
}else{ } else {
$("#presets").append($('<option></option>') $("#presets").append($('<option></option>')
.attr("value", key) .attr("value", key)
.text(key) .text(key)
@@ -188,28 +187,29 @@
} }
} }
$(function() { $(function () {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore! // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog:ui-dialog" ).dialog( "destroy" ); $("#dialog:ui-dialog").dialog("destroy");
var name = $( "#name" ), accessclass = $( "#accessclass" ), subviewType =$( "#subviewType" ) , mediaType = $( "#mediaType" ), presets = $( "#presets" ), var name = $("#name"), accessclass = $("#accessclass"), subviewType = $("#subviewType"),
allFields = $( [] ).add( name ).add(accessclass).add(subviewType).add(mediaType).add(presets), mediaType = $("#mediaType"), presets = $("#presets"),
tips = $( ".validateTips" ); allFields = $([]).add(name).add(accessclass).add(subviewType).add(mediaType).add(presets),
tips = $(".validateTips");
function updateTips( t ) { function updateTips(t) {
tips tips
.text( t ) .text(t)
.addClass( "ui-state-highlight" ); .addClass("ui-state-highlight");
setTimeout(function() { setTimeout(function () {
tips.removeClass( "ui-state-highlight", 1500 ); tips.removeClass("ui-state-highlight", 1500);
}, 500 ); }, 500);
} }
function checkLength( o, n, min, max ) { function checkLength(o, n, min, max) {
if ( o.val().length > max || o.val().length < min ) { if (o.val().length > max || o.val().length < min) {
o.addClass( "ui-state-error" ); o.addClass("ui-state-error");
updateTips( "Length of " + n + " must be between " + updateTips("Length of " + n + " must be between " +
min + " and " + max + "." ); min + " and " + max + ".");
return false; return false;
} else { } else {
@@ -217,12 +217,12 @@
} }
} }
function checkPresence( mediaType, o ) { function checkPresence(mediaType, o) {
var el = $('input[name="subdefs[]"][value="'+mediaType+'_'+o.val()+'"]'); var el = $('input[name="subdefs[]"][value="' + mediaType + '_' + o.val() + '"]');
if ( el.length !== 0 ) { if (el.length !== 0) {
o.addClass( "ui-state-error" ); o.addClass("ui-state-error");
updateTips( "SubdefName should be unique per group" ); updateTips("SubdefName should be unique per group");
return false; return false;
} else { } else {
@@ -230,84 +230,81 @@
} }
} }
function checkSpecialChar( o ) function checkSpecialChar(o) {
{
var ok = true; var ok = true;
var reg = new RegExp("[A-Za-z0-9-]+","g"); var reg = new RegExp("[A-Za-z0-9-]+", "g");
if(o.val().match(reg)[0].length !== o.val().length) if (o.val().match(reg)[0].length !== o.val().length) {
{
ok = false; ok = false;
o.addClass( "ui-state-error" ); o.addClass("ui-state-error");
updateTips( "Special characters (except minus) or espaces are not authorized" ); updateTips("Special characters (except minus) or espaces are not authorized");
} }
return ok; return ok;
} }
$( "#dialog-form" ).dialog({ $("#dialog-form").dialog({
autoOpen: false, autoOpen: false,
height: 420, height: 420,
width: 300, width: 300,
modal: true, modal: true,
buttons: { buttons: {
"Create a Subdef": function() { "Create a Subdef": function () {
var bValid = true; var bValid = true;
allFields.removeClass( "ui-state-error" ); allFields.removeClass("ui-state-error");
bValid = bValid && checkLength( name, "subdef name", 3, 16 ); bValid = bValid && checkLength(name, "subdef name", 3, 16);
bValid = bValid && checkSpecialChar( name ); bValid = bValid && checkSpecialChar(name);
bValid = bValid && checkPresence( subviewType.val(), name ); bValid = bValid && checkPresence(subviewType.val(), name);
if ( bValid ) { if (bValid) {
$('input[name="add_subdef[group]"]').val(subviewType.val()); $('input[name="add_subdef[group]"]').val(subviewType.val());
$('input[name="add_subdef[name]"]').val(name.val()); $('input[name="add_subdef[name]"]').val(name.val());
$('input[name="add_subdef[mediaType]"]').val(mediaType.val()); $('input[name="add_subdef[mediaType]"]').val(mediaType.val());
$('input[name="add_subdef[class]"]').val(accessclass.val()); $('input[name="add_subdef[class]"]').val(accessclass.val());
$('input[name="add_subdef[presets]"]').val(presets.val()); $('input[name="add_subdef[presets]"]').val(presets.val());
$( this ).dialog( "close" ); $(this).dialog("close");
$('form.subdefs').submit(); $('form.subdefs').submit();
} }
}, },
Cancel: function() { Cancel: function () {
$( this ).dialog( "close" ); $(this).dialog("close");
} }
}, },
close: function() { close: function () {
allFields.val( "" ).removeClass( "ui-state-error" ); allFields.val("").removeClass("ui-state-error");
} }
}); });
$( "#create-subdef" ) $("#create-subdef")
// .button() // .button()
.click(function() { .click(function () {
$( "#dialog-form" ).dialog( "open" ); $("#dialog-form").dialog("open");
}); });
$('.subdef_deleter') $('.subdef_deleter')
// .button() // .button()
.click(function(){ .click(function () {
delete_subdef($(this).next('input[name="subdef"]').val()); delete_subdef($(this).next('input[name="subdef"]').val());
return false; return false;
}); });
function delete_subdef(name) function delete_subdef(name) {
{ $("#dialog-delete-subdef").dialog({
$( "#dialog-delete-subdef" ).dialog({
resizable: false, resizable: false,
height:140, height: 140,
modal: true, modal: true,
buttons: { buttons: {
"Delete subdef": function() { "Delete subdef": function () {
$('#delete_subdef').val(name); $('#delete_subdef').val(name);
$( this ).dialog( "destroy" ); $(this).dialog("destroy");
$('form.subdefs').submit(); $('form.subdefs').submit();
}, },
Cancel: function() { Cancel: function () {
$( this ).dialog( "destroy" ); $(this).dialog("destroy");
} }
} }
}); });
@@ -363,32 +360,41 @@
</form> </form>
</div> </div>
<form method="post" action="{{ path('admin_subdefs_subdef_update', { 'sbas_id' : databox.get_sbas_id }) }}" target="_self" class="subdefs"> <form method="post" action="{{ path('admin_subdefs_subdef_update', { 'sbas_id' : databox.get_sbas_id }) }}"
target="_self" class="subdefs">
<div class="tabs"> <div class="tabs">
<ul> <ul>
{% for subdefgroup, subdeflist in subdefs %} {% for subdefgroup, subdeflist in subdefs %}
<li><a class="no-ajax" href="#{{subdefgroup}}">{{subdefgroup}}</a></li> <li><a class="no-ajax" href="#{{ subdefgroup }}">{{ subdefgroup }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
<button type="submit" disabled="disabled" class="btn btn-primary subviews-submit">{{ 'boutton::valider' | trans }}</button> <button type="submit" disabled="disabled"
class="btn btn-primary subviews-submit">{{ 'boutton::valider' | trans }}</button>
{% for subdefgroup, subdeflist in subdefs %} {% for subdefgroup, subdeflist in subdefs %}
<div id="{{subdefgroup}}"> <div id="{{ subdefgroup }}">
{% for subdefname , subdef in subdeflist %} {% for subdefname , subdef in subdeflist %}
<div> <div>
<input type="hidden" name="subdefs[]" value="{{subdefgroup}}_{{subdefname}}"/> <input type="hidden" name="subdefs[]" value="{{ subdefgroup }}_{{ subdefname }}"/>
<h2 class="subdefName">{{subdefname}}</h2><button class="subdef_deleter btn btn-danger btn-mini">{{ 'boutton::supprimer' | trans }}</button> <h2 class="subdefName">{{ subdefname }}</h2>
<input type="hidden" name="subdef" value="{{subdefgroup}}_{{subdefname}}"/> <button class="subdef_deleter btn btn-danger btn-mini">{{ 'boutton::supprimer' | trans }}</button>
<br /> <input type="hidden" name="subdef" value="{{ subdefgroup }}_{{ subdefname }}"/>
<table class="subdefTab" cellspacing="0" cellpading="0" border="0" style="display:inline-block;"> <br/>
<table class="subdefTab" cellspacing="0" cellpading="0" border="0"
style="display:inline-block;">
<tbody> <tbody>
<tr> <tr>
<td style="width:100px;line-height: 0.9rem;">{{ 'Telechargeable' | trans }}</td> <td style="width:100px;line-height: 0.9rem;">{{ 'Telechargeable' | trans }}</td>
<td style="width:300px;"><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_downloadable" {% if subdef.isDownloadable() %}checked="checked"{% endif %} value="1" /></td> <td style="width:300px;"><input type="checkbox"
name="{{ subdefgroup }}_{{ subdefname }}_downloadable"
{% if subdef.isDownloadable() %}checked="checked"{% endif %}
value="1"/></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>{{ 'subdef.orderable' | trans }}</td> <td>{{ 'subdef.orderable' | trans }}</td>
<td><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_orderable" {% if subdef.isOrderable() %}checked="checked"{% endif %} value="1" /></td> <td><input type="checkbox" name="{{ subdefgroup }}_{{ subdefname }}_orderable"
{% if subdef.isOrderable() %}checked="checked"{% endif %} value="1"/>
</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
@@ -396,11 +402,14 @@
{{ 'classe' | trans }} {{ 'classe' | trans }}
</td> </td>
<td> <td>
<select name="{{subdefgroup}}_{{subdefname}}_class"> <select name="{{ subdefgroup }}_{{ subdefname }}_class">
<option>{{ 'classe' | trans }}</option> <option>{{ 'classe' | trans }}</option>
<option value="document" {% if subdef.get_class() == "document" %}selected="selected"{% endif %}>{{ 'document' | trans }}</option> <option value="document"
<option value="preview" {% if subdef.get_class() == "preview" %}selected="selected"{% endif %}>{{ 'preview' | trans }}</option> {% if subdef.get_class() == "document" %}selected="selected"{% endif %}>{{ 'document' | trans }}</option>
<option value="thumbnail" {% if subdef.get_class() == "thumbnail" %}selected="selected"{% endif %}>{{ 'tout le monde' | trans }}</option> <option value="preview"
{% if subdef.get_class() == "preview" %}selected="selected"{% endif %}>{{ 'preview' | trans }}</option>
<option value="thumbnail"
{% if subdef.get_class() == "thumbnail" %}selected="selected"{% endif %}>{{ 'tout le monde' | trans }}</option>
</select> </select>
</td> </td>
<td></td> <td></td>
@@ -410,10 +419,12 @@
{{ 'mediatype' | trans }} {{ 'mediatype' | trans }}
</td> </td>
<td> <td>
<select onchange="select_mediatype('{{subdefgroup}}', '{{subdefname}}', this);" name="{{subdefgroup}}_{{subdefname}}_mediatype"> <select onchange="select_mediatype('{{ subdefgroup }}', '{{ subdefname }}', this);"
name="{{ subdefgroup }}_{{ subdefname }}_mediatype">
<option>{{ 'Choisir' | trans }}</option> <option>{{ 'Choisir' | trans }}</option>
{% for subdefType in subdef.getAvailableSubdefTypes() %} {% for subdefType in subdef.getAvailableSubdefTypes() %}
<option value="{{ subdefType.getType() }}" {% if subdef.getSubdefType.getType() == subdefType.getType() %}selected="selected"{% endif %}>{{ subdefType.getType() }}</option> <option value="{{ subdefType.getType() }}"
{% if subdef.getSubdefType.getType() == subdefType.getType() %}selected="selected"{% endif %}>{{ subdefType.getType() }}</option>
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
@@ -424,14 +435,16 @@
{{ 'Presets' | trans }} {{ 'Presets' | trans }}
</td> </td>
<td> <td>
<select onchange="populate_values('{{subdefgroup}}', '{{subdefname}}');" name="{{subdefgroup}}_{{subdefname}}_presets"> <select onchange="populate_values('{{ subdefgroup }}', '{{ subdefname }}');"
name="{{ subdefgroup }}_{{ subdefname }}_presets">
<option value="custom">{{ 'Custom' | trans }}</option> <option value="custom">{{ 'Custom' | trans }}</option>
{% set defType = subdef.getSubdefType.getType() %} {% set defType = subdef.getSubdefType.getType() %}
{% for key, pressets in config[defType].definitions %} {% for key, pressets in config[defType].definitions %}
{% if pressets == null %} {% if pressets == null %}
<option disabled="disabled">{{ key }}</option> <option disabled="disabled">{{ key }}</option>
{% else %} {% else %}
<option value="{{ key }}" {% if subdef.get_preset() == key %}selected="selected"{% endif %}>{{ key }}</option> <option value="{{ key }}"
{% if subdef.get_preset() == key %}selected="selected"{% endif %}>{{ key }}</option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>
@@ -443,7 +456,9 @@
Path Path
</td> </td>
<td> <td>
<input class="path_testable test_writeable" type="text" value="{{subdef.get_path()}}" name="{{subdefgroup}}_{{subdefname}}_path"/> <input class="path_testable test_writeable" type="text"
value="{{ subdef.get_path() }}"
name="{{ subdefgroup }}_{{ subdefname }}_path"/>
</td> </td>
<td></td> <td></td>
</tr> </tr>
@@ -452,7 +467,9 @@
{{ 'Write Metas' | trans }} {{ 'Write Metas' | trans }}
</td> </td>
<td> <td>
<input type="checkbox" value="yes" {% if subdef.isMetadataUpdateRequired() %}checked="checked"{% endif %} name="{{subdefgroup}}_{{subdefname}}_meta"/> <input type="checkbox" value="yes"
{% if subdef.isMetadataUpdateRequired() %}checked="checked"{% endif %}
name="{{ subdefgroup }}_{{ subdefname }}_meta"/>
</td> </td>
<td></td> <td></td>
</tr> </tr>
@@ -465,38 +482,46 @@
{% for code, language in app['locales.available'] %} {% for code, language in app['locales.available'] %}
<tr> <tr>
<td style="width:100px;">{{ language }}</td> <td style="width:100px;">{{ language }}</td>
<td style="width:300px;"><input type="text" name="{{subdefgroup}}_{{subdefname}}_label[{{ code }}]" value="{{ subdef.get_label(code, false) }}" /></td> <td style="width:300px;"><input type="text"
name="{{ subdefgroup }}_{{ subdefname }}_label[{{ code }}]"
value="{{ subdef.get_label(code, false) }}"/>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% for subdefType in subdef.getAvailableSubdefTypes() %} {% for subdefType in subdef.getAvailableSubdefTypes() %}
<span class="toggle" data-toggle="#box{{subdefgroup}}{{subdefname}}{{ subdefType.getType() }}" {% if subdef.getSubdefType.getType() != subdefType.getType() %}style="display:none;"{% endif %}> <span class="toggle"
data-toggle="#box{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}"
{% if subdef.getSubdefType.getType() != subdefType.getType() %}style="display:none;"{% endif %}>
{{ 'Advanced settings' | trans }} {{ 'Advanced settings' | trans }}
</span> </span>
<div id="box{{subdefgroup}}{{subdefname}}{{ subdefType.getType() }}" class="{{subdefgroup}}{{subdefname}}" {% if subdef.getSubdefType.getType() != subdefType.getType() %}style="display:none;"{% endif %}> <div id="box{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}"
class="{{ subdefgroup }}{{ subdefname }}"
{% if subdef.getSubdefType.getType() != subdefType.getType() %}style="display:none;"{% endif %}>
<table cellspacing="0" cellpading="0" border="0" style="width:500px;"> <table cellspacing="0" cellpading="0" border="0" style="width:500px;">
{% for option in subdefType.getOptions() %} {% for option in subdefType.getOptions() %}
{% set varname = subdefgroup~'_'~subdefname~'_'~subdefType.getType()~'['~ option.getName() ~']' %} {% set varname = subdefgroup~'_'~subdefname~'_'~subdefType.getType()~'['~ option.getName() ~']' %}
<tr> <tr>
<td style="width:120px;"> <td style="width:120px;">
{{option.getDisplayName()}} {{ option.getDisplayName() }}
</td> </td>
<td style="width:250px;"> <td style="width:250px;">
{% set extradata = '' %} {% set extradata = '' %}
{% if option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_RANGE') %} {% if option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_RANGE') %}
<div style="width:250px;" id="slider{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}"></div> <div style="width:250px;"
id="slider{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}{{ option.getName() }}"></div>
<script type="text/javascript"> <script type="text/javascript">
$('#slider{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}') $('#slider{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}{{ option.getName() }}')
.slider({ .slider({
value:{{ option.getValue }}, value:{{ option.getValue }},
min: {{ option.getMinValue() }}, min: {{ option.getMinValue() }},
max: {{ option.getMaxValue() }}, max: {{ option.getMaxValue() }},
{% if option.getStep() is not empty %}step : {{ option.getStep() }},{% endif %} {% if option.getStep() is not empty %}step: {{ option.getStep() }},{% endif %}
slide: function( event, ui ) { slide: function (event, ui) {
$( "#slidervalue{{subdefgroup}}{{subdefname}}{{ subdefType.getType() }}{{ option.getName() }}" ).val( ui.value ); $("#slidervalue{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}{{ option.getName() }}").val(ui.value);
jQuery('[name={{subdefgroup}}_{{subdefname}}_presets]').val("custom"); jQuery('[name={{ subdefgroup }}_{{ subdefname }}_presets]').val("custom");
if(jQuery(".subviews-submit").attr("disabled")) if (jQuery(".subviews-submit").attr("disabled"))
activeSubmit(); activeSubmit();
}, },
create: function (event, ui) { create: function (event, ui) {
@@ -505,33 +530,40 @@
} }
}); });
$('#slidervalue{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}').on('change', function(){ $('#slidervalue{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}{{ option.getName() }}').on('change', function () {
var $this = $(this); var $this = $(this);
$('#slider{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}').slider( "option", "value", $this.val() ); $('#slider{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}{{ option.getName() }}').slider("option", "value", $this.val());
}) })
</script> </script>
{% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_ENUM') %} {% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_ENUM') %}
<select name="{{varname}}"> <select name="{{ varname }}">
<option value="">{{ 'Choisir' | trans }}</option> <option value="">{{ 'Choisir' | trans }}</option>
{% for pot_value in option.getAvailableValues() %} {% for pot_value in option.getAvailableValues() %}
<option value="{{ pot_value }}" {% if pot_value == option.getValue() %}selected="selected"{% endif %}>{{ pot_value }}</option> <option value="{{ pot_value }}"
{% if pot_value == option.getValue() %}selected="selected"{% endif %}>{{ pot_value }}</option>
{% endfor %} {% endfor %}
</select> </select>
{% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_BOOLEAN') %} {% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_BOOLEAN') %}
<input name="{{varname}}" type="radio" value="yes" {% if option.getValue() %}checked="checked"{% endif %} /> {{ 'yes' | trans }} <input name="{{ varname }}" type="radio" value="yes"
<input name="{{varname}}" type="radio" value="no" {% if option.getValue() is empty %}checked="checked"{% endif %}/> {{ 'no' | trans }} {% if option.getValue() %}checked="checked"{% endif %} /> {{ 'yes' | trans }}
<input name="{{ varname }}" type="radio" value="no"
{% if option.getValue() is empty %}checked="checked"{% endif %}/> {{ 'no' | trans }}
{% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_MULTI') %} {% elseif option.getType() == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_MULTI') %}
{% for pot_value, selected in option.Value(true) %} {% for pot_value, selected in option.Value(true) %}
<label class="checkbox inline"> <label class="checkbox inline">
<input type="checkbox" name="{{varname}}[]" value="{{ pot_value }}" {% if selected %}checked="checked"{% endif %}/>{{ pot_value }} <input type="checkbox" name="{{ varname }}[]"
value="{{ pot_value }}"
{% if selected %}checked="checked"{% endif %}/>{{ pot_value }}
</label> </label>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if option.type == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_RANGE') %} {% if option.type == constant('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType::TYPE_RANGE') %}
<input style="width:35px;" value="{{option.value}}" id="slidervalue{{subdefgroup}}{{subdefname}}{{subdefType.getType()}}{{ option.getName() }}" name="{{varname}}" /> <input style="width:35px;" value="{{ option.value }}"
id="slidervalue{{ subdefgroup }}{{ subdefname }}{{ subdefType.getType() }}{{ option.getName() }}"
name="{{ varname }}"/>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
@@ -542,8 +574,8 @@
</div> </div>
<script> <script>
{% set defType = subdef.getSubdefType.getType() %} {% set defType = subdef.getSubdefType.getType() %}
jQuery('#box{{subdefgroup}}{{subdefname}}{{ defType }} input, #box{{subdefgroup}}{{subdefname}}{{ defType }} select').change(function(){ jQuery('#box{{ subdefgroup }}{{ subdefname }}{{ defType }} input, #box{{ subdefgroup }}{{ subdefname }}{{ defType }} select').change(function () {
jQuery('[name={{subdefgroup}}_{{subdefname}}_presets]').val("custom"); jQuery('[name={{ subdefgroup }}_{{ subdefname }}_presets]').val("custom");
}); });
</script> </script>
{% endfor %} {% endfor %}

View File

@@ -138,7 +138,8 @@
<a target="_blank" href="https://docs.phraseanet.com/4.0/"> <a target="_blank" href="https://docs.phraseanet.com/4.0/">
<span> <span>
{{ 'phraseanet:: aide' | trans }} {{ 'phraseanet:: aide' | trans }}
<span style="display:inline-block;cursor:pointer;padding:0;border:none;padding-right:4px;padding-left:4px;" id="help-trigger"> <i class="icon-caret-down"></i></span> <span style="display:inline-block;cursor:pointer;padding:0;border:none;padding-right:4px;padding-left:4px;"
id="help-trigger"> <i class="icon-caret-down"></i></span>
</span> </span>
</a> </a>
<table cellspacing="0" cellpadding="0" style="display:none;" class="contextMenu helpcontextmenu"> <table cellspacing="0" cellpadding="0" style="display:none;" class="contextMenu helpcontextmenu">

View File

@@ -31,8 +31,10 @@
<input type="hidden" name="id" value="{{ element.getId() }}"/> <input type="hidden" name="id" value="{{ element.getId() }}"/>
<input type="hidden" name="title" value="{{ element.getRecord(app).get_title() }}"/> <input type="hidden" name="title" value="{{ element.getRecord(app).get_title() }}"/>
<input type="hidden" name="default" value="{{ element.getOrd() }}"/> <input type="hidden" name="default" value="{{ element.getOrd() }}"/>
<input type="hidden" name="date_created" value="{{ element.getRecord(app).getCreated() | date('Y-m-dTH:i:s') }}"/> <input type="hidden" name="date_created"
<input type="hidden" name="date_updated" value="{{ element.getRecord(app).getUpdated() | date('Y-m-dTH:i:s') }}"/> value="{{ element.getRecord(app).getCreated() | date('Y-m-dTH:i:s') }}"/>
<input type="hidden" name="date_updated"
value="{{ element.getRecord(app).getUpdated() | date('Y-m-dTH:i:s') }}"/>
</form> </form>
</div> </div>
{% endfor %} {% endfor %}

View File

@@ -17,14 +17,18 @@
</span> </span>
</p> </p>
<p> <p>
<a id="twitter-link" href="http://www.twitter.com/home/?status={{ subdefList[defKey].permaviewUrl }}" target="_blank"> <a id="twitter-link" href="http://www.twitter.com/home/?status={{ subdefList[defKey].permaviewUrl }}"
<img src="/assets/common/images/icons/twitter.png" title="share this on twitter" style="width:25px;vertical-align:middle;padding:0 5px;"/> target="_blank">
<img src="/assets/common/images/icons/twitter.png" title="share this on twitter"
style="width:25px;vertical-align:middle;padding:0 5px;"/>
{% trans %}Send to Twitter{% endtrans %} {% trans %}Send to Twitter{% endtrans %}
</a> </a>
</p> </p>
<p> <p>
<a id="facebook-link" href="http://www.facebook.com/sharer.php?u={{ subdefList[defKey].permaviewUrl }}" target="_blank"> <a id="facebook-link" href="http://www.facebook.com/sharer.php?u={{ subdefList[defKey].permaviewUrl }}"
<img src="/assets/common/images/icons/facebook.png" title="share on facebook" style="width:25px;vertical-align:middle;padding:0 5px;"/> target="_blank">
<img src="/assets/common/images/icons/facebook.png" title="share on facebook"
style="width:25px;vertical-align:middle;padding:0 5px;"/>
{% trans %}Send to Facebook{% endtrans %} {% trans %}Send to Facebook{% endtrans %}
</a> </a>
</p> </p>
@@ -32,19 +36,23 @@
<form action="#"> <form action="#">
<div class="form-group clearfix"> <div class="form-group clearfix">
<label style="display:inline-block;">{% trans %}Resource URL{% endtrans %}</label> <label style="display:inline-block;">{% trans %}Resource URL{% endtrans %}</label>
<input class="input-block-level" readonly="readonly" type="text" value="{{ subdefList[defKey].permalinkUrl }}" <input class="input-block-level" readonly="readonly" type="text"
value="{{ subdefList[defKey].permalinkUrl }}"
id="permalinkUrl"/> id="permalinkUrl"/>
<p class="pull-right"> <p class="pull-right">
<a id="permalinkUrl-link" href="{{ subdefList[defKey].permalinkUrl }}" target="_blank">{{ 'previewLinkLabel' | trans }}</a> &nbsp;&nbsp; <a id="permalinkUrl-link" href="{{ subdefList[defKey].permalinkUrl }}"
target="_blank">{{ 'previewLinkLabel' | trans }}</a> &nbsp;&nbsp;
<a href="#" class="" id="permalinkUrlCopy">{{ 'copyClipboardLabel' | trans }}</a> <a href="#" class="" id="permalinkUrlCopy">{{ 'copyClipboardLabel' | trans }}</a>
</p> </p>
</div> </div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label>{% trans %}Detailed view URL{% endtrans %}</label> <label>{% trans %}Detailed view URL{% endtrans %}</label>
<input class="input-block-level" readonly="readonly" type="text" value="{{ subdefList[defKey].permaviewUrl }}" id="permaviewUrl"/> <input class="input-block-level" readonly="readonly" type="text"
value="{{ subdefList[defKey].permaviewUrl }}" id="permaviewUrl"/>
<p class="pull-right"> <p class="pull-right">
<a id="permaviewUrl-link" href="{{ subdefList[defKey].permaviewUrl }}" target="_blank">{{ 'previewLinkLabel' | trans }}</a> &nbsp;&nbsp; <a id="permaviewUrl-link" href="{{ subdefList[defKey].permaviewUrl }}"
target="_blank">{{ 'previewLinkLabel' | trans }}</a> &nbsp;&nbsp;
<a href="#" class="" id="permaviewUrlCopy">{{ 'copyClipboardLabel' | trans }}</a> <a href="#" class="" id="permaviewUrlCopy">{{ 'copyClipboardLabel' | trans }}</a>
</p> </p>
</div> </div>
@@ -53,11 +61,14 @@
<label>{% trans %}Embed code{% endtrans %}</label> <label>{% trans %}Embed code{% endtrans %}</label>
{% spaceless %} {% spaceless %}
<textarea class="input-block-level" rows="4" readonly="true" id="embedRecordUrl"> <textarea class="input-block-level" rows="4" readonly="true" id="embedRecordUrl">
<iframe width="{{ subdefList[defKey].width }}" height="{{ subdefList[defKey].height }}" src="{{ subdefList[defKey].embedUrl }}" frameborder="0" allowfullscreen></iframe> <iframe width="{{ subdefList[defKey].width }}" height="{{ subdefList[defKey].height }}"
src="{{ subdefList[defKey].embedUrl }}" frameborder="0"
allowfullscreen></iframe>
</textarea> </textarea>
{% endspaceless %} {% endspaceless %}
<p class="pull-right"> <p class="pull-right">
<a id="embedRecordUrl-link" href="{{ subdefList[defKey].embedUrl }}" target="_blank">{{ 'previewLinkLabel' | trans }}</a> &nbsp;&nbsp; <a id="embedRecordUrl-link" href="{{ subdefList[defKey].embedUrl }}"
target="_blank">{{ 'previewLinkLabel' | trans }}</a> &nbsp;&nbsp;
<a href="#" class="" id="embedCopy">{{ 'copyClipboardLabel' | trans }}</a> <a href="#" class="" id="embedCopy">{{ 'copyClipboardLabel' | trans }}</a>
</p> </p>
</div> </div>
@@ -67,31 +78,35 @@
<script language="javascript"> <script language="javascript">
// var subdefListObj = JSON.parse(subdefList); // to convert json into a javascript object // var subdefListObj = JSON.parse(subdefList); // to convert json into a javascript object
$(document).ready(function(){ $(document).ready(function () {
var subdefList = JSON.parse('{{ subdefList | json_encode | escape('js') }}'); var subdefList = JSON.parse('{{ subdefList | json_encode | escape('js') }}');
$('#resource_type_sel').on('change', function() { $('#resource_type_sel').on('change', function () {
assignPermalinks(this.value); assignPermalinks(this.value);
}); });
$('input.ui-state-default').hover( $('input.ui-state-default').hover(
function(){$(this).addClass('ui-state-hover');}, function () {
function(){$(this).removeClass('ui-state-hover');} $(this).addClass('ui-state-hover');
},
function () {
$(this).removeClass('ui-state-hover');
}
); );
$('#permalinkUrlCopy').on('click', function(event) { $('#permalinkUrlCopy').on('click', function (event) {
event.preventDefault(); event.preventDefault();
return copyElContentClipboard('permalinkUrl'); return copyElContentClipboard('permalinkUrl');
}); });
$('#permaviewUrlCopy').on('click', function(event) { $('#permaviewUrlCopy').on('click', function (event) {
event.preventDefault(); event.preventDefault();
return copyElContentClipboard('permaviewUrl'); return copyElContentClipboard('permaviewUrl');
}); });
$('#embedCopy').on('click', function(event) { $('#embedCopy').on('click', function (event) {
event.preventDefault(); event.preventDefault();
return copyElContentClipboard('embedRecordUrl'); return copyElContentClipboard('embedRecordUrl');
}); });
$('#advance-share').on('click', function() { $('#advance-share').on('click', function () {
$('#shared-def').show(); $('#shared-def').show();
}); });
var copyElContentClipboard = function(elId) { var copyElContentClipboard = function (elId) {
var copyEl = document.getElementById(elId); var copyEl = document.getElementById(elId);
copyEl.select(); copyEl.select();
try { try {
@@ -102,7 +117,7 @@
console.log('unable to copy'); console.log('unable to copy');
} }
} }
var assignPermalinks = function(resourceType) { var assignPermalinks = function (resourceType) {
$('#twitter-link').attr('href', 'http://www.twitter.com/home/?status=' + subdefList[resourceType].permaviewUrl); $('#twitter-link').attr('href', 'http://www.twitter.com/home/?status=' + subdefList[resourceType].permaviewUrl);
$('#facebook-link').attr('href', 'http://www.facebook.com/sharer.php?u=' + subdefList[resourceType].permaviewUrl); $('#facebook-link').attr('href', 'http://www.facebook.com/sharer.php?u=' + subdefList[resourceType].permaviewUrl);
$('#permalinkUrl').val(subdefList[resourceType].permalinkUrl); $('#permalinkUrl').val(subdefList[resourceType].permalinkUrl);

View File

@@ -12,11 +12,12 @@
<button type="button" class="autoorder btn btn-inverse">{{ 'Re-ordonner' | trans }}</button> <button type="button" class="autoorder btn btn-inverse">{{ 'Re-ordonner' | trans }}</button>
<button type="button" class="reverseorder btn btn-inverse">{{ 'Inverser' | trans }}</button> <button type="button" class="reverseorder btn btn-inverse">{{ 'Inverser' | trans }}</button>
</form> </form>
<form class="form-inline span2" name="reorder" method="POST" action="{{ path('prod_stories_story_reorder', { 'sbas_id' : story.get_sbas_id(), 'record_id' : story.get_record_id() }) }}"> <form class="form-inline span2" name="reorder" method="POST"
action="{{ path('prod_stories_story_reorder', { 'sbas_id' : story.get_sbas_id(), 'record_id' : story.get_record_id() }) }}">
{% for element in story.get_children() %} {% for element in story.get_children() %}
<input type="hidden" name="element[{{ element.get_record_id() }}]" value="{{ element.getNumber() }}"/> <input type="hidden" name="element[{{ element.get_record_id() }}]" value="{{ element.getNumber() }}"/>
{% endfor %} {% endfor %}
<input type="submit" class="btn btn-inverse" value="{{ 'boutton::valider' | trans }}" /> <input type="submit" class="btn btn-inverse" value="{{ 'boutton::valider' | trans }}"/>
</form> </form>
</div> </div>
<div style="top:45px;overflow:auto;" id="reorder_box" class="row-fluid"> <div style="top:45px;overflow:auto;" id="reorder_box" class="row-fluid">

View File

@@ -304,7 +304,9 @@
<td style="width:50%; vertical-align:top;"> <td style="width:50%; vertical-align:top;">
{% set useTruncation = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'use_truncation') %} {% set useTruncation = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'use_truncation') %}
<label class="checkbox inline" for="ADVSRCH_USE_TRUNCATION"> <label class="checkbox inline" for="ADVSRCH_USE_TRUNCATION">
<input id="ADVSRCH_USE_TRUNCATION" type="checkbox" class="checkbox preferences-options-use-truncation" name="truncation" {% if useTruncation == '1' or useTruncation == NULL %}checked="checked"{% endif %}> <input id="ADVSRCH_USE_TRUNCATION" type="checkbox"
class="checkbox preferences-options-use-truncation" name="truncation"
{% if useTruncation == '1' or useTruncation == NULL %}checked="checked"{% endif %}>
{{ 'index:advanced-preferences:: use truncation' | trans }} {{ 'index:advanced-preferences:: use truncation' | trans }}
</label> </label>
<div id="ADVSRCH_SBAS_ZONE" class="sbasglob"> <div id="ADVSRCH_SBAS_ZONE" class="sbasglob">
@@ -689,9 +691,12 @@
{% set order_collection_by = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'order_collection_by') %} {% set order_collection_by = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'order_collection_by') %}
<label class="select" for="orderByName"> <label class="select" for="orderByName">
<select class="preferences-options-collection-order" name="orderByName"> <select class="preferences-options-collection-order" name="orderByName">
<option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_ADMIN') %} selected="selected" {% endif %} value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_ADMIN') }}">{{ 'Defined by admin' | trans }}</option> <option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_ADMIN') %} selected="selected" {% endif %}
<option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') %} selected="selected" {% endif %} value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') }}">{{ 'Alphabetic asc' | trans }}</option> value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_ADMIN') }}">{{ 'Defined by admin' | trans }}</option>
<option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') %} selected="selected" {% endif %} value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') }}">{{ 'Alphabetic desc' | trans }}</option> <option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') %} selected="selected" {% endif %}
value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') }}">{{ 'Alphabetic asc' | trans }}</option>
<option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') %} selected="selected" {% endif %}
value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') }}">{{ 'Alphabetic desc' | trans }}</option>
</select> </select>
</label> </label>
</form> </form>

View File

@@ -230,7 +230,8 @@
<li> <li>
<a class="results_window {{ action.classes|default('') }}"> <a class="results_window {{ action.classes|default('') }}">
{% if action.icon %} {% if action.icon %}
<img src="{{ plugin_asset(plugin.PluginName, action.icon) }}" height="16" width="16" class="btn-image"/> <img src="{{ plugin_asset(plugin.PluginName, action.icon) }}"
height="16" width="16" class="btn-image"/>
{% endif %} {% endif %}
{% set label = action.label %} {% set label = action.label %}

View File

@@ -44,7 +44,8 @@
{#{% endif %}#} {#{% endif %}#}
{#</p>#} {#</p>#}
{#{% if app['browser'].supportFileAPI() %}#} {#{% if app['browser'].supportFileAPI() %}#}
<a style="display: none" id="UPLOAD_HTML5_LINK" href="{{ path('upload_html5_form') }}" class="dialog full-dialog">{{ 'Use the HTML5 uploader' | trans }}</a> <a style="display: none" id="UPLOAD_HTML5_LINK" href="{{ path('upload_html5_form') }}"
class="dialog full-dialog">{{ 'Use the HTML5 uploader' | trans }}</a>
{#{% endif %}#} {#{% endif %}#}
{#</td>#} {#</td>#}
</tr> </tr>
@@ -59,7 +60,9 @@
{% for sbasId, availableCollections in collections %} {% for sbasId, availableCollections in collections %}
<optgroup label="{{ availableCollections['databox'].get_label(app['locale']) }}" class="select-label"> <optgroup label="{{ availableCollections['databox'].get_label(app['locale']) }}" class="select-label">
{% for collection in availableCollections['databox_collections'] %} {% for collection in availableCollections['databox_collections'] %}
<option {% if last_used_collection == collection.get_base_id() %} selected="selected" {% endif %} value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale']) }}</option> <option {% if last_used_collection == collection.get_base_id() %} selected="selected" {% endif %}
value="{{ collection.get_base_id() }}"
class="select-row">{{ collection.get_label(app['locale']) }}</option>
{% endfor %} {% endfor %}
</optgroup> </optgroup>
{% endfor %} {% endfor %}
@@ -67,7 +70,8 @@
{# collections status #} {# collections status #}
{% for availableCollections in collections %} {% for availableCollections in collections %}
{% for collection in availableCollections['databox_collections'] %} {% for collection in availableCollections['databox_collections'] %}
<div id="status-{{ collection.get_base_id() }}" class='collection-status' style='{{ last_used_collection == collection.get_base_id() ? "display:block" :"display:none" }}'> <div id="status-{{ collection.get_base_id() }}" class='collection-status'
style='{{ last_used_collection == collection.get_base_id() ? "display:block" :"display:none" }}'>
<h5>{{ 'upload:: Status :' | trans }} :</h5> <h5>{{ 'upload:: Status :' | trans }} :</h5>
<table class="status-tab"> <table class="status-tab">
<tbody> <tbody>

View File

@@ -46,7 +46,8 @@
{#{{ 'Your browser does not support all HTML5 features properly.' | trans }}#} {#{{ 'Your browser does not support all HTML5 features properly.' | trans }}#}
{#{% endif %}#} {#{% endif %}#}
{#</p>#} {#</p>#}
<a style="display: none" id="UPLOAD_FLASH_LINK" href="{{ path('upload_flash_form') }}" class="dialog full-dialog">{{ 'Use the Flash uploader' | trans }}</a> <a style="display: none" id="UPLOAD_FLASH_LINK" href="{{ path('upload_flash_form') }}"
class="dialog full-dialog">{{ 'Use the Flash uploader' | trans }}</a>
{#</td>#} {#</td>#}
</tr> </tr>
</table> </table>
@@ -58,9 +59,12 @@
{% set last_used_collection = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'upload_last_used_collection') %} {% set last_used_collection = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'upload_last_used_collection') %}
<select name="base_id" class="span3 upload-options-collection" style="margin-left: 10px;"> <select name="base_id" class="span3 upload-options-collection" style="margin-left: 10px;">
{% for sbasId, availableCollections in collections %} {% for sbasId, availableCollections in collections %}
<optgroup label="{{ availableCollections['databox'].get_label(app['locale']) }}" class="select-label"> <optgroup label="{{ availableCollections['databox'].get_label(app['locale']) }}"
class="select-label">
{% for collection in availableCollections['databox_collections'] %} {% for collection in availableCollections['databox_collections'] %}
<option {% if last_used_collection == collection.get_base_id() %} selected="selected" {% endif %} value="{{ collection.get_base_id() }}" class="select-row">{{ collection.get_label(app['locale']) }}</option> <option {% if last_used_collection == collection.get_base_id() %} selected="selected" {% endif %}
value="{{ collection.get_base_id() }}"
class="select-row">{{ collection.get_label(app['locale']) }}</option>
{% endfor %} {% endfor %}
</optgroup> </optgroup>
{% endfor %} {% endfor %}
@@ -68,7 +72,8 @@
{# collections status #} {# collections status #}
{% for availableCollections in collections %} {% for availableCollections in collections %}
{% for collection in availableCollections['databox_collections'] %} {% for collection in availableCollections['databox_collections'] %}
<div id="status-{{ collection.get_base_id() }}" class='collection-status' style='{{ last_used_collection == collection.get_base_id() ? "display:block" :"display:none" }}'> <div id="status-{{ collection.get_base_id() }}" class='collection-status'
style='{{ last_used_collection == collection.get_base_id() ? "display:block" :"display:none" }}'>
<h5>{{ 'upload:: Status :' | trans }} :</h5> <h5>{{ 'upload:: Status :' | trans }} :</h5>
<table class="status-tab"> <table class="status-tab">
<tbody> <tbody>

View File

@@ -270,7 +270,8 @@
<tr> <tr>
<td style="text-align:right; width:80px;"><span class="label"></span> :&nbsp;</td> <td style="text-align:right; width:80px;"><span class="label"></span> :&nbsp;</td>
<td></td> <td></td>
<td><input type="text" style="width:250px;" name="term" onkeyup="inputChanged();return(false);"></td> <td><input type="text" style="width:250px;" name="term"
onkeyup="inputChanged();return(false);"></td>
</tr> </tr>
<tr> <tr>
<td style="text-align:right">{{ 'thesaurus:: contexte' | trans }} : </td> <td style="text-align:right">{{ 'thesaurus:: contexte' | trans }} : </td>

View File

@@ -23,17 +23,19 @@ class ShareTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testRouteSlashALL() public function testRouteSlashALL()
{ {
$this->_RouteSlash("all", [0=>true, 1=>true, 2=>true, 3=>true]); $this->_RouteSlash("all", [0 => true, 1 => true, 2 => true, 3 => true]);
} }
public function testRouteSlashPublishers() public function testRouteSlashPublishers()
{ {
$this->_RouteSlash("publishers", [0=>false, 1=>true, 2=>false, 3=>true]); $this->_RouteSlash("publishers", [0 => false, 1 => true, 2 => false, 3 => true]);
} }
public function testRouteSlashNone() public function testRouteSlashNone()
{ {
$this->_RouteSlash("none", [0=>false, 1=>false, 2=>false, 3=>false]); $this->_RouteSlash("none", [0 => false, 1 => false, 2 => false, 3 => false]);
} }
private function _RouteSlash($setting, $expected) private function _RouteSlash($setting, $expected)
{ {
$app = $this->getApplication(); $app = $this->getApplication();
@@ -49,25 +51,27 @@ class ShareTest extends \PhraseanetAuthenticatedWebTestCase
case ['registry', 'actions', 'social-tools']: case ['registry', 'actions', 'social-tools']:
return $setting; return $setting;
} }
return $_conf->get($param, $default); return $_conf->get($param, $default);
})); }));
$result = []; $result = [];
foreach($expected as $flags=>$v) { foreach ($expected as $flags => $v) {
$stubbedACL = $this->stubACL(); $stubbedACL = $this->stubACL();
// "has_right_on_sbas" IS checked by the route->before(), the url will return 403 // "has_right_on_sbas" IS checked by the route->before(), the url will return 403
$stubbedACL->expects($this->any()) $stubbedACL->expects($this->any())
->method('has_right_on_sbas') ->method('has_right_on_sbas')
->will($this->returnValue(($flags & 1) ? true:false)); ->will($this->returnValue(($flags & 1) ? true : false));
// but "has_access_to_subdef" IS NOT checked (the url will return a 200 with a message "no subdef to share") // but "has_access_to_subdef" IS NOT checked (the url will return a 200 with a message "no subdef to share")
$stubbedACL->expects($this->any()) $stubbedACL->expects($this->any())
->method('has_access_to_subdef') ->method('has_access_to_subdef')
->will($this->returnValue(($flags & 2) ? true:false)); ->will($this->returnValue(($flags & 2) ? true : false));
$url = sprintf('/prod/share/record/%d/%d/', self::$DI['record_1']->get_base_id(), self::$DI['record_1']->get_record_id()); $url = sprintf('/prod/share/record/%d/%d/', self::$DI['record_1']->get_base_id(), self::$DI['record_1']->get_record_id());
self::$DI['client']->request('GET', $url); self::$DI['client']->request('GET', $url);
$result[$flags] = self::$DI['client']->getResponse()->isOk(); $result[$flags] = self::$DI['client']->getResponse()->isOk();
} }
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }
/** /**
* @covers Alchemy\Phrasea\Controller\Prod\Share::shareRecord * @covers Alchemy\Phrasea\Controller\Prod\Share::shareRecord
*/ */