Added default path alias for node.

Fixed set path alias, when alias already exists in the history.
This commit is contained in:
2017-02-28 17:35:18 +01:00
parent a341bd98eb
commit 13d0927c58
6 changed files with 133 additions and 12 deletions

View File

@@ -24,19 +24,34 @@ feature -- URL aliases
-- <Precursor>
local
l_parameters: STRING_TABLE [detachable ANY]
l_source: like source_of_path_alias
l_continue: BOOLEAN
do
error_handler.reset
create l_parameters.make (2)
l_parameters.put (a_source, "source")
l_parameters.put (a_alias, "alias")
if attached source_of_path_alias (a_alias) as l_path then
if a_source.same_string (l_path) then
-- already up to date
l_source := source_of_path_alias (a_alias)
l_continue := True
if
l_source /= Void -- Alias exists!
then
if a_source.same_string (l_source) then
if attached path_alias (l_source) as l_alias and then l_alias.same_string (a_alias) then
-- already up to date
l_continue := False
else
-- multiple alias and a_alias is not the default alias
-- then unset, and set again !
unset_path_alias (a_source, a_alias)
end
else
l_continue := False
error_handler.add_custom_error (0, "alias exists", "Path alias %"" + a_alias + "%" already exists!")
end
else
end
if l_continue then
sql_insert (sql_insert_path_alias, l_parameters)
sql_finalize
end