Commit 5ea3de3b authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Check in voting advice app in new repo

parents

Too many changes to show.

To preserve performance only 384 of 384+ files are displayed.

<?php
include('../config/config.php');
include(ADMIN_HTML.'html.inc.php');
include(ADMIN_INCLUDES.'functions.php');
checkLoginAdmin();
if ( isset($_POST['submit']) )
{
$fileName = time().str_replace(' ', '_', $_FILES['partyImage']['name']); // replace the space with '_'
move_uploaded_file($_FILES['partyImage']['tmp_name'],UPLOADS_PATH.'partylogo/'.$fileName);
// Generate Images thunmnails
generate_image_thumbnail(UPLOADS_PATH.'partylogo/'.$fileName, UPLOADS_PATH.'partylogo/thumbs/thumb_'.$fileName,80,60);
$insQry = "INSERT INTO tbl_candidate
SET
Name = '".clean($_POST['candi_title'])."',
Description = '".clean($_POST['candiDes'])."',
Party = '".clean($_POST['party_title'])."',
Logo = '".$fileName."'";
mysql_query($insQry);
$redirectUrl = 'view-candidates.php';
$_SESSION['succesMessage'] = 4;
header("Location: $redirectUrl");
}
startHtml($title = "Add Candidate");
tophead($title);
leftNav();
?>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
// update validation status on change
onchange_callback: function(editor) {
tinyMCE.triggerSave();
$("#" + editor.id).valid();
}
});
jQuery.validator.addMethod("imageExt", function(value, element) {
return this.optional(element) || /^.*\.(jpg|jpeg|gif|JPG|png|PNG)$/.test(value);
}, ("Only [jpeg, gif, JPG, PNG] formats are allowed."));
// Form validation
$(function() {
var validator = $("#addCandiForm").submit(function() {
// update underlying textarea before submit validation
tinyMCE.triggerSave();
}).validate({
ignore: "",
rules: {
candi_title: "required",
candiDes: "required",
party_title: "required",
partyImage: {
required: true,
imageExt: true
}
},
messages: {
candi_title: "Enter candidate name.",
candiDes: "Enter candidate description.",
party_title: "Enter party name",
partyImage: {
required: 'Select Party image.'
}
},
errorPlacement: function(label, element) {
// position error label after generated textarea
if (element.is("textarea")) {
label.insertAfter(element.next());
} else {
label.insertAfter(element)
}
}
});
validator.focusInvalid = function() {
// put focus on tinymce on submit validation
if( this.settings.focusInvalid ) {
try {
var toFocus = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []);
if (toFocus.is("textarea")) {
tinyMCE.get(toFocus.attr("id")).focus();
} else {
toFocus.filter(":visible").focus();
}
} catch(e) {
// ignore IE throwing errors when focusing hidden elements
}
}
}
});
</script>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3>Add Candidate</h3>
</header>
<form name="addCandiForm" id="addCandiForm" action="" method="post" enctype="multipart/form-data">
<fieldset style="margin:15px">
<table width="100%">
<tr>
<td>
<label>Candidate Name</label>
<input type="text" name="candi_title" id="candi_title" />
</td>
</tr>
<tr>
<td>
<label>Candidate Party</label>
<input type="text" name="party_title" id="party_title" />
</td>
</tr>
<tr>
<td>
<label>Description</label>
<span class="tinyMCE"><textarea id="candiDes" name="candiDes" rows="15" cols="80" style="width: 99%;float:left;"></textarea></span>
<label for="candiDes" class="error" style="display:none;">Enter description.</label>
</td>
</tr>
<tr>
<td>
<label>Party Logo</label>
<input type="file" name="partyImage" id="partyImage" />
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" id="submit" value="Add Record" />
<input type="button" name="cancel" id="cancel" value="Cancel" onclick="window.location='<?php echo ADMIN_URL;?>view-candidates.php'" />
</td>
</tr>
</table>
</fieldset>
</form>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>
\ No newline at end of file
<?php
include('../config/config.php');
include(ADMIN_HTML.'html.inc.php');
include(ADMIN_INCLUDES.'functions.php');
checkLoginAdmin();
if ( isset($_POST['submit']) )
{
if ( !empty($_POST['question']) )
{
$insQry = "INSERT INTO tbl_questions
SET
Heading = '".clean($_POST['title'])."',
Question = '".clean($_POST['question'])."'";
mysql_query($insQry);
}
$redirectUrl = 'view-questions.php';
$_SESSION['succesMessage'] = 4;
header("Location: $redirectUrl");
}
startHtml($title = "Add Question");
tophead($title);
leftNav();
?>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
// update validation status on change
onchange_callback: function(editor) {
tinyMCE.triggerSave();
$("#" + editor.id).valid();
}
});
$(function() {
var validator = $("#addQuestForm").submit(function() {
// update underlying textarea before submit validation
tinyMCE.triggerSave();
}).validate({
ignore: "",
rules: {
title: "required",
question: "required"
},
messages: {
title: "Enter question title.",
question: "Enter question."
},
errorPlacement: function(label, element) {
// position error label after generated textarea
if (element.is("textarea")) {
label.insertAfter(element.next());
} else {
label.insertAfter(element)
}
}
});
validator.focusInvalid = function() {
// put focus on tinymce on submit validation
if( this.settings.focusInvalid ) {
try {
var toFocus = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []);
if (toFocus.is("textarea")) {
tinyMCE.get(toFocus.attr("id")).focus();
} else {
toFocus.filter(":visible").focus();
}
} catch(e) {
// ignore IE throwing errors when focusing hidden elements
}
}
}
});
</script>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3>Add Question</h3>
</header>
<form name="addQuestForm" id="addQuestForm" action="" method="post">
<fieldset style="margin:15px">
<table width="100%">
<tr>
<td>
<label>Title</label>
<input type="text" name="title" id="title" />
</td>
</tr>
<tr>
<td>
<label>Question</label>
<span class="tinyMCE"><textarea id="question" name="question" rows="15" cols="80" style="width: 99%;float:left;"></textarea></span>
<label for="question" class="error" style="display:none;">Enter Question Description</label>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" id="submit" value="Add Record" />
<input type="button" name="cancel" id="cancel" value="Cancel" onclick="window.location='<?php echo ADMIN_URL;?>view-questions.php'" />
</td>
</tr>
</table>
</fieldset>
</form>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>
\ No newline at end of file
<?php
include('../config/config.php');
include(ADMIN_HTML.'html.inc.php');
include(ADMIN_INCLUDES.'functions.php');
checkLoginAdmin();
if ( isset($_POST['submit']) )
{
if ( !empty($_POST['question']) )
{
for($i=0;$i<sizeof($_POST['question']);$i++)
{
$insQry = "INSERT INTO tbl_party_response
SET
CandidateId='".clean($_POST['candidate'])."',
QuestionId = '".clean($_POST['question'][$i])."',
Answer = '".clean($_POST['answer'][$i])."'";
mysql_query($insQry);
}
$checkBox=array();
$checkBox=$_POST['check'];
foreach($checkBox as $key=>$box)
{
$insQry = "UPDATE tbl_party_response
SET
PriorityBit='1'
WHERE tbl_party_response.CandidateId='".$_POST['candidate']."' AND tbl_party_response.QuestionId='$key'";
mysql_query($insQry);
}
}
$redirectUrl = 'index.php';
$_SESSION['succesMessage'] = 4;
header("Location: $redirectUrl");
}
startHtml($title = "Add Question Response");
tophead($title);
leftNav();
?>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
// update validation status on change
onchange_callback: function(editor) {
tinyMCE.triggerSave();
$("#" + editor.id).valid();
}
});
$(function() {
var validator = $("#addQuestForm").submit(function() {
// update underlying textarea before submit validation
tinyMCE.triggerSave();
}).validate({
ignore: "",
rules: {
candidate: "required",
},
messages: {
candidate: "Select Candidate",
},
errorPlacement: function(label, element) {
// position error label after generated textarea
if (element.is("textarea")) {
label.insertAfter(element.next());
} else {
label.insertAfter(element)
}
}
});
validator.focusInvalid = function() {
// put focus on tinymce on submit validation
if( this.settings.focusInvalid ) {
try {
var toFocus = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []);
if (toFocus.is("textarea")) {
tinyMCE.get(toFocus.attr("id")).focus();
} else {
toFocus.filter(":visible").focus();
}
} catch(e) {
// ignore IE throwing errors when focusing hidden elements
}
}
}
});
</script>
<style>
.radio{
cursor:pointer;
}
</style>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3>Add Questions Response</h3>
</header>
<form name="addQuestForm" id="addQuestForm" action="" method="post">
<fieldset style="margin:15px">
<table width="100%">
<tr>
<td>
<label>Select Candidate</label>
<select name="candidate" style="width:30%;">
<option value="">-Select-</option>
<?php
$flag=false;
$getRes = mysql_query("SELECT Id, Name FROM tbl_candidate ORDER BY Id DESC");
while( $row = mysql_fetch_array($getRes) )
{
$qry="SELECT COUNT(tbl_party_response.Id) AS ROW FROM tbl_party_response WHERE tbl_party_response.CandidateId='".$row["Id"]."'";
$getRemain=mysql_query($qry);
$remain = mysql_fetch_array($getRemain);
if($remain["ROW"]<1)
{
$flag=true;
?>
<option value="<?php echo $row["Id"];?>"><?php echo $row["Name"];?></option>
<?php
}
}
?>
<?php
if($flag==false)
{
?>
<option value="">No Candidate Left</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>
<label>Questions</label>
</td>
</tr>
<tr><td><hr/></td></tr>
<?php
$getRes = mysql_query("SELECT Id, Heading,Question FROM tbl_questions ORDER BY Id DESC");
$i=0;
while( $row = mysql_fetch_array($getRes) )
{
?>
<tr>
<td>
<label class="trigger" style="color:#00F"><?php echo $row['Heading'];?></label>
<input type="hidden" name="question[<?php echo $i;?>]" value="<?php echo $row['Id']; ?>"/>
<ul class="toggle" style="list-style:none;">
<li><?php echo "<br/>".$row['Question'];?></li>
</ul>
</td>
</tr>
<tr>
<td>
<span style="padding-left:10px;">
Agree<input type="radio" name="answer[<?php echo $i;?>]" value="A" class="radio" required="required"/>&nbsp;&nbsp;&nbsp;
Neutral<input type="radio" name="answer[<?php echo $i;?>]" value="N" class="radio" required="required"/>&nbsp;&nbsp;&nbsp;
Disagree<input type="radio" name="answer[<?php echo $i;?>]" value="D" class="radio" required="required"/>&nbsp;&nbsp;&nbsp;
Priority<input type="checkbox" name="check[<?php echo $row['Id'];?>]" class="radio"/>
</span>
</td>
</tr>
<?php
$i++;
}
?>
<tr><td><hr/></td></tr>
<tr>
<td>
<input type="submit" name="submit" id="submit" value="Add Record"/>
<input type="button" name="cancel" id="cancel" value="Cancel" onclick="window.location='<?php echo ADMIN_URL;?>view-responses.php'" />
</td>
</tr>
</table>
</fieldset>
</form>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>
\ No newline at end of file
<?php
include('../config/config.php');
include(ADMIN_HTML.'html.inc.php');
include(ADMIN_INCLUDES.'functions.php');
checkLoginAdmin();
if ( isset($_POST['submit']) )
{
$updateQry = "UPDATE tbl_login
SET
Password = '".clean($_POST['newPassword'])."'
WHERE Id = '".$_SESSION['user_login_id']."'";
mysql_query($updateQry);
$_SESSION['password'] = clean($_POST['newPassword']);
$_SESSION['succesMessage'] = 2;
header("Location: $redirectUrl");
exit;
}
startHtml($title = "Change Password");
tophead($title);
leftNav();
?>
<script src="<?php echo ADMIN_JS;?>accounts.js" type="text/javascript"></script>
<?php
if ( isset($_SESSION['succesMessage']) )
{
successMsg($_SESSION['succesMessage']);
unset($_SESSION['succesMessage']);
}
?>
<section id="main" class="column">
<article class="module width_half">
<header>
<h3>Change Password</h3>
</header>
<form name="changePassForm" id="changePassForm" action="" method="post">
<fieldset style="margin:15px">
<table width="100%">
<tr>
<td>
<label>Old Password</label>
<input type="password" name="oldPassword" id="oldPassword">
</td>
</tr>
<tr>
<td>
<label>New Password</label>
<input type="password" name="newPassword" id="newPassword">
</td>
</tr>
<tr>
<td>
<label>Confirm New Password</label>
<input type="password" name="confirmPassword" id="confirmPassword">
<input type="hidden" name="oldHidPass" id="oldHidPass" value="<?php echo $_SESSION['password'];?>" />
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" id="submit" value="Change Password" />
<input type="button" name="cancel" id="cancel" value="Cancel" onclick="window.location='<?php echo ADMIN_URL;?>'" />
</td>
</tr>
</table>
</fieldset>
</form>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>
\ No newline at end of file
/*
* File: demo_table_jui.css
* CVS: $Id$
* Description: CSS descriptions for DataTables demo pages
* Author: Allan Jardine
* Created: Tue May 12 06:47:22 BST 2009
* Modified: $Date$ by $Author$
* Language: CSS
* Project: DataTables
*
* Copyright 2009 Allan Jardine. All Rights Reserved.
*
* ***************************************************************************