Add button to pin the box

This commit is contained in:
Dany De Bontridder 2017-10-24 21:17:58 +02:00
parent ff6f08fc72
commit 922d4a7b11
4 changed files with 69 additions and 24 deletions

View file

@ -424,7 +424,7 @@ EOF;
from menu_ref where me_code=$1", array($me_code));
if (empty($m))
{
echo HtmlInput::title_box(_("Ce plugin n'existe pas "), $ctl);
echo HtmlInput::title_box(_("Ce plugin n'existe pas "), $ctl,"close","","y");
echo "<p>"._("Il y a une erreur, ce plugin n'existe pas").
"</p>";
exit;

View file

@ -25,7 +25,7 @@
*/
var ask_reload = 0;
var tag_choose = '';
var aDraggableElement=new Array();
/**
* callback function when we just need to update a hidden div with an info
* message
@ -671,11 +671,13 @@ function create_div(obj)
else if ( ! obj.effect ){ Effect.Grow(obj.id,{direction:'top-right',duration:0.1}); }*/
if (obj.drag)
{
new Draggable(obj.id, {starteffect: function ()
aDraggableElement[obj.id]=new Draggable(obj.id, {starteffect: function ()
{
new Effect.Highlight(obj.id, {scroll: window, queue: 'end'});
}}
);
}
return elt;
}
@ -2958,4 +2960,22 @@ function alternate_row_color(p_table)
}
}
}
/**
* Make an DOM element draggable or not
* @param object_id DOM id
*/
function pin (object_id) {
if ( aDraggableElement[object_id]) {
aDraggableElement[object_id].destroy();
aDraggableElement[object_id]=undefined;
$('pin_'+object_id).firstChild.innerHTML="&oplus;";
} else {
aDraggableElement[object_id]=new Draggable(object_id, {starteffect: function ()
{
new Effect.Highlight(object_id, {scroll: window, queue: 'end'});
}}
);
$('pin_'+object_id).firstChild.innerHTML="&#10057;";
}
}

View file

