Fix #802 : Edit subdefs target devices

This commit is contained in:
Romain Neutron
2012-07-11 15:06:34 +02:00
parent 28a4b6bd8f
commit af8da6dac9
3 changed files with 6 additions and 4 deletions

View File

@@ -85,8 +85,8 @@ class Subdefs implements ControllerProviderInterface
$post_sub_ex = explode('_', $post_sub);
$group = $post_sub_ex[0];
$name = $post_sub_ex[1];
$group = array_shift($post_sub_ex);
$name = implode('_', $post_sub_ex);
$class = $request->get($post_sub . '_class');
$downloadable = $request->get($post_sub . '_downloadable');

View File

@@ -221,7 +221,7 @@ class databox_subdef
}
}
$mediatype_obj->registerOption(new \Alchemy\Phrasea\Media\Subdef\OptionType\Multi(_('Target Device'), 'device', $availableDevices, $this->devices));
$mediatype_obj->registerOption(new \Alchemy\Phrasea\Media\Subdef\OptionType\Multi(_('Target Device'), 'devices', $availableDevices, $this->devices));
$subdefTypes[] = $mediatype_obj;
}

View File

@@ -261,13 +261,15 @@ class databox_subdefsStructure implements IteratorAggregate
. 'subdef[@name="' . $name . '"]'
);
$refNode = null;
if ($nodes->length > 0) {
for ($i = 0; $i < $nodes->length; $i ++ ) {
$refNode = $nodes->item($i)->nextSibling;
$dom_group->removeChild($nodes->item($i));
}
}
$dom_group->appendChild($subdef);
$dom_group->insertBefore($subdef, $refNode);
$this->databox->saveStructure($dom_struct);