diff --git a/e107_admin/theme.php b/e107_admin/theme.php index 266e9953d..e8f14420c 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -72,8 +72,9 @@ if(e_AJAX_REQUEST) if(e_AJAX_REQUEST) -{ - $data = $themec->getThemeInfo('jayya'); +{ + $tm = (string) $_GET['id']; + $data = $themec->getThemeInfo($tm); echo $themec->renderThemeInfo($data); exit; diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index b0377b19d..1823f37ca 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -533,9 +533,7 @@ class themeHandler function renderThemeInfo($theme) { - - // TO-DO : This SHOULD be loaded by ajax before release. - + global $pref; $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); $website = ($theme['website'] ? "".$theme['website']."" : ""); @@ -543,7 +541,9 @@ class themeHandler $text = "
".TPVLAN_7."
- "; +
+ "; + $text .= $author ? "" : ""; $text .= $website ? "" : ""; $text .= $theme['date'] ? "" : ""; @@ -678,14 +678,16 @@ class themeHandler function renderTheme($mode = FALSE, $theme) { - + $ns = e107::getRender(); + $pref = e107::getPref(); + $frm = e107::getForm(); /* mode = 0 :: normal mode = 1 :: selected site theme mode = 2 :: selected admin theme */ - global $ns,$pref,$frm; + // global $ns,$pref,$frm; $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); @@ -697,7 +699,7 @@ class themeHandler $main_icon = ($pref['sitetheme'] != $theme['path']) ? "" : ""; // $info_icon = ""; - $info_icon = "info"; + $info_icon = "info"; $preview_icon = "Preview"; @@ -709,9 +711,13 @@ class themeHandler $admin_icon = ""; } + if($theme['path'] == 'bootstrap') + { + // print_a($theme); + } + // - - $newpreview = "".($theme['preview'] ? "" : "").""; + $newpreview = "".(vartrue($theme['preview'][0]) ? "" : "").""; // Choose a Theme to Install. if(!$mode) @@ -855,9 +861,9 @@ class themeHandler } $itext .= "
".$theme['name']."
".TPVLAN_4.":".$author."
".TPVLAN_5.":".$website."
".TPVLAN_6.":".$theme['date']."
"; - $itext .= ($val['@attributes']['previewFull']) ? "" : ""; + // $itext .= ($val['@attributes']['previewFull']) ? "" : ""; $itext .= $val['@attributes']['title']; - $itext .= ($val['@attributes']['previewFull']) ? "" : ""; + // $itext .= ($val['@attributes']['previewFull']) ? "" : ""; $custompage_count = (isset($pref['sitetheme_custompages'][$key])) ? " [".count($pref['sitetheme_custompages'][$key])."]" : ""; $custompage_diz = ""; @@ -1325,8 +1331,6 @@ class themeHandler $lays['legacyDefault']['@attributes'] = array('title'=>'Default', - 'preview'=>'', - 'previewFull'=>'', 'plugins'=>'', 'default'=>'true'); @@ -1352,8 +1356,6 @@ class themeHandler { $themeArray['custompages']['legacyCustom'] = explode(" ", $CUSTOMPAGES); $lays['legacyCustom']['@attributes'] = array('title'=>'Custom', - 'preview'=>'', - 'previewFull'=>'', 'plugins'=>''); } @@ -1361,22 +1363,28 @@ class themeHandler foreach($customHeaderArray as $tm) { $lays[$tm]['@attributes'] = array('title'=>str_replace("_"," ",$tm), - 'preview'=>'', - 'previewFull'=>'', 'plugins'=>''); } foreach($customFooterArray as $tm) { $lays[$tm]['@attributes'] = array('title'=>str_replace("_"," ",$tm), - 'preview'=>'', - 'previewFull'=>'', 'plugins'=>''); } } $themeArray['path'] = $path; $themeArray['layouts'] = $lays; + + if(file_exists(e_THEME.$path."/preview.jpg")) + { + $themeArray['preview'] = array("preview.jpg"); + } + + if(file_exists(e_THEME.$path."/preview.png")) + { + $themeArray['preview'] = array("preview.png"); + } // echo "

".$themeArray['name']."

"; // print_a($lays); @@ -1390,8 +1398,10 @@ class themeHandler // loadLanFiles($path, 'admin'); // Look for LAN files on default paths // layout should always be an array. - $xml->setOptArrayTags('layout'); + $xml->setOptArrayTags('layout,screenshots/image'); $xml->setOptStringTags('menuPresets,customPages'); + + $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true); $vars['name'] = varset($vars['@attributes']['name']); @@ -1408,8 +1418,9 @@ class themeHandler $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); $vars['path'] = $path; $vars['@attributes']['default'] = (varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true') ? 1 : 0; + $vars['preview'] = varset($vars['screenshots']['image']); - unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description']); + unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'],$vars['screenshots']); // Compile layout information into a more usable format. @@ -1434,17 +1445,17 @@ class themeHandler $vars['path'] = $path; $vars['custompages'] = $custom; - /* + /* $mes = e107::getMessage(); - - if($path == "bootstrap") + + if($path == "bootstrap" || $path == "jayya") { $mes->addDebug("

".$path."

"); $mes->addDebug(print_a($vars,true)); $mes->addDebug("
"); } - */ - + + */ return $vars; } diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index 3ee349e6a..cba96a362 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -620,15 +620,28 @@ class xmlClass { return $vars; } - - - foreach($this->arrayTags as $vl) + + + foreach($this->arrayTags as $p) { - + + list($vl,$sub) = explode("/",$p); + + if($sub) + { + if(isset($vars[$vl][$sub]) && is_string($vars[$vl][$sub])) + { + $vars[$vl][$sub] = array($vars[$vl][$sub]); + } + + continue; + } + + if(isset($vars[$vl]) && is_array($vars[$vl]) && !varset($vars[$vl][0])) { - - $vars[$vl] = array($vars[$vl]); + + $vars[$vl] = array($vars[$vl]); } } diff --git a/e107_themes/_blank/theme.xml b/e107_themes/_blank/theme.xml index a179759e6..ab12e9dc8 100644 --- a/e107_themes/_blank/theme.xml +++ b/e107_themes/_blank/theme.xml @@ -7,8 +7,11 @@ + + + - + @@ -21,7 +24,7 @@ - + usersettings.php diff --git a/e107_themes/bootstrap/theme.xml b/e107_themes/bootstrap/theme.xml index 1cb8b8a3a..78027a2dc 100644 --- a/e107_themes/bootstrap/theme.xml +++ b/e107_themes/bootstrap/theme.xml @@ -7,6 +7,10 @@ bootstrap clean + + preview.jpg + fullpreview.png + usersettings.php diff --git a/e107_themes/e107v4a/theme.xml b/e107_themes/e107v4a/theme.xml index 65e31a029..38831544f 100644 --- a/e107_themes/e107v4a/theme.xml +++ b/e107_themes/e107v4a/theme.xml @@ -9,8 +9,11 @@ + + preview.jpg + - + @@ -24,7 +27,7 @@ - + diff --git a/e107_themes/jayya/theme.xml b/e107_themes/jayya/theme.xml index 63a41ab6f..bb435b5ce 100644 --- a/e107_themes/jayya/theme.xml +++ b/e107_themes/jayya/theme.xml @@ -8,11 +8,12 @@ classic generic + + preview.jpg + - - - - + + \ No newline at end of file