aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-08-17 21:25:50 -0400
committerAndrew Manning <tamanning@zoho.com>2016-08-17 21:25:50 -0400
commitf2e87a204d0a257edb501dfedaad867700c58842 (patch)
treeadf61dd77dedbb332c5e48fe0e297da54047d7f8
parentc98b91f5149d53f522a19ec0f69b4d4727d34896 (diff)
downloadvolse-hubzilla-f2e87a204d0a257edb501dfedaad867700c58842.tar.gz
volse-hubzilla-f2e87a204d0a257edb501dfedaad867700c58842.tar.bz2
volse-hubzilla-f2e87a204d0a257edb501dfedaad867700c58842.zip
Progress implementing zip file export
-rw-r--r--Zotlabs/Module/Webpages.php26
-rw-r--r--include/text.php32
-rw-r--r--include/widgets.php19
-rw-r--r--view/pdl/mod_webpages.pdl3
-rw-r--r--view/tpl/webpage_export_list.tpl21
-rw-r--r--view/tpl/website_export_tools.tpl14
-rw-r--r--view/tpl/website_portation_tools.tpl (renamed from view/tpl/website_import_tools.tpl)29
7 files changed, 80 insertions, 64 deletions
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index 0a48d43c6..439d60a89 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -62,6 +62,16 @@ class Webpages extends \Zotlabs\Web\Controller {
case 'importselected':
$_SESSION['action'] = null;
break;
+ case 'export_select_list':
+ $_SESSION['action'] = null;
+ $o .= replace_macros(get_markup_template('webpage_export_list.tpl'), array(
+ '$title' => t('Export Webpage Elements'),
+ '$exportbtn' => t('Export selected'),
+ '$action' => $_SESSION['export'], // value should be 'zipfile' or 'cloud'
+ ));
+ $_SESSION['export'] = null;
+ return $o;
+
default :
$_SESSION['action'] = null;
break;
@@ -233,7 +243,7 @@ class Webpages extends \Zotlabs\Web\Controller {
}
function post() {
-
+ logger(json_encode($_REQUEST), LOGGER_DEBUG);
$action = $_REQUEST['action'];
if( $action ){
switch ($action) {
@@ -382,7 +392,19 @@ class Webpages extends \Zotlabs\Web\Controller {
info( t('Import complete.') . EOL);
}
break;
-
+
+ case 'exportzipfile':
+
+ if(isset($_POST['w_download'])) {
+ logger($_POST['w_download'], LOGGER_DEBUG);
+ $_SESSION['action'] = 'export_select_list';
+ $_SESSION['export'] = 'zipfile';
+ if(isset($_POST['filename'])) {
+ $filename = filter_var($_POST['filename'], 'FILTER_SANITIZE_ENCODED');
+ } else {
+ $filename = 'website.zip';
+ }
+ }
default :
break;
}
diff --git a/include/text.php b/include/text.php
index c8e0b1888..1729048e9 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2267,11 +2267,11 @@ function design_tools() {
}
/**
- * @brief Creates website import tools menu
+ * @brief Creates website portation tools menu
*
* @return string
*/
-function website_import_tools() {
+function website_portation_tools() {
$channel = App::get_channel();
$sys = false;
@@ -2282,7 +2282,7 @@ function website_import_tools() {
$sys = true;
}
- return replace_macros(get_markup_template('website_import_tools.tpl'), array(
+ return replace_macros(get_markup_template('website_portation_tools.tpl'), array(
'$title' => t('Import'),
'$import_label' => t('Import website...'),
'$import_placeholder' => t('Select folder to import'),
@@ -2290,29 +2290,11 @@ function website_import_tools() {
'$file_import_text' => t('Import from cloud files:'),
'$desc' => t('/cloud/channel/path/to/folder'),
'$hint' => t('Enter path to website files'),
- '$select' => t('Select folder'),
- ));
-}
-
-/**
- * @brief Creates website export tools menu
- *
- * @return string
- */
-function website_export_tools() {
-
- $channel = App::get_channel();
- $sys = false;
-
- if(App::$is_sys && is_site_admin()) {
- require_once('include/channel.php');
- $channel = get_sys_channel();
- $sys = true;
- }
-
- return replace_macros(get_markup_template('website_export_tools.tpl'), array(
- '$title' => t('Export'),
+ '$select' => t('Select folder'),
'$export_label' => t('Export website...'),
+ '$file_download_text' => t('Export to a zip file'),
+ '$filename_desc' => t('website.zip'),
+ '$filename_hint' => t('Enter a name for the zip file.'),
));
}
diff --git a/include/widgets.php b/include/widgets.php
index fc2a9830b..2f8416f8e 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -779,7 +779,7 @@ function widget_design_tools($arr) {
return design_tools();
}
-function widget_website_import_tools($arr) {
+function widget_website_portation_tools($arr) {
// mod menu doesn't load a profile. For any modules which load a profile, check it.
// otherwise local_channel() is sufficient for permissions.
@@ -791,22 +791,7 @@ function widget_website_import_tools($arr) {
if(! local_channel())
return '';
- return website_import_tools();
-}
-
-function widget_website_export_tools($arr) {
-
- // mod menu doesn't load a profile. For any modules which load a profile, check it.
- // otherwise local_channel() is sufficient for permissions.
-
- if(App::$profile['profile_uid'])
- if((App::$profile['profile_uid'] != local_channel()) && (! App::$is_sys))
- return '';
-
- if(! local_channel())
- return '';
-
- return website_export_tools();
+ return website_portation_tools();
}
function widget_findpeople($arr) {
diff --git a/view/pdl/mod_webpages.pdl b/view/pdl/mod_webpages.pdl
index 292d6791c..9e4d604ba 100644
--- a/view/pdl/mod_webpages.pdl
+++ b/view/pdl/mod_webpages.pdl
@@ -1,5 +1,4 @@
[region=aside]
[widget=design_tools][/widget]
-[widget=website_import_tools][/widget]
-[widget=website_export_tools][/widget]
+[widget=website_portation_tools][/widget]
[/region] \ No newline at end of file
diff --git a/view/tpl/webpage_export_list.tpl b/view/tpl/webpage_export_list.tpl
new file mode 100644
index 000000000..4ee14359d
--- /dev/null
+++ b/view/tpl/webpage_export_list.tpl
@@ -0,0 +1,21 @@
+<div class="generic-content-wrapper">
+ <form action="" method="post" autocomplete="on" >
+ <input type="hidden" name="action" value="{{$action}}">
+ <div class="section-title-wrapper">
+ <div class="pull-right">
+ <button class="btn btn-md btn-success" type="submit" name="submit" value="{{$exportbtn}}">{{$exportbtn}}</button>
+ </div>
+ <h2>{{$title}}</h2>
+ <div class="clear"></div>
+ </div>
+ <div id="import-website-content-wrapper" class="section-content-wrapper">
+ <div class="pull-left">
+ <button id="toggle-select-all" class="btn btn-xs btn-primary" onclick="checkedAll(window.isChecked); return false;"><i class="fa fa-check"></i>&nbsp;Toggle Select All</button>
+ </div>
+ <div class="clear"></div>
+
+ </div>
+ <div class="clear"></div>
+ </form>
+</div>
+
diff --git a/view/tpl/website_export_tools.tpl b/view/tpl/website_export_tools.tpl
deleted file mode 100644
index 36f5c8e24..000000000
--- a/view/tpl/website_export_tools.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<div id="website-export-tools" class="widget">
- <h3>{{$title}}</h3>
- <ul class="nav nav-pills nav-stacked">
- <li>
- <a href="#" onclick="openClose('export-form');
- return false;"><i class="fa fa-cloud-upload generic-icons"></i> {{$export_label}}</a>
- </li>
- <li>
- <form id="export-form" enctype="multipart/form-data" method="post" action="" style="display: none;" class="sub-menu">
-
- </form>
- </li>
- </ul>
-</div>
diff --git a/view/tpl/website_import_tools.tpl b/view/tpl/website_portation_tools.tpl
index cb3e6b524..d9ebed179 100644
--- a/view/tpl/website_import_tools.tpl
+++ b/view/tpl/website_portation_tools.tpl
@@ -1,16 +1,15 @@
-<div id="website-import-tools" class="widget">
- <h3>{{$title}}</h3>
+<div id="website-portation-tools" class="widget">
<ul class="nav nav-pills nav-stacked">
<li>
<a href="#" onclick="openClose('import-form');
return false;"><i class="fa fa-cloud-upload generic-icons"></i> {{$import_label}}</a>
</li>
- <li>
+ <li style="margin-left: 12px;" >
<form id="import-form" enctype="multipart/form-data" method="post" action="" style="display: none;" class="sub-menu">
<input type="hidden" name="action" value="scan">
- <p style="margin-top: 20px;" class="descriptive-text">{{$file_import_text}}</p>
+ <p style="margin-top: 10px;" class="descriptive-text">{{$file_import_text}}</p>
<div class="form-group">
<div class="input-group">
<input class="widget-input" type="text" name="path" title="{{$hint}}" placeholder="{{$desc}}" />
@@ -34,4 +33,26 @@
</form>
</li>
</ul>
+ <ul class="nav nav-pills nav-stacked">
+ <li>
+ <a href="#" onclick="openClose('export-form');
+ return false;"><i class="fa fa-share-square-o generic-icons"></i> {{$export_label}}</a>
+ </li>
+ <li style="margin-left: 12px;" >
+ <form id="export-form" enctype="multipart/form-data" method="post" action="" style="display: none;" class="sub-menu">
+ <input type="hidden" name="action" value="exportzipfile">
+ <!-- Or download a zipped file containing the website -->
+ <p style="margin-top: 10px;" class="descriptive-text">{{$file_download_text}}</p>
+ <div class="form-group">
+
+ <div class="input-group">
+ <input class="widget-input" type="text" name="filename" title="{{$filename_hint}}" placeholder="{{$filename_desc}}" />
+ <div class="input-group-btn">
+ <button class="btn btn-default btn-sm" type="submit" name="w_download" value="w_download"><i class="fa fa-download generic-icons"></i></button>
+ </div>
+ </div>
+ </div>
+ </form>
+ </li>
+ </ul>
</div>