Skip to content
This repository was archived by the owner on Dec 6, 2019. It is now read-only.

Commit 6aa1493

Browse files
author
Nabeel Shahzad
committed
VMS-261 VMS-262 VMS-263 VMS-264 VMS-265 VMS-266 #close fixed
1 parent b88acd7 commit 6aa1493

19 files changed

+220
-183
lines changed

admin/lib/phpvmsadmin.js

Lines changed: 71 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -18,73 +18,15 @@
1818
var depicon = baseurl + '/lib/images/towerdeparture.png';
1919
var arricon = baseurl + '/lib/images/towerarrival.png';
2020

21-
function formInit()
22-
{
23-
$("#form").ajaxForm({
24-
target: '#bodytext',
25-
success: function() {
26-
$('#bodytext').fadeIn('slow');
27-
formInit();
28-
$("button, input:button, input:submit, a.button").button();
29-
}
30-
});
31-
32-
$("#flashForm").ajaxForm({
33-
target: '#results',
34-
success: function() {
35-
formInit();
36-
$("button, input:button, input:submit, a.button").button();
37-
}
38-
});
39-
40-
$('#pilotoptionchangepass').ajaxForm({
41-
target: '#dialogresult',
42-
success: function() {
43-
formInit();
44-
}
45-
});
46-
47-
$('#selectpilotgroup').ajaxForm({
48-
target: '#pilotgroups',
49-
success: function() {
50-
formInit();
51-
}
52-
});
53-
54-
$('#addaward').ajaxForm({
55-
target: '#awardslist',
56-
success: function() {
57-
formInit();
58-
}
59-
});
60-
61-
$("button, input:button, input:submit, a.button").button();
62-
}
63-
64-
function reloadGroups() {
65-
$('.pilotgroupajax').live('click', function() {
66-
$("#pilotgroups").load($(this).attr("href"),
67-
{ action: $(this).attr("action"), pilotid: $(this).attr("pilotid"), groupid: $(this).attr("id") },
68-
function() {
69-
reloadGroups();
70-
});
71-
});
72-
73-
$('a.button').button();
74-
$('button').button();
75-
}
76-
77-
function calcDistance() {
78-
$("#distance").val("Calculating...");
79-
$.get(baseurl + "/admin/action.php/operations/calculatedistance",
80-
{ depicao: $("#depicao").val(), arricao: $("#arricao").val() },
81-
function(data) {
82-
$("#distance").val(data);
83-
});
84-
}
21+
$(document).ready(function() {
22+
initListeners();
23+
});
8524

