Fixed "with the close or save and close button you get an exception"
This commit is contained in:
@@ -269,10 +269,10 @@ class FileController extends BaseAdminController
|
|||||||
$fileManager = $this->getFileManager();
|
$fileManager = $this->getFileManager();
|
||||||
$imageModel = $fileManager->getModelInstance('image', $parentType);
|
$imageModel = $fileManager->getModelInstance('image', $parentType);
|
||||||
|
|
||||||
$redirectUrl = $imageModel->getRedirectionUrl($imageId);
|
|
||||||
|
|
||||||
$image = $imageModel->getQueryInstance()->findPk($imageId);
|
$image = $imageModel->getQueryInstance()->findPk($imageId);
|
||||||
|
|
||||||
|
$redirectUrl = $image->getRedirectionUrl();
|
||||||
|
|
||||||
return $this->render('image-edit', array(
|
return $this->render('image-edit', array(
|
||||||
'imageId' => $imageId,
|
'imageId' => $imageId,
|
||||||
'imageType' => $parentType,
|
'imageType' => $parentType,
|
||||||
@@ -306,7 +306,7 @@ class FileController extends BaseAdminController
|
|||||||
|
|
||||||
$document = $documentModel->getQueryInstance()->findPk($documentId);
|
$document = $documentModel->getQueryInstance()->findPk($documentId);
|
||||||
|
|
||||||
$redirectUrl = $documentModel->getRedirectionUrl($documentId);
|
$redirectUrl = $document->getRedirectionUrl();
|
||||||
|
|
||||||
return $this->render('document-edit', array(
|
return $this->render('document-edit', array(
|
||||||
'documentId' => $documentId,
|
'documentId' => $documentId,
|
||||||
@@ -394,7 +394,13 @@ class FileController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($this->getRequest()->get('save_mode') == 'close') {
|
if ($this->getRequest()->get('save_mode') == 'close') {
|
||||||
$this->redirect(URL::getInstance()->absoluteUrl($fileModelInstance->getRedirectionUrl($fileId)));
|
|
||||||
|
if ($objectType == 'document')
|
||||||
|
$tab = 'documents';
|
||||||
|
else
|
||||||
|
$tab = 'images';
|
||||||
|
|
||||||
|
$this->redirect(URL::getInstance()->absoluteUrl($file->getRedirectionUrl(), ['current_tab' => $tab]));
|
||||||
} else {
|
} else {
|
||||||
$this->redirectSuccess($fileUpdateForm);
|
$this->redirectSuccess($fileUpdateForm);
|
||||||
}
|
}
|
||||||
@@ -417,7 +423,7 @@ class FileController extends BaseAdminController
|
|||||||
->setGeneralError($message);
|
->setGeneralError($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fileModelInstance;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -454,7 +460,6 @@ class FileController extends BaseAdminController
|
|||||||
*/
|
*/
|
||||||
public function updateDocumentAction($documentId, $parentType)
|
public function updateDocumentAction($documentId, $parentType)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE)) {
|
if (null !== $response = $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE)) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -464,7 +469,7 @@ class FileController extends BaseAdminController
|
|||||||
return $this->render('document-edit', array(
|
return $this->render('document-edit', array(
|
||||||
'documentId' => $documentId,
|
'documentId' => $documentId,
|
||||||
'documentType' => $parentType,
|
'documentType' => $parentType,
|
||||||
'redirectUrl' => $documentInstance->getRedirectionUrl($documentId),
|
'redirectUrl' => $documentInstance->getRedirectionUrl(),
|
||||||
'formId' => $documentInstance->getUpdateFormId()
|
'formId' => $documentInstance->getUpdateFormId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ interface FileModelInterface
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId);
|
public function getRedirectionUrl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Query instance for this object
|
* Get the Query instance for this object
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ class BrandDocument extends BaseBrandDocument implements BreadcrumbInterface, Fi
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/brand/update/' . $objectId . '?current_tab=document';
|
return '/admin/brand/update/' . $this->getBrandId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ class BrandImage extends BaseBrandImage implements FileModelInterface, Breadcrum
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/brand/update/' . $objectId . '?current_tab=image';
|
return '/admin/brand/update/' . $this->getBrandId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ class CategoryDocument extends BaseCategoryDocument implements BreadcrumbInterfa
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/categories/update?category_id=' . $objectId . '?current_tab=document';
|
return '/admin/categories/update?category_id=' . $this->getCategoryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface, Fi
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/categories/update?category_id=' . $objectId . '?current_tab=image';
|
return '/admin/categories/update?category_id=' . $this->getCategoryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/content/update/' . $objectId . '?current_tab=document';
|
return '/admin/content/update/' . $this->getContentId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -121,9 +121,9 @@ class ContentImage extends BaseContentImage implements BreadcrumbInterface, File
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/content/update/' . $objectId . '?current_tab=image';
|
return '/admin/content/update/' . $this->getContentId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface,
|
|||||||
* @param int $objectId the ID of the parent object
|
* @param int $objectId the ID of the parent object
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/folder/update/' . $objectId . '?current_tab=image';
|
return '/admin/folder/update/' . $this->getFolderId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ class FolderImage extends BaseFolderImage implements BreadcrumbInterface, FileMo
|
|||||||
* @param int $objectId the ID of the parent object
|
* @param int $objectId the ID of the parent object
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/folder/update/' . $objectId . '?current_tab=image';
|
return '/admin/folder/update/' . $this->getFolderId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/products/update?product_id=' . $objectId . '?current_tab=document';
|
return '/admin/products/update?product_id=' . $this->getProductId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ class ProductImage extends BaseProductImage implements BreadcrumbInterface, File
|
|||||||
*
|
*
|
||||||
* @return string the URL to redirect to after update from the back-office
|
* @return string the URL to redirect to after update from the back-office
|
||||||
*/
|
*/
|
||||||
public function getRedirectionUrl($objectId)
|
public function getRedirectionUrl()
|
||||||
{
|
{
|
||||||
return '/admin/products/update?product_id=' . $objectId . '?current_tab=image';
|
return '/admin/products/update?product_id=' . $this->getProductId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
hide_submit_buttons = false
|
hide_submit_buttons = false
|
||||||
|
|
||||||
page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}"
|
page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}"
|
||||||
close_url = "{url path="{$redirectUrl}" noamp=1}"
|
close_url = "{url path="{$redirectUrl}" current_tab="documents" noamp=1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
hide_flags = true
|
hide_flags = true
|
||||||
|
|
||||||
page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}"
|
page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}"
|
||||||
close_url = "{url path="{$redirectUrl}"}"
|
close_url = "{url path="{$redirectUrl}" current_tab="documents"}"
|
||||||
}
|
}
|
||||||
</form>
|
</form>
|
||||||
{/form}
|
{/form}
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row inner-toolbar clearfix">
|
<div class="row inner-toolbar clearfix">
|
||||||
<div class="col-md-6 inner-actions pull-right">
|
<div class="col-md-6 inner-actions pull-right">
|
||||||
<a href="{url path="{$redirectUrl}"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a>
|
<a href="{url path="{$redirectUrl}" current_tab="documents"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
hide_submit_buttons = false
|
hide_submit_buttons = false
|
||||||
|
|
||||||
page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}"
|
page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}"
|
||||||
close_url = "{url path="{$redirectUrl}" noamp=1}"
|
close_url = "{url path="{$redirectUrl}" current_tab="images" noamp=1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
hide_flags = true
|
hide_flags = true
|
||||||
|
|
||||||
page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}"
|
page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}"
|
||||||
close_url = "{url path="{$redirectUrl}"}"
|
close_url = "{url path="{$redirectUrl}" current_tab="images"}"
|
||||||
}
|
}
|
||||||
</form>
|
</form>
|
||||||
{/form}
|
{/form}
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row inner-toolbar clearfix">
|
<div class="row inner-toolbar clearfix">
|
||||||
<div class="col-md-6 inner-actions pull-right">
|
<div class="col-md-6 inner-actions pull-right">
|
||||||
<a href="{url path="{$redirectUrl}"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a>
|
<a href="{url path="{$redirectUrl}" current_tab="images"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
|
|||||||
Reference in New Issue
Block a user