From 0116b9ff648f06bd5f2473a36c35ede2388a39c0 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 25 Jan 2013 19:30:26 -0800 Subject: [PATCH] Online theme selection integrated into admin area. "Find Themes". Incomplete. --- e107_admin/plugin.php | 2 +- e107_admin/theme.php | 3 ++ e107_handlers/theme_handler.php | 93 ++++++++++++++++++++++++++++++++- e107_themes/bootstrap/theme.xml | 3 +- 4 files changed, 97 insertions(+), 4 deletions(-) diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index b9c622f1f..1d7dc96ef 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -302,7 +302,7 @@ class pluginManager{ $from = intval(varset($_GET['frm'])); // $file = SITEURLBASE.e_PLUGIN_ABS."release/release.php"; // temporary testing - $file = "http://e107.org/feed?frm=".$from; + $file = "http://e107.org/feed?type=plugin&frm=".$from; $xml->setOptArrayTags('plugin'); // make sure 'plugin' tag always returns an array $xdata = $xml->loadXMLfile($file,'advanced'); diff --git a/e107_admin/theme.php b/e107_admin/theme.php index e8f14420c..29fc22c46 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -142,6 +142,9 @@ function theme_adminmenu() $var['choose']['text'] = TPVLAN_51; $var['choose']['link'] = e_SELF."?choose"; + + $var['online']['text'] = "Find Themes"; + $var['online']['link'] = e_SELF."?online"; $var['upload']['text'] = TPVLAN_38; $var['upload']['link'] = e_SELF."?upload"; diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 4a7eff992..d19ffc6e0 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -462,12 +462,101 @@ class themeHandler foreach ($this->themeArray as $key=>$theme) { $text .= $this->renderTheme(FALSE, $theme); + // print_a($theme); } $text .= "
 
"; $ns->tablerender(TPVLAN_26." :: ".TPVLAN_39, $mes->render().$text); } + + + if($mode == "online") + { + $e107 = e107::getInstance(); + $xml = e107::getXml(); + $mes = e107::getMessage(); + + $mes->addWarning("This area is experimental, incomplete and may produce unpredictable results."); + + $from = intval(varset($_GET['frm'])); + + // $file = SITEURLBASE.e_PLUGIN_ABS."release/release.php"; // temporary testing + $file = "http://e107.org/feed?type=theme&frm=".$from; + + $xml->setOptArrayTags('theme'); // make sure 'theme' tag always returns an array + $xdata = $xml->loadXMLfile($file,'advanced'); + + $total = $xdata['@attributes']['total']; + + + // print_a($xdata); + //TODO use admin_ui including filter capabilities by sending search queries back to the xml script. + + // XML data array. + $c = 1; + $text = ""; + foreach($xdata['theme'] as $r) + { + $mes->addDebug(print_a($r,true)); + + $theme = array( + 'name' => $r['@attributes']['name'], + 'summary' => $r['description'][0], + 'preview' => array($r['@attributes']['screenshot']), + 'date' => $r['@attributes']['date'], + 'version' => $r['@attributes']['version'] + ); + + $text .= $this->renderTheme(FALSE, $theme); + /* + + [author] => e107 Inc + [summary] => Bootstrap e107 admin theme + [category] => generic + [keywords] => Array + ( + [word] => Array + ( + [0] => bootstrap + [1] => clean + ) + + ) + [name] => bootstrap + [version] => 1.0 + [date] => 2012-12-01 + [compatibility] => 2.0 + [releaseUrl] => + [email] => e107inc@something.com + [website] => http://e107.org + [info] => Bootstrap e107 admin theme + [compliance] => Array + ( + [@attributes] => Array + ( + [xhtml] => + [css] => + ) + + ) + + [xhtmlcompliant] => + [csscompliant] => + [path] => bootstrap + + */ + + } + + $text .= "
 
"; + $ns->tablerender(TPVLAN_26." :: Available for Download", $mes->render().$text); + + + } + + + echo "\n\n"; @@ -714,8 +803,8 @@ class themeHandler // print_a($theme); } // - - $newpreview = "".(vartrue($theme['preview'][0]) ? "" : "").""; + $previewPath = (substr($theme['preview'][0],0,4) == 'http') ? $theme['preview'][0] : e_THEME.$theme['path'] ."/".$theme['preview'][0]; + $newpreview = "".(vartrue($theme['preview'][0]) ? "" : "").""; // Choose a Theme to Install. if(!$mode) diff --git a/e107_themes/bootstrap/theme.xml b/e107_themes/bootstrap/theme.xml index 2666e65c4..e1828038b 100644 --- a/e107_themes/bootstrap/theme.xml +++ b/e107_themes/bootstrap/theme.xml @@ -3,13 +3,14 @@ Bootstrap e107 admin theme Bootstrap e107 admin theme + generic bootstrap clean preview.jpg - fullpreview.png + fullpreview.jpg