function show_sources(id) { if (document.getElementById(id).style.display=='none') { document.getElementById(id).style.display=''; } else { document.getElementById(id).style.display='none'; } } "; $pair_impair=0; $parity=0; foreach($conns->connectors as $aconn) { $pair_impair = $parity++ % 2 ? "even" : "odd"; $comment=$aconn->comment; $sign=$aconn->name." : ".$comment." - "; $sign.="Auteur : ".$aconn->author." - ".$aconn->org." - "; $sign.=formatdate($aconn->date); $n_sources=count($aconn->sources); $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"if (event) e=event; else e=window.event; if (e.srcElement) target=e.srcElement; else target=e.target; if (target.nodeName!='IMG') document.location='./admin.php?categ=connecteurs&sub=out&action=edit&id=".$aconn->id."';return false;\" "; print "\n"; print ""; } print "
  ".$msg["connector_out_service"]." ".$msg["connector_out_sources"]."  
".($n_sources?"":" ")."".htmlentities($aconn->comment,ENT_QUOTES,$charset)." ".sprintf($msg["connecteurs_count_sources"],$n_sources)."
"; } function show_connector_out_form($connector_id) { global $msg; print '
'; print '

'.$msg['connector_out_edit'].'

'; print '
'; //id print ''; $daconn = instantiate_connecteur_out($connector_id); if ($daconn) { echo $daconn->get_config_form(); } //buttons print "
"; print " "; print ''; print "
 "; print '
'; } function show_sourceout_form($source_id=0, $connector_id, $name="", $comment="", $config_form=NULL) { global $msg; print '
'; if ($source_id) print '

'.$msg['connector_out_sourceedit'].'

'; else print '

'.$msg['connector_out_sourceadd'].'

'; print '
'; //id print ''; print ''; if ($config_form) { print '
'; print call_user_func($config_form); print '
'; } //buttons print "
"; print '
'; print " "; print ''; print "
"; if ($source_id) { print confirmation_delete("./admin.php?categ=connecteurs&sub=out&action=source_del&id="); print ""; } print ''; } /*$conn = new connecteur_out(0, "dummy"); highlight_string(print_r($conn, true)); echo $conn->ckeck_api_requirements();*/ /*$conns = new connecteurs_out(); highlight_string(print_r($conns, true));*/ switch ($action) { case "update": $daconn = instantiate_connecteur_out($id); if ($daconn) { $daconn->update_config_from_form(); $daconn->commit_to_db(); } list_connectors_out(); break; case "edit": show_connector_out_form($id); break; case "source_add": if (!$connector_id) { list_connectors_out(); break; } $daconn = instantiate_connecteur_out($connector_id); if (!$daconn) { list_connectors_out(); break; } $source_object = $daconn->instantiate_source_class(0); show_sourceout_form($id, $connector_id, "", "", array($source_object, 'get_config_form')); break; case "source_del": if (!$id) { list_connectors_out(); break; } connecteur_out_source::delete($id); list_connectors_out(); break; case "source_edit": if (!$connector_id || !$source_id) { list_connectors_out(); break; } $daconn = instantiate_connecteur_out($connector_id); if (!$daconn) { list_connectors_out(); break; } $source_object = $daconn->instantiate_source_class($source_id); show_sourceout_form($source_object->id, $connector_id, $source_object->name, $source_object->comment, array($source_object, 'get_config_form')); break; case "source_update": if (!$connector_id) { list_connectors_out(); break; } if (!$id) { //Création d'une nouvelle source //Récupération d'un nouvel id d'une nouvelle source générique vide $new_source = connecteur_out_source::add_new($connector_id); $new_source_id = $new_source->id; //Instantiation de cette nouvelle source en tant que source du connecteur $daconn = instantiate_connecteur_out($connector_id); if (!$daconn) { list_connectors_out(); break; } $source_object = $daconn->instantiate_source_class($new_source_id); //Mise à jour $source_object->update_config_from_form(); $source_object->commit_to_db(); } else { //Modification d'une existante if (!$connector_id || !$id) { list_connectors_out(); break; } $daconn = instantiate_connecteur_out($connector_id); if (!$daconn) { list_connectors_out(); break; } $source_object = $daconn->instantiate_source_class($id); $source_object->update_config_from_form(); $source_object->commit_to_db(); } list_connectors_out(); break; default: list_connectors_out(); break; } ?>