Bonjour à tous,
Je vous explique brièvement mon projet:
Je prépare un gros voyage avec beaucoup d'activités et je souhaiterais utiliser [url=http://www.dhtmlgoodies.com/scripts/dhtmlgoodies-week-planner/dhtmlgoodies-week-planner.html]WEEK PLANNER[/url] afin de planifier au mieux mon séjour (serveur local Synology DS106j, phpmyadmin, etc.). Je voudrais par la suite l'utiliser via une application adobe air. J'ai donc téléchargé le ZIP sur cette page [url=http://www.dhtmlgoodies.com/index.html?whichScript=dhtmlgoodies-week-planner]dhtmlgoodies.com[/url] et j'ai fais quelques tests mais j'ai quelques problèmes/incompréhensions:
-Déja, sans rien modifier, lorsque je clique sur un events, une popup (edit_event) s'ouvre et se ferme instantanément. J'ai constaté que ça venait de la ligne 32, j'ai placé la ligne en commentaire afin de continuer mes test. Auriez vous une idée de l'intérêt de cette ligne?
-J'ai créé une table "events", etc... mais je n'arrive pas à y lire, ni écrire les infos dans mes tables(voir mes tests lignes 96, 97)
-Encore plus étrange, dans le code d'origine, lorsque "edit_event" s'ouvre, dans le champs, il est inscrit :<? echo $inf["eventDescription"]; ?>(ligne 110) et non pas "this is just..." (ligne 87). Je ne comprend pas pourquoi il renvoi la commande brute et non la déscription.
Voici le code (un petit peu modifié)
[code]
<?php
/********************************
*
* THIS FILE GIVES YOU AN EXAMPLE OF HOW A POPUP WINDOW FOR EVENT EDIT COULD LOOK LIKE
*
********************************/
// Input to this file: $_GET['id'] which is the id of the node that you are about to edit
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Edit event</title>
<?
// Saving event
if(isset($_POST['save'])){
// Update your database with the values of the form
// mysql_connect....
// mysql_select_db...
// mysql_query(".....
// Closing window
?>
<script type="text/javascript">
//self.close();
</script>
<?
exit;
}
?>
<script type="text/javascript">
function confirmSave()
{
if(confirm('Click OK to save')){
if(window.opener){
var id = <? echo $_GET['id']; ?>;
var formObj = document.forms[0];
opener.setElement_txt(id,formObj.eventDescription.value); // Calling function in week planner - update content
if(formObj.color.value.length>0)opener.setElement_color(id,formObj.color.value); // Calling function in week planner - updating color
}
return true;
}
return false;
}
// This function doesn't do anything with the week planner - it only updates color on this page. The confirmSave() function sends the color value back
// to the week planner
var activeColorObj = false;
function selectColor(inputObj,color)
{
if(activeColorObj)activeColorObj.className='colorDiv';
inputObj.className='colorDivSelected';
activeColorObj = inputObj;
document.forms[0].color.value = color;
}
</script>
</head>
<body>
<?
if(isset($_GET['id'])){
$db = mysql_connect("localhost","root","***") or die("Unable to connect to mysql database");
mysql_select_db("site1",$db);
$res = mysql_query("select * from events where id='".$_GET['id']."'");
$inf = mysql_fetch_array($res);
}else{
die("no id sent to this window");
}
$inf = array();
$inf["eventDescription"] = "This is just an example text. This text should be pulled from the database dynamically from the input variable \$_GET['id']";
$inf["projectID"] = 2;
$inf["colorCode"] = "#FFFFFF";
$inf["contactID"] = 2;
$colors = array("#CCCCCC","#FFFFFF","#E2EBED"); // array of colors the user could choose from
?>
<input type="text" size="30" name="titre3" value="<?php echo $res["contactID"]; ?>">
<input type="text" size="30" name="titre3" value="<? $res "contactID"; ?>">
<!-- Example of a form --->
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="Post">
<input type="hidden" name="id" value="<? echo $_GET['id']; ?>">
<input type="hidden" name="color" value="">
<fieldset>
<legend>Edit event</legend>
<table border="0" cellpadding="2" cellpadding="0">
<tr>
<td>
<label for="eventDescription">Event:</label>
</td>
<td>
<textarea id="eventDescription" name="eventDescription"><? echo $inf["eventDescription"]; ?></textarea>
</td>
</tr>
<tr>
<td>Project:</td>
<td><select name="projectID">
<option value="1"<? if($inf["projectID"]==1) echo " selected"; ?>>Ajax tools</option>
<option value="2"<? if($inf["projectID"]==2) echo " selected"; ?>>Color tools</option>
<option value="3"<? if($inf["projectID"]==3) echo " selected"; ?>>Calendars</option>
</select>
</td>
</tr>
<tr>
<td>Contact:</td>
<td><select name="contactID">
<option value="1"<? if($inf["contactID"]==1) echo " selected"; ?>>Alf Magne Kalleland</option>
<option value="2"<? if($inf["contactID"]==2) echo " selected"; ?>>Ronaldinho</option>
</select>
</td>
</tr>
<tr>
<td>Color:</td>
<td><?
for($no=0;$no<count($colors);$no++){
echo "<div class=\"colorDiv\" onclick=\"selectColor(this,'".$colors[$no]."')\" style=\"background-color:".$colors[$no]."\"><span></span></div>";
}
?>
</td>
</tr>
</table>
</fieldset>
<div class="buttonDiv">
<input type="submit" value="Save" name="save" class="aButton" onclick="return confirmSave()">
<input type="button" value="Close" class="aButton" onclick="self.close()">
</div>
</form>
</body>
</html>
[/code]
Pouvez vous m'éclairer? :ange:
Merci d'avance à tous!