allow any type of attachments; fixed cordova build in docker

This commit is contained in:
Marc Wäckerlin
2016-01-12 00:22:58 +00:00
parent a3288d4241
commit 3c87e6585b
7 changed files with 161 additions and 43 deletions

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="32px"
height="32px"
viewBox="0 0 32 32"
enable-background="new 0 0 32 32"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="document_sans.svg"><defs
id="defs3265" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview3263"
showgrid="false"
inkscape:zoom="7.375"
inkscape:cx="16"
inkscape:cy="16"
inkscape:window-x="53"
inkscape:window-y="24"
inkscape:window-maximized="0"
inkscape:current-layer="svg2" /><metadata
id="metadata3255"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>PICOL Icon</dc:title><dc:date>2009-03-15</dc:date><dc:creator><cc:Agent><dc:title>Melih Bilgil</dc:title></cc:Agent></dc:creator><dc:rights><cc:Agent><dc:title>Creative Commons BY-SA</dc:title></cc:Agent></dc:rights><dc:publisher><cc:Agent><dc:title>PICOL - Pictorial Communication Language</dc:title></cc:Agent></dc:publisher><dc:identifier>http://blog.picol.org</dc:identifier><dc:source>http://blog.picol.org</dc:source><dc:language>en</dc:language><dc:subject><rdf:Bag><rdf:li>PICOL</rdf:li><rdf:li>icon</rdf:li><rdf:li>icons</rdf:li><rdf:li>sign</rdf:li><rdf:li>GUI</rdf:li><rdf:li>vector</rdf:li><rdf:li>interface</rdf:li></rdf:Bag></dc:subject><dc:description>This is one icon out of all PICOL icons</dc:description><dc:contributor><cc:Agent><dc:title>Melih Bilgil (www.lonja.de), Christopher Adjei (www.boffer.net)</dc:title></cc:Agent></dc:contributor><cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" /></cc:Work><cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"><cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" /><cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" /><cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /><cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" /></cc:License></rdf:RDF></metadata><g
id="background"><rect
fill="none"
width="32"
height="32"
id="rect3258" /></g><path
id="path3261"
d="M 18.414,0 H 0 V 32 H 24 V 5.584 L 18.414,0 z M 17.998,2.413 21.586,6 H 17.998 V 2.413 z M 2,30 V 1.998 h 14 v 6.001 h 6 V 30 H 2 z" /></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -330,9 +330,19 @@ function clearmessage() {
/// Display Image Attachments
function attachments(files, id) {
if (files) files.forEach(function(file) {
console.log(file);
var img = document.createElement('img');
img.src = file.content;
$(id).append(img);
img.title = file.name;
if (file.type.match('^image/')) {
img.src = file.content;
} else {
img.src = "images/Document_sans_PICOL-PIctorial-COmmunication-Language.svg";
}
var a = document.createElement('a');
a.href = file.content;
a.target = '_blank';
a.appendChild(img);
$(id).append(a);
});
}
@@ -348,39 +358,47 @@ function fileupload(evt) {
return error("your browser does not support file upload", true);
for (var i=0, f; f=evt.target.files[i]; ++i) {
var file = f;
console.log(file);
var reader = new FileReader();
reader.onload = function(evt) {
if (evt.target.error) return error("error reading file", true);
if (evt.target.readyState==0) return notice("waiting for data …");
if (evt.target.readyState==1) return notice("loading data …");
if (!file.type.match('^image/'))
return error(file.name+": not an image", true);
var img = document.createElement("img");
img.onload = function() {
var MAX = 400;
var width = img.width;
var height = img.height;
if (width > MAX) {
height *= MAX / width;
width = MAX;
}
if (height > MAX) {
width *= MAX / height;
height = MAX;
}
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
if (file.type.match('^image/')) {
var img = document.createElement("img");
img.onload = function() {
filecontent.push({type: file.type, content: img.src});
$("#preview").append(img);
success('image of type '+file.type+' is ready to be sent');
var MAX = 400;
var width = img.width;
var height = img.height;
if (width > MAX) {
height *= MAX / width;
width = MAX;
}
if (height > MAX) {
width *= MAX / height;
height = MAX;
}
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, width, height);
img.onload = function() {
filecontent.push({name:file.name, type: file.type, content: img.src});
$("#preview").append(img);
success('image of type '+file.type+' is ready to be sent');
}
img.title = file.name;
img.src = canvas.toDataURL(file.type);
}
img.src = canvas.toDataURL(file.type);
img.src=evt.target.result;
} else {
filecontent.push({name:file.name, type: file.type, content: evt.target.result});
var img = document.createElement("img");
img.src = "images/Document_sans_PICOL-PIctorial-COmmunication-Language.svg";
img.title = file.name;
$("#preview").append(img);
}
img.src=evt.target.result;
}
reader.readAsDataURL(file);
}

View File

@@ -247,9 +247,12 @@ label[for=send] img {
float: left;
padding: .5ex 1ex .5ex 1ex;
}
#msgs .msg img {
#msgs .msg .text img {
border-radius: 2ex;
-moz-border-radius: 2ex;
-webkit-border-radius: 2ex;
display: block;
width: 99%;
width: 100%;
}
#preview img {

View File

@@ -120,20 +120,18 @@
<label for="photo"><img src="images/photo.svg"/></label>
<input autocomplete="off" type="file" accept="image/*" id="photo" multiple />
</span>
<!--
<span class="toolbutton">
<label for="video"><img src="images/video.svg"/></label>
<input autocomplete="off" type="file" accept="video/*" id="video"/>
</span>
<span class="toolbutton">
<label for="audio"><img src="images/audio.svg"/></label>
<input autocomplete="off" type="file" accept="audio/*" id="audio"/>
</span>
<span class="toolbutton">
<label for="file"><img src="images/attachment.svg"/></label>
<input autocomplete="off" type="file" id="file"/>
</span>
-->
<span class="toolbutton">
<label for="video"><img src="images/video.svg"/></label>
<input autocomplete="off" type="file" accept="video/*" id="video"/>
</span>
<span class="toolbutton">
<label for="audio"><img src="images/audio.svg"/></label>
<input autocomplete="off" type="file" accept="audio/*" id="audio"/>
</span>
<span class="toolbutton">
<label for="file"><img src="images/attachment.svg"/></label>
<input autocomplete="off" type="file" id="file"/>
</span>
<span class="toolbutton">
<label for="send"><img src="images/send.svg"/></label>
<input type="submit" id="send" disabled/>