From e0ff14d4bcc1659675a8c5208d4151a04c2b0de9 Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Tue, 10 Jul 2007 18:48:41 +0000 Subject: [PATCH] issue27, first trial of gallery export for HTML and MoinMoin markup git-svn-id: file:///var/lib/svn/phpfspot/trunk@185 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- phpfspot.class.php | 39 +++++++++++++++++++++++++++++++++++++++ phpfspot.js | 4 +++- rpc.php | 5 +++++ templates/photo_index.tpl | 9 +-------- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/phpfspot.class.php b/phpfspot.class.php index 3a6a590..14dff99 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -64,6 +64,11 @@ class PHPFSPOT { $_SESSION['selected_tags'] = split(',', $_GET['tags']); } break; + case 'export': + $this->tmpl->show("export.tpl"); + return; + break; + } $this->tmpl->assign('content_page', 'welcome.tpl'); @@ -594,7 +599,10 @@ class PHPFSPOT { $extern_link.= "&tags=". $current_tags; } + $export_link = "index.php?mode=export"; + $this->tmpl->assign('extern_link', $extern_link); + $this->tmpl->assign('export_link', $export_link); $this->tmpl->assign('count', $count); $this->tmpl->assign('width', $this->cfg->thumb_width); $this->tmpl->assign('images', $images); @@ -1129,6 +1137,37 @@ class PHPFSPOT { } // get_calendar() + public function getExport($mode) + { + $pictures = $this->getPhotoSelection(); + + if(!isset($_SERVER['HTTPS'])) $protocol = "http"; + else $protocol = "https"; + + $server_name = $_SERVER['SERVER_NAME']; + + foreach($pictures as $picture) { + + $orig_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->photo_width; + $thumb_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width; + + switch($mode) { + + case 'HTML': + // + print htmlspecialchars("") ."
\n"; + break; + + case 'MoinMoin': + // [%pictureurl% %thumbnailurl%] + print htmlspecialchars("[$orig_url $thumb_url]") ."
\n"; + break; + } + + } + + } // getExport() + } ?> diff --git a/phpfspot.js b/phpfspot.js index 4b6a640..ce66cf6 100644 --- a/phpfspot.js +++ b/phpfspot.js @@ -117,7 +117,9 @@ function startTagSearch(searchfor) function setViewMode(mode) { - window.alert(mode); + var exprt = document.getElementById('output'); + exprt.innerHTML = "Loading..."; + exprt.innerHTML = HTML_AJAX.grab(encodeURI('rpc.php?action=get_export&mode=' + mode)); } function clearSearch() diff --git a/rpc.php b/rpc.php index 9b56c48..704c921 100644 --- a/rpc.php +++ b/rpc.php @@ -98,6 +98,11 @@ class PHPFSPOT_RPC { $fspot->startTagSearch($_GET['for']); break; + case 'get_export': + + $fspot->getExport($_GET['mode']); + break; + } } // process_ajax_request(); diff --git a/templates/photo_index.tpl b/templates/photo_index.tpl index 8aea9bc..774e142 100644 --- a/templates/photo_index.tpl +++ b/templates/photo_index.tpl @@ -21,17 +21,10 @@ {/if} -
{if $extern_link } {/if} - - -
+ Export -- 2.17.1