1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Fix for Admin -> Sitelinks -> Sublink Generator. (no SEF URL support yet).

Bootstrap
This commit is contained in:
Cameron 2016-03-08 09:32:52 -08:00
parent 724b1697b3
commit 7e55a677b3
3 changed files with 72 additions and 26 deletions

View File

@ -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
</td>
</tr>
<tr>
<td>".LINKLAN_7."</td>
<td>".LINKLAN_7." (".LAN_OPTIONAL.")</td>
<td>
";
$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++;
}

View File

@ -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'));

View File

@ -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 = " <a class='btn btn-default e-modal' data-modal-caption=\"Use the 'Themes' menu to view the selection.\" href='http://bootswatch.com/default/'>".LAN_PREVIEW."</a>";
$var[3]['caption'] = "Bootswatch Styles";
$var[3]['html'] = "<div class='form-inline'>".$frm->select('bootswatch', $bootswatch, e107::pref('theme', 'bootswatch', ''),null,LAN_DEFAULT ).$previewLink."</div>";
$var[3]['help'] = "";
// $var[1]['caption'] = "Sample configuration field 2";
// $var[1]['html'] = $frm->text('_blank_example2', e107::pref('theme', 'example2', 'default'));