зеркало из https://github.com/mozilla/oldpto.git
Changed wording from 'reason' to 'details'
git-svn-id: https://svn.mozilla.org/projects/pto/trunk@30603 4eb1ac78-321c-0410-a911-ec516a8615a5
This commit is contained in:
Родитель
78276aeeec
Коммит
43fad0be68
8
auth.php
8
auth.php
|
@ -1,12 +1,18 @@
|
|||
<?php
|
||||
|
||||
function ask() {
|
||||
header('WWW-Authenticate: Basic realm="Mozilla Corporation - LDAP Login"');
|
||||
}
|
||||
|
||||
function wail_and_bail() {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
ask();
|
||||
print "<h1>401 Unauthorized</h1>";
|
||||
die;
|
||||
}
|
||||
|
||||
if (!isset($_SERVER["PHP_AUTH_USER"])) {
|
||||
header('WWW-Authenticate: Basic realm="Mozilla Corporation - LDAP Login"');
|
||||
ask();
|
||||
wail_and_bail();
|
||||
} else {
|
||||
// Check for validity of login
|
||||
|
|
|
@ -20,7 +20,7 @@ define("DISABLE_DB", FALSE);
|
|||
# Set below to TRUE to see MySQL error messages and query strings sent.
|
||||
define("DEBUG_ON", FALSE);
|
||||
|
||||
# Specify HR managers with email address only.
|
||||
# Specify HR managers with email addresses only.
|
||||
$hr_managers = array(
|
||||
"dportillo@mozilla.com",
|
||||
"karen@mozilla.com"
|
||||
|
@ -36,11 +36,11 @@ $notified_people = array(
|
|||
$from = "submitter";
|
||||
|
||||
# The following template variables are available:
|
||||
# %notifier%, %start%, %end%, %reason%
|
||||
# %notifier%, %start%, %end%, %details%
|
||||
$subject = "PTO notification from %notifier%";
|
||||
$body = <<<EOD
|
||||
%notifier% has submitted PTO from %start% to %end% with the reason:
|
||||
%reason%
|
||||
%notifier% has submitted PTO from %start% to %end% with the details:
|
||||
%details%
|
||||
|
||||
- The Happy PTO Managing Intranet App
|
||||
EOD;
|
||||
|
|
|
@ -6,6 +6,12 @@ body {
|
|||
background: url(background.jpg) repeat-x;
|
||||
}
|
||||
|
||||
span.ui-timepickr {
|
||||
background-color: #FCFDFD;
|
||||
border: 1px solid #A6C9E2;
|
||||
-moz-border-radius: 5px;
|
||||
}
|
||||
|
||||
#views {
|
||||
background-color: rgba(102, 204, 255, 0.5);
|
||||
padding: 0.25em 0 0.25em 0;
|
||||
|
|
10
export.php
10
export.php
|
@ -19,7 +19,7 @@ $manager_dn = $data[0]["manager"][0];
|
|||
preg_match("/mail=([a-z]+@mozilla\\.com),/", $manager_dn, $matches);
|
||||
$manager_email = $matches[1];
|
||||
$is_hr = in_array($manager_email, $hr_managers);
|
||||
// Exclude reason from non-HR personnel
|
||||
// Exclude details from non-HR personnel
|
||||
$fields = $is_hr ? '*' : "id, person, added, start, end";
|
||||
|
||||
$query = mysql_query(
|
||||
|
@ -120,10 +120,10 @@ if (function_exists($output_function)){
|
|||
}
|
||||
|
||||
function inject(data) {
|
||||
var preferredOrder = "id|person|added|start|end|reason".split('|');
|
||||
var preferredOrder = "id|person|added|start|end|details".split('|');
|
||||
var fieldNames = {
|
||||
id: "ID", person: "Who", added: "Added on",
|
||||
start: "Start", end: "End", reason: "Reason"
|
||||
start: "Start", end: "End", details: "Details"
|
||||
};
|
||||
var presentFields = [];
|
||||
for (var field in data[0]) { presentFields.push(field); }
|
||||
|
@ -136,10 +136,10 @@ if (function_exists($output_function)){
|
|||
return $.strftime({format: '%Y-%m-%d %H:%M', dateTime: new Date(x * 1000)});
|
||||
};
|
||||
|
||||
var K = function(x) x;
|
||||
var K = function(x) { return x; };
|
||||
var formatters = {
|
||||
id: K, person: function(x) x.replace(/@mozilla\.com$/, ''),
|
||||
added: fdate, start: fdate, end: fdate, reason: K // properly escape reason?
|
||||
added: fdate, start: fdate, end: fdate, details: K
|
||||
};
|
||||
|
||||
$("#pto table").remove();
|
||||
|
|
14
index.php
14
index.php
|
@ -45,7 +45,7 @@ $notified_people[] = $manager_name ." <". $manager_email .'>';
|
|||
(function($) {
|
||||
$(document).ready(function() {
|
||||
$("#start, #end").datepicker();
|
||||
$("#start-time, #end-time").timepickr();
|
||||
$("#start-time, #end-time").timepickr({convention: 12});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
@ -59,15 +59,15 @@ $notified_people[] = $manager_name ." <". $manager_email .'>';
|
|||
<tr>
|
||||
<td><label for="start">Start</label></td>
|
||||
<td>
|
||||
<input type="text" id="start" name="start" /> at
|
||||
<input type="text" id="start-time" name="start_time" size="5" value="00:00" />
|
||||
<input type="text" id="start" name="start" size="10" /> at
|
||||
<input type="text" id="start-time" name="start_time" size="8" value="00:00 am" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="end">End</label></td>
|
||||
<td>
|
||||
<input type="text" id="end" name="end" /> at
|
||||
<input type="text" id="end-time" name="end_tme" size="5" value="00:00" />
|
||||
<input type="text" id="end" name="end" size="10" /> at
|
||||
<input type="text" id="end-time" name="end_tme" size="8" value="00:00 am" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -79,8 +79,8 @@ $notified_people[] = $manager_name ." <". $manager_email .'>';
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="reason">Reason</label><br />(optional)</td>
|
||||
<td><textarea name="reason" id="reason" cols="80" rows="10"></textarea></td>
|
||||
<td><label for="details">Details</label><br />(optional)</td>
|
||||
<td><textarea name="details" id="details" cols="80" rows="10"></textarea></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<input type="submit" value="Submit" />
|
||||
|
|
|
@ -20,7 +20,7 @@ function output_csv($data) {
|
|||
|
||||
header("Content-Type: ". ($correct_mime ? "text/csv" : "text/plain"));
|
||||
$f = fopen("php://output", 'w');
|
||||
$fields = array("id", "person", "added", "reason", "start", "end");
|
||||
$fields = array("id", "person", "added", "details", "start", "end");
|
||||
$dates = array("added", "start", "end");
|
||||
fputcsv($f, array_map("ucwords", $fields));
|
||||
foreach ($data as $pto) {
|
||||
|
|
|
@ -3,10 +3,10 @@ CREATE TABLE IF NOT EXISTS pto (
|
|||
id int(10) unsigned NOT NULL auto_increment,
|
||||
person varchar(128) NOT NULL,
|
||||
added int(11) NOT NULL,
|
||||
reason varchar(255) NOT NULL,
|
||||
details varchar(255) NOT NULL,
|
||||
`start` int(11) NOT NULL,
|
||||
`end` int(11) NOT NULL,
|
||||
PRIMARY KEY (id,person,added),
|
||||
KEY `start` (`start`,`end`),
|
||||
FULLTEXT KEY person (person,reason)
|
||||
FULLTEXT KEY person (person,details)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
|
10
submit.php
10
submit.php
|
@ -47,8 +47,8 @@ while ($check = array_pop($notified_people)) {
|
|||
}
|
||||
$notified_people = $allowed;
|
||||
|
||||
$start_time = isset($_POST["start_time"]) ? $_POST["start_time"] : "00:00";
|
||||
$end_time = isset($_POST["end_time"]) ? $_POST["end_time"] : "00:00";
|
||||
$start_time = isset($_POST["start_time"]) ? $_POST["start_time"] : "00:00 am";
|
||||
$end_time = isset($_POST["end_time"]) ? $_POST["end_time"] : "00:00 am";
|
||||
$start = maketime($_POST["start"] . $start_time);
|
||||
$end = maketime($_POST["end"] . $end_time);
|
||||
|
||||
|
@ -60,7 +60,7 @@ $tokens = array(
|
|||
"%notifier%" => $notifier_name,
|
||||
"%start%" => $_POST["start"],
|
||||
"%end%" => $_POST["end"],
|
||||
"%reason%" => $_POST["reason"]
|
||||
"%details%" => $_POST["details"]
|
||||
);
|
||||
|
||||
foreach ($tokens as $token => $replacement) {
|
||||
|
@ -72,9 +72,9 @@ $c = mysql_connect($mysql["host"], $mysql["user"], $mysql["password"]);
|
|||
mysql_select_db($mysql["database"]);
|
||||
if (!DISABLE_DB) {
|
||||
$query_string =
|
||||
"INSERT INTO pto (person, reason, start, end, added) VALUES(".
|
||||
"INSERT INTO pto (person, details, start, end, added) VALUES(".
|
||||
'"'. $notifier_email .'", '.
|
||||
'"'. mysql_real_escape_string($_POST["reason"]) .'", '.
|
||||
'"'. mysql_real_escape_string($_POST["details"]) .'", '.
|
||||
(string)$start .', '.
|
||||
(string)$end .', '.
|
||||
(string)time() .
|
||||
|
|
Загрузка…
Ссылка в новой задаче