8625
function initListeners()
8726
{
27+
formInit();
28+
reloadGroups();
29+
8830
$('#jqmdialog').jqm({
8931
ajax: '@href',
9032
onLoad: function(h) {
@@ -122,9 +64,6 @@ function initListeners()
12264

12365
$('a.button, button, input[type=submit]').button();
12466

125-
formInit();
126-
reloadGroups();
127-
12867
$("#slidermenu").accordion({ clearStyle: true, autoHeight: false, navigation: true });
12968

13069
$("#dialogform").ajaxForm({
@@ -227,9 +166,71 @@ function initListeners()
227166
}
228167
}
229168

230-
$(document).ready(function() {
231-
initListeners();
232-
});
169+
170+
function formInit()
171+
{
172+
$("#form").ajaxForm({
173+
target: '#bodytext',
174+
success: function() {
175+
formInit();
176+
$("button, input:button, input:submit, a.button").button();
177+
}
178+
});
179+
180+
$("#flashForm").ajaxForm({
181+
target: '#results',
182+
success: function() {
183+
formInit();
184+
$("button, input:button, input:submit, a.button").button();
185+
$("#grid").trigger("reloadGrid");
186+
}
187+
});
188+
189+
$('#pilotoptionchangepass').ajaxForm({
190+
target: '#dialogresult',
191+
success: function() {
192+
formInit();
193+
}
194+
});
195+
196+
$('#selectpilotgroup').ajaxForm({
197+
target: '#pilotgroups',
198+
success: function() {
199+
formInit();
200+
}
201+
});
202+
203+
$('#addaward').ajaxForm({
204+
target: '#awardslist',
205+
success: function() {
206+
formInit();
207+
}
208+
});
209+
210+
$("button, input:button, input:submit, a.button").button();
211+
}
212+
213+
function reloadGroups() {
214+
$('.pilotgroupajax').live('click', function() {
215+
$("#pilotgroups").load($(this).attr("href"),
216+
{ action: $(this).attr("action"), pilotid: $(this).attr("pilotid"), groupid: $(this).attr("id") },
217+
function() {
218+
reloadGroups();
219+
});
220+
});
221+
222+
$('a.button').button();
223+
$('button').button();
224+
}
225+
226+
function calcDistance() {
227+
$("#distance").val("Calculating...");
228+
$.get(baseurl + "/admin/action.php/operations/calculatedistance",
229+
{ depicao: $("#depicao").val(), arricao: $("#arricao").val() },
230+
function(data) {
231+
$("#distance").val(data);
232+
});
233+
}
233234

234235
function lookupICAO() {
235236
icao = $("#airporticao").val();

admin/maintenance.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
You should either point to this file directly in your web-host's control panel
2222
Or add an entry into the crontab file. I recommend running this maybe 2-3am,
2323
*/
24-
24+
define('ADMIN_PANEL', true);
2525
include dirname(dirname(__FILE__)).'/core/codon.config.php';
26+
Auth::$userinfo->pilotid = 0;
27+
2628
error_reporting(E_ALL);
2729
ini_set('display_errors', 'on');
2830

@@ -47,7 +49,5 @@
4749

4850
MaintenanceData::optimizeTables();
4951

50-
include dirname(__FILE__).'/modules/Maintenance/Maintenance.php';
51-
$m = new Maintenance();
52-
$m->resetpirepcount();
53-
$m->resethours();
52+
MainController::Run('Maintenance', 'resetpirepcount');
53+
MainController::Run('Maintenance', 'resethours');

admin/modules/Maintenance/Maintenance.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ public function changepilotid()
133133
return;
134134
}
135135

136+
if($this->post->new_pilotid < 1)
137+
{
138+
$error = true;
139+
$this->set('message', 'You cannot have an ID less than 1');
140+
$this->render('core_error.tpl');
141+
return;
142+
}
143+
136144
if(empty($this->post->new_pilotid))
137145
{
138146
$error = true;
@@ -157,19 +165,12 @@ public function changepilotid()
157165
$this->render('core_error.tpl');
158166
return;
159167
}
160-
else
161-
{
162-
$error = true;
163-
$this->set('message', 'Invalid pilot!');
164-
$this->render('core_error.tpl');
165-
return;
166-
}
167168

168169
if($error === false)
169170
{
170171
PilotData::changePilotID($this->post->old_pilotid, $this->post->new_pilotid);
171172

172-
$this->set('message', 'Pilot ID changed');
173+
$this->set('message', "Pilot ID changed from {$this->post->old_pilotid} to {$this->post->new_pilotid}");
173174
$this->render('core_success.tpl');
174175
}
175176
}
@@ -264,7 +265,6 @@ public function resethours()
264265
StatsData::UpdateTotalHours();
265266
echo 'Found '.StatsData::TotalHours().' total hours, updated<br /></p>';
266267

267-
268268
LogData::addLog(Auth::$userinfo->pilotid, 'Reset hours');
269269
}
270270

admin/modules/Operations/Operations.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ public function airports()
256256
$this->edit_airport_post();
257257
break;
258258
}
259+
260+
return;
259261
}
260262

