190 likes | 582 Views
Custom Alerts. Dean Dahlvang PSUG-MO March 2010. About Dean. Dean Dahlvang (ddahlvan@proctor.k12.mn.us) Director of Administrative Technology for the Proctor Public Schools (just outside of Duluth, Minnesota at the tip of Lake Superior).
E N D
Custom Alerts Dean Dahlvang PSUG-MO March 2010
About Dean • Dean Dahlvang (ddahlvan@proctor.k12.mn.us) • Director of Administrative Technology for the Proctor Public Schools (just outside of Duluth, Minnesota at the tip of Lake Superior). • PowerSchool Admin for 9 years, PowerSchool contracted state reporting programmer for the last 4 years. • I winter camp near the Canadian border.
What are Alerts? • Alerts are the little icons that appear in the student name section of a student page. • Here are the delivered alerts • Birthday • Discipline • Guardian • Medical • Other
How Do Alerts Function? • Alerts basically react to a logical condition. If that condition is met, then the icon(s) appear at the top of the page. • Birthday alert is triggered when a student is nearing their birthday • Discipline, Guardian, Medical and Other are triggered when data is entered into a specific field.
What Do Alerts Do? • When an alert is triggered, it allows us to click on the icon and then it displays a pop-up window with specific information. • The pop-up window is just a skinnied down web page. • Some alerts also have expiration dates. The expiration date is included in the logic that triggers the icon.
How Do We Make Our Own Alert? • Let’s start with a simple “static” alert. • This alert is triggered by the presence of data in some field (like the medical and other alerts). • We will worry about 3 things: • The field that will trigger the alert and how to populate the field. • The wildcard file that holds the student header information. • The pop-up page that will display.
Student Note Alert • In this example we will create a custom field and a custom page that will trigger our Student Note alert. • Using the conventional means, create a custom field called student_note. • Also, create a custom screen that will allow text entry for our new field student_note. • This will allow users to populate our custom screen if they want the alert to trigger.
Student Note Alert (step 2) • Alert icons appear at the top of the page in the student name header. • This header is a wildcard file called title_student_end.txt • Change this <td>~[studentalert]</td> to: • <td>~[studentalert]~[if.~([01]student_note)#]<a href="javascript:alertwindow('~[directory]', 'note', '~(studentfrn)')" onMouseOver="window.status='Student Note'; return true"><imgsrc="/images/student_note.gif" alt="Student Note" border="0"></a>[/if]</td>
Student Note Alert (step 3) • To create the pop-up page, copy an existing alert like otheralert.html to the custom area. Rename the page to notealert.html (“note” was a parameter in our step 2!) • Modify a couple of lines of code to reflect the Student Note instead of Other alert info • Add the field that contains the alert text ~(student_note)
Student Note Alert Code • Otheralert.html • <title>Other Alert</title> • <imgsrc="/images/alert_otherwhite.gif" width="42" height="42" alt="" border="0"> • <span class="header">Other Alert</span> • <td colspan="3">~(alert_other)<br> <br>Alert Expires: ~[if.~(alert_otherexpires)=0/0/0]Never[else]~(alert_otherexpires)[/if]<br> <br></td> • Notealert.html • <title>Student Note</title> • <imgsrc="/images/student_notewhite.gif" width="42" height="42" alt="" border="0"> • <span class="header">Student Note</span> • <td colspan="3">~(student_note)<br> <br> <br></td>
Try It Out! • Let’s see what happens when we try it! • Also, creating the icon graphics are not covered in this session. You are on your own for those. • Typically, the header icon is 30px x 24px. • The “white” icon is 42px x 42px.
How ‘Bout a Dynamic Alert? • What if we wanted to be aware of something that wasn’t user triggered but data triggered? • Let’s create an alert that will warn us if a student has an F as a historical grade. • The trigger will be if a student has an F grade count greater than 0. • We can employ a gpa calculation method to help.
The F Alert • Create a very, very simple gpa calculation method to count the number of cumulative F’s. • Method Name: F CountFormula: countof("F",gpa_grade())Calculation Type: Cumulative
The F Alert (step 2) • Just like with the Student Note alert, we need to make an adjustment to the wildcard file that acts as our trigger. • <td>~[studentalert]~[if.~([01]student_note)#]<a href="javascript:alertwindow('~[directory]', 'note', '~(studentfrn)')" onMouseOver="window.status='Student Note'; return true"><imgsrc="/images/student_note.gif" alt="Student Note" border="0"></a>[/if]~[if.~(*gpa method="F Count")>0]<a href="javascript:alertwindow('~[directory]', 'f', '~(studentfrn)')" onMouseOver="window.status='F Alert'; return true"><imgsrc="/images/fcount.gif" alt="F Alert" border="0"></a>[/if]</td>
The F Alert (step 3) • Again, use a copy of the otheralert.html file as a guide (or our previously used notealert.html) • Name the file falert.html (remember the parameter from step 2.) • Code changes • <title>F Alert</title> • <imgsrc="/images/fcountwhite.gif" width="42" height="42" alt="" border="0"> • <span class="header">F Alert</span> • <td colspan="3">Number of F grades: ~(*gpa method="F Count")<br> <br> <br></td>
Summary • The alert in 3 simple steps: • The field that will trigger the alert and how to populate the field. • The wildcard file that holds the student header information. • The pop-up page that will display. • Remember to use the Other Alert as an example.