@ -824,20 +824,43 @@ class HtmlInput
* @param type $div element id, except for mode none or custom
* @param type $mod hide , close , zoom , custom or none, with
* custom , the $name contains all the code
* @param type $p_js contains the javascript with "custom" contains button + code
* @param type $p_js contains the javascript if mod = "custom" or "zoom" contains button + code
* @return type
*/
static function title_box($name,$div,$mod="close",$p_js="")
static function title_box($p_name,$p_div,$p_mod="close",$p_js="",$p_draggable="y")
{
if ($mod=='close') {$r=HtmlInput::anchor_close($div,$p_js); }else
if ($mod=='hide') {$r=HtmlInput::anchor_hide("&#10761;","$('$div').hide();$p_js");} else
if ($mod=='zoom') {$r='<span id="span_'.$div.'" >'.'<img id="close_div"'.$p_js.' src="image/popout.gif">'.'</span>'; } else
if ( $mod == 'custom') {$r='<span id="span_'.$div.'" style="float:right;margin-right:5px">'.$p_js."</span>";} else
if ( $mod == 'none') {$r="" ; }
else
die (__FILE__.":".__LINE__._('Paramètre invaide'));
$r.=h2($name,' class="title" ');
return $r;
$r="";
if ($p_mod=='close'){
$r=HtmlInput::anchor_close($p_div,$p_js);
}
elseif ($p_mod=='zoom') {
$r='<span id="span_'.$p_div.'" style="float:right;margin-right:5px;padding-top:3px">'.HtmlInput::anchor("&#11036;","",$p_js,' name="small'.$p_div.'" id="close_div" class="input_text" ').'</span>';
}
elseif ($p_mod=='hide') {
$r=HtmlInput::anchor_hide("&#10761;","$('$p_div').hide();$p_js");
}
elseif ($p_mod=='zoom') {
$r='<span id="span_'.$div.'" >'.'<img id="close_div"'.$p_js.' src="image/popout.gif">'.'</span>';
}
else
if ( $p_mod == 'custom')
{$r='<span id="span_'.$p_div.'" style="float:right;margin-right:5px">'.$p_js."</span>";} else
if ( $p_mod == 'none') {$r="" ; }
else
die (__FILE__.":".__LINE__._('Paramètre invaide'));
if ( $p_draggable=="y") {
$drag=sprintf('<span id="pin_%s" style="float:right;margin:0px;padding:0px;margin-right:25px;padding-top:2px;font-size:120%%;border-width:0px" ><a class="input_text" onclick="pin(\'%s\')" id="close_div"> &#8631; </a></span>',
$p_div,
$p_div);
$r.=$drag;
}
$r.=h2($p_name,' class="title" ');
return $r;
}
/**
* @brief let you create only a link and set an id on it.
@ -873,10 +896,12 @@ class HtmlInput
if ($p_js != "")
{
$p_url="javascript:void(0)";
} else {
$p_url=sprintf('href="%s"',$p_url);
}
$str=sprintf('<a %s href="%s" %s>%s</a>',
$str=sprintf('<a %s %s %s>%s</a>',
$p_style,$p_url,$p_js,$p_text);
return $str;
}

View file

@ -3,11 +3,11 @@
//see licence.txt
?><!-- left div -->
<div id="calendar_box_div" class="box">
<?php echo HtmlInput::title_box(_('Calendrier'),'cal_div','zoom',"onclick=\"calendar_zoom($obj)\"");?>
<?php echo HtmlInput::title_box(_('Calendrier'),'cal_div','zoom',"onclick=\"calendar_zoom($obj)\"",'n');?>
<?php echo $cal->display('short',0); ?>
</div>
<div id="todo_listg_div" class="box"> <?php echo HtmlInput::title_box(_('Pense-Bête'),"todo_listg_div",'zoom'," onclick=\"zoom_todo()\"")?>
<div id="todo_listg_div" class="box"> <?php echo HtmlInput::title_box(_('Pense-Bête'),"todo_listg_div",'zoom'," onclick=\"zoom_todo()\"",'n')?>
<?php
/*
@ -36,7 +36,7 @@ if ( ! empty ($array) ) {
</div>
<div id="situation_div" class="box">
<?php echo HtmlInput::title_box(_("Situation"),"situation_div",'none')?>
<?php echo HtmlInput::title_box(_("Situation"),"situation_div",'none','','n')?>
<table class='result'>
<tr>
<th>
@ -147,7 +147,7 @@ if ( $rapport->exist() == false ) {
}
if ( $report != 0 ) : ?>
<div id="report_div" class="box"><?php echo HtmlInput::title_box($rapport->get_name(),'report_div','none');?>
<div id="report_div" class="box"><?php echo HtmlInput::title_box($rapport->get_name(),'report_div','none','','n');?>
<?php
$exercice=$g_user->get_exercice();
if ( $exercice == 0 ) {
@ -180,7 +180,7 @@ if ( $report != 0 ) : ?>
<?php
else :
?>
<div id="report_div" class="box"> <?php echo HtmlInput::title_box(_('Aucun rapport défini'),'report_div','none')?>
<div id="report_div" class="box"> <?php echo HtmlInput::title_box(_('Aucun rapport défini'),'report_div','none','','n')?>
<p>
<a href="javascript:void(0)" class="cell" onclick="set_preference('<?php echo dossier::id()?>')"><?php echo _('Cliquez ici pour mettre à jour vos préférences')?></a>
<p>
@ -228,7 +228,7 @@ endif;
<div id="action_now_div" class="inner_box" style="display:none;margin-left:25%;width: 50%;top:25%;min-height:50%;overflow: auto;">
<?php
echo HtmlInput::title_box(_("Action pour aujourd'hui"), "action_now_div","hide")
echo HtmlInput::title_box(_("Action pour aujourd'hui"), "action_now_div","hide",'','n')
?>
<ol>
<?php
@ -267,7 +267,7 @@ endif;
<div id="last_operation_box_div" class="box">
<?php echo HtmlInput::title_box(_('Dernières opérations'),"last_operation_box_div",'zoom','onclick="popup_recherche('.dossier::id().')"')?>
<?php echo HtmlInput::title_box(_('Dernières opérations'),"last_operation_box_div",'zoom','onclick="popup_recherche('.dossier::id().')"','n')?>
<table style="width: 100%">
<?php
@ -299,7 +299,7 @@ for($i=0;$i<count($last_ledger);$i++):
</div>
<div id="last_operation_management_div" class="box">
<?php
echo HtmlInput::title_box(_('Suivi'),"last_operation_management_div",'zoom','onclick="action_show('.dossier::id().')"');
echo HtmlInput::title_box(_('Suivi'),"last_operation_management_div",'zoom','onclick="action_show('.dossier::id().')"','n');
?>
<?php
require_once NOALYSS_INCLUDE.'/class/follow_up.class.php';
@ -343,7 +343,7 @@ $wTitle=new IText('p_title');
$wDesc=new ITextArea('p_desc');
$wDesc->heigh=5;
$wDesc->width=40;
echo HtmlInput::title_box("Note","add_todo_list","hide");
echo HtmlInput::title_box("Note","add_todo_list","hide",'','n');
echo _("Date")." ".$wDate->input().'<br>';
echo _("Titre")." ".$wTitle->input().'<br>';
echo _("Description")."<br>".$wDesc->input().'<br>';