select page not found
This commit is contained in:
parent
2bbf79cde9
commit
5648e8313c
@ -35,6 +35,12 @@
|
||||
'name'=>'homepage',
|
||||
'value'=>$site->homepage()
|
||||
));
|
||||
|
||||
// Page not found
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'pageNotFound',
|
||||
'value'=>$site->pageNotFound()
|
||||
));
|
||||
?>
|
||||
|
||||
<!-- General tab -->
|
||||
@ -113,7 +119,6 @@
|
||||
} catch (Exception $e) {
|
||||
$homeValue = '';
|
||||
}
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'homepageTMP',
|
||||
'label'=>$L->g('Homepage'),
|
||||
@ -123,13 +128,20 @@
|
||||
'tip'=>$L->g('Returning page for the main page')
|
||||
));
|
||||
|
||||
$homepageOptions[' '] = '- '.$L->g('Default message').' -';
|
||||
echo Bootstrap::formSelect(array(
|
||||
'name'=>'pageNotFound',
|
||||
// Page not found 404
|
||||
try {
|
||||
$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'),
|
||||
'options'=>$homepageOptions,
|
||||
'selected'=>$site->pageNotFound(),
|
||||
'value'=>$pageNotFoundValue,
|
||||
'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')
|
||||
));
|
||||
|
||||
@ -268,7 +280,7 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
// Parent autocomplete
|
||||
// Homepage autocomplete
|
||||
var homepageXHR;
|
||||
var homepageList; // Keep the parent list returned to get the key by the title page
|
||||
$("#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>
|
||||
|
||||
@ -498,3 +537,9 @@
|
||||
</div>
|
||||
|
||||
<?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 $syslog;
|
||||
global $L, $language;
|
||||
global $blocks;
|
||||
|
||||
if (Sanitize::pathFile(PATH_THEMES.$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(
|
||||
'dictionaryKey'=>'new-theme-configured',
|
||||
'notes'=>$themeDirectory
|
||||
@ -818,7 +809,3 @@ function activateTheme($themeDirectory) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function deleteAllBlocks() {
|
||||
global $blocks;
|
||||
}
|
Loading…
Reference in New Issue
Block a user