Add files via upload

This commit is contained in:
seb1k 2024-10-05 14:38:08 +02:00 committed by GitHub
parent 813996b3e6
commit 3972bc2b67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 95 additions and 13 deletions

40
styles/styles.min.css vendored
View file

@ -563,6 +563,7 @@ body {
left: 0 !important; left: 0 !important;
} }
.attachmentslistics:before,
.attach_fullsizeM:before, .attach_fullsizeM:before,
.zipdownloadicon:before, .zipdownloadicon:before,
#divscale_default:before, #divscale_default:before,
@ -972,6 +973,7 @@ margin-top:-25px;
#mailtoolbar a{ #mailtoolbar a{
display:inline-block; display:inline-block;
border-radius:2px;
} }
@ -4620,17 +4622,45 @@ background-repeat: no-repeat;
.attachmentslistics{ .attachmentslistics{
position:absolute; position:absolute;
width:36px; width:42px;
height:100%; height:100%;
right:0px;
top:0; top:0;
right:0;
z-index:10; z-index:10;
background-color: var(--backgroundhoverlight);
font-weight: bold;
font-size: 20px;
text-align: center;
padding-top: 0px;
border-radius: 4px;
} }
.attachmentslistics:hover{ .attachmentslistics:hover{
filter: brightness(30%); background-color: #D7F2FF;
} }
.attachmentslistics:hover:before{
opacity: 1;
}
html.dark-mode .attachmentslistics:hover{
background-color: #52676D;
}
.attachmentslistics:before{
content: "\f0fe";
font-weight: 400;
font-size:18px;
margin: 10px;
color: var(--font);
opacity: .7;
}
.attachmentslist .dropdown{ .attachmentslist .dropdown{
display:none; display:none;
@ -4779,7 +4809,7 @@ background-color: var(--backgroundhover);
.attachmentslist li a.filename:after { .attachmentslist li a.filename:after {
content: ""; content: "";
background: #aaa; background-color: rgba(0, 0, 0, 0.3);
filter: brightness(30%); filter: brightness(30%);
display: block; display: block;
position: absolute; position: absolute;

View file

@ -145,6 +145,13 @@
</ul> </ul>
</div> </div>
<div id="popupcalendarchoice" class="popupmenu">
<ul class="menu listing" role="menu">
<li role="menuitem"><a class="calendar" role="button" tabindex="-1" aria-disabled="true" href="#">AAAAA</a></li>
<li role="menuitem"><a class="calendar" role="button" tabindex="-1" aria-disabled="true" href="#">BBBBB</a></li>
</ul>
</div>

61
ui.min.js vendored
View file

@ -5395,10 +5395,12 @@ if(typeof rcube_calendar ==="function") // rcube_calendar exist ?
var hovertxt = $('#attachmentsavecal').text() var hovertxt = $('#attachmentsavecal').text()
$('.attachmentslist .ics').each(function() { $('.attachmentslist .ics').each(function() {
jQuery(this).find(".filename").append( "<div class='attachmentslistics' title='"+hovertxt+"'onclick='click_add_calendar(event,this)'>Add<br>Cal</div>" ); jQuery(this).find(".filename").append( "<div class='attachmentslistics' title='"+hovertxt+"'onclick='click_add_calendar(event,this)'></div>" );
}) })
} }
if($('.zipdownload').length ) // zipdownload plugin
// zipdownload plugin
if($('.zipdownload').length )
{ {
var zd = $('.zipdownload')[0] var zd = $('.zipdownload')[0]
$('.tdzipdownload').css( "display","table-cell") $('.tdzipdownload').css( "display","table-cell")
@ -5412,7 +5414,7 @@ if($('.zipdownload').length ) // zipdownload plugin
$('.attachmentslist .filename').off() $('.attachmentslist .filename').off()
$('.attachmentslist .filename').removeAttr("onclick") $('.attachmentslist .filename').removeAttr("onclick")
$('.attachmentslist .filename').attr('target','_blank'); $('.attachmentslist .filename').attr('target','_blank');
$('.attachmentslist li:not(.pdf, .image) .filename').attr("download", "") // open image & pdf in browser, download everything else (bug for pdf is forced download :/) $('.attachmentslist li:not(.pdf, .image) .filename').attr("download", "") // open image & pdf in browser, download everything else
// add button if more than 2 files // add button if more than 2 files
if($('.attachmentslist li').length > 2) if($('.attachmentslist li').length > 2)
@ -5426,15 +5428,58 @@ function click_add_calendar(e,p)
{ {
var attachid = p.closest("li").id.replace('attach',''); var attachid = p.closest("li").id.replace('attach','');
rcmail.http_post('calendar/mailimportattach', {
_uid: rcmail.env.uid, // only way i found to get the calendar number + name
_mbox: rcmail.env.mailbox, var stupid_request = $.ajax({ type: "GET", url: "?_task=calendar&_action=print",async: false, }).responseText
_part: attachid
}, rcmail.set_busy(true, 'itip.savingdata')); var start_rcmailenv = stupid_request.indexOf("rcmail.set_env({") + 15
var end_rcmailenv = stupid_request.indexOf("\n",start_rcmailenv)-2
var rcmailenvline = stupid_request.substring( start_rcmailenv, end_rcmailenv);
var rcmailenv = JSON.parse(rcmailenvline)
var nb_calendar=Object.keys(rcmailenv.calendars).length
if(nb_calendar==1)
{
rcmail.http_post('calendar/mailimportattach', {
_uid: rcmail.env.uid,
_mbox: rcmail.env.mailbox,
_part: attachid
}, rcmail.set_busy(true, 'itip.savingdata'));
}
else // show menu to choose calendar
{
rcmail.command('menu-open', {menu: 'popupcalendarchoice', link: p}, p, e);
//create menu
$('#popupcalendarchoice ul').empty()
$.each(rcmailenv.calendars, function(index, value) {
var calendarname = value.name
var calendarid = value.calendar_id
$('#popupcalendarchoice ul').append($('<li role="menuitem" onclick="click_add_calendarid('+calendarid+',\''+attachid+'\')"><a class="calendar" role="button" tabindex="-1" aria-disabled="true" href="#">'+calendarname+'</a></li>'))
});
}
e.preventDefault(); e.preventDefault();
} }
function click_add_calendarid(calendarid,attachid)
{
rcmail.http_post('calendar/mailimportattach', {
_uid: rcmail.env.uid,
_mbox: rcmail.env.mailbox,
_part: attachid,
_calendar:calendarid
}, rcmail.set_busy(true, 'itip.savingdata'));
}
function attach_fullsize() function attach_fullsize()
{ {
$('.attachmentslist').css('max-height','unset'); $('.attachmentslist').css('max-height','unset');