diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-08-19 19:32:52 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-08-19 19:32:52 -0400 |
commit | 40a7d3821098c095a01e2a30b2b49c53bb38e2cf (patch) | |
tree | d5b9ba8b822752911b5a325a68b9fb8f1edf3dae | |
parent | f2e87a204d0a257edb501dfedaad867700c58842 (diff) | |
download | volse-hubzilla-40a7d3821098c095a01e2a30b2b49c53bb38e2cf.tar.gz volse-hubzilla-40a7d3821098c095a01e2a30b2b49c53bb38e2cf.tar.bz2 volse-hubzilla-40a7d3821098c095a01e2a30b2b49c53bb38e2cf.zip |
Pages populate the available-to-export list. New checkbox class for smaller boxes.
-rw-r--r-- | Zotlabs/Module/Webpages.php | 14 | ||||
-rw-r--r-- | include/import.php | 62 | ||||
-rw-r--r-- | view/css/mod_webpages.css | 74 | ||||
-rw-r--r-- | view/tpl/webpage_export_list.tpl | 42 |
4 files changed, 182 insertions, 10 deletions
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php index 439d60a89..b927f95df 100644 --- a/Zotlabs/Module/Webpages.php +++ b/Zotlabs/Module/Webpages.php @@ -41,7 +41,6 @@ class Webpages extends \Zotlabs\Web\Controller { $uid = local_channel(); $owner = 0; - $channel = null; $observer = \App::get_observer(); $channel = \App::get_channel(); @@ -64,10 +63,19 @@ class Webpages extends \Zotlabs\Web\Controller { break; case 'export_select_list': $_SESSION['action'] = null; + if(!$uid) { + $_SESSION['export'] = null; + break; + } + require_once('include/import.php'); + + $elements = get_webpage_elements($channel, 'pages'); + logger(json_encode($elements), LOGGER_DEBUG); $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' + '$pages' => $elements['pages'], )); $_SESSION['export'] = null; return $o; @@ -243,7 +251,6 @@ class Webpages extends \Zotlabs\Web\Controller { } function post() { - logger(json_encode($_REQUEST), LOGGER_DEBUG); $action = $_REQUEST['action']; if( $action ){ switch ($action) { @@ -396,11 +403,10 @@ class Webpages extends \Zotlabs\Web\Controller { 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'); + $filename = filter_var($_POST['filename'], FILTER_SANITIZE_ENCODED); } else { $filename = 'website.zip'; } diff --git a/include/import.php b/include/import.php index 84881a420..f7df636f3 100644 --- a/include/import.php +++ b/include/import.php @@ -1472,3 +1472,65 @@ function scan_webpage_elements($path, $type, $cloud = false) { return $element; } + +function get_webpage_elements($channel, $type = 'all') { + $elements = array(); + if(!$channel['channel_id']) { + return null; + } + switch ($type) { + case 'pages': + $elements['pages'] = null; + $owner = $channel['channel_id']; + + $sql_extra = item_permissions_sql($owner); + + + $r = q("select * from iconfig left join item on iconfig.iid = item.id + where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'WEBPAGE' and item_type = %d + $sql_extra order by item.created desc", + intval($owner), + intval(ITEM_TYPE_WEBPAGE) + ); + + $pages = null; + + if($r) { + $elements['pages'] = array(); + $pages = array(); + foreach($r as $rr) { + unobscure($rr); + + //$lockstate = (($rr['allow_cid'] || $rr['allow_gid'] || $rr['deny_cid'] || $rr['deny_gid']) ? 'lock' : 'unlock'); + + $element_arr = array( + 'type' => 'webpage', + 'title' => $rr['title'], + 'body' => $rr['body'], + 'created' => $rr['created'], + 'edited' => $rr['edited'], + 'mimetype' => $rr['mimetype'], + 'pagetitle' => $rr['v'], + 'mid' => $rr['mid'], + 'layout_mid' => $rr['layout_mid'] + ); + $pages[$rr['iid']][] = array( + 'url' => $rr['iid'], + 'pagetitle' => $rr['v'], + 'title' => $rr['title'], + 'created' => datetime_convert('UTC',date_default_timezone_get(),$rr['created']), + 'edited' => datetime_convert('UTC',date_default_timezone_get(),$rr['edited']), + 'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]', + //'lockstate' => $lockstate + ); + $elements['pages'][] = $element_arr; + } + + } + break; + + default: + return null; + } + return $elements; +}
\ No newline at end of file diff --git a/view/css/mod_webpages.css b/view/css/mod_webpages.css index f72f632dd..805d95dc2 100644 --- a/view/css/mod_webpages.css +++ b/view/css/mod_webpages.css @@ -119,3 +119,77 @@ opacity: 1; } + +/* SQUARED THREE */ +.squaredThree { + width: 14px; + height: 14px; + background: #fcfff4; + + background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); + background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); + background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); + background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); + background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 ); + margin: 5px auto; + + -webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); + -moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); + box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5); + position: relative; +} + +.squaredThree label { + cursor: pointer; + position: absolute; + width: 10px; + height: 10px; + left: 2px; + top: 2px; + + -webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1); + -moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1); + box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1); + + background: -webkit-linear-gradient(top, #222 0%, #45484d 100%); + background: -moz-linear-gradient(top, #222 0%, #45484d 100%); + background: -o-linear-gradient(top, #222 0%, #45484d 100%); + background: -ms-linear-gradient(top, #222 0%, #45484d 100%); + background: linear-gradient(top, #222 0%, #45484d 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 ); +} + +.squaredThree label:after { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + opacity: 0; + content: ''; + position: absolute; + width: 9px; + height: 5px; + background: transparent; + top: 2px; + left: 2px; + border: 3px solid #fcfff4; + border-top: none; + border-right: none; + + -webkit-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + transform: rotate(-45deg); +} + +.squaredThree label:hover::after { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; + filter: alpha(opacity=30); + opacity: 0.3; +} + +.squaredThree input[type=checkbox]:checked + label:after { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); + opacity: 1; +}
\ No newline at end of file diff --git a/view/tpl/webpage_export_list.tpl b/view/tpl/webpage_export_list.tpl index 4ee14359d..1b943ace8 100644 --- a/view/tpl/webpage_export_list.tpl +++ b/view/tpl/webpage_export_list.tpl @@ -9,13 +9,43 @@ <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> Toggle Select All</button> - </div> - <div class="clear"></div> - + <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> Toggle Select All</button> + </div> + + <div class="clear"></div> + <h4>Pages</h4> + <div> + <table class="table-striped table-responsive table-hover" style="width: 100%;"> + <tr><td>Export?</td><td>Page Title</td><td>Page Link</td><td>Type</td></tr> + {{foreach $pages as $page}} + <tr> + <td> + <div class='squaredThree'> + <input type="checkbox" id="page_{{$page.mid}}" name="page[]" value="{{$page.mid}}"> + <label for="page_{{$page.mid}}"></label> + </div> + </td> + <td> + <div class='desc'> + {{$page.title}}<br> + </div> + </td> + <td> + <div class='desc'> + {{$page.pagetitle}}<br> + </div> + </td> + <td> + <div class='desc'> + {{$page.mimetype}}<br> + </div> + </td> + </tr> + {{/foreach}} + </table> + </div> </div> - <div class="clear"></div> </form> </div> |