1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Custom Pages "new page" fix.

This commit is contained in:
CaMer0n
2012-08-11 05:00:50 +00:00
parent 3a44372559
commit cbd44f0ddd
2 changed files with 29 additions and 15 deletions

View File

@@ -292,10 +292,11 @@ class page_admin_ui extends e_admin_ui
{ {
$count = varset($_GET['count']); $count = varset($_GET['count']);
$frm = e107::getForm(); $frm = e107::getForm();
$text .= "<fieldset id='e-tab-empty'>\n"; $text = "<fieldset id='page_{$count}'>\n";
$text .= "<div>Title: ".$frm->text('page_subtitle[]', '', 250)."</div>\n"; $text .= "<div>Title: ".$frm->text('page_subtitle[]', '', 250)."</div>\n";
$text .= $frm->bbarea('data_'.intval($count), '', 'page','help','large'); $text .= $frm->bbarea('data_'.(intval($count)), '', 'page','page','large');
$text .= "</fieldset>"; $text .= "</fieldset>";
// $text .= 'name='.$nm."<br />page=".$page."<br />help_mode=". $help_mod."<br />htlp_tagid=".$help_tagid."<br />size=".$size;
echo $text; echo $text;
exit; exit;
// return $text; // return $text;
@@ -592,35 +593,37 @@ class page_admin_ui extends e_admin_ui
} }
$pages = preg_split("/\[newpage(.*?)\]/si", $textareaValue, -1, PREG_SPLIT_NO_EMPTY); $pages = preg_split("/\[newpage(.*?)\]/si", $textareaValue, -1, PREG_SPLIT_NO_EMPTY);
$c= 1;
$c= 0;
$titles[0] = ""; $titles[0] = "";
$text .= "<ul class='e-tabs'>"; $text .= "<ul class='e-tabs'>";
foreach($pages as $page) foreach($pages as $page)
{ {
$id = "#page_".$c; $id = "#page_".$c;
$pageCap = "Page ".($c+1); $pageCap = "Page ".($c);
$text .= "<li><a href='{$id}'>{$pageCap}</a></li>"; $text .= "<li><a href='{$id}'>{$pageCap}</a></li>";
$c++; $c++;
} }
$text .= "</ul>"; $text .= "</ul>";
$c= 0; $c= 1;
foreach($pages as $page) foreach($pages as $curval)
{ {
$titles[] = isset($pt[1][$c]) ? $pt[1][$c] : ""; $titles[] = isset($pt[1][($c-1)]) ? $pt[1][($c-1)] : "";
$id = "page_".$c; $id = "page_".$c;
$nm = $name."_".$c; $nm = $name."_".$c;
$text .= "<fieldset id='{$id}'>\n"; $text .= "<fieldset id='{$id}'>\n";
$text .= "<div>Title: ".$frm->text('page_subtitle[]', $titles[($c+1)], 250)."</div>\n"; $text .= "<div>Title: ".$frm->text('page_subtitle['.$c.']', $titles[($c)], 250)."</div>\n";
$text .= $frm->bbarea($nm, $page, $help_mod,$help_tagid,$size,$counter); $text .= $frm->bbarea($nm, $curval, $help_mod,$help_tagid,$size,$counter);
$text .= "</fieldset>"; $text .= "</fieldset>";
// $text .= 'name='.$nm."<br />page=".$page."<br />help_mode=". $help_mod."<br />htlp_tagid=".$help_tagid."<br />size=".$size;
$c++; $c++;
} }
$text .= "<input type='text' id='e-tab-count' value='".count($pages)."' />"; $text .= "<input type='hidden' id='e-tab-count' value='".count($pages)."' />";
$text .= "<button class='e-bb e-tabs-add e-wysiwyg-add' data-url='".e_SELF."?mode=dialog&action=dialog&iframe=1' data-function='add' href='#' data-bbcode=''><span>New Page</span></button>";
return $text; return $text;
} }
@@ -712,7 +715,7 @@ class page_admin_ui extends e_admin_ui
$page_title = $tp->toDB($_POST['page_title']); $page_title = $tp->toDB($_POST['page_title']);
// print_a($_POST); // print_a($_POST);
// if(is_array($_POST['data']) && is_array($_POST['subtitle'])) // if(is_array($_POST['data']) && is_array($_POST['subtitle']))
@@ -731,6 +734,7 @@ class page_admin_ui extends e_admin_ui
} }
// echo nl2br($newData); // echo nl2br($newData);
// return;
$page_text = $tp->toDB($newData); $page_text = $tp->toDB($newData);
$pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0); // Ideally, this check should be done in the front-end. $pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0); // Ideally, this check should be done in the front-end.

View File

@@ -19,7 +19,7 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
if(e_PAGE != 'image.php') if(e_PAGE != 'image.php')
{ {
e107::js('tinymce','tiny_mce.js','jquery'); e107::js('tinymce','tiny_mce.js','jquery');
e107::js('tinymce','wysiwyg.php','jquery'); e107::js('tinymce','wysiwyg.php','jquery',5);
} }
else else
{ {
@@ -39,6 +39,13 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
$('#bbcode-panel-'+id+'--preview').hide(); $('#bbcode-panel-'+id+'--preview').hide();
}); });
$('.e-wysiwyg').live('click',function(){
var id = $(this).attr('id'); // eg. news-body
$('#bbcode-panel-'+id+'--preview').hide();
$('#'+id).after('<div><a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle\">Switch to BBCODE</a></div>');
tinyMCE.execCommand('mceAddControl', false, id);
});
$('a.e-wysiwyg-toggle').toggle(function(){ $('a.e-wysiwyg-toggle').toggle(function(){
@@ -60,6 +67,9 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
tinyMCE.execCommand('mceInsertRawHTML',false,html); tinyMCE.execCommand('mceInsertRawHTML',false,html);
tinyMCEPopup.close(); tinyMCEPopup.close();
}); });