Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
c127a84f
Commit
c127a84f
authored
16 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Can rename a directory in ECM module
parent
dd7ad40d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/ecm/docmine.php
+50
-3
50 additions, 3 deletions
htdocs/ecm/docmine.php
htdocs/ecm/ecmdirectory.class.php
+6
-5
6 additions, 5 deletions
htdocs/ecm/ecmdirectory.class.php
with
56 additions
and
8 deletions
htdocs/ecm/docmine.php
+
50
−
3
View file @
c127a84f
...
...
@@ -139,11 +139,51 @@ if ($_POST['action'] == 'confirm_deletedir' && $_POST['confirm'] == 'yes')
// Update description
if
(
$_POST
[
'action'
]
==
'update'
&&
!
$_POST
[
'cancel'
])
{
$db
->
begin
();
$oldlabel
=
$ecmdir
->
label
;
$olddir
=
$ecmdir
->
getRelativePath
(
0
);
$olddir
=
$conf
->
ecm
->
dir_output
.
'/'
.
$olddir
;
// Fetch was already done
$ecmdir
->
label
=
$_POST
[
"label"
];
$ecmdir
->
description
=
$_POST
[
"description"
];
$result
=
$ecmdir
->
update
(
$user
);
if
(
$result
<=
0
)
if
(
$result
>
0
)
{
$error
=
0
;
// Try to rename file if changed
if
(
$oldlabel
!=
$ecmdir
->
label
&&
file_exists
(
$olddir
))
{
$newdir
=
$ecmdir
->
getRelativePath
(
1
);
// return "xxx/zzz/" from ecm directory
$newdir
=
$conf
->
ecm
->
dir_output
.
'/'
.
$newdir
;
//print $olddir.'-'.$newdir;
$result
=@
rename
(
$olddir
,
$newdir
);
if
(
!
$result
)
{
$langs
->
load
(
'errors'
);
$mesg
=
'<div class="error">'
.
$langs
->
trans
(
'ErrorFailToRenameDir'
,
$olddir
,
$newdir
)
.
'</div>'
;
$error
++
;
}
}
if
(
!
$error
)
{
$db
->
commit
();
$relativepath
=
$ecmdir
->
getRelativePath
();
$upload_dir
=
$conf
->
ecm
->
dir_output
.
'/'
.
$relativepath
;
}
else
{
$db
->
rollback
();
}
}
else
{
$db
->
rollback
();
$mesg
=
'<div class="error">'
.
$ecmdir
->
error
.
'</div>'
;
}
}
...
...
@@ -186,10 +226,15 @@ $s='';
$tmpecmdir
=
new
ECMDirectory
(
$db
);
// Need to create a new one
$tmpecmdir
->
fetch
(
$ecmdir
->
id
);
$result
=
1
;
$i
=
0
;
while
(
$tmpecmdir
&&
$result
>
0
)
{
$tmpecmdir
->
ref
=
$tmpecmdir
->
label
;
$s
=
$tmpecmdir
->
getNomUrl
(
1
)
.
$s
;
if
(
$i
==
0
&&
$_GET
[
"action"
]
==
'edit'
)
{
$s
=
'<input type="text" name="label" size="32" value="'
.
$tmpecmdir
->
label
.
'">'
;
}
else
$s
=
$tmpecmdir
->
getNomUrl
(
1
)
.
$s
;
if
(
$tmpecmdir
->
fk_parent
)
{
$s
=
' -> '
.
$s
;
...
...
@@ -199,6 +244,7 @@ while ($tmpecmdir && $result > 0)
{
$tmpecmdir
=
0
;
}
$i
++
;
}
print
img_picto
(
''
,
'object_dir'
)
.
' <a href="'
.
DOL_URL_ROOT
.
'/ecm/index.php">'
.
$langs
->
trans
(
"ECMRoot"
)
.
'</a> -> '
;
...
...
@@ -247,6 +293,7 @@ if ($_GET["action"] == 'edit')
print
'</div>'
;
// Actions buttons
if
(
$_GET
[
"action"
]
!=
'edit'
&&
$_GET
[
'action'
]
!=
'delete_dir'
&&
$_GET
[
'action'
]
!=
'delete'
)
{
...
...
@@ -275,7 +322,7 @@ if ($_GET["action"] != 'edit' && $_GET['action'] != 'delete_dir' && $_GET['actio
print
'</div>'
;
}
if
(
$mesg
)
{
print
$mesg
.
'<br>'
;
}
if
(
$mesg
)
{
print
'<br>'
.
$mesg
.
'<br>'
;
}
// Confirm remove file
...
...
This diff is collapsed.
Click to expand it.
htdocs/ecm/ecmdirectory.class.php
+
6
−
5
View file @
c127a84f
...
...
@@ -392,12 +392,13 @@ class EcmDirectory // extends CommonObject
}
/**
\brief Return relative path of a directory on disk
\return string Relative physical path
*/
function
getRelativePath
()
* \brief Return relative path of a directory on disk
* \param force Force reload of full arbo even if already loaded
* \return string Relative physical path
*/
function
getRelativePath
(
$force
=
0
)
{
$this
->
get_full_arbo
();
$this
->
get_full_arbo
(
$force
);
$ret
=
''
;
$idtosearch
=
$this
->
id
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment