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

Commit a46b0e5

Browse files
committed
Implement font-based mime icons.
1 parent 0678397 commit a46b0e5

File tree

18 files changed

+198
-69
lines changed

18 files changed

+198
-69
lines changed

core/src/core/classes/class.AJXP_Utils.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@ public static function mimetype($fileName, $mode, $isDir)
497497
if (!isSet($mime)) {
498498
$mime = $EXTENSIONS["ajxp_empty"];
499499
}
500-
if (is_numeric($mime[2]) || array_key_exists($mime[2], $mess)) {
501-
$mime[2] = $mess[$mime[2]];
500+
if (is_numeric($mime[3]) || array_key_exists($mime[3], $mess)) {
501+
$mime[3] = $mess[$mime[3]];
502502
}
503-
return (($mode == "image" ? $mime[1] : $mime[2]));
503+
return (($mode == "image" ? $mime[1] : $mime[3]));
504504
}
505505

506506
public static $registeredExtensions;
@@ -524,7 +524,7 @@ public static function mimeData($fileName, $isDir)
524524
if (!isSet($mime)) {
525525
$mime = self::$registeredExtensions["ajxp_empty"];
526526
}
527-
return array($mime[2], $mime[1]);
527+
return array($mime[3], $mime[1], $mime[2]);
528528

529529
}
530530

core/src/core/classes/class.ConfService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,12 @@ public function getRegisteredExtensionsInst()
13681368
$nodes = AJXP_PluginsService::getInstance()->searchAllManifests("//extensions/extension", "nodes", true);
13691369
$res = array();
13701370
foreach ($nodes as $node) {
1371-
$res[$node->getAttribute("mime")] = array($node->getAttribute("mime"), $node->getAttribute("icon"), $node->getAttribute("messageId"));
1371+
$res[$node->getAttribute("mime")] = array(
1372+
$node->getAttribute("mime"),
1373+
$node->getAttribute("icon"),
1374+
$node->getAttribute("font"),
1375+
$node->getAttribute("messageId")
1376+
);
13721377
}
13731378
if (count($res)) {
13741379
$EXTENSIONS = array_merge($EXTENSIONS, $res);

core/src/plugins/access.fs/class.fsAccessDriver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,13 +1231,17 @@ public function loadNodeInfo(&$ajxpNode, $parentNode = false, $details = false)
12311231
if (RecycleBinManager::recycleEnabled() && $ajxpNode->getPath() == RecycleBinManager::getRelativeRecycle()) {
12321232
$recycleIcon = ($this->countFiles($ajxpNode->getUrl(), false, true)>0?"trashcan_full.png":"trashcan.png");
12331233
$metaData["icon"] = $recycleIcon;
1234+
$metaData["fonticon"] = "delete";
12341235
$metaData["mimestring"] = $mess[122];
12351236
$ajxpNode->setLabel($mess[122]);
12361237
$metaData["ajxp_mime"] = "ajxp_recycle";
12371238
} else {
12381239
$mimeData = AJXP_Utils::mimeData($ajxpNode->getUrl(), !$isLeaf);
12391240
$metaData["mimestring_id"] = $mimeData[0]; //AJXP_Utils::mimetype($ajxpNode->getUrl(), "type", !$isLeaf);
12401241
$metaData["icon"] = $mimeData[1]; //AJXP_Utils::mimetype($nodeName, "image", !$isLeaf);
1242+
if(!empty($mimeData[2])){
1243+
$metaData["fonticon"] = $mimeData[2];
1244+
}
12411245
if ($metaData["icon"] == "folder.png") {
12421246
$metaData["openicon"] = "folder_open.png";
12431247
}

core/src/plugins/action.compression/manifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
<registry_contributions>
1313
<extensions>
14-
<extension mime="tar" icon="archive.png" messageId="61"/>
15-
<extension mime="bz2" icon="archive.png" messageId="61"/>
14+
<extension mime="tar" font="archive" icon="archive.png" messageId="61"/>
15+
<extension mime="bz2" font="archive" icon="archive.png" messageId="61"/>
1616
</extensions>
1717
<actions>
1818
<action name="compression">

core/src/plugins/action.timestamp/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
</actions>
8181
<extensions>
82-
<extension icon="timestamp_images/mimes/ICON_SIZE/horo.png" messageId="CONF_MESSAGE[timestamp]" mime="ers"/>
82+
<extension icon="timestamp_images/mimes/ICON_SIZE/horo.png" font="timer" messageId="CONF_MESSAGE[timestamp]" mime="ers"/>
8383
</extensions>
8484
</registry_contributions>
8585
<dependencies>

core/src/plugins/core.ajaxplorer/ajxp_registry.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@
512512
<xs:attribute name="mime" use="required" type="xs:NCName"/>
513513
<xs:attribute name="messageId" use="required" type="xs:all"/>
514514
<xs:attribute name="icon" use="required"/>
515+
<xs:attribute name="font" type="xs:all"/>
515516
</xs:complexType>
516517
</xs:element>
517518
<xs:element name="processing">

core/src/plugins/editor.browser/manifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
</action>
7878
</actions>
7979
<extensions>
80-
<extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" messageId="openbrowser.7" mime="url"/>
81-
<extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" messageId="openbrowser.7" mime="website"/>
80+
<extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" font="link" messageId="openbrowser.7" mime="url"/>
81+
<extension icon="openbrowser_images/mimes/ICON_SIZE/earth.png" font="web" messageId="openbrowser.7" mime="website"/>
8282
</extensions>
8383
</registry_contributions>
8484
</editor>

core/src/plugins/editor.etherpad/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
</action>
121121
</actions>
122122
<extensions>
123-
<extension icon="etherpad/discussion.png" messageId="etherpad.1" mime="pad"/>
123+
<extension icon="etherpad/discussion.png" messageId="etherpad.1" font="comment-multiple-outline" mime="pad"/>
124124
</extensions>
125125
<hooks>
126126
<!--<serverCallback methodName="hideExtension" hookName="node.info"/>-->
1.85 KB
Loading

core/src/plugins/editor.video/class.VideoPreviewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ preload="auto" width="#{WIDTH}" height="#{HEIGHT}" data-setup="{}">\n\
236236
}
237237
return div;
238238
}else{
239-
return new Element('img', {src:resolveImageSource(ajxpNode.getIcon(),'/images/mimes/ICON_SIZE',64)});
239+
return AbstractEditor.prototype.getPreview(ajxpNode);
240240
}
241241
},
242242

0 commit comments

Comments
 (0)