1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

SEF Generate button added to newpost area. Can now generate and edit prior to saving.

This commit is contained in:
Cameron 2016-01-13 01:31:12 -08:00
parent 896d1f4345
commit 82d4a5583a
7 changed files with 79 additions and 18 deletions

View File

@ -22,6 +22,8 @@ if(vartrue($_GET['iframe']) == 1)
define('e_IFRAME', true);
}
$e_sub_cat = 'main';
if (varset($pref['adminstyle'])=='cascade' || varset($pref['adminstyle'])=='beginner') // Deprecated Admin-include.

View File

@ -20,6 +20,19 @@ if (!defined('e107_INIT'))
header('Content-type: text/html; charset=utf-8', TRUE);
if(!empty($_GET['iframe'])) // global iframe support.
{
define('e_IFRAME', true);
}
// .e-sef-generate routine.
if(ADMIN && defset('e_ADMIN_UI') && varset($_POST['mode']) == 'sef' && !empty($_POST['source']) && e_AJAX_REQUEST)
{
$d = array('converted'=> eHelper::title2sef($_POST['source']));
echo json_encode($d);
exit;
}
### Language files
e107::coreLan('header', true);
e107::coreLan('footer', true);
@ -53,10 +66,7 @@ e107::coreLan('footer', true);
// Get Icon constants, theme override (theme/templates/admin_icons_template.php) is allowed
include_once(e107::coreTemplatePath('admin_icons'));
if(!empty($_GET['iframe']))
{
define('e_IFRAME', true);
}

View File

@ -21,6 +21,10 @@ if (!getperms('H|N|H0|H1|H2|H3|H4|H5'))
e107::coreLan('newspost', true);
class news_admin extends e_admin_dispatcher
{
@ -88,7 +92,13 @@ class news_admin extends e_admin_dispatcher
protected $menuTitle = "News";
function init()
{
}
}
@ -393,7 +403,7 @@ class news_admin_ui extends e_admin_ui
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'tags', 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'textarea', 'tab'=>1, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'writeParms'=>array('size'=>'xxlarge')),
'news_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'tab'=>1, 'writeParms'=>'size=xxlarge', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'tab'=>1, 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'writeParms'=>array('size'=>'xxlarge', 'show'=>1, 'tdClassRight'=>'form-inline')),
'news_ping' => array('title' => LAN_PING, 'type' => 'checkbox', 'tab'=>1, 'data'=>false, 'writeParms'=>'value=0', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_author' => array('title' => LAN_AUTHOR, 'type' => 'method', 'tab'=>0, 'readParms'=>'idField=user_id&nameField=user_name', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
@ -682,9 +692,10 @@ class news_admin_ui extends e_admin_ui
$this->fields['news_email_notify']['writeParms']['post'] = "<span class='radio-inline radio inline'><a class='e-modal btn btn-xs btn-mini btn-primary' data-modal-caption='".ADLAN_149."' href='notify.php?iframe=1&type=admin_news_notify#/tab-news-events'>".LAN_CONFIGURE."</a></span>";
$this->fields['news_sef']['writeParms']['post'] = "<span class='form-inline input-group-btn'><a class='e-sef-generate btn btn-default' data-src='news-title' data-target='news-sef' data-confirm=\"".LAN_WILL_OVERWRITE_SEF." ".LAN_JSCONFIRM."\">".LAN_GENERATE."</a></span>";
// e107::getMessage()->addDebug(print_a($_POST,true));
// e107::getMessage()->addDebug(print_a($_POST,true));
if($this->getAction() == 'create' || $this->getAction() == 'edit')
{

View File

@ -2379,7 +2379,7 @@ class pluginBuilder
$text .= "
<div class='buttons-bar center'>
".$frm->hidden('newplugin', $this->pluginName)."
".$frm->admin_button('step', 3,'other',EPL_ADLAN_111)."
".$frm->admin_button('step', 3,'other', LAN_GENERATE)."
</div>";
$text .= $frm->close();

View File

@ -415,5 +415,7 @@ define("LAN_CUSTOM_URL", "Custom URL");
define("LAN_CUSTOM_URL_DISABLED", "Disabled or Enter Custom URL");
define("LAN_GENERAL", "General");
define("LAN_GENERATE", "Generate");
define("LAN_WILL_OVERWRITE_SEF", "This will overwrite your existing SEF URL.");
// TODO - move e_form related LANS below, add new lan_form.php file (for both front/back-end)

View File

@ -126,7 +126,7 @@ define ('EPL_ADLAN_107',"Build an admin-area and xml file for:");
define ('EPL_ADLAN_108',"Check language files:");
define ('EPL_ADLAN_109',"Basic Info.");
// define ('EPL_ADLAN_110',"Preferences");
define ('EPL_ADLAN_111',"Generate");
// define ('EPL_ADLAN_111',"Generate");// LAN_GENERATE
define ('EPL_ADLAN_112',"Review all fields and modify if necessary.");
define ('EPL_ADLAN_113',"Review ALL tabs before clicking 'Generate'.");
define ('EPL_ADLAN_114',"Plugin Builder");

View File

@ -575,19 +575,55 @@ $(document).ready(function()
// Basic Delete Confirmation
$("input.delete,button.delete").click(function(){
var answer = confirm($(this).attr("data-confirm"));
return answer // answer is a boolean
$('input.delete,button.delete,a[data-confirm]').click(function(){
answer = confirm($(this).attr("data-confirm"));
return answer; // answer is a boolean
});
$("e-confirm").click(function(){
var answer = confirm($(this).attr("title"));
return answer // answer is a boolean
});
$(".e-confirm").click(function(){
answer = confirm($(this).attr("title"));
return answer; // answer is a boolean
});
// Menu Manager Layout drop-down options
// see boot.php for main processing. (works only in admin)
$(".e-sef-generate").click(function(){
src = $(this).attr("data-src");
target = $(this).attr("data-target");
toconvert = $('#'+src).val();
script = window.location;
$.ajax({
type: "POST",
url: script,
data: { source: toconvert, mode: 'sef' }
}).done(function( data ) {
var a = $.parseJSON(data);
// alert(a.converted);
if(a.converted)
{
$('#'+target).val(a.converted);
// $('#uiAlert').notify({
// type: 'success',
// message: { text: 'Completed' },
// fadeOut: { enabled: true, delay: 2000 }
// }).show();
}
});
});
// Menu Manager Layout drop-down options
$("#menuManagerSelect").change(function(){
var link = $(this).val();
$("#menu_iframe").attr("src",link);