rexpokinghorn
08-26-2010, 09:28 AM
Hi all,
Very amateur coder here hoping to find some help! (If you'd like me to paste the whole bit of code, please let me know!)
I have two button that repeats itself for every extension I have:
<td class="$currentTableClass"><b>$extension</b></td>
<td class="$currentTableClass"><b>$name</b></td>
<td class="$currentTableClass">$select_contacts\t\t\t\t</td>
<td class="$currentTableClass"><input type="button" value="Alert Page" onclick="change_coverage_path(\'$path_number\', document.form1.select$path_number, \'$name\');"></td>
Now, the first button works just great. I have it pop a confirmation window:
<script language="JavaScript">
function change_coverage_path(coverage_path, obj, role) {
var returnvalue = window.confirm("Are you sure you want to page the " + role + "?");
var pt1 = obj.options[obj.selectedIndex].value;
var contact = obj.options[obj.selectedIndex].text;
if (returnvalue) {
document.location.href = "?command=change_coverage_path&coverage_path=" + coverage_path + "&pt1=" + pt1 + "&role=" + role + "&contact=" + contact;
}
}
</script>
And pass that information to send an email out with a message for the specific button selected:
if (($command eq "change_coverage_path") && $c_coverage_path && $c_pt1) {
print <<hereDoc;
<html>
<head>
<script language="JavaScript">
function bodyonload() {
setTimeout("document.location.href = 'pager.cgi'", 3000);
}
</script>
</head>
<body onload="bodyonload();">
<b>Paging $c_role...</b><br><br>
hereDoc
my $result = "";
my $contact_number = `/bin/echo "$c_contact" | cut -d "(" -f2 | sed -e 's/)//'`;
$result = `/bin/echo -e '\nThere's a problem! | /usr/bin/mail -s "Join the Crisis Bridge" $contact_number`;
writelog("$c_role (coverage path $c_coverage_path) changed to $contact_number");
print <<hereDoc;
<b>Update complete. Please wait while the page is refreshed.</b>
</body>
</html>
hereDoc
exit 0;
}
What I'm trying to do is add a text box where you can specify a message instead of having it set static.
$result = `/bin/echo -e '\nThere's a problem! | /usr/bin/mail -s "Join the Crisis Bridge" $contact_number`;
Is there a good way of going about doing this?
Thanks!
Very amateur coder here hoping to find some help! (If you'd like me to paste the whole bit of code, please let me know!)
I have two button that repeats itself for every extension I have:
<td class="$currentTableClass"><b>$extension</b></td>
<td class="$currentTableClass"><b>$name</b></td>
<td class="$currentTableClass">$select_contacts\t\t\t\t</td>
<td class="$currentTableClass"><input type="button" value="Alert Page" onclick="change_coverage_path(\'$path_number\', document.form1.select$path_number, \'$name\');"></td>
Now, the first button works just great. I have it pop a confirmation window:
<script language="JavaScript">
function change_coverage_path(coverage_path, obj, role) {
var returnvalue = window.confirm("Are you sure you want to page the " + role + "?");
var pt1 = obj.options[obj.selectedIndex].value;
var contact = obj.options[obj.selectedIndex].text;
if (returnvalue) {
document.location.href = "?command=change_coverage_path&coverage_path=" + coverage_path + "&pt1=" + pt1 + "&role=" + role + "&contact=" + contact;
}
}
</script>
And pass that information to send an email out with a message for the specific button selected:
if (($command eq "change_coverage_path") && $c_coverage_path && $c_pt1) {
print <<hereDoc;
<html>
<head>
<script language="JavaScript">
function bodyonload() {
setTimeout("document.location.href = 'pager.cgi'", 3000);
}
</script>
</head>
<body onload="bodyonload();">
<b>Paging $c_role...</b><br><br>
hereDoc
my $result = "";
my $contact_number = `/bin/echo "$c_contact" | cut -d "(" -f2 | sed -e 's/)//'`;
$result = `/bin/echo -e '\nThere's a problem! | /usr/bin/mail -s "Join the Crisis Bridge" $contact_number`;
writelog("$c_role (coverage path $c_coverage_path) changed to $contact_number");
print <<hereDoc;
<b>Update complete. Please wait while the page is refreshed.</b>
</body>
</html>
hereDoc
exit 0;
}
What I'm trying to do is add a text box where you can specify a message instead of having it set static.
$result = `/bin/echo -e '\nThere's a problem! | /usr/bin/mail -s "Join the Crisis Bridge" $contact_number`;
Is there a good way of going about doing this?
Thanks!