Commit f4eb7ccd authored by sikeda's avatar sikeda
Browse files

[dev] Uniform menu items on shared document pages.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12905 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent b46813d7
......@@ -1427,7 +1427,8 @@ a.actionMenuLinksCurrentPage {
border-radius:2px;
}
a.actionMenuLinks {
a.actionMenuLinks,
span.actionMenuLinksInactive {
border: 1px solid;
font-size: 0.9em;
text-decoration: none;
......@@ -1441,15 +1442,13 @@ a.actionMenuLinks:hover {
border-radius:2px;
}
a.actionMenuLinksInactive {
border: 1px solid;
text-decoration: none;
padding: 0px 10px;
}
#actionnuLinksInactive {
text-decoration: none;
padding-left: 3px;
.sharedMenu {
display: inline-block;
max-width: 20%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: keep-all;
}
a.ArcMenuLinks,
......
......@@ -4,28 +4,74 @@
<menu class="shared">
[% FOREACH a = shared_doc.ancestors ~%]
[% IF a.type == 'root' ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks tip-left" data-tooltip aria-haspopup="true"
href="[% 'd_read' | url_rel([list,'']) %]"
class="tip-left" data-tooltip aria-haspopup="true"
title="[%|loc%]Root folder[%END%]">
<i class="fa fa-home fa-lg"></i>
</a></li>
[%~ ELSE ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks sharedMenu"
href="[% 'd_read' | url_rel([list,a.paths_d]) %]">
<i class="fa fa-folder"></i> [%~ a.name ~%]
<i class="fa fa-folder-open"></i> [%~ a.name ~%]
</a></li>
[%~ END %]
[%~ END ~%]
<li><span class="actionMenuLinksInactive sharedMenu">
[% IF shared_doc.type == 'directory' ~%]
<i class="fa fa-folder"></i> [%~ shared_doc.name ~%]
[%~ ELSE ~%]
<i class="fa fa-file"></i> [%~ shared_doc.name ~%]
[%~ END %]
</span></li>
</menu>
<h3>[%|loc(shared_doc.name)%]Access control for the document %1[%END%]</h3>
<h3>
<i class="fa fa-lock fa-lg"></i>
[%|loc(shared_doc.name)%]Access control for the document %1[%END%]
</h3>
<p>
[%|loc(shared_doc.owner)%]Owner: %1[%END%] <br />
[%|loc(shared_doc.date)%]Last update: %1[%END%] <br />
[%|loc(shared_doc.title)%]Description: %1[%END%] <br />
</p>
[% IF shared_doc.may_edit || shared_doc.may_control ~%]
<menu class="shared">
<span class="search_form">
[% IF shared_doc.type == 'directory' %]
<a class="actionMenuLinks"
href="[% 'd_read' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-list-ul"></i> [%|loc%]browse[%END%]</a>
[% ELSIF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_editfile' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-pencil"></i> [%|loc%]edit[%END%]</a>
[% ELSE %]
<span class="actionMenuLinksInactive">
<i class="fa fa-pencil"></i> [%|loc%]edit[%END%]</span>
[% END %]
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]"
onclick="request_confirm_link('[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]', '[% | escape_quote %][%|loc(shared_doc.name)%]Do you really want to delete %1?[%END%][%END%]'); return false;">
<i class="fa fa-trash"></i> [%|loc%]delete[%END%]</a>
[% END %]
[% IF shared_doc.may_control %]
<span class="actionMenuLinksInactive"
<i class="fa fa-lock"></i> [%|loc%]access[%END%]</span>
[% END %]
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_properties' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-cog"></i> [%|loc%]properties[%END%]</a>
[% END %]
</span>
</menu>
[%~ END %]
<form action="[% path_cgi %]" method="post">
<fieldset>
<label for="read_access">[%|loc%]Read access[%END%]</label>
......
......@@ -4,26 +4,32 @@
<menu class="shared">
[% FOREACH a = shared_doc.ancestors ~%]
[% IF a.type == 'root' ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks tip-left" data-tooltip aria-haspopup="true"
href="[% 'd_read' | url_rel([list,'']) %]"
class="tip-left" data-tooltip aria-haspopup="true"
title="[%|loc%]Root folder[%END%]">
<i class="fa fa-home fa-lg"></i>
</a></li>
[%~ ELSE ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks sharedMenu"
href="[% 'd_read' | url_rel([list,a.paths_d]) %]">
<i class="fa fa-folder"></i> [%~ a.name ~%]
<i class="fa fa-folder-open"></i> [%~ a.name ~%]
</a></li>
[%~ END %]
[%~ END %]
<li><span class="actionMenuLinksInactive sharedMenu">
<i class="fa fa-file"></i> [%~ shared_doc.name ~%]
</span></li>
</menu>
[% IF shared_doc.type == 'url' %]
<h3>[%|loc(shared_doc.name)%]Edition of the bookmark %1[%END%]</h3>
[% ELSE %]
<h3>[%|loc(shared_doc.name)%]Edition of the file %1[%END%]</h3>
[% END %]
<h3>
<i class="fa fa-pencil fa-lg"></i>
[% IF shared_doc.type == 'url' ~%]
[%|loc(shared_doc.name)%]Edition of the bookmark %1[%END%]
[%~ ELSE ~%]
[%|loc(shared_doc.name)%]Edition of the file %1[%END%]
[%~ END %]
</h3>
<p>
[%|loc(shared_doc.owner)%]Owner: %1[%END%] <br />
......@@ -31,6 +37,32 @@
[%|loc(shared_doc.title)%]Description: %1[%END%] <br />
</p>
[% IF shared_doc.may_edit || shared_doc.may_control ~%]
<menu class="shared">
<span class="search_form">
<span class="actionMenuLinksInactive">
<i class="fa fa-pencil"></i> [%|loc%]edit[%END%]</span>
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]"
onclick="request_confirm_link('[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]', '[% | escape_quote %][%|loc(shared_doc.name)%]Do you really want to delete %1?[%END%][%END%]'); return false;">
<i class="fa fa-trash"></i> [%|loc%]delete[%END%]</a>
[% END %]
[% IF shared_doc.may_control %]
<a class="actionMenuLinks"
href="[% 'd_control' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-lock"></i> [%|loc%]access[%END%]</a>
[% END %]
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_properties' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-cog"></i> [%|loc%]properties[%END%]</a>
[% END %]
</span>
</menu>
[%~ END %]
[% UNLESS shared_doc.type == 'directory' %]
[% IF shared_doc.type == 'url' ~%]
......
......@@ -4,33 +4,80 @@
<menu class="shared">
[% FOREACH a = shared_doc.ancestors ~%]
[% IF a.type == 'root' ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks tip-left" data-tooltip aria-haspopup="true"
href="[% 'd_read' | url_rel([list,'']) %]"
class="tip-left" data-tooltip aria-haspopup="true"
title="[%|loc%]Root folder[%END%]">
<i class="fa fa-home fa-lg"></i>
</a></li>
[%~ ELSE ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks sharedMenu"
href="[% 'd_read' | url_rel([list,a.paths_d]) %]">
<i class="fa fa-folder"></i> [%~ a.name ~%]
<i class="fa fa-folder-open"></i> [%~ a.name ~%]
</a></li>
[%~ END %]
[%~ END ~%]
<li><span class="actionMenuLinksInactive sharedMenu">
[% IF shared_doc.type == 'directory' ~%]
<i class="fa fa-folder"></i> [%~ shared_doc.name ~%]
[%~ ELSE ~%]
<i class="fa fa-file"></i> [%~ shared_doc.name ~%]
[%~ END %]
</span></li>
</menu>
[% IF shared_doc.type == 'url' %]
<h3>[%|loc(shared_doc.label)%]Properties of the bookmark %1[%END%] </h3>
[% ELSIF shared_doc.type == 'directory' %]
<h3>[%|loc(shared_doc.name)%]Properties of the directory %1[%END%]</h3>
[% ELSE %]
<h3>[%|loc(shared_doc.name)%]Properties of the file %1[%END%]</h3>
[% END %]
<h3>
<i class="fa fa-cog fa-lg"></i>
[% IF shared_doc.type == 'url' ~%]
[%|loc(shared_doc.label)%]Properties of the bookmark %1[%END%]
[%~ ELSIF shared_doc.type == 'directory' ~%]
[%|loc(shared_doc.name)%]Properties of the directory %1[%END%]
[%~ ELSE ~%]
[%|loc(shared_doc.name)%]Properties of the file %1[%END%]
[%~ END %]
</h3>
<p>
[%|loc(shared_doc.owner)%]Owner: %1[%END%] <br />
[%|loc(shared_doc.date)%]Last update: %1[%END%] <br />
[%|loc(shared_doc.title)%]Description: %1[%END%] <br />
</p>
[% IF shared_doc.may_edit || shared_doc.may_control ~%]
<menu class="shared">
<span class="search_form">
[% IF shared_doc.type == 'directory' %]
<a class="actionMenuLinks"
href="[% 'd_read' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-list-ul"></i> [%|loc%]browse[%END%]</a>
[% ELSIF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_editfile' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-pencil"></i> [%|loc%]edit[%END%]</a>
[% ELSE %]
<span class="actionMenuLinksInactive">
<i class="fa fa-pencil"></i> [%|loc%]edit[%END%]</span>
[% END %]
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]"
onclick="request_confirm_link('[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]', '[% | escape_quote %][%|loc(shared_doc.name)%]Do you really want to delete %1?[%END%][%END%]'); return false;">
<i class="fa fa-trash"></i> [%|loc%]delete[%END%]</a>
[% END %]
[% IF shared_doc.may_control %]
<a class="actionMenuLinks"
href="[% 'd_control' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-lock"></i> [%|loc%]access[%END%]</a>
[% END %]
[% IF shared_doc.may_edit %]
<span class="actionMenuLinksInactive">
<i class="fa fa-cog"></i> [%|loc%]properties[%END%]</a>
[% END %]
</span>
</menu>
[%~ END %]
<form action="[% path_cgi %]" method="post">
<fieldset>
<label for="content">
......
<!-- $Id$ -->
<h2>[%|loc%]Shared documents[%END%] <a href="[% 'nomenu/help/shared' | url_rel %]" title="[%|loc%]Open in a new window[%END%]" onclick="window.open('','wws_help','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=200')" target="wws_help"><i class="fa fa-question-circle" title="[%|loc%]Help[%END%]"></i></a></h2>
[% IF file %]
[% INSERT $file IF file %]
[% ELSE %]
<menu class="shared">
[% IF shared_doc.paths.size -%]
[% FOREACH a = shared_doc.ancestors ~%]
[% IF a.type == 'root' ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks tip-left" data-tooltip aria-haspopup="true"
href="[% 'd_read' | url_rel([list,'']) %]"
class="tip-left" data-tooltip aria-haspopup="true"
title="[%|loc%]Root folder[%END%]">
<i class="fa fa-home fa-lg"></i>
</a></li>
[%~ ELSE ~%]
<li><a class="actionMenuLinks"
<li><a class="actionMenuLinks sharedMenu"
href="[% 'd_read' | url_rel([list,a.paths_d]) %]">
<i class="fa fa-folder"></i> [%~ a.name ~%]
<i class="fa fa-folder-open"></i> [%~ a.name ~%]
</a></li>
[%~ END %]
[%~ END %]
[%~ END %]
[%~ END ~%]
[% IF expert_page -%]
<li><a class="actionMenuLinks"
href="[% 'd_read' | url_rel([list,shared_doc.paths_d],{type=>'directory',previous_action=>'d_read',show_user_page=>'1'}) %]">
<i class="fa fa-user "></i> [%|loc%]User mode[%END%]</a></li>
<li><a class="actionMenuLinksCurrentPage"
href="[% 'd_read' | url_rel([list,shared_doc.paths_d],{type=>'directory',previous_action=>'d_read',show_expert_page=>'1'}) %]">
<i class="fa fa-cogs"></i> [%|loc%]Expert mode[%END%]</a></li>
[%~ ELSE ~%]
[% IF shared_doc.may_edit || shared_doc.may_control -%]
<li><a class="actionMenuLinksCurrentPage"
href="[% 'd_read' | url_rel([list,shared_doc.paths_d],{type=>'directory',previous_action=>'d_read',show_user_page=>'1'}) %]">
<i class="fa fa-user"></i> [%|loc%]User mode[%END%]</a></li>
<li><a class="actionMenuLinks"
href="[% 'd_read' | url_rel([list,shared_doc.paths_d],{type=>'directory',previous_action=>'d_read',show_expert_page=>'1'}) %]">
<i class="fa fa-cogs"></i> [%|loc%]Expert mode[%END%]</a></li>
<li><span class="actionMenuLinksInactive sharedMenu">
[% IF shared_doc.type == 'directory' ~%]
<i class="fa fa-folder"></i> [%~ shared_doc.name ~%]
[%~ ELSE ~%]
<i class="fa fa-file"></i> [%~ shared_doc.name ~%]
[%~ END %]
[%~ END %]
</span></li>
[%~ END %]
</menu>
[% IF shared_doc.paths.size ~%]
<h3>[%|loc%]Listing of folder[%END%] [% shared_doc.name %] </h3>
<menu class="shared">
<h3>
<i class="fa fa-list-ul fa-lg"></i>
[%|loc%]Listing of folder[%END%] [% shared_doc.name %]
</h3>
[% IF expert_page %]
<menu class="shared">
<span class="search_form">
<span class="actionMenuLinksInactive">
<i class="fa fa-list-ul"></i>
[%|loc%]browse[%END%]
</span>
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]"
onclick="request_confirm_link('[% 'd_delete' | url_rel([list,shared_doc.paths_d]) %]', '[% | escape_quote %][%|loc(shared_doc.name)%]Do you really want to delete %1?[%END%][%END%]'); return false;">
<i class="fa fa-trash"></i> [%|loc%]delete[%END%]</a>
<a class="actionMenuLinks"
href="[% 'd_properties' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-cog"></i> [%|loc%]properties[%END%]</a>
[% END %]
[% IF shared_doc.may_control %]
<a class="actionMenuLinks"
href="[% 'd_control' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-lock"></i> [%|loc%]access[%END%]</a>
[% END %]
[% IF shared_doc.may_edit %]
<a class="actionMenuLinks"
href="[% 'd_properties' | url_rel([list,shared_doc.paths_d]) %]">
<i class="fa fa-cog"></i> [%|loc%]properties[%END%]</a>
[% END %]
</span>
</menu>
[% END %]
</menu>
<p>
[%|loc(shared_doc.owner)%]Owner: %1[%END%] <br />
......@@ -74,7 +69,10 @@
[%~ END %]
</p>
[%~ ELSE ~%]
<h3>[%|loc%]Listing of root folder[%END%]</h3>
<h3>
<i class="fa fa-list-ul fa-lg"></i>
[%|loc%]Listing of root folder[%END%]
</h3>
[%~ END %]
[% IF shared_doc.empty %]
......@@ -382,6 +380,4 @@
[%~ END %]
[%~ END %]
[%~ END %]
<!-- end d_read.tt2 -->
......@@ -184,4 +184,25 @@
</nav>
[% END %]
[% IF action == 'd_read' ~%]
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li calss="name"> </li>
<li class="toggle-topbar menu-icon">
<a href="#"><span>[%|loc%]Menu[%END%]</span></a> </li>
<menu class="top-bar-section">
<ul class="left">
<li class="[% UNLESS expert_page %]active not-click[%END%]">
<a href="[% 'd_read' | url_rel([list,shared_doc.paths_d],{type=>'directory',previous_action=>'d_read',show_user_page=>'1'}) %]">
<i class="fa fa-user "></i> [%|loc%]User mode[%END%]</a> </li>
<li class="divider"></li>
<li class="[% IF expert_page %]active not-click[%END%]">
<a href="[% 'd_read' | url_rel([list,shared_doc.paths_d],{type=>'directory',previous_action=>'d_read',show_expert_page=>'1'}) %]">
<i class="fa fa-cogs"></i> [%|loc%]Expert mode[%END%]</a> </li>
</ul>
</menu>
</ul>
</nav>
[%~ END %]
<!-- end nav.tt2 -->
......@@ -14047,7 +14047,7 @@ sub do_d_editfile {
 
# Access control.
my %access = $shared_doc->get_privileges(
mode => 'edit',
mode => 'edit,control',
sender => $param->{'user'}{'email'},
auth_method => $param->{'auth_method'},
scenario_context => {
......@@ -14056,9 +14056,7 @@ sub do_d_editfile {
remote_addr => $param->{'remote_addr'}
}
);
my $may_edit = $access{may}{edit};
unless ($may_edit) {
unless ($access{may}{edit}) {
Sympa::Report::reject_report_web('auth', $access{reason}{edit},
{}, $param->{'action'}, $list);
wwslog('err', 'Access denied for %s', $param->{'user'}{'email'});
......@@ -14075,6 +14073,9 @@ sub do_d_editfile {
 
$param->{'list'} = $list->{'name'};
 
$param->{'shared_doc'}{'may_edit'} = $access{may}{edit};
$param->{'shared_doc'}{'may_control'} = $access{may}{control};
# Test if it's a text file.
if (-T $shared_doc->{fs_path}) { #FIXME:Better check
$param->{'textfile'} = 1;
......@@ -14142,7 +14143,7 @@ sub do_d_properties {
 
# Access control.
my %access = $shared_doc->get_privileges(
mode => 'edit',
mode => 'edit,control',
sender => $param->{'user'}{'email'},
auth_method => $param->{'auth_method'},
scenario_context => {
......@@ -14166,6 +14167,9 @@ sub do_d_properties {
 
$param->{'list'} = $list->{'name'};
 
$param->{'shared_doc'}{'may_edit'} = $access{may}{edit};
$param->{'shared_doc'}{'may_control'} = $access{may}{control};
##FIXME: Required?
#$allow_absolute_path = 1;
 
......@@ -15449,7 +15453,7 @@ sub do_d_control {
 
# Access control.
my %access = $shared_doc->get_privileges(
mode => 'control',
mode => 'edit,control',
sender => $param->{'user'}{'email'},
auth_method => $param->{'auth_method'},
scenario_context => {
......@@ -15492,6 +15496,9 @@ sub do_d_control {
# template parameters
$param->{'list'} = $list->{'name'};
 
$param->{'shared_doc'}{'may_edit'} = $access{may}{edit};
$param->{'shared_doc'}{'may_control'} = $access{may}{control};
my $lang = $param->{'lang'};
 
## Scenario list for READ
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment