mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
add path field in subview window
This commit is contained in:
@@ -53,7 +53,7 @@ class SubdefsController extends Controller
|
||||
|
||||
$databox = $this->findDataboxById((int) $sbas_id);
|
||||
|
||||
$add_subdef = ['class' => null, 'name' => null, 'group' => null, 'mediaType' => null, 'presets' => null];
|
||||
$add_subdef = ['class' => null, 'name' => null, 'group' => null, 'mediaType' => null, 'presets' => null, 'path' => null];
|
||||
foreach ($add_subdef as $k => $v) {
|
||||
if (!isset($toadd_subdef[$k]) || trim($toadd_subdef[$k]) === '') {
|
||||
unset($add_subdef[$k]);
|
||||
@@ -69,7 +69,7 @@ class SubdefsController extends Controller
|
||||
$subdefs = $databox->get_subdef_structure();
|
||||
$subdefs->delete_subdef($group, $name);
|
||||
}
|
||||
elseif (count($add_subdef) === 5) {
|
||||
elseif (count($add_subdef) === 6) {
|
||||
$subdefs = $databox->get_subdef_structure();
|
||||
|
||||
$group = $add_subdef['group'];
|
||||
@@ -79,8 +79,9 @@ class SubdefsController extends Controller
|
||||
$class = $add_subdef['class'];
|
||||
$preset = $add_subdef['presets'];
|
||||
$mediatype = $add_subdef['mediaType'];
|
||||
$path = $add_subdef['path'];
|
||||
|
||||
$subdefs->add_subdef($group, $name, $class, $mediatype, $preset);
|
||||
$subdefs->add_subdef($group, $name, $class, $mediatype, $preset, $path);
|
||||
|
||||
if ($preset !== "Choose") {
|
||||
$options = [];
|
||||
@@ -154,6 +155,7 @@ class SubdefsController extends Controller
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$subdefs = $databox->get_subdef_structure();
|
||||
|
||||
foreach ($Parmsubdefs as $post_sub) {
|
||||
|
@@ -1480,7 +1480,7 @@ class databox extends base implements ThumbnailedElement
|
||||
*/
|
||||
public function getSubdefStorage(){
|
||||
|
||||
return p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'subdefs'])).$this->get_dbname()."/subdefs/";
|
||||
return p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'subdefs'])).$this->get_dbname()."/subview/";
|
||||
}
|
||||
|
||||
protected function retrieve_structure()
|
||||
|
@@ -187,9 +187,10 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
* @param string $class
|
||||
* @param string $mediatype
|
||||
* @param string $preset
|
||||
* @param string $path
|
||||
* @return databox_subdefsStructure
|
||||
*/
|
||||
public function add_subdef($groupname, $name, $class, $mediatype, $preset)
|
||||
public function add_subdef($groupname, $name, $class, $mediatype, $preset, $path)
|
||||
{
|
||||
$dom_struct = $this->databox->get_dom_structure();
|
||||
|
||||
@@ -202,9 +203,8 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
$mediaTypeElement->appendChild($dom_struct->createTextNode($mediatype));
|
||||
$subdef->appendChild($mediaTypeElement);
|
||||
|
||||
$defaultPath = $this->databox->getSubdefStorage();
|
||||
$pathElement = $dom_struct->createElement('path');
|
||||
$pathElement->appendChild($dom_struct->createTextNode($defaultPath));
|
||||
$pathElement->appendChild($dom_struct->createTextNode($path));
|
||||
$subdef->appendChild($pathElement);
|
||||
|
||||
$dom_xp = $this->databox->get_xpath_structure();
|
||||
|
@@ -192,7 +192,7 @@
|
||||
$("#dialog:ui-dialog").dialog("destroy");
|
||||
|
||||
var name = $("#name"), accessclass = $("#accessclass"), subviewType = $("#subviewType"),
|
||||
mediaType = $("#mediaType"), presets = $("#presets"),
|
||||
mediaType = $("#mediaType"), presets = $("#presets"), subviewPath = $("#subviewPath"),
|
||||
allFields = $([]).add(name).add(accessclass).add(subviewType).add(mediaType).add(presets),
|
||||
tips = $(".validateTips");
|
||||
|
||||
@@ -217,6 +217,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
function isNotEmpty(o){
|
||||
if(o.val().length > 0){
|
||||
return true;
|
||||
}else{
|
||||
o.addClass("ui-state-error");
|
||||
updateTips("Path is required");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkPresence(mediaType, o) {
|
||||
|
||||
var el = $('input[name="subdefs[]"][value="' + mediaType + '_' + o.val() + '"]');
|
||||
@@ -260,6 +270,7 @@
|
||||
bValid = bValid && checkLength(name, "subdef name", 3, 16);
|
||||
bValid = bValid && checkSpecialChar(name);
|
||||
bValid = bValid && checkPresence(subviewType.val(), name);
|
||||
bValid = bValid && isNotEmpty(subviewPath);
|
||||
|
||||
if (bValid) {
|
||||
$('input[name="add_subdef[group]"]').val(subviewType.val());
|
||||
@@ -267,6 +278,7 @@
|
||||
$('input[name="add_subdef[mediaType]"]').val(mediaType.val());
|
||||
$('input[name="add_subdef[class]"]').val(accessclass.val());
|
||||
$('input[name="add_subdef[presets]"]').val(presets.val());
|
||||
$('input[name="add_subdef[path]"]').val(subviewPath.val());
|
||||
$(this).dialog("close");
|
||||
$('form.subdefs').submit();
|
||||
}
|
||||
@@ -367,6 +379,8 @@
|
||||
<option>{{ 'Choisir' | trans }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<label for="subviewPath">{{ 'Path' | trans }}</label>
|
||||
<input type="text" name="subviewPath" id="subviewPath" class="text ui-widget-content ui-corner-all" value="{{ databox.getSubdefStorage }}" />
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
@@ -599,6 +613,7 @@
|
||||
<input type="hidden" name="add_subdef[mediaType]" value=""/>
|
||||
<input type="hidden" name="add_subdef[class]" value=""/>
|
||||
<input type="hidden" name="add_subdef[presets]" value=""/>
|
||||
<input type="hidden" name="add_subdef[path]" value=""/>
|
||||
</form>
|
||||
|
||||
<div style="display:none;">
|
||||
|
@@ -50,7 +50,9 @@ class SubdefsTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
{
|
||||
$subdefs = $this->getApplication()->findDataboxById($this->databox_id)->get_subdef_structure();
|
||||
$name = $this->getSubdefName();
|
||||
$subdefs->add_subdef("image", $name, "thumbnail", "image", "1280px JPG (preview Phraseanet)");
|
||||
$path = $this->findDataboxById($this->databox_id)->getSubdefStorage();
|
||||
|
||||
$subdefs->add_subdef("image", $name, "thumbnail", "image", "1280px JPG (preview Phraseanet)", $path);
|
||||
self::$DI['client']->request("POST", "/admin/subdefs/" . $this->databox_id . "/", ['delete_subdef' => 'image_' . $name]);
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
|
||||
try {
|
||||
@@ -63,7 +65,9 @@ class SubdefsTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
{
|
||||
$subdefs = $this->getApplication()->findDataboxById($this->databox_id)->get_subdef_structure();
|
||||
$name = $this->getSubdefName();
|
||||
$subdefs->add_subdef("image", $name, "thumbnail", "image", "1280px JPG (preview Phraseanet)");
|
||||
$path = $this->findDataboxById($this->databox_id)->getSubdefStorage();
|
||||
|
||||
$subdefs->add_subdef("image", $name, "thumbnail", "image", "1280px JPG (preview Phraseanet)", $path);
|
||||
self::$DI['client']->request("POST", "/admin/subdefs/" . $this->databox_id . "/"
|
||||
, ['subdefs' => [
|
||||
'image_' . $name
|
||||
|
Reference in New Issue
Block a user