Skip to content

Commit

Permalink
New: Can define if ckeditor is opened or not in editval
Browse files Browse the repository at this point in the history
New: Can use a width of 100% in ckeditor
  • Loading branch information
eldy committed Mar 17, 2012
1 parent e5190a0 commit 21a1d47
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 23 deletions.
4 changes: 2 additions & 2 deletions htdocs/core/class/doleditor.class.php
Expand Up @@ -65,7 +65,7 @@ function DolEditor($htmlname,$content,$width='',$height=200,$toolbarname='Basic'
{
global $conf,$langs;

dol_syslog("DolEditor::DolEditor htmlname=".$htmlname." toolbarname=".$toolbarname);
dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." toolbarname=".$toolbarname);

if (! $rows) $rows=round($height/20);
if (! $cols) $cols=($width?round($width/6):80);
Expand Down Expand Up @@ -177,7 +177,7 @@ function Create($noprint=0)
customConfig : \''.dol_buildpath('/theme/'.$conf->theme.'/ckeditor/config.js',1).'\',
toolbar: \''.$this->toolbarname.'\',
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
width: '.($this->width ? $this->width : '\'\'').',
width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').',
height: '.$this->height.',
skin: \''.$skin.'\',
on :
Expand Down
9 changes: 5 additions & 4 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -118,7 +118,7 @@ function editfieldkey($text,$htmlname,$preselected,$object,$perm,$typeofdata='st
* @param string $value Value to show/edit
* @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height', 'select:xxx'...)
* @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:1:rows:cols', 'select:xxx'...)
* @param string $editvalue When in edit mode, use this value as $value instead of value
* @param object $extObject External object
* @param string $success Success message
Expand Down Expand Up @@ -152,9 +152,10 @@ function editfieldval($text,$htmlname,$value,$object,$perm,$typeofdata='string',
$tmp=explode(':',$typeofdata);
$ret.='<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue?$editvalue:$value).'"'.($tmp[1]?' size="'.$tmp[1].'"':'').'>';
}
else if ($typeofdata == 'text' || $typeofdata == 'textarea' || $typeofdata == 'note')
else if (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata))
{
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" cols="70">'.($editvalue?$editvalue:$value).'</textarea>';
$tmp=explode(':',$typeofdata);
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'" cols="'.($tmp[2]?$tmp[2]:'100').'">'.($editvalue?$editvalue:$value).'</textarea>';
}
else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
{
Expand All @@ -174,7 +175,7 @@ function editfieldval($text,$htmlname,$value,$object,$perm,$typeofdata='string',
{
$tmp=explode(':',$typeofdata);
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor($htmlname,($editvalue?$editvalue:$value),($tmp[2]?$tmp[2]:''),($tmp[3]?$tmp[3]:'100'),($tmp[1]?$tmp[1]:'dolibarr_notes'),'In',false,true,true);
$doleditor=new DolEditor($htmlname, ($editvalue?$editvalue:$value), ($tmp[2]?$tmp[2]:''), ($tmp[3]?$tmp[3]:'100'), ($tmp[1]?$tmp[1]:'dolibarr_notes'), 'In', ($tmp[4]?$tmp[4]:0), true, true, ($tmp[5]?$tmp[5]:'20'), ($tmp[6]?$tmp[6]:'100'));
$ret.=$doleditor->Create(1);
}
$ret.='</td>';
Expand Down
10 changes: 6 additions & 4 deletions htdocs/core/tpl/notes.tpl.php
Expand Up @@ -22,18 +22,20 @@
if ($module == 'propal') $module = 'propale';
else if ($module == 'fichinter') { $module = 'ficheinter'; $note_private = 'note_private'; }

if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200:1:12:100';
else $typeofdata='textarea:12:100';
?>

<!-- BEGIN PHP TEMPLATE NOTES -->
<div class="table-border">
<div class="table-border-row">
<div class="table-key-border-col"><?php echo $form->editfieldkey("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,'textarea'); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,'textarea'); ?></div>
<div class="table-key-border-col"><?php echo $form->editfieldkey("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,$typeofdata); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,$typeofdata); ?></div>
</div>
<?php if (! $user->societe_id) { ?>
<div class="table-border-row">
<div class="table-key-border-col"><?php echo $form->editfieldkey("NotePrivate",$note_private,$object->note_private,$object,$user->rights->$module->creer,'textarea'); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate",$note_private,$object->note_private,$object,$user->rights->$module->creer,'textarea'); ?></div>
<div class="table-key-border-col"><?php echo $form->editfieldkey("NotePrivate",$note_private,$object->note_private,$object,$user->rights->$module->creer,$typeofdata); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate",$note_private,$object->note_private,$object,$user->rights->$module->creer,$typeofdata); ?></div>
</div>
<?php } ?>
</div>
Expand Down
47 changes: 35 additions & 12 deletions htdocs/theme/bureau2crea/style.css.php
Expand Up @@ -1402,22 +1402,22 @@
div#stats {
}

tr.liste_titre {
div.liste_titre, tr.liste_titre {
text-align: <?php echo $left; ?>;
}

tr.liste_titre a {
div.liste_titre a, tr.liste_titre a {
color: #333333;
margin: 0px 5px;
}

tr.liste_titre td {
div.liste_titre td, tr.liste_titre td {
padding: 0px 5px;
vertical-align: middle;
background: none !important;
}

th.liste_titre, td.liste_titre
div.liste_titre, th.liste_titre, td.liste_titre
{
background-repeat: repeat-x;
color: #333333;
Expand All @@ -1428,14 +1428,7 @@
background: none;
}

/*tr.liste_titre select.flat {
float: left;
width: 200px;
position: relative;
margin: 30px 10px 10px 0px;
}*/

tr.liste_titre input.button {
div.liste_titre input.button, tr.liste_titre input.button {
float: left;
position: relative;
/*margin: 30px 10px 10px 0px;*/
Expand Down Expand Up @@ -2200,6 +2193,36 @@
}


/* ============================================================================== */
/* Table with div */
/* ============================================================================== */

div.table-border {
display:table;
width: 100%;
border-collapse: collapse;
border: 1px solid #9CACBB;
}
div.table-border-row {
display:table-row;
}
div.table-key-border-col {
display:table-cell;
width: 25%;
vertical-align:top;
padding: 1px 2px 1px 1px;
border: 1px solid #9CACBB;
border-collapse: collapse;
}
div.table-val-border-col {
display:table-cell;
width:auto;
padding: 1px 2px 1px 1px;
border: 1px solid #9CACBB;
border-collapse: collapse;
}


/* ============================================================================== */
/* Login */
/* ============================================================================== */
Expand Down
33 changes: 32 additions & 1 deletion htdocs/theme/cameleo/style.css.php
Expand Up @@ -1319,7 +1319,7 @@
padding-right: 2px;
}

tr.liste_titre {
div.liste_titre, tr.liste_titre {
height: 20px;
color: #842F00;
font-weight: bold;
Expand Down Expand Up @@ -2130,6 +2130,37 @@
height: 72px !important;
}


/* ============================================================================== */
/* Table with div */
/* ============================================================================== */

div.table-border {
display:table;
width: 100%;
border-collapse: collapse;
border: 1px solid #9CACBB;
}
div.table-border-row {
display:table-row;
}
div.table-key-border-col {
display:table-cell;
width: 25%;
vertical-align:top;
padding: 1px 2px 1px 1px;
border: 1px solid #9CACBB;
border-collapse: collapse;
}
div.table-val-border-col {
display:table-cell;
width:auto;
padding: 1px 2px 1px 1px;
border: 1px solid #9CACBB;
border-collapse: collapse;
}


<?php
if (is_object($db)) $db->close();
?>

0 comments on commit 21a1d47

Please sign in to comment.