40 print
"Error, template page can't be called as URL";
45 print
'Parameter langs not defined.';
48if (empty($htmlname)) {
49 print
'Parameter htmlname not defined.';
54<!-- BEGIN PHP TEMPLATE formlayoutai.tpl.php -->
58@phan-var-force ?FormWebSite $formwebsite
59@phan-var-force ?FormMail $formmail
60@phan-var-force ?FormAI $formai
61@phan-var-force string $showlinktolayout
62@phan-var-force string $showlinktolayoutlabel
63@phan-var-force string $showlinktoai
64@phan-var-force string $showlinktoailabel
65@phan-var-force ?string $out
66@phan-var-force ?string $morecss
67@phan-var-force string $aiprompt
73if (!isset($morecss)) {
76if (!isset($aiprompt)) {
80if ($showlinktolayout) {
81 $out .=
'<a href="#" id="linkforlayouttemplates" class="notasortlink inline-block alink marginrightonly">';
82 $out .=
img_picto($showlinktolayoutlabel,
'layout',
'class="paddingrightonly"');
83 $out .=
'<span class="hideobject hideonsmartphone">'.$showlinktolayoutlabel.
'...</span>';
84 $out .=
'</a> ';
87 $(document).ready(function() {
88 $("#linkforlayouttemplates").click(function() {
89 console.log("We click on linkforlayouttemplates, we toggle .template-selector");
90 event.preventDefault();
91 jQuery(".template-selector").toggle();
92 jQuery(".ai_input'.$htmlname.
'").hide();
93 jQuery("#pageContent").show(); // May exists for website page only
102 $out .=
'<a href="#" id="linkforaiprompt'.$showlinktoai.
'" class="notasortlink inline-block alink '.$morecss.
'">';
103 $out .=
img_picto($showlinktoailabel,
'ai',
'class="paddingrightonly"');
104 $out .=
'<span class="hideobject hideonsmartphone">'.$showlinktoailabel.
'...</span>';
108 $(document).ready(function() {
109 $("#linkforaiprompt'.$showlinktoai.
'").click(function() {
110 console.log("formlayoutai.tpl: We click on linkforaiprompt'.$showlinktoai.
', we toggle .ai_input'.$showlinktoai.
'");
111 event.preventDefault();
112 jQuery(".ai_dropdown'.$htmlname.
'").toggle();
113 jQuery(".template-selector").hide();
114 jQuery(".email-layout-container").hide();
115 if (!jQuery("#ai_dropdown'.$htmlname.
'").is(":hidden")) {
116 console.log("Set focus on input field #ai_instructions'.$htmlname.
'");
117 jQuery("#ai_instructions'.$htmlname.
'").focus();
118 if (!jQuery("pageContent").is(":hidden")) { // May exists for website page only
119 jQuery("#pageContent").show();
123 $(document).on("click", function (event) {
124 aidropdown = $(".ai_dropdown'.$htmlname.
'");
125 aidropdownbutton = $("#linkforaiprompt'.$showlinktoai.
'");
126 if (!aidropdown.is(event.target) && !aidropdownbutton.is(event.target) && $(event.target).closest(aidropdown).length === 0 && $(event.target).closest(aidropdownbutton).length === 0 && aidropdown.is(":visible")) {
127 console.log("You clicked outside of ai_dropdown - we close it");
128 $(".ai_dropdown'.$htmlname.
'").hide();
136if ($showlinktolayout) {
137 if (!empty($formwebsite) && is_object($formwebsite)) {
138 $out .= $formwebsite->getContentPageTemplate($htmlname);
140 if (!is_object($formmail)) {
142 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
145 $out .= $formmail->getEmailLayoutSelector($htmlname, $showlinktolayout);
148 $out .=
'<!-- No link to the layout feature, $formmail->withlayout must be set to a string use case, module WYSIWYG must be enabled and MAIN_EMAIL_USE_LAYOUT must be set -->';
154 if (empty($formai) || $formai instanceof
FormAI) {
155 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formai.class.php';
156 $formai =
new FormAI($db);
158 $out .= $formai->getAjaxAICallFunction();
160 if (empty($onlyenhancements)) {
161 $onlyenhancements =
'';
163 if (!empty($aiprompt) && !empty(
$object)) {
164 $formai->setSubstitFromObject(
$object, $langs);
167 $out .= $formai->getSectionForAIEnhancement($showlinktoai, $formmail->withaiprompt, $htmlname, $onlyenhancements, $aiprompt);
169 $out .=
'<!-- No link to the AI feature, $formmail->withaiprompt must be set to the ai feature and module ai must be enabled -->';
173<!-- END PHP TEMPLATE commonfields_edit.tpl.php -->
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...