Fix #135 : substitution of a story image

This commit is contained in:
Romain Neutron
2011-12-30 11:59:31 +01:00
parent d0fc37b957
commit 9ea7c19c92
3 changed files with 12 additions and 2 deletions

View File

@@ -192,6 +192,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->path = $registry->get('GV_RootPath') . 'www/skins/icons/';
$this->file = 'deleted.png';
$this->is_physically_present = false;
$this->is_substituted = true;
}
if (!$row || !file_exists($this->path . $this->file))
{
@@ -204,6 +205,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->path = $registry->get('GV_RootPath')
. 'www/skins/icons/substitution/';
$this->file = 'regroup_thumb.png';
$this->is_substituted = true;
}
else
{
@@ -217,6 +219,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->path = $registry->get('GV_RootPath')
. 'www/skins/icons/substitution/';
$this->file = str_replace('+', '%20', $mime) . '.png';
$this->is_substituted = true;
}
$this->is_physically_present = false;
if (!file_exists($this->path . $this->file))
@@ -225,6 +228,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->path = $registry->get('GV_RootPath')
. 'www/skins/icons/';
$this->file = 'substitution.png';
$this->is_substituted = true;
}
}

View File

@@ -436,7 +436,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
try
{
$reg_record = $this->get_grouping_head();
$reg_sbas_id = $reg_record->get_base_id();
$reg_sbas_id = $reg_record->get_sbas_id();
$newsubdef_reg = new record_adapter($reg_sbas_id, $request->get('newrepresent'));
@@ -452,7 +452,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
}
catch (Exception $e)
{
}
}

View File

@@ -968,6 +968,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
try
{
$value = $this->get_subdef($name);
if ($value->is_substituted())
{
throw new Exception('Cannot replace a substitution');
}
$original_file = p4string::addEndSlash($value->get_path()) . $value->get_file();
unlink($original_file);
}