261263
//$this->set('airports', OperationsData::getAllAirports());
@@ -801,7 +803,8 @@ protected function add_airport_post()
801803
{
802804

803805
if($this->post->icao == '' || $this->post->name == ''
804-
|| $this->post->country == '' || $this->post->lat == '' || $this->post->long == '')
806+
|| $this->post->country == ''
807+
|| $this->post->lat == '' || $this->post->lng == '')
805808
{
806809
$this->set('message', 'Some fields were blank!');
807810
$this->render('core_error.tpl');
@@ -818,7 +821,7 @@ protected function add_airport_post()
818821
'name' => $this->post->name,
819822
'country' => $this->post->country,
820823
'lat' => $this->post->lat,
821-
'lng' => $this->post->long,
824+
'lng' => $this->post->lng,
822825
'hub' => $this->post->hub,
823826
'chartlink' => $this->post->chartlink,
824827
'fuelprice' => $this->post->fuelprice
@@ -837,16 +840,16 @@ protected function add_airport_post()
837840
return;
838841
}
839842

840-
$this->set('message', 'The airport has been added');
841-
$this->render('core_success.tpl');
843+
/*$this->set('message', 'The airport has been added');
844+
$this->render('core_success.tpl');*/
842845

843846
LogData::addLog(Auth::$userinfo->pilotid, 'Added the airport "'.$this->post->icao.' - '.$this->post->name.'"');
844847
}
845848

846849
protected function edit_airport_post()
847850
{
848851
if($this->post->icao == '' || $this->post->name == ''
849-
|| $this->post->country == '' || $this->post->lat == '' || $this->post->long == '')
852+
|| $this->post->country == '' || $this->post->lat == '' || $this->post->lng == '')
850853
{
851854
$this->set('message', 'Some fields were blank!');
852855
$this->render('core_message.tpl');
@@ -864,7 +867,7 @@ protected function edit_airport_post()
864867
'name' => $this->post->name,
865868
'country' => $this->post->country,
866869
'lat' => $this->post->lat,
867-
'lng' => $this->post->long,
870+
'lng' => $this->post->lng,
868871
'hub' => $this->post->hub,
869872
'chartlink' => $this->post->chartlink,
870873
'fuelprice' => $this->post->fuelprice

admin/templates/finance_expenseform.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h3><?php echo $title;?></h3>
2-
<form id="form" action="<?php echo adminaction('/finances/viewexpenses');?>" method="post">
2+
<form id="form" action="<?php echo adminaction('/finance/viewexpenses');?>" method="post">
33
<dl>
44
<dt>* Expense Name:</dt>
55
<dd><input name="name" type="text" value="<?php echo $expense->name; ?>" /></dd>

admin/templates/maintenance_changepilotid.tpl

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
<p><b>NOTE:</b> Be VERY cautioned when changing a pilot ID. Even though this is 'controlled', problems can still occur. If you change the pilot ID to a number which is HIGHER than the highest pilot ID, all new registered pilots will have an ID starting after that. This WILL change their login ID. <b>This user cannot be logged in while doing the change.</b></p>
2+
<p>The PILOT ID is shown in the following format below:<br />
3+
<pre>FORMATTED_PILOT_ID - DATABASE_ID - NAME</pre>
4+
You must enter a new DATABASE_ID. The formatted pilow ID is based on the database ID and the offset. Your current offset is <strong><?php echo Config::Get('PILOTID_OFFSET');?></strong>.</p>
5+
<p>For example, you want the pilot ID to be VMS<?php echo Config::Get('PILOTID_OFFSET') + 200;?> - for the new ID you would enter: <?php echo 200 - intval(Config::Get('PILOTID_OFFSET'));?>. If your offset is 1000 (meaning all pilot IDs start from 1000), to have a pilot ID of 1030 you would change the DB ID to 30 (that's what you would enter below).
6+
</p>
7+
<p>
8+
<strong>ID Calculator:</strong> Enter the intended pilot ID: <input type="text" value="" onKeyUp="showid(this.value);" /><br />
9+
<span id="enterid"></span>
10+
</p>
11+
<hr>
212
<form action="" method="post">
3-
413
<b>Select Pilot:</b><br />
514
<select name="old_pilotid">
615
<option value="0">Select a Pilot</option>
@@ -32,4 +41,18 @@
3241
<br />
3342
<p><b>Are you sure?</b></p>
3443
<input type="submit" name="submit" value="Confirm Change ID" />
35-
</form>
44+
</form>
45+
<script type="text/javascript">
46+
var OFFSET = <?php echo Config::Get('PILOTID_OFFSET')?>;
47+
function showid(value)
48+
{
49+
value = parseInt(value);
50+
if(value < OFFSET)
51+
{
52+
$("#enterid").html("The displayed pilot ID cannot be less than your offset");
53+
}
54+
55+
id = value - OFFSET;
56+
$("#enterid").html("Enter \""+id+"\" in the field below (without quotes!)");
57+
}
58+
</script>

admin/templates/maintenance_options.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,5 @@
106106
<input type="text" name="cron" style="padding: 5px; width: 400px; " value="php -f <?php echo SITE_ROOT?>admin/maintenance.php" />
107107
</p>
108108
<p>It's recommended to run this sometime between 2-6am (pick an artibrary time when you would least-likely have any flights).
109-
Also, remember to change in local.config.php, USE_CRON to true, so phpVMS doesn't try to automatically schedule these tasks to run.</p>
109+
Also, remember to change in local.config.php, USE_CRON to true, so phpVMS doesn't try to automatically schedule these tasks to run.</p>
110+
<p><strong>Note: </strong> If you setup the cron to run, it's recommended to also run it by hand once to ensure data is populated, unless you want to wait for it to run automatically.</p>

admin/templates/ops_airportform.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h3><?php echo $title?></h3>
2-
<form id="form" action="<?php echo adminaction('/operations/airports');?>" method="post">
2+
<form id="flashForm" action="<?php echo adminaction('/operations/airports');?>" method="post">
33
<dl>
44
<dt>Airport ICAO Code *</dt>
55
<dd><input id="airporticao" name="icao" type="text" value="<?php echo $airport->icao?>" />
@@ -18,7 +18,7 @@
1818
<dd><input id="airportlat" name="lat" type="text" value="<?php echo $airport->lat?>" /></dd>
1919

2020
<dt>Longitude *</dt>
21-
<dd><input id="airportlong" name="long" type="text" value="<?php echo $airport->lng?>" /></dd>
21+
<dd><input id="airportlong" name="lng" type="text" value="<?php echo $airport->lng?>" /></dd>
2222

2323
<dt>Chart Link</dt>
2424
<dd><input id="chartlink" name="chartlink" type="text" value="<?php echo $airport->chartlink?>" /></dd>
@@ -47,6 +47,7 @@
4747
</dd>
4848
</dl>
4949
</form>
50+
5051
<script type="text/javascript">
5152
$("#airporticao").bind("blur", function()
5253
{

admin/templates/ops_airportlist.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h3>Airports List</h3>
2-
2+
<div id="results"></div>
33
<table id="grid"></table>
44
<div id="pager"></div>
55
<br />

core/classes/Debug.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public static function log($string, $filename = 'log')
106106
if($filename == '')
107107
$filename = 'log';
108108

109+
$time = date('m.d.y H:i:s');
109110
$string = "=====\n"
110111
."Time: {$time}\n"
111112
."{$string}\n=====\n\n";

core/classes/ezdb/ezdb_base.class.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -635,14 +635,7 @@ public function build_select($params)
635635

636636
if(!empty($params['where']))
637637
{
638-
if(is_array($params['where']))
639-
{
640-
$sql .= $this->build_where($params['where']);
641-
}
642-
else
643-
{
644-
$sql .= $params['where'];
645-
}
638+
$sql .= $this->build_where($params['where']);
646639
}
647640

648641
if(!empty($params['group']))

0 commit comments

Comments
 (0)