aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php6
-rw-r--r--Zotlabs/Module/Wiki.php36
-rw-r--r--view/tpl/wikilist.tpl4
3 files changed, 37 insertions, 9 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index 558a70a3c..4b637781e 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -607,11 +607,11 @@ class NativeWikiPage {
}
static public function get_file_ext($arr) {
- if($arr['mimeType'] === 'text/bbcode')
+ if($arr['mimetype'] === 'text/bbcode')
return '.bb';
- elseif($arr['mimeType'] === 'text/markdown')
+ elseif($arr['mimetype'] === 'text/markdown')
return '.md';
- elseif($arr['mimeType'] === 'text/plain')
+ elseif($arr['mimetype'] === 'text/plain')
return '.txt';
}
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 1eb600f51..9a30d1b42 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -113,12 +113,13 @@ class Wiki extends \Zotlabs\Web\Controller {
$o = '';
// Download a wiki
-/*
+
if((argc() > 3) && (argv(2) === 'download') && (argv(3) === 'wiki')) {
$resource_id = argv(4);
+ $w = Zlib\NativeWiki::get_wiki($owner['channel_id'],$observer_hash,$resource_id);
- $w = Zlib\NativeWiki::get_wiki($owner,$observer_hash,$resource_id);
+// $w = Zlib\NativeWiki::get_wiki($owner,$observer_hash,$resource_id);
if(! $w['htmlName']) {
notice(t('Error retrieving wiki') . EOL);
}
@@ -133,8 +134,35 @@ class Wiki extends \Zotlabs\Web\Controller {
$zip_filename = $w['urlName'];
$zip_filepath = '/tmp/' . $zip_folder_name . '/' . $zip_filename;
+
// Generate the zip file
- ZLib\ExtendedZip::zipTree($w['path'], $zip_filepath, \ZipArchive::CREATE);
+
+ $zip = new \ZipArchive;
+ $r = $zip->open($zip_filepath, \ZipArchive::CREATE);
+ if($r === true) {
+ $i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'",
+ dbesc($resource_id)
+ );
+ if($i) {
+ foreach($i as $iv) {
+ if($iv['mimetype'] === 'text/plain') {
+ $content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
+ }
+ elseif($iv['mimetype'] === 'text/bbcode') {
+ $content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
+ }
+ elseif($iv['mimetype'] === 'text/markdown') {
+ $content = html_entity_decode(\Zlib\MarkdownSoap::unescape($iv['body']),ENT_COMPAT,'UTF-8');
+ }
+ $fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . Zlib\NativeWikiPage::get_file_ext($iv);
+ $zip->addFromString($fname,$content);
+ }
+
+
+ }
+
+ }
+ $zip->close();
// Output the file for download
@@ -153,7 +181,7 @@ class Wiki extends \Zotlabs\Web\Controller {
killme();
}
-*/
+
switch(argc()) {
case 2:
$wikis = Zlib\NativeWiki::listwikis($owner, get_observer_hash());
diff --git a/view/tpl/wikilist.tpl b/view/tpl/wikilist.tpl
index 2deec76c0..1a750aec4 100644
--- a/view/tpl/wikilist.tpl
+++ b/view/tpl/wikilist.tpl
@@ -30,7 +30,7 @@
<th width="96%">{{$name}}</th>
<th width="1%">{{$type}}</th>
<th width="1%" class="wikis-index-tool"></th>
- <!-- th width="1%" class="wikis-index-tool"></th -->
+ <th width="1%" class="wikis-index-tool"></th>
{{if $owner}}
<th width="1%"></th>
{{/if}}
@@ -45,7 +45,7 @@
<ul id="panel-{{$wiki.id}}" class="lockview-panel dropdown-menu dropdown-menu-right"></ul>
{{/if}}
</td>
- <!-- td class="wiki-index-tool"><i class="fa fa-download fakelink" onclick="wiki_download_wiki('{{$wiki.resource_id}}'); return false;"></i></td -->
+ <td class="wiki-index-tool"><i class="fa fa-download fakelink" onclick="wiki_download_wiki('{{$wiki.resource_id}}'); return false;"></i></td>
{{if $owner}}
<td><i class="fa fa-trash-o drop-icons" onclick="wiki_delete_wiki('{{$wiki.title}}', '{{$wiki.resource_id}}'); return false;"></i></td>
{{/if}}