Merge branch '251014-enrich' into unstable

* 251014-enrich:
  TinyMCE  : height is a parameter
  TinyMCE: different type of editor :full,minimal, no-toolbar, plain
  NOALYSS: use TinyMCE
This commit is contained in:
sparkyx 2025-10-17 13:08:09 +02:00
commit cd1d9f0d90
11 changed files with 79 additions and 1773 deletions

File diff suppressed because it is too large Load diff

View file

@ -2265,7 +2265,7 @@ function filter_list(phrase, _id) {
ele += la_content[e].innerText;
}
console.debug(`ele = ${ele}`);
if (ele.toLowerCase().indexOf(words) >= 0) {
tot_found++;
l_list.childNodes[r].style.display = 'block';
@ -4326,7 +4326,7 @@ function check_password_strength(p_pass_domid, p_result_domid, details) {
return;
}
var answer = req.responseJSON;
console.debug(answer);
if (answer['password'] == 'nok') {
id$(p_pass_domid).setStyle("background-color:red");
@ -4724,20 +4724,25 @@ Noalyss = function () {
* @param {string} mode min for minimum or full , gives an error if the mode doesn't exist
* @returns {undefined}
*/
Noalyss.prototype.activate_tinymce=function (domid,mode) {
Noalyss.prototype.activate_tinymce=function (domid,mode,p_height) {
tinymce.remove('#'+domid);
if ( mode == 'min' || ! mode )
if (! p_height) p_height=500;
if ( mode == 'minimal' || ! mode )
{
tinymce.init({
selector: 'textarea#'+domid,
height: 500,
plugins:'link quickbars ',
height: p_height,
menubar: false,
toolbar: 'undo redo | ' +
'bold italic underline forecolor backcolor |fontsize styles ' +
'bold italic underline forecolor backcolor |fontsize ' +
' | bullist numlist | ' +
'removeformat | help',
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
quickbars_insert_toolbar:false,
promotion: false,
quickbars_selection_toolbar:' bold italic underline forecolor backcolor ',
license_key:'gpl',
statusbar: false,
branding: false
@ -4754,22 +4759,43 @@ Noalyss.prototype.activate_tinymce=function (domid,mode) {
*/
tinymce.init({
selector: 'textarea#'+domid,
height: 500,
height: p_height,
menubar: false,
plugins:'link lists emoticons quickbars pagebreak table',
toolbar: 'undo redo ' +
'bold italic underline strikethrough | hr quickimage | forecolor backcolor|emoticons |fontsize styles ' +
'bold italic underline strikethrough | hr quickimage | forecolor backcolor|emoticons |fontsize styles fontfamily ' +
' table tabledelete |' +
' | link unlink bullist numlist | ' +
'removeformat | help',
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
quickbars_insert_toolbar:false,
promotion: false,
quickbars_selection_toolbar:' bold italic underline forecolor backcolor ',
license_key:'gpl',
statusbar: false,
statusbar: true,
branding: false
});
}else {
}else if ( mode == 'no-toolbar' )
{
console.debug(`no toolbar ${domid} height ${p_height}`)
tinymce.init({
selector: 'textarea#'+domid,
height: p_height,
plugins:' quickbars',
menubar:false,
toolbar: false,
quickbars_selection_toolbar:' bold italic underline forecolor backcolor hide',
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
promotion: false,
license_key:'gpl',
statusbar: false,
toolbar_mode: 'hide',
quickbars_insert_toolbar:false,
branding: false
});
} else {
console.error(`Noalyss.activate_tinymce unknow mode`);
}

View file

@ -225,7 +225,7 @@ class Follow_Up
// Description
$desc=new ITextArea();
$desc->set_enrichText("enrich");
$desc->set_enrichText("full");
$desc->style=' class="itextarea" style="width:80%;margin-left:5%;"';
$desc->name="ag_comment";
$desc->readOnly=$readonly;

View file

@ -2779,7 +2779,6 @@ EOF;
echo js_include('todo_list.js');
echo js_include('anc_script.js');
echo js_include('sorttable.js');
echo js_include('nicEdit.js');
echo js_include('managetable.js');
echo js_include('acc_currency.js');
echo js_include('taggroup.js');

View file

@ -35,6 +35,7 @@ class ITextarea extends HtmlInput
parent::__construct($p_name, $p_value, $p_id);
$this->style=' class="itextarea" ';
$this->enrichText="plain";
$this->heigh=500;
}
/**
@ -53,9 +54,10 @@ class ITextarea extends HtmlInput
*/
public function set_enrichText($enrich)
{
if ( ! in_array($enrich,['plain','enrich',"min"])) {
throw new \Exception("IT57.Invalid option");
if ( ! in_array($enrich,['enrich','plain','full',"minimal","no-toolbar"])) {
throw new \Exception("IT57.Invalid option [$enrich]");
}
if ( $enrich == 'enrich') $enrich='full';
$this->enrichText = $enrich;
return $this;
}
@ -69,36 +71,26 @@ class ITextarea extends HtmlInput
$this->value=($p_value==null)?$this->value:$p_value;
$this->id=($this->id=="")?$this->name:$this->id;
if ( $this->readOnly==true) return $this->display();
if ( empty($this->id)) $this->id=$this->name;
if ( $this->enrichText == "plain" ) {
$r="";
$r.='<TEXTAREA '.$this->style.' name="'.$this->name.'" id="'.$this->id.'"';
$r.='>';
$r.=$this->value;
$r.="</TEXTAREA>";
} elseif ($this->enrichText=='enrich') {
if ( empty($this->id)) $this->id=$this->name;
} else {
$r=<<<EOF
<textarea name="{$this->name}" id="{$this->id}" {$this->style}>{$this->value}</textarea>
<script type="text/javascript">
(function() {
noalyss.activate_tinymce('{$this->name}','full');
})();
</script>
EOF;
}elseif ($this->enrichText=='min') {
if ( empty($this->id)) $this->id=$this->name;
$r=<<<EOF
<textarea name="{$this->name}" id="{$this->id}" {$this->style}>{$this->value}</textarea>
<script type="text/javascript">
(function() {
noalyss.activate_tinymce('{$this->name}','min');
noalyss.activate_tinymce('{$this->name}','{$this->enrichText}','{$this->heigh}');
})();
</script>
EOF;
}
return $r;
}

View file

@ -334,7 +334,7 @@ function small(p_id_textarea){
$style_enl='style="display:inline"';$style_small='style="display:none"';
// description
$description = new ITextarea("ag_description");
$description->set_enrichText("enrich");
$description->set_enrichText("full");
$description->id="ag_description";
$has_description = false;
//---------------------------------- Description -------------------------------------------------------------------

View file

@ -5,6 +5,7 @@
/**
* @var $str_anc String HTML contains the detail of analytic
* @var $g_user Noalyss_User inherited , it is the connected user
* @var $div (string) current DIV ID
*/
$str_anc="";
global $div,$g_parameter,$cn,$access,$jr_id,$obj;
@ -107,6 +108,7 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj;
<td style="text-align:center;vertical-align: top">
<?php
$inote = new ITextarea('jrn_note');
$inote->id="jrn_note";
$inote->style=' class="itextarea" style="width:90%;height:100%;"';
$inote->value = strip_tags($obj->det->note);
echo $inote->input();

View file

@ -3,6 +3,8 @@
//see licence.txt
$str_anc="";
global $g_parameter,$g_user;
//* @var $div (string) current DIV ID
?><?php require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php'; ?>
<div class="content" style="padding:0;">
<?php

View file

@ -9,6 +9,7 @@ require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php';
$periode_id=new Periode($cn,$obj->det->jr_tech_per);
$exercice=$periode_id->get_exercice();
$owner = new Noalyss_Parameter_Folder($cn);
//* @var $div (string) current DIV
?>
<?php
?>

View file

@ -1,6 +1,8 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
//* @var $div (string) current DIV
global $div, $g_parameter, $cn, $access, $jr_id, $obj,$g_user;
?>

View file

@ -38,15 +38,38 @@ echo '</div>';
$itext=new \ITextarea("enrich");
$itext->value= $http->post("enrich","raw","");
$itext->set_enrichText("enrich");
$itext->set_enrichText("full");
echo $itext->input();
?>
<hr>
<h1>Plain Area</h1>
<h1>Minimum Area</h1>
<?php
$itext=new \ITextarea("enrich2");
$itext->value= $http->post("enrich2","raw","");
$itext->set_enrichText("minimal");
echo $itext->input();
?>
<p>
<h1>No Toolbar</h1>
<?php
$itext=new \ITextarea("enrich3");
$itext->value= $http->post("enrich3","raw","");
$itext->heigh=130;
$itext->set_enrichText("no-toolbar");
echo $itext->input();
?>
<p>
<h1>Plain Area</h1>
<?php
$itext=new \ITextarea("enrich4");
$itext->value= strip_tags($http->post("enrich2","raw",""));
$itext->set_enrichText("plain");