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
f2535d74
Commit
f2535d74
authored
11 years ago
by
Cédric Salvador
Committed by
Raphaël Doursenaud
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
edit link lines function
parent
b158e8bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
htdocs/core/class/html.formfile.class.php
+46
-27
46 additions, 27 deletions
htdocs/core/class/html.formfile.class.php
htdocs/core/tpl/doc2.tpl.php
+1
-1
1 addition, 1 deletion
htdocs/core/tpl/doc2.tpl.php
htdocs/core/tpl/document_actions.tpl.php
+19
-0
19 additions, 0 deletions
htdocs/core/tpl/document_actions.tpl.php
with
66 additions
and
28 deletions
htdocs/core/class/html.formfile.class.php
+
46
−
27
View file @
f2535d74
...
...
@@ -1018,7 +1018,7 @@ class FormFile
}
public
function
list_of_links
(
$object
,
$permtodelete
=
1
)
public
function
list_of_links
(
$object
,
$permtodelete
=
1
,
$action
=
null
,
$selected
=
null
)
{
global
$user
,
$conf
,
$langs
,
$hookmanager
,
$user
;
...
...
@@ -1057,34 +1057,53 @@ class FormFile
$var
=
true
;
foreach
(
$links
as
$link
)
{
$var
=!
$var
;
$var
=!
$var
;
print
'<tr '
.
$bc
[
$var
]
.
'>'
;
print
'<td>'
;
//print "XX".$file['name']; //$file['name'] must be utf8
print
'<a data-ajax="false" href="'
.
$link
->
url
.
'">'
;
print
$link
->
label
;
print
'</a>'
;
print
"</td>
\n
"
;
print
'<td align="right"></td>'
;
print
'<td align="center">'
.
dol_print_date
(
$link
->
datea
,
"dayhour"
,
"tzuser"
)
.
'</td>'
;
// Preview
/*if (empty($useinecm))
{
print '<td align="center">';
$tmp=explode('.',$file['name']);
$minifile=$tmp[0].'_mini.'.$tmp[1];
if (image_format_supported($file['name']) > 0) print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
else print ' ';
//edit mode
if
(
$action
==
'update'
&&
$selected
===
$link
->
id
)
{
print
'<form action="'
.
$_SERVER
[
'PHP_SELF'
]
.
'?id='
.
$object
->
id
.
'" method="post">'
;
print
'<input type="hidden" name="linkid" value="'
.
$link
->
id
.
'">'
;
print
'<input type="hidden" name="action" value="confirm_updateline">'
;
print
'<td>'
;
print
$langs
->
trans
(
'Link'
)
.
': <input type="text" name="link" value = "'
.
$link
->
url
.
'">'
;
print
'</td>'
;
}*/
print
'<td align="center"></td>'
;
// Delete or view link
// ($param must start with &)
print
'<td align="right" colspan="2">'
;
print
'<a href="'
.
$_SERVER
[
'PHP_SELF'
]
.
'?action=update&linkid='
.
$link
->
id
.
'&id='
.
$object
->
id
.
'" class="editfilelink" >'
.
img_edit
()
.
'</a>'
;
if
(
$permtodelete
)
print
'<a href="'
.
$_SERVER
[
'PHP_SELF'
]
.
'?action=delete&linkid='
.
$link
->
id
.
'&id='
.
$object
->
id
.
'" class="deletefilelink" >'
.
img_delete
()
.
'</a>'
;
else
print
' '
;
print
"</td>"
;
print
'<td align="right">'
;
print
$langs
->
trans
(
'Label'
)
.
': <input type="text" name="label" value = "'
.
$link
->
label
.
'">'
;
print
'</td>'
;
print
'<td align="center">'
.
dol_print_date
(
dol_now
(),
"dayhour"
,
"tzuser"
)
.
'</td>'
;
print
'<td align="right"></td>'
;
print
'<td align="right" colspan="2"><input type="submit" name="save" class="button" value="'
.
$langs
->
trans
(
'Save'
)
.
'">'
;
print
'<input type="submit" name="cancel" class="button" value="'
.
$langs
->
trans
(
'Cancel'
)
.
'"></td>'
;
print
'</form>'
;
}
else
{
print
'<td>'
;
//print "XX".$file['name']; //$file['name'] must be utf8
print
'<a data-ajax="false" href="'
.
$link
->
url
.
'">'
;
print
$link
->
label
;
print
'</a>'
;
print
"</td>
\n
"
;
print
'<td align="right"></td>'
;
print
'<td align="center">'
.
dol_print_date
(
$link
->
datea
,
"dayhour"
,
"tzuser"
)
.
'</td>'
;
// Preview
/*if (empty($useinecm))
{
print '<td align="center">';
$tmp=explode('.',$file['name']);
$minifile=$tmp[0].'_mini.'.$tmp[1];
if (image_format_supported($file['name']) > 0) print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">';
else print ' ';
print '</td>';
}*/
print
'<td align="center"></td>'
;
// Delete or view link
// ($param must start with &)
print
'<td align="right" colspan="2">'
;
print
'<a href="'
.
$_SERVER
[
'PHP_SELF'
]
.
'?action=update&linkid='
.
$link
->
id
.
'&id='
.
$object
->
id
.
'" class="editfilelink" >'
.
img_edit
()
.
'</a>'
;
if
(
$permtodelete
)
print
'<a href="'
.
$_SERVER
[
'PHP_SELF'
]
.
'?action=delete&linkid='
.
$link
->
id
.
'&id='
.
$object
->
id
.
'" class="deletefilelink" >'
.
img_delete
()
.
'</a>'
;
else
print
' '
;
print
"</td>"
;
}
print
"</tr>
\n
"
;
}
if
(
$nboflinks
==
0
)
...
...
This diff is collapsed.
Click to expand it.
htdocs/core/tpl/doc2.tpl.php
+
1
−
1
View file @
f2535d74
...
...
@@ -38,5 +38,5 @@ $formfile->list_of_documents($filearray,
print
"<br>"
;
//List of links
$formfile
->
list_of_links
(
$object
,
$permission
);
$formfile
->
list_of_links
(
$object
,
$permission
,
$action
,
GETPOST
(
'linkid'
,
'int'
)
);
print
"<br>"
;
This diff is collapsed.
Click to expand it.
htdocs/core/tpl/document_actions.tpl.php
+
19
−
0
View file @
f2535d74
...
...
@@ -47,5 +47,24 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
header
(
'Location: '
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
);
exit
;
}
}
elseif
(
$action
==
'confirm_updateline'
&&
GETPOST
(
'save'
)
&&
GETPOST
(
'link'
,
'alpha'
))
{
require_once
DOL_DOCUMENT_ROOT
.
'/link/class/link.class.php'
;
$langs
->
load
(
'link'
);
$link
=
new
Link
(
$db
);
$link
->
id
=
GETPOST
(
'linkid'
,
'int'
);
$f
=
$link
->
fetch
();
if
(
$f
)
{
$link
->
url
=
GETPOST
(
'link'
,
'alpha'
);
if
(
substr
(
$link
->
url
,
0
,
7
)
!=
'http://'
&&
substr
(
$link
->
url
,
0
,
8
)
!=
'https://'
)
{
$link
->
url
=
'http://'
.
$link
->
url
;
}
$link
->
label
=
GETPOST
(
'label'
,
'alpha'
);
$res
=
$link
->
update
(
$user
);
if
(
!
$res
)
{
setEventMessage
(
$langs
->
trans
(
"ErrorFailedToUpdateLink"
,
$link
->
label
));
}
}
else
{
//error fetching
}
}
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