| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Rev: 197 $ | $LastChangedBy: brieb $ |
|---|
| 4 | $LastChangedDate: 2007-03-02 10:48:56 -0700 (Fri, 02 Mar 2007) $ |
|---|
| 5 | +-------------------------------------------------------------------------+ |
|---|
| 6 | | Copyright (c) 2004 - 2010, Kreotek LLC | |
|---|
| 7 | | All rights reserved. | |
|---|
| 8 | +-------------------------------------------------------------------------+ |
|---|
| 9 | | | |
|---|
| 10 | | Redistribution and use in source and binary forms, with or without | |
|---|
| 11 | | modification, are permitted provided that the following conditions are | |
|---|
| 12 | | met: | |
|---|
| 13 | | | |
|---|
| 14 | | - Redistributions of source code must retain the above copyright | |
|---|
| 15 | | notice, this list of conditions and the following disclaimer. | |
|---|
| 16 | | | |
|---|
| 17 | | - Redistributions in binary form must reproduce the above copyright | |
|---|
| 18 | | notice, this list of conditions and the following disclaimer in the | |
|---|
| 19 | | documentation and/or other materials provided with the distribution. | |
|---|
| 20 | | | |
|---|
| 21 | | - Neither the name of Kreotek LLC nor the names of its contributore may | |
|---|
| 22 | | be used to endorse or promote products derived from this software | |
|---|
| 23 | | without specific prior written permission. | |
|---|
| 24 | | | |
|---|
| 25 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
|---|
| 26 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
|---|
| 27 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
|---|
| 28 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
|---|
| 29 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
|---|
| 30 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
|---|
| 31 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
|---|
| 32 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
|---|
| 33 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
|---|
| 34 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
|---|
| 35 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
|---|
| 36 | | | |
|---|
| 37 | +-------------------------------------------------------------------------+ |
|---|
| 38 | */ |
|---|
| 39 | |
|---|
| 40 | include("../../include/session.php"); |
|---|
| 41 | include("include/tables.php"); |
|---|
| 42 | include("include/fields.php"); |
|---|
| 43 | include("include/scheduler.php"); |
|---|
| 44 | |
|---|
| 45 | $thetable = new scheduler($db,"tbld:83de284b-ef79-3567-145c-30ca38b40796"); |
|---|
| 46 | $therecord = $thetable->processAddEditPage(); |
|---|
| 47 | |
|---|
| 48 | if(isset($therecord["phpbmsStatus"])) |
|---|
| 49 | $statusmessage = $therecord["phpbmsStatus"]; |
|---|
| 50 | |
|---|
| 51 | $pageTitle="Scheduler"; |
|---|
| 52 | |
|---|
| 53 | $currentpath=getcwd(); |
|---|
| 54 | |
|---|
| 55 | $phpbms->cssIncludes[] = "pages/scheduler.css"; |
|---|
| 56 | $phpbms->jsIncludes[] = "modules/base/javascript/scheduler.js"; |
|---|
| 57 | |
|---|
| 58 | //Form Elements |
|---|
| 59 | //============================================================== |
|---|
| 60 | $theform = new phpbmsForm(); |
|---|
| 61 | $theform->id = $theform->name; |
|---|
| 62 | |
|---|
| 63 | $theinput = new inputCheckbox("inactive",$therecord["inactive"]); |
|---|
| 64 | $theform->addField($theinput); |
|---|
| 65 | |
|---|
| 66 | $theinput = new inputField("name",$therecord["name"],NULL,true,NULL,32,64); |
|---|
| 67 | $theinput->setAttribute("class","important"); |
|---|
| 68 | $theform->addField($theinput); |
|---|
| 69 | |
|---|
| 70 | if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ |
|---|
| 71 | |
|---|
| 72 | $list = array( |
|---|
| 73 | "file" => "job", |
|---|
| 74 | "push record"=>"pushrecord" |
|---|
| 75 | ); |
|---|
| 76 | $theinput = new inputBasicList("scripttype", $therecord["scripttype"], $list, "script type"); |
|---|
| 77 | $theform->addField($theinput); |
|---|
| 78 | |
|---|
| 79 | $theinput = new inputSmartSearch($db, "pushrecordid", "Pick Push Record For Cron", $therecord["pushrecordid"]); |
|---|
| 80 | $theform->addField($theinput); |
|---|
| 81 | |
|---|
| 82 | }//end if |
|---|
| 83 | |
|---|
| 84 | $theinput = new inputField("job",$therecord["job"],"script",false,NULL,32,128,false); |
|---|
| 85 | $theform->addField($theinput); |
|---|
| 86 | |
|---|
| 87 | $theinput = new inputDatePicker("startdate",$therecord["startdate"], "start date" ,true, 11, 15, false); |
|---|
| 88 | $theform->addField($theinput); |
|---|
| 89 | |
|---|
| 90 | $theinput = new inputTimePicker("starttime",$therecord["starttime"], "start time" ,true,11, 15, false); |
|---|
| 91 | $theform->addField($theinput); |
|---|
| 92 | |
|---|
| 93 | $theinput = new inputDatePicker("enddate",$therecord["enddate"], "end date" ,false, 11, 15, false); |
|---|
| 94 | $theform->addField($theinput); |
|---|
| 95 | |
|---|
| 96 | $theinput = new inputTimePicker("endtime",$therecord["endtime"], "end time" ,false,11, 15, false); |
|---|
| 97 | $theform->addField($theinput); |
|---|
| 98 | |
|---|
| 99 | $thetable->getCustomFieldInfo(); |
|---|
| 100 | $theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord); |
|---|
| 101 | $theform->jsMerge(); |
|---|
| 102 | //============================================================== |
|---|
| 103 | //End Form Elements |
|---|
| 104 | |
|---|
| 105 | include("header.php"); |
|---|
| 106 | |
|---|
| 107 | ?><div class="bodyline"> |
|---|
| 108 | <?php $theform->startForm($pageTitle)?> |
|---|
| 109 | |
|---|
| 110 | <fieldset id="fsAttributes"> |
|---|
| 111 | <legend>attributes</legend> |
|---|
| 112 | <p><?php $theform->showField("inactive");?></p> |
|---|
| 113 | |
|---|
| 114 | <p> |
|---|
| 115 | script last run<br /> |
|---|
| 116 | <strong><?php if($therecord["lastrun"]) echo $therecord["lastrun"]; else echo "never"?></strong> |
|---|
| 117 | </p> |
|---|
| 118 | </fieldset> |
|---|
| 119 | |
|---|
| 120 | <div id="leftSideDiv"> |
|---|
| 121 | <fieldset> |
|---|
| 122 | <legend>Enabling the Scheduler</legend> |
|---|
| 123 | <p>In order to enable the phpBMS scheduler, make sure you add the following line to your crontab:</p> |
|---|
| 124 | <p class="mono important">* * * * * |
|---|
| 125 | cd <?php echo $currentpath;?>; php -f cron.php > /dev/null 2>&1 </p> |
|---|
| 126 | </fieldset> |
|---|
| 127 | <fieldset> |
|---|
| 128 | <legend>Scheduled Job</legend> |
|---|
| 129 | |
|---|
| 130 | <p><?php $theform->showField("name");?></p> |
|---|
| 131 | |
|---|
| 132 | <?php if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ ?> |
|---|
| 133 | <p><?php $theform->showField("scripttype"); ?></p> |
|---|
| 134 | <p id="pushrecordidp"> |
|---|
| 135 | <?php $theform->showField("pushrecordid"); ?> |
|---|
| 136 | </p> |
|---|
| 137 | <?php }//end if ?> |
|---|
| 138 | <p id="jobp"> |
|---|
| 139 | <label for="job">script</label> <span class="notes">(path relative to <?php echo $currentpath?>)</span><br /> |
|---|
| 140 | <?php $theform->showField("job");?> |
|---|
| 141 | </p> |
|---|
| 142 | <p> |
|---|
| 143 | <label for="description">description</label><br /> |
|---|
| 144 | <textarea id="description" name="description" rows="4" cols="48"><?php echo htmlQuotes($therecord["description"]) ?></textarea> |
|---|
| 145 | </p> |
|---|
| 146 | </fieldset> |
|---|
| 147 | |
|---|
| 148 | <fieldset> |
|---|
| 149 | <legend>Interval</legend> |
|---|
| 150 | <p class="crontabnotation"> |
|---|
| 151 | <label for="min">min</label><br /> |
|---|
| 152 | <input name="min" id="min" maxlength="25" size="3" value="<?php echo $therecord["min"]?>" type="text" /> |
|---|
| 153 | </p> |
|---|
| 154 | <p class="crontabnotation"> |
|---|
| 155 | <label for="hrs">hrs</label><br /> |
|---|
| 156 | <input name="hrs" id="hrs" maxlength="25" size="3" value="<?php echo $therecord["hrs"]?>" type="text" /> |
|---|
| 157 | </p> |
|---|
| 158 | <p class="crontabnotation"> |
|---|
| 159 | <label for="date">date</label><br /> |
|---|
| 160 | <input name="date" id="date" maxlength="25" size="3" value="<?php echo $therecord["date"]?>" type="text" /> |
|---|
| 161 | </p> |
|---|
| 162 | <p class="crontabnotation"> |
|---|
| 163 | <label for="mo">mo</label><br /> |
|---|
| 164 | <input name="mo" id="mo" maxlength="25" size="3" value="<?php echo $therecord["mo"]?>" type="text" /> |
|---|
| 165 | </p> |
|---|
| 166 | <p class="crontabnotation"> |
|---|
| 167 | <label for="day">day</label><br /> |
|---|
| 168 | <input name="day" id="day" maxlength="25" size="3" value="<?php echo $therecord["day"]?>" type="text" /> |
|---|
| 169 | </p> |
|---|
| 170 | <p class="notes" id="standarNotationP">(Uses standard crontab notation.)</p> |
|---|
| 171 | |
|---|
| 172 | </fieldset> |
|---|
| 173 | <fieldset> |
|---|
| 174 | <legend>Dates</legend> |
|---|
| 175 | <p> |
|---|
| 176 | <label for="startdate">start</label><br /> |
|---|
| 177 | <?php $theform->showField("startdate");?> <?php $theform->showField("starttime");?> |
|---|
| 178 | </p> |
|---|
| 179 | <p> |
|---|
| 180 | <label for="enddate">end</label><br /> |
|---|
| 181 | <?php $theform->showField("enddate");?> <?php $theform->showField("endtime");?> |
|---|
| 182 | </p> |
|---|
| 183 | </fieldset> |
|---|
| 184 | |
|---|
| 185 | <?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?> |
|---|
| 186 | |
|---|
| 187 | </div> |
|---|
| 188 | |
|---|
| 189 | <?php |
|---|
| 190 | $theform->showGeneralInfo($phpbms,$therecord); |
|---|
| 191 | $theform->endForm(); |
|---|
| 192 | ?> |
|---|
| 193 | </div> |
|---|
| 194 | <?php include("footer.php");?> |
|---|