[go: up one dir, main page]

Menu

[r10]: / answerForm.php  Maximize  Restore  History

Download this file

133 lines (114 with data), 5.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
$pageRef='Customer care';
include('includes/header.php');
?>
<script>
function backToUnanswered(){
window.location.href = 'http://127.0.0.1/Oreste/questions.php?qType=una';
}
function disableAll(value){
var el;
//disable/enable links
el = document.getElementsByTagName('a');
for(var i=0;i<el.length;i++){
if(value == 'disabled'){
el[i].disabled = true;
}else if(value == 'enabled'){
el[i].disabled = false;
}
}
}
function successInCreatingAnswerF(transport){
var args=transport.responseText.evalJSON();
disableAll('enabled');
//Success in create request
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
//Success in create operation
window.location.href = 'http://127.0.0.1/Oreste/questions.php?qType=una';
}else{
//Failure in create operation
}
}
function failureInCreatingAnswerF(){
//Failure in create request
disableAll('enabled');
alert('<?php echo _T("NI_answerForm_III"); ?>');
}
function sendAnswer(qid){
var mail = $F('qMail');
var body = $F('qDomanda');
var answer = $F('qRisposta');
if(formValidationRules.validate()){
disableAll('disabled');
$('qResult').innerHTML = '<?php echo _T("NI_answerForm_IV"); ?>';
OL_createNewAnswer(mail, body, answer, qid, {onSuccess: successInCreatingAnswerF, onFailure: failureInCreatingAnswerF});
}else{
alert('<?php echo _T("NI_answerForm_I"); ?>');
}
}
</script>
<?php
$getQuestion = mysql_query("SELECT * FROM questions WHERE questID='$_GET[qid]'");
while($row = mysql_fetch_array($getQuestion)) {
$body=$row[questBody];
$mail=$row[questMail];
$name=$row[questName];
$surname=$row[questSurname];
}
?>
<form id="formToValidate">
<div id="qResult" class="OpResult"></div>
<div class="Columns">
<div class="Column1">
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Actions") ?></span></span><div class="BlockContentBorder">
<ul>
<?php echo "<li><a href=\"javascript:sendAnswer('" . $_GET[qid] . "');\">" . _T("Send the answer") . "</a></li>"; ?>
<?php echo "<li><a href=\"javascript:backToUnanswered();\">" . _T("Back to unanswered question") . "</a></li>"; ?>
</ul>
</div>
</div>
</div>
</div>
<div class="MainColumn">
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Answer form") ?></span></span><div class="BlockContentBorder">
<table width="100%">
<tr valign="top"><td><b><?php echo _T("Name") ?> </b></td><td width="95%"><input type="text" id="qNome" style="width:95%;" disabled="disabled" value="<?php echo $name ?>"></td> </tr>
<tr valign="top"><td><b><?php echo _T("Surname") ?> </b></td><td width="95%"><input type="text" id="qCognome" style="width:95%;" disabled="disabled" value="<?php echo $surname ?>"></td> </tr>
<tr valign="top"><td><b><?php echo _T("Email") ?> </b></td><td width="95%"><input type="text" id="qMail" style="width:95%;" disabled="disabled" value="<?php echo $mail ?>"></td> </tr>
<tr valign="top"><td><b><?php echo _T("Question") ?> </b></td><td width="95%"><textarea id="qDomanda" style="width:95%;" rows="7" disabled="disabled"><?php echo $body ?></textarea></td> </tr>
<tr valign="top"><td><b><?php echo _T("Answer") ?> </b></td><td width="95%"><textarea id="qRisposta" style="width:95%;" rows="7" class="required" title="<?php echo _T("NI_answerForm_II") ?>"></textarea></td> </tr>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// *****************************************
// * Load faqs table for the first time *
// *****************************************
//questionTableLoad('<?php echo $_GET[qType] ?>', 'qTable', 'qMenu', 'w');
// **************************
// * Install event handlers *
// **************************
Event.observe('qResult', 'mouseover', function(){OL_makeThisElementInvisible('qResult');});
// *********************
// * Install validator *
// *********************
formValidationRules = new Validation('formToValidate',{immediate:true, onSubmit:false, useTitles:true, stopOnFirst:false});
});
</script>
<!-- tags opened in the header -->
</div>
</div>
</div>
</body>
</html>