Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Implement font-based mime icons.
Browse files Browse the repository at this point in the history
(cherry picked from commit a46b0e5)
  • Loading branch information
cdujeu committed Jul 12, 2016
1 parent 98d447e commit 72f88e2
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 30 deletions.
4 changes: 2 additions & 2 deletions core/src/plugins/action.compression/manifest.xml
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.timestamp/manifest.xml
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/ajxp_registry.xsd
Expand Up @@ -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">
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/editor.browser/manifest.xml
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion core/src/plugins/editor.etherpad/manifest.xml
Expand Up @@ -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"/>-->
Expand Down
Binary file modified core/src/plugins/editor.soundmanager/player_bg_icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion core/src/plugins/editor.video/class.VideoPreviewer.js
Expand Up @@ -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);
}
},

Expand Down
30 changes: 15 additions & 15 deletions core/src/plugins/editor.zoho/manifest.xml
Expand Up @@ -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>
Expand Down
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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");
}

});
Expand Up @@ -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
Expand Down
Expand Up @@ -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";
}

4 changes: 2 additions & 2 deletions core/src/plugins/uploader.http/manifest.xml
Expand Up @@ -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">
Expand Down

0 comments on commit 72f88e2

Please sign in to comment.