From 7e55a677b3f6623d9a2b13ff9069d71f6e5ae6ad Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 8 Mar 2016 09:32:52 -0800 Subject: [PATCH] Fix for Admin -> Sitelinks -> Sublink Generator. (no SEF URL support yet). Bootstrap --- e107_admin/links.php | 46 +++++++++++++------------ e107_themes/bootstrap3/theme.php | 17 +++++++-- e107_themes/bootstrap3/theme_config.php | 35 +++++++++++++++++-- 3 files changed, 72 insertions(+), 26 deletions(-) diff --git a/e107_admin/links.php b/e107_admin/links.php index d8c452499..6e5f6e87f 100644 --- a/e107_admin/links.php +++ b/e107_admin/links.php @@ -153,10 +153,6 @@ class links_admin_ui extends e_admin_ui - - - - public function handleListLinkParentBatch($selected, $value) { $field = 'link_parent'; @@ -208,7 +204,7 @@ class links_admin_ui extends e_admin_ui /** * Form submitted - 'etrigger_generate_sublinks' POST variable caught - */ + *//* public function SublinksGenerateSublinksTrigger() { $this->generateSublinks(); @@ -217,13 +213,19 @@ class links_admin_ui extends e_admin_ui public function sublinksObserver() { $this->getTreeModel()->load(); - } + }*/ /** * Sublinks generator */ public function toolsPage() { + + if(!empty($_POST['etrigger_generate_sublinks'])) + { + $this->generateSublinks($_POST); + } + $sublinks = $this->sublink_data(); $ui = $this->getUI(); // TODO - use UI create form @@ -257,7 +259,7 @@ class links_admin_ui extends e_admin_ui - ".LINKLAN_7." + ".LINKLAN_7." (".LAN_OPTIONAL.") "; $text .= $ui->link_parent($this->getPosted('link_parent'), 'write'); @@ -341,17 +343,17 @@ class links_admin_ui extends e_admin_ui if(!$pid) { - $mes->warning(LCLAN_109); - return; + // $mes->addWarning(LCLAN_109); + // return; } if(!$subtype) { - $mes->warning(LCLAN_110); + $mes->addWarning(LCLAN_110); return; } if(!$sublink) { - $mes->error(LCLAN_111); + $mes->addError(LCLAN_111); return; } @@ -362,8 +364,8 @@ class links_admin_ui extends e_admin_ui $sql2 = e107::getDb('sql2'); - $sql->db_Select("links", "*", "link_id=".$pid); - $par = $sql->db_Fetch(); + $sql->select("links", "*", "link_id=".$pid); + $par = $sql->fetch(); //extract($par); // Added option for passing of result array @@ -397,9 +399,9 @@ class links_admin_ui extends e_admin_ui } else { - $sql->db_Select($sublink['table'], "*", $sublink['query']); + $sql->select($sublink['table'], "*", $sublink['query']); $count = 1; - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { $subcat = $row[($sublink['fieldid'])]; $name = $row[($sublink['fieldname'])]; @@ -414,22 +416,22 @@ class links_admin_ui extends e_admin_ui 'link_url' => $suburl, 'link_description' => $subdiz, 'link_button' => $subicon, - 'link_category' => $par['link_category'], + 'link_category' => vartrue($par['link_category'],1), 'link_order' => $count, 'link_parent' => $subparent, 'link_open' => $par['link_open'], - 'link_class' => $par['link_class'], + 'link_class' => intval($par['link_class']), 'link_function' => '' ); - if($sql2->db_Insert("links",$insert_array)) + if($sql2->insert("links",$insert_array)) { - $message .= LAN_CREATED." ({$name})[!br!]"; - $mes->success(LAN_CREATED." ({$name})"); + $message = LAN_CREATED." ({$name})[!br!]"; + $mes->addSuccess(LAN_CREATED." ({$name})"); } else { - $message .= LAN_CREATED_FAILED." ({$name})[!br!]"; - $mes->error(LAN_CREATED_FAILED." ({$name})"); + $message = LAN_CREATED_FAILED." ({$name})[!br!]"; + $mes->addError(LAN_CREATED_FAILED." ({$name})"); } $count++; } diff --git a/e107_themes/bootstrap3/theme.php b/e107_themes/bootstrap3/theme.php index b1f46ee5e..6ad5fbd2a 100644 --- a/e107_themes/bootstrap3/theme.php +++ b/e107_themes/bootstrap3/theme.php @@ -14,8 +14,21 @@ define('VIEWPORT', "width=device-width, initial-scale=1.0"); // use https if e107 is using https. e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery', 2); -e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css'); -e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css'); + +if($bootswatch = e107::pref('theme', 'bootswatch',false)) +{ + e107::css('url', 'https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/'.$bootswatch.'/bootstrap.min.css'); +} +else +{ + e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css'); +} + +e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css'); + + + + /* @example prefetch */ //e107::link(array('rel'=>'prefetch', 'href'=>THEME.'images/browsers.png')); diff --git a/e107_themes/bootstrap3/theme_config.php b/e107_themes/bootstrap3/theme_config.php index dab4b4878..22b23e58d 100644 --- a/e107_themes/bootstrap3/theme_config.php +++ b/e107_themes/bootstrap3/theme_config.php @@ -8,12 +8,12 @@ class theme_bootstrap3 implements e_theme_config function process() // Save posted values from config() fields. { $pref = e107::getConfig(); - $tp = e107::getParser(); - + $theme_pref = array(); $theme_pref['nav_alignment'] = $_POST['nav_alignment']; $theme_pref['usernav_placement'] = $_POST['usernav_placement']; $theme_pref['branding'] = $_POST['branding']; + $theme_pref['bootswatch'] = $_POST['bootswatch']; $pref->set('sitetheme_pref', $theme_pref); return $pref->dataHasChanged(); @@ -37,6 +37,37 @@ class theme_bootstrap3 implements e_theme_config $var[2]['html'] = $frm->select('usernav_placement', array('top', 'bottom'), e107::pref('theme', 'usernav_placement', 'top'),'useValues=1' ); $var[2]['help'] = ""; + + $bootswatch = array( + // '' => LAN_DEFAULT, + "cerulean"=> 'Cerulean', + "cosmo"=> 'Cosmo', + "cyborg"=> 'Cyborg', + "darkly"=> 'Darkly', + "flatly"=> 'Flatly', + "journal"=> 'Journal', + "lumen"=> 'Lumen', + "paper"=> 'Paper', + "readable"=> 'Readable', + "sandstone"=> 'Sandstone', + "simplex"=> 'Simplex', + "slate"=> 'Slate', + "spacelab"=> 'Spacelab', + "superhero"=> 'Superhero', + "united"=> 'United', + "yeti"=> 'Yeti', + ); + + + $previewLink = " ".LAN_PREVIEW.""; + + $var[3]['caption'] = "Bootswatch Styles"; + $var[3]['html'] = "
".$frm->select('bootswatch', $bootswatch, e107::pref('theme', 'bootswatch', ''),null,LAN_DEFAULT ).$previewLink."
"; + $var[3]['help'] = ""; + + + + // $var[1]['caption'] = "Sample configuration field 2"; // $var[1]['html'] = $frm->text('_blank_example2', e107::pref('theme', 'example2', 'default'));