Skip to content

Commit

Permalink
Fixed issues #14, #15, #16
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohamedin committed Jan 4, 2023
1 parent 58592bd commit f9a9de3
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Once installed, you will see an option to create a Draw.io diagram/whiteboard fr
## Installation ##
1. Copy Nextcloud draw.io integration app ("drawio" directory) to your Nextcloud server into the /apps/ directory
2. Go to "Apps" > "+ Apps" > "Not Enabled" and _Enable_ the **Draw.io** application
3. Go to "Admin settings > Additional settings" ( /index.php/settings/admin/additional ) and click the "Save" button to register MIME types.
3. Go to "Admin settings > Draw.io" ( /index.php/settings/admin/drawio ) and click the "Save" button to register MIME types.


## Known Issues ##
Expand Down
5 changes: 5 additions & 0 deletions drawio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 2.0.2

- Fixed preview bug (issue #14 and #16)
- Added draw.io own section to the admin settings (issue #15)

## 2.0.1

- Fixed saving in offline mode and draw.io versions < 20.8.0
Expand Down
3 changes: 2 additions & 1 deletion drawio/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<name>Draw.io</name>
<summary>Draw.io integration app</summary>
<description><![CDATA[Integrates draw.io diagrams editor with Nextcloud]]></description>
<version>2.0.1</version>
<version>2.0.2</version>
<licence>agpl</licence>
<author>JGraph Ltd</author>
<namespace>Drawio</namespace>
Expand All @@ -24,6 +24,7 @@
</dependencies>
<settings>
<admin>OCA\Drawio\Settings\Admin</admin>
<admin-section>OCA\Drawio\Settings\Section</admin-section>
</settings>
<repair-steps>
<install>
Expand Down
18 changes: 18 additions & 0 deletions drawio/img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions drawio/lib/Preview/DrawioPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public function getMimeType(): string
public function isAvailable(FileInfo $file): bool
{
$prevFile = $this->getPreviewFile($file->getId());
return ($this->appConfig->getPreviews() === 'yes') && $prevFile !== false &&
return ($this->appConfig->GetPreviews() === 'yes') && $prevFile !== false &&
$prevFile->getMtime() >= $file->getMtime();
}

public function getThumbnail($path, $maxX, $maxY, $scalingup, $view)
{
$thumbnail = $this->getPreviewFile($view->getFileInfo($path)->getId());

if ($this->appConfig->getPreviews() === 'no' || $thumbnail === false) {
if ($this->appConfig->GetPreviews() === 'no' || $thumbnail === false) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion drawio/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getForm()

public function getSection()
{
return "additional";
return "drawio";
}

public function getPriority()
Expand Down
35 changes: 35 additions & 0 deletions drawio/lib/Settings/Section.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace OCA\Drawio\Settings;

use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class Section implements IIconSection {
/** @var IURLGenerator */
private $url;
/** @var IL10N */
private $l10n;

public function __construct(IURLGenerator $url, IL10N $l10n) {
$this->url = $url;
$this->l10n = $l10n;
}

public function getID() {
return 'drawio';
}

public function getName() {
return $this->l10n->t('Draw.io');
}

public function getPriority() {
return 75;
}

public function getIcon() {
return $this->url->imagePath('drawio', 'app-dark.svg');
}
}

0 comments on commit f9a9de3

Please sign in to comment.