Clean code for creating a new website page
This commit is contained in:
parent
9dd9119f8a
commit
3145d24af8
3 changed files with 82 additions and 43 deletions
|
|
@ -341,7 +341,7 @@ class FormWebsite
|
|||
|
||||
$templates = array(
|
||||
'empty' => 'empty',
|
||||
'text' => 'dynamic',
|
||||
//'text' => 'dynamic',
|
||||
'basic' => 'basic',
|
||||
//'news' => 'news',
|
||||
//'commerce' => 'commerce',
|
||||
|
|
|
|||
|
|
@ -1277,12 +1277,13 @@ Encrypted=Encrypted
|
|||
Settings=Settings
|
||||
FillMessageWithALayout=Fill message with a layout
|
||||
FillMessageWithAIContent=Fill message with AI content
|
||||
FillPageWithALayout=Fill page with a layout
|
||||
FillPageWithAIContent=Fill page with AI content
|
||||
EnterYourAIPromptHere=Enter your AI prompt here
|
||||
UseOrOperatorShort=or
|
||||
GoOnList=Go on list
|
||||
ShowSearchFields=Do a search
|
||||
MyUserCard=My user file
|
||||
PublicFile=Public file
|
||||
FillPageWithALayout=Fill page with a layout
|
||||
EntityNameNotDefined=No entity name
|
||||
AllEntities=All entities
|
||||
|
|
|
|||
|
|
@ -4309,7 +4309,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
print '</td><td class="tdtop">';
|
||||
|
||||
$out = '';
|
||||
// Add link to add layout
|
||||
// Add link to add a predefined layout
|
||||
$out .= '<a href="#" id="linkforlayouttemplates" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithALayout"), 'layout', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillPageWithALayout").'...';
|
||||
|
|
@ -4333,7 +4333,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
if ($formmail->withaiprompt && isModEnabled('ai')) {
|
||||
$out .= '<a href="#" id="linkforaiprompt" class="reposition notasortlink inline-block alink marginrightonly">';
|
||||
$out .= img_picto($langs->trans("FillMessageWithAIContent"), 'ai', 'class="paddingrightonly"');
|
||||
$out .= $langs->trans("FillMessageWithAIContent").'...';
|
||||
$out .= $langs->trans("FillPageWithAIContent").'...';
|
||||
$out .= '</a>';
|
||||
$out .= '<script>
|
||||
$(document).ready(function() {
|
||||
|
|
@ -4370,7 +4370,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'" autofocus>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Alias
|
||||
// Alias page
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">';
|
||||
print $langs->trans('WEBSITE_PAGENAME');
|
||||
print '</td><td>';
|
||||
|
|
@ -4390,12 +4390,29 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($pagedescription).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
$htmlhelp = $langs->trans("WEBSITE_IMAGEDesc");
|
||||
print $form->textwithpicto($langs->trans('WEBSITE_IMAGE'), $htmlhelp, 1, 'help', '', 0, 2, 'imagetooltip');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_IMAGE" value="'.dol_escape_htmltag($pageimage).'">';
|
||||
print '</td></tr>';
|
||||
// Deprecated. Image for RSS or Thumbs must be taken from the content.
|
||||
if (getDolGlobalInt('WEBSITE_MANAGE_IMAGE_FOR_PAGES')) {
|
||||
print '<tr class="trimageforpage hidden"><td>';
|
||||
$htmlhelp = $langs->trans("WEBSITE_IMAGEDesc");
|
||||
print $form->textwithpicto($langs->trans('WEBSITE_IMAGE'), $htmlhelp, 1, 'help', '', 0, 2, 'imagetooltip');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_IMAGE" value="'.dol_escape_htmltag($pageimage).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#selectWEBSITE_TYPE_CONTAINER").change(function() {
|
||||
console.log("We change type of page : "+jQuery("#selectWEBSITE_TYPE_CONTAINER").val());
|
||||
if (jQuery("#selectWEBSITE_TYPE_CONTAINER").val() == \'blogpost\') {
|
||||
jQuery(".trimageforpage").show();
|
||||
} else {
|
||||
jQuery(".trimageforpage").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
// Keywords
|
||||
print '<tr><td>';
|
||||
|
|
@ -4542,49 +4559,42 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
|
||||
$fuser = new User($db);
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('Author');
|
||||
print '</td><td>';
|
||||
if ($pageauthorid > 0) {
|
||||
$fuser->fetch($pageauthorid);
|
||||
print $fuser->getNomUrl(1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('PublicAuthorAlias');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat minwidth300" name="WEBSITE_AUTHORALIAS" value="'.dol_escape_htmltag($pageauthoralias).'" placeholder="Anonymous">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('DateCreation');
|
||||
print '</td><td>';
|
||||
print $form->selectDate($pagedatecreation, 'datecreation', 1, 1, 0, '', 1, 1);
|
||||
//print dol_print_date($pagedatecreation, 'dayhour');
|
||||
print '</td></tr>';
|
||||
|
||||
if ($action != 'createcontainer') {
|
||||
print '<tr><td>';
|
||||
print $langs->trans('UserModif');
|
||||
print $langs->trans('DateLastModification');
|
||||
print '</td><td>';
|
||||
if ($pageusermodifid > 0) {
|
||||
$fuser->fetch($pageusermodifid);
|
||||
print $fuser->getNomUrl(1);
|
||||
}
|
||||
print dol_print_date($pagedatemodification, 'dayhour', 'tzuser');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('DateModification');
|
||||
print $langs->trans('UserModification');
|
||||
print '</td><td>';
|
||||
print dol_print_date($pagedatemodification, 'dayhour', 'tzuser');
|
||||
if ($pageusermodifid > 0) {
|
||||
$fuser->fetch($pageusermodifid);
|
||||
print $fuser->getNomUrl(-1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr id="pageContent" class="hideobject"><td class="tdtop">';
|
||||
print $langs->trans('PreviewPageContent');
|
||||
$url = 'https://wiki.dolibarr.org/index.php/Module_Website';
|
||||
|
||||
$htmltext = '<small>';
|
||||
$htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource", $url);
|
||||
$htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource1", $url);
|
||||
$htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource2", $url);
|
||||
$htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSource3", $url);
|
||||
$htmltext .= $langs->transnoentitiesnoconv("YouCanEditHtmlSourceMore", $url);
|
||||
$htmltext .= '<br>';
|
||||
$htmltext .= '</small>';
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block', 1, 2, 'tooltipsubstitution');
|
||||
} else {
|
||||
//img_help(($tooltiptrigger != '' ? 2 : 1), $alt)
|
||||
print $form->textwithpicto($langs->trans("PreviewPageContent").' '.img_help(2, $langs->trans("PreviewPageContent")), $htmltext, 1, 'none', 'inline-block', 1, 2, 'tooltipsubstitution');
|
||||
}
|
||||
print '</td><td>';
|
||||
//$doleditor = new DolEditor('content', GETPOST('content', 'restricthtmlallowunvalid'), '', 200, 'dolibarr_mailings', 'In', true, true, true, 40, '90%');
|
||||
$doleditor = new DolEditor('contentpreview', GETPOST('content', 'none'), '', 200, 'dolibarr_mailings', 'In', true, true, true, 40, '90%');
|
||||
|
|
@ -4594,6 +4604,33 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
print '<textarea id="content" name="content" class="hideobject">'.GETPOST('content', 'none').'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Date creation
|
||||
print '<tr><td>';
|
||||
print $langs->trans('DateCreation');
|
||||
print '</td><td>';
|
||||
print $form->selectDate($pagedatecreation, 'datecreation', 1, 1, 0, '', 1, 1);
|
||||
//print dol_print_date($pagedatecreation, 'dayhour');
|
||||
print '</td></tr>';
|
||||
|
||||
// Author
|
||||
print '<tr><td>';
|
||||
print $langs->trans('Author');
|
||||
print '</td><td>';
|
||||
if ($pageauthorid > 0) {
|
||||
$fuser->fetch($pageauthorid);
|
||||
print $fuser->getNomUrl(-1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Author - public alias
|
||||
print '<tr><td>';
|
||||
print $langs->trans('PublicAuthorAlias');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat minwidth300" name="WEBSITE_AUTHORALIAS" value="'.dol_escape_htmltag($pageauthoralias).'" placeholder="Anonymous">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdhtmlheader tdtop">';
|
||||
$htmlhelp = $langs->trans("EditTheWebSiteForACommonHeader").'<br><br>';
|
||||
$htmlhelp .= $langs->trans("Example").' :<br>';
|
||||
|
|
@ -4658,6 +4695,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
|||
var disableautofillofalias = 0;
|
||||
var selectedm = \'\';
|
||||
var selectedf = \'\';
|
||||
|
||||
jQuery("#WEBSITE_TITLE").keyup(function() {
|
||||
if (disableautofillofalias == 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue