Permalink
Browse files

Implement font-based mime icons.

(cherry picked from commit a46b0e5)
  • Loading branch information...
1 parent 98d447e commit 72f88e2414dd0c1f0b7d30d89e59e917362458a9 @cdujeu cdujeu committed Jul 5, 2016
@@ -11,8 +11,8 @@
<registry_contributions>
<extensions>
- <extension mime="tar" icon="archive.png" messageId="61"/>
- <extension mime="bz2" icon="archive.png" messageId="61"/>
+ <extension mime="tar" font="archive" icon="archive.png" messageId="61"/>
+ <extension mime="bz2" font="archive" icon="archive.png" messageId="61"/>
</extensions>
<actions>
<action name="compression">
@@ -79,7 +79,7 @@
</actions>
<extensions>
- <extension icon="timestamp_images/mimes/ICON_SIZE/horo.png" messageId="CONF_MESSAGE[timestamp]" mime="ers"/>
+ <extension icon="timestamp_images/mimes/ICON_SIZE/horo.png" font="timer" messageId="CONF_MESSAGE[timestamp]" mime="ers"/>
</extensions>
</registry_contributions>
<dependencies>
@@ -512,6 +512,7 @@
<xs:attribute name="mime" use="required" type="xs:NCName"/>
<xs:attribute name="messageId" use="required" type="xs:all"/>
<xs:attribute name="icon" use="required"/>
+ <xs:attribute name="font" type="xs:all"/>
</xs:complexType>
</xs:element>
<xs:element name="processing">
@@ -77,8 +77,8 @@
</action>
</actions>
<extensions>
- <extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" messageId="openbrowser.7" mime="url"/>
- <extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" messageId="openbrowser.7" mime="website"/>
+ <extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" font="link" messageId="openbrowser.7" mime="url"/>
+ <extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" font="web" messageId="openbrowser.7" mime="website"/>
</extensions>
</registry_contributions>
</editor>
@@ -120,7 +120,7 @@
</action>
</actions>
<extensions>
- <extension icon="etherpad/discussion.png" messageId="etherpad.1" mime="pad"/>
+ <extension icon="etherpad/discussion.png" messageId="etherpad.1" font="comment-multiple-outline" mime="pad"/>
</extensions>
<hooks>
<!--<serverCallback methodName="hideExtension" hookName="node.info"/>-->
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -237,7 +237,7 @@ preload="auto" width="#{WIDTH}" height="#{HEIGHT}" data-setup="{}">\n\
}
return div;
}else{
- return new Element('img', {src:resolveImageSource(ajxpNode.getIcon(),'/images/mimes/ICON_SIZE',64)});
+ return AbstractEditor.prototype.getPreview(ajxpNode);
}
},
@@ -39,21 +39,21 @@
</action>
</actions>
<extensions>
- <extension icon="zoho_img/mimes/ICON_SIZE/word.png" messageId="zoho_editor.3" mime="doc"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/word.png" messageId="zoho_editor.3" mime="docx"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/word.png" messageId="zoho_editor.3" mime="odt"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/word.png" messageId="zoho_editor.3" mime="sxw"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/word.png" messageId="zoho_editor.3" mime="rtf"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" messageId="zoho_editor.5" mime="xls"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" messageId="zoho_editor.5" mime="xlsx"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" messageId="zoho_editor.5" mime="ods"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" messageId="zoho_editor.5" mime="sxc"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" messageId="zoho_editor.5" mime="csv"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" messageId="zoho_editor.5" mime="tsv"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" messageId="zoho_editor.4" mime="ppt"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" messageId="zoho_editor.4" mime="pps"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" messageId="zoho_editor.4" mime="odp"/>
- <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" messageId="zoho_editor.4" mime="sxi"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/word.png" font="file-word" messageId="zoho_editor.3" mime="doc"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/word.png" font="file-word" messageId="zoho_editor.3" mime="docx"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/word.png" font="file-word" messageId="zoho_editor.3" mime="odt"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/word.png" font="file-word" messageId="zoho_editor.3" mime="sxw"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/word.png" font="file-word" messageId="zoho_editor.3" mime="rtf"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" font="file-excel" messageId="zoho_editor.5" mime="xls"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" font="file-excel" messageId="zoho_editor.5" mime="xlsx"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" font="file-excel" messageId="zoho_editor.5" mime="ods"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" font="file-excel" messageId="zoho_editor.5" mime="sxc"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" font="file-excel" messageId="zoho_editor.5" mime="csv"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/spreadsheet.png" font="file-excel" messageId="zoho_editor.5" mime="tsv"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" font="file-powerpoint" messageId="zoho_editor.4" mime="ppt"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" font="file-powerpoint" messageId="zoho_editor.4" mime="pps"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" font="file-powerpoint" messageId="zoho_editor.4" mime="odp"/>
+ <extension icon="zoho_img/mimes/ICON_SIZE/presentation.png" font="file-powerpoint" messageId="zoho_editor.4" mime="sxi"/>
</extensions>
</registry_contributions>
<dependencies>
@@ -488,7 +488,13 @@ Class.create("AbstractEditor" , {
if(!ajxpNode.isLeaf()) src = resolveImageSource('folder.png', "/images/mimes/ICON_SIZE", 64);
else src = resolveImageSource('mime_empty.png', "/images/mimes/ICON_SIZE", 64);
}
- var imgObject = new Element("img", {src:src, width:64, height:64, align:'absmiddle', border:0});
+ var svg = AbstractEditor.prototype.getSvgSource(ajxpNode);
+ var imgObject;
+ if(svg){
+ imgObject = new Element("div", {className:"mimefont mdi mdi-"+svg, style:"font-size:28px;", "data-is_loaded": "true"});
+ }else{
+ imgObject = new Element("img", {src:src, width:28, height:28, align:'absmiddle', border:0});
+ }
imgObject.resizePreviewElement = function(dimensionObject){
dimensionObject.maxWidth = dimensionObject.maxHeight = 64;
var styleObject = fitRectangleToDimension({width:64,height:64},dimensionObject);
@@ -497,8 +503,15 @@ Class.create("AbstractEditor" , {
var mT = parseInt((dimensionObject.width - 64)/2) + dimensionObject.margin;
var mB = dimensionObject.width+(dimensionObject.margin*2)-newHeight-mT-1;
styleObject.marginTop = mT + "px";
- styleObject.marginBottom = mB + "px";
- }
+ styleObject.marginBottom = mB + "px";
+ if(svg){
+ styleObject.fontSize = styleObject.height;
+ styleObject.lineHeight = "50px";
+ }
+ }else if(svg){
+ styleObject.fontSize = styleObject.height;
+ styleObject.lineHeight = styleObject.height;
+ }
this.setStyle(styleObject);
}.bind(imgObject);
return imgObject;
@@ -511,6 +524,15 @@ Class.create("AbstractEditor" , {
*/
getThumbnailSource : function(ajxpNode){
return resolveImageSource(ajxpNode.getIcon(), "/images/mimes/ICON_SIZE", 64);
- }
+ },
+
+ /**
+ * Return SVG Icon if it exists
+ * @param ajxpNode
+ * @returns {V}
+ */
+ getSvgSource: function(ajxpNode){
+ return svg = ajxpNode.getMetadata().get("fonticon");
+ }
});
@@ -610,7 +610,7 @@ Class.create("InfoPanel", AjxpPane, {
}
}
}
- return '<img src="' + resolveImageSource(ajxpNode.getIcon(), '/images/mimes/ICON_SIZE',64) + '" height="64" width="64">';
+ return AbstractEditor.prototype.getPreview(ajxpNode).outerHTML; // '<img src="' + resolveImageSource(ajxpNode.getIcon(), '/images/mimes/ICON_SIZE',64) + '" height="64" width="64">';
},
/**
* Parses config node
@@ -70,4 +70,96 @@
.mdi-radar:before {
content: "\f526";
-}
+}
+
+.mdi-archive:before {
+ content: "\f13a";
+}
+
+.mdi-drawing-box:before {
+ content: "\f2d4";
+}
+
+.mdi-delete:before {
+ content: "\f2b5";
+}
+
+.mdi-file-document:before {
+ content: "\f30e";
+}
+
+.mdi-file-excel:before {
+ content: "\f310";
+}
+
+.mdi-file-image:before {
+ content: "\f314";
+}
+
+.mdi-file-music:before {
+ content: "\f318";
+}
+.mdi-file-pdf:before {
+ content: "\f31a";
+}
+
+.mdi-file-powerpoint:before {
+ content: "\f31c";
+}
+
+.mdi-file-video:before {
+ content: "\f320";
+}
+
+.mdi-file-word:before {
+ content: "\f321";
+}
+
+.mdi-file-xml:before {
+ content: "\f323";
+}
+
+.mdi-language-css3:before {
+ content: "\f40e";
+}
+
+.mdi-language-html5:before {
+ content: "\f40f";
+}
+
+.mdi-language-javascript:before {
+ content: "\f410";
+}
+
+.mdi-language-php:before {
+ content: "\f411";
+}
+
+.mdi-movie:before {
+ content: "\f472";
+}
+
+.mdi-timer:before {
+ content: "\f609";
+}
+
+.mdi-link:before {
+ content: "\f429";
+}
+
+.mdi-web:before {
+ content: "\f68c";
+}
+
+.mdi-comment-multiple-outline:before {
+ content: "\f277";
+}
+
+.mdi-cloud-download:before {
+ content: "\f258";
+}
+
+.mdi-file-import:before {
+ content: "\f315";
+}
+
@@ -10,8 +10,8 @@
</client_settings>
<registry_contributions>
<extensions>
- <extension mime="download" messageId="httpdownloader.17" icon="httpdownloader_images/ICON_SIZE/kget_list.png"/>
- <extension mime="dlpart" messageId="httpdownloader.18" icon="exe.png"/>
+ <extension mime="download" messageId="httpdownloader.17" font="cloud-download" icon="httpdownloader_images/ICON_SIZE/kget_list.png"/>
+ <extension mime="dlpart" messageId="httpdownloader.18" font="file-import" icon="exe.png"/>
</extensions>
<actions>
<action name="external_download">

0 comments on commit 72f88e2

Please sign in to comment.