diff --git a/html/ajax_card.php b/html/ajax_card.php
index 46526de6c..6b8f7fc4c 100644
--- a/html/ajax_card.php
+++ b/html/ajax_card.php
@@ -398,13 +398,8 @@ case 'ac':
}
$html='';
- $html.="
';
- $html.=$ctl;
- $html.= '
';
- $html.= '
';
+
}
else
{
@@ -438,29 +430,29 @@ case 'scc':
$html='';
if ( $user->check_action(FICCAT) == 1 )
{
- if ( strlen(trim($_POST['nom_mod'])) != 0 &&
- strlen(trim($_POST['class_base'])) != 0 )
+ $script=create_script("removeDiv('$ctl')");
+ $html.=$script;
+ if ( strlen(trim($_GET['nom_mod'])) != 0 &&
+ strlen(trim($_GET['class_base'])) != 0 )
{
$array=array("FICHE_REF"=>$cat,
- "nom_mod"=>$_POST['nom_mod'],
- "class_base"=>$_POST['class_base']);
+ "nom_mod"=>$_GET['nom_mod'],
+ "class_base"=>$_GET['class_base']);
if ( isset ($_POST['create'])) $array['create']=1;
$catcard=new Fiche_Def($cn);
if ( $catcard->Add($array) == -1)
- $html.="alert('"._('Catégorie existe déjà')."')";
+ $script="alert('"._('Catégorie existe déjà')."')";
else
- $html.="alert('"._('Catégorie sauvée')."')";
- $html.=create_script($html);
+ $script="alert('"._('Catégorie sauvée')."')";
+ $html.=create_script($script);
}
else
{
- $html.="alert('"._("Le nom et la classe base ne peuvent être vide")."')";
- $html.=create_script($html);
+ $script="alert('"._("Le nom et la classe base ne peuvent être vide")."')";
+ $html.=create_script($script);
$invalid=1;
}
- $ipop=str_replace('_content','',$ctl);
- $html.=create_script('hideIPopup(\''.$ipop.'\');');
}
else
{
diff --git a/html/js/card.js b/html/js/card.js
index 14e93f437..6809ac6b6 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -397,7 +397,7 @@ function select_card_type(obj)
filter=-1;
}
var content="select_card_div";
- if ( $(content)){ removeDiv(content);}
+ if ( $(content)){removeDiv(content);}
var sx=0;
if ( window.scrollY)
{
@@ -529,12 +529,29 @@ function save_card(obj)
*/
function add_category(obj)
{
+ var sx=0;
+ if ( window.scrollY)
+ {
+ sx=window.scrollY+120;
+ }
+ else
+ {
+ sx=document.body.scrollTop+120;
+ }
+
+ var div_style="top:"+sx+";width:60%;heigth:80%";
// show ipopup
- showIPopup(obj.ipopup);
+ var div={id:obj.ipopup,
+ cssclass:"op_detail",drag:1,style:div_style};
+ if ( $(div) ) {
+ removeDiv(div);
+ }
+ add_div(div);
+ waiting_box();
var dossier=$('gDossier').value;
var queryString='gDossier='+dossier;
queryString+='&op=ac';
- queryString+='&ctl='+obj.ipopup+'_content';
+ queryString+='&ctl='+obj.ipopup;
if ( obj.type_cat)
{
queryString+='&cat='+obj.type_cat;
@@ -544,7 +561,7 @@ function add_category(obj)
method:'get',
parameters:queryString,
onFailure:errorFid,
- onSuccess:successFill_ipopcard
+ onSuccess:fill_box
}
);
@@ -560,25 +577,29 @@ function save_card_category(obj)
alert('Erreur pas d\' attribut ipopup '+obj.id);
return;
};
- var content=$(obj).ipopup+'_content';
- // Data must be taken here
+ try {
+ // Data must be taken here
+
data=$('newcat').serialize(false);
- $(content).innerHTML=loading();
- showIPopup($(obj).ipopup);
var dossier=$('gDossier').value;
- var queryString='?';
- queryString+='&ctl='+content+'&';
+ queryString='ctl='+obj.ipopup+'&';
queryString+=data;
queryString+='&op=scc'; // sc for save card
var action=new Ajax.Request ( 'ajax_card.php',
{
- method:'post',
+ method:'get',
parameters:queryString,
onFailure:errorFid,
- onSuccess:successFill_ipopcard
+ onSuccess:fill_box
}
);
+ } catch(e)
+ {
+ alert(e.message);
+ return false;
+ }
+ return false;
}
/**
*@brief Remove a definition of an attribut
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 98404cc3f..a2c3b6321 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -292,47 +292,6 @@ function popup_recherche()
var w=window.open("recherche.php?gDossier="+p_dossier+"&ac=SEARCH",'','statusbar=no,scrollbars=yes,toolbar=no');
w.focus();
}
-/**
- *@brief show the popup. The top property is adapted if you've scrolled the window
- *@param name of the object PHP IPopup
- */
-function showIPopup(p_name)
-{
- var sx=0;
- if ( window.scrollY)
- {
- sx=window.scrollY+40;
- }
- else
- {
- sx=document.body.scrollTop+40;
- }
- $(p_name+'_border').style.top=sx;
- if ( g(p_name+'_fond') )
- {
- show(p_name+'_fond');
- }
- show(p_name+'_border');
- show(p_name+'_content');
-}
-/**
- *@brief hide the popup
- *@param name of the object PHP IPopup
- */
-function hideIPopup(p_name)
-{
- g(p_name+'_content').innerHTML=loading();
- if (g(p_name+'_fond'))
- {
- hide(p_name+'_fond');
- }
- if (g(p_name+'_border'))
- {
- hide(p_name+'_border');
- }
- hide(p_name+'_content');
-
-}
/**
*@brief replace the special characters (><'") by their HTML representation
*@return a string without the offending char.
diff --git a/include/adm.inc.php b/include/adm.inc.php
index d7e1de478..eeaf79066 100644
--- a/include/adm.inc.php
+++ b/include/adm.inc.php
@@ -80,9 +80,10 @@ if ( $low_action == "list" )
$a=(isset($_GET['query']))?$_GET['query']:"";
printf (_('Recherche').'