select page not found
This commit is contained in:
parent
2bbf79cde9
commit
5648e8313c
|
@ -35,6 +35,12 @@
|
||||||
'name'=>'homepage',
|
'name'=>'homepage',
|
||||||
'value'=>$site->homepage()
|
'value'=>$site->homepage()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Page not found
|
||||||
|
echo Bootstrap::formInputHidden(array(
|
||||||
|
'name'=>'pageNotFound',
|
||||||
|
'value'=>$site->pageNotFound()
|
||||||
|
));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- General tab -->
|
<!-- General tab -->
|
||||||
|
@ -113,7 +119,6 @@
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$homeValue = '';
|
$homeValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'homepageTMP',
|
'name'=>'homepageTMP',
|
||||||
'label'=>$L->g('Homepage'),
|
'label'=>$L->g('Homepage'),
|
||||||
|
@ -123,13 +128,20 @@
|
||||||
'tip'=>$L->g('Returning page for the main page')
|
'tip'=>$L->g('Returning page for the main page')
|
||||||
));
|
));
|
||||||
|
|
||||||
$homepageOptions[' '] = '- '.$L->g('Default message').' -';
|
// Page not found 404
|
||||||
echo Bootstrap::formSelect(array(
|
try {
|
||||||
'name'=>'pageNotFound',
|
$pageNotFoundKey = $site->pageNotFound();
|
||||||
|
$pageNotFound = new Page($pageNotFoundKey);
|
||||||
|
$pageNotFoundValue = $pageNotFound->title();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$pageNotFoundValue = '';
|
||||||
|
}
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'pageNotFoundTMP',
|
||||||
'label'=>$L->g('Page not found'),
|
'label'=>$L->g('Page not found'),
|
||||||
'options'=>$homepageOptions,
|
'value'=>$pageNotFoundValue,
|
||||||
'selected'=>$site->pageNotFound(),
|
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
|
'placeholder'=>$L->g('Start typing a page title to see a list of suggestions.'),
|
||||||
'tip'=>$L->g('Returning page when the page doesnt exist')
|
'tip'=>$L->g('Returning page when the page doesnt exist')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -268,7 +280,7 @@
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// Parent autocomplete
|
// Homepage autocomplete
|
||||||
var homepageXHR;
|
var homepageXHR;
|
||||||
var homepageList; // Keep the parent list returned to get the key by the title page
|
var homepageList; // Keep the parent list returned to get the key by the title page
|
||||||
$("#jshomepageTMP").autoComplete({
|
$("#jshomepageTMP").autoComplete({
|
||||||
|
@ -306,6 +318,33 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// pageNotFound autocomplete
|
||||||
|
var pageNotFoundXHR;
|
||||||
|
var pageNotFoundList; // Keep the parent list returned to get the key by the title page
|
||||||
|
$("#jspageNotFoundTMP").autoComplete({
|
||||||
|
minChars: 1,
|
||||||
|
source: function(term, response) {
|
||||||
|
// Prevent call inmediatly another ajax request
|
||||||
|
try { pageNotFoundXHR.abort(); } catch(e){}
|
||||||
|
pageNotFoundXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/get-published", {query: term},
|
||||||
|
function(data) {
|
||||||
|
pageNotFoundList = data;
|
||||||
|
term = term.toLowerCase();
|
||||||
|
var matches = [];
|
||||||
|
for (var title in data) {
|
||||||
|
if (~title.toLowerCase().indexOf(term))
|
||||||
|
matches.push(title);
|
||||||
|
}
|
||||||
|
response(matches);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSelect: function(e, term, item) {
|
||||||
|
// pageNotFoundList = array( pageTitle => pageKey )
|
||||||
|
var key = pageNotFoundList[term];
|
||||||
|
$("#jspageNotFound").attr("value", key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -498,3 +537,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo Bootstrap::formClose(); ?>
|
<?php echo Bootstrap::formClose(); ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Open the tab defined in the URL
|
||||||
|
const anchor = window.location.hash;
|
||||||
|
$(`a[href="${anchor}"]`).tab('show');
|
||||||
|
</script>
|
||||||
|
|
|
@ -795,19 +795,10 @@ function activateTheme($themeDirectory) {
|
||||||
global $site;
|
global $site;
|
||||||
global $syslog;
|
global $syslog;
|
||||||
global $L, $language;
|
global $L, $language;
|
||||||
global $blocks;
|
|
||||||
|
|
||||||
if (Sanitize::pathFile(PATH_THEMES.$themeDirectory)) {
|
if (Sanitize::pathFile(PATH_THEMES.$themeDirectory)) {
|
||||||
$site->set(array('theme'=>$themeDirectory));
|
$site->set(array('theme'=>$themeDirectory));
|
||||||
|
|
||||||
// Remove all blocks
|
|
||||||
$blocks->truncate();
|
|
||||||
|
|
||||||
// Include Blocks for the theme
|
|
||||||
if (Sanitize::pathFile(PATH_THEMES.$themeDirectory.DS.'blocks.php')) {
|
|
||||||
include(PATH_THEMES.$themeDirectory.DS.'blocks.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
'dictionaryKey'=>'new-theme-configured',
|
'dictionaryKey'=>'new-theme-configured',
|
||||||
'notes'=>$themeDirectory
|
'notes'=>$themeDirectory
|
||||||
|
@ -818,7 +809,3 @@ function activateTheme($themeDirectory) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteAllBlocks() {
|
|
||||||
global $blocks;
|
|
||||||
}
|
|
Loading…
Reference in New Issue