Files
        @ 435c41f135a5
    
        
              Branch filter: 
        
    Location: SlatePermutate/input.php - annotation
        
            
            435c41f135a5
            12.8 KiB
            text/x-php
        
        
    
    Fix autocomplete of the course number part of a course identifier, fixing a regression from ff180c328353.
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398  | f13987338fbf 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 1cb6f6105b45 f13987338fbf c772d532c74a 5d94cc8ac7cd c772d532c74a c772d532c74a c772d532c74a 27edaecc0d90 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 6b24e9820611 cebfe2251d8c 2e6cc9ff84be f2de63b6af0b 3441c7023bc1 fe65a57a01fe 6b24e9820611 cebfe2251d8c 6b24e9820611 fe65a57a01fe fe65a57a01fe ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f b181890c13e4 ba908910fd8f ba908910fd8f ba908910fd8f 85225ae6e519 85225ae6e519 85225ae6e519 ba908910fd8f ba908910fd8f 85225ae6e519 85225ae6e519 85225ae6e519 ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f cebfe2251d8c 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f ba908910fd8f 85225ae6e519 85225ae6e519 2afaa65abd5e cebfe2251d8c f2de63b6af0b f2de63b6af0b f2de63b6af0b f2de63b6af0b f2de63b6af0b f2de63b6af0b d7044a583ccc f2de63b6af0b ba908910fd8f f2de63b6af0b 85225ae6e519 f652ff09d273 f652ff09d273 0741fde6e765 0741fde6e765 0741fde6e765 0741fde6e765 cebfe2251d8c 3441c7023bc1 3441c7023bc1 acc2b5f0aae2 0741fde6e765 acc2b5f0aae2 0741fde6e765 cebfe2251d8c 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 828706182e2f 828706182e2f 828706182e2f 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 6012ec60a8b0 2afaa65abd5e 2afaa65abd5e 6012ec60a8b0 6012ec60a8b0 6012ec60a8b0 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 6012ec60a8b0 6012ec60a8b0 acc2b5f0aae2 bc140e90c361 bc140e90c361 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e cebfe2251d8c 3441c7023bc1 2dcedb8734d1 2dcedb8734d1 acc2b5f0aae2 3441c7023bc1 e01a189f2233 e890665419df 02327021cfa6 e01a189f2233 02327021cfa6 02327021cfa6 3441c7023bc1 3441c7023bc1 03fa89bf8deb 3441c7023bc1 cebfe2251d8c 4d7bb7e8bc2e 4d7bb7e8bc2e 4d7bb7e8bc2e 4d7bb7e8bc2e 4d7bb7e8bc2e 4d7bb7e8bc2e d7044a583ccc d7044a583ccc d7044a583ccc 4d7bb7e8bc2e 4d7bb7e8bc2e 4d7bb7e8bc2e 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 85fd0c4b6efd 4d7bb7e8bc2e 4d7bb7e8bc2e 4d7bb7e8bc2e cebfe2251d8c d903bd3d579e d903bd3d579e d903bd3d579e 1e78016d4463 1e78016d4463 d903bd3d579e 85225ae6e519 1e78016d4463 a23c8e3ebe9e 85225ae6e519 d903bd3d579e 85225ae6e519 eb70a5d98c42 85225ae6e519 85225ae6e519 85225ae6e519 d903bd3d579e d903bd3d579e d903bd3d579e 7a6777d84d07 7a6777d84d07 85225ae6e519 d903bd3d579e d903bd3d579e d903bd3d579e eb70a5d98c42 d903bd3d579e d903bd3d579e d903bd3d579e d903bd3d579e 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 85225ae6e519 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 3b78fdf04ce4 7c7e7468078f aa34ac34003f a569f5a9e624 a569f5a9e624 a569f5a9e624 a569f5a9e624 a569f5a9e624 a569f5a9e624 a569f5a9e624 d903bd3d579e c772d532c74a 82a941eaa8ec 55349723a344 f652ff09d273 f652ff09d273 f652ff09d273 82a941eaa8ec 82a941eaa8ec 82a941eaa8ec 82a941eaa8ec 3f6590312102 82a941eaa8ec d903bd3d579e 4a879ea2e1b6 27edaecc0d90 7ef12fd0ca70 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e cdd71db71d14 2afaa65abd5e 2afaa65abd5e ba908910fd8f 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e 2afaa65abd5e fe65a57a01fe 6012ec60a8b0 ba908910fd8f ba908910fd8f fe65a57a01fe c772d532c74a 4384f5bb4a40 bbc0c3b4c101 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3f6590312102 3f6590312102 3f6590312102 3f6590312102 3f6590312102 3f6590312102 3f6590312102 da3582f113b9 3f6590312102 3f6590312102 3f6590312102 3f6590312102 3f6590312102 d9aac160c873 3f6590312102 3f6590312102 3f6590312102 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 da3582f113b9 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 da3582f113b9 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 3b98a9a5aee8 40ac3e1dc483 27edaecc0d90 27edaecc0d90 bc140e90c361 bc140e90c361 bc140e90c361 bc140e90c361 3b98a9a5aee8 5bc9711b7884 3b98a9a5aee8 185eb297fcfe 27edaecc0d90 185eb297fcfe 4a879ea2e1b6 4a879ea2e1b6 4a879ea2e1b6 5bc9711b7884 5bc9711b7884 4a879ea2e1b6 5bc9711b7884 d903bd3d579e c49dba728f72 3441c7023bc1 acc2b5f0aae2 3441c7023bc1 828706182e2f 828706182e2f 828706182e2f 6012ec60a8b0 6012ec60a8b0 3441c7023bc1 acc2b5f0aae2 acc2b5f0aae2 acc2b5f0aae2 acc2b5f0aae2 3441c7023bc1 3441c7023bc1 6012ec60a8b0 6012ec60a8b0 6012ec60a8b0 6012ec60a8b0 da3582f113b9 da3582f113b9 6012ec60a8b0 fc1e0b24a7eb acc2b5f0aae2 acc2b5f0aae2 bc140e90c361 bc140e90c361 3441c7023bc1 3441c7023bc1 3441c7023bc1 3441c7023bc1 3441c7023bc1  | <?php 
/*
 * Copyright 2010 Nathan Gelderloos, Ethan Zonca, Nathan Phillip Brink
 *
 * This file is part of SlatePermutate.
 *
 * SlatePermutate is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * SlatePermutate is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with SlatePermutate.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.schedule.php';
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.course.inc';
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.section.php';
include_once 'inc' . DIRECTORY_SEPARATOR . 'class.page.php';
require_once('inc' . DIRECTORY_SEPARATOR . 'schedule_store.inc');
/*
 * Help constrol whether or not the school selection dialogue should
 * be shown or whether or not $_SESSION['school_chosen'] should be set
 * TRUE. These things should generally be false when loading a saved
 * schedule.
 */
$creating_new_schedule = TRUE;
$schedule_store = FALSE;
$sch = FALSE;
$errors_fix = FALSE;
$inputPage_options = array('school_semester_constant' => FALSE);
$parent_schedule_id = NULL;
if (isset($_REQUEST['s']))
  {
    $schedule_store = schedule_store_init();
    $parent_schedule_id = (int)$_REQUEST['s'];
    $sch = schedule_store_retrieve($schedule_store, $parent_schedule_id);
    /*
     * Allow a user to change the school and semester of a
     * saved_schedule he's trying to revive if he really wants to.
     */
    if (!empty($_GET['school']))
      $school = school_load_guess(FALSE);
    else
      $school = $sch->school_get();
    if (!empty($_GET['semester']))
      $semester = school_semester_guess($school, FALSE);
    else
      $semester = $sch->semester_get();
    if (!empty($sch))
      {
	$creating_new_schedule = FALSE;
	$inputPage_options += array('school' => $school,
				    'semester' => $semester);
      }
    else
      $parent_schedule_id = NULL;
    /*
     * Code outside of this block should _not_ assume $school and/or
     * $semester are defined. But it'd be more expensive to unset()
     * them here than to just overwrite them later...
     */
  }
elseif (!empty($_REQUEST['e']))
  {
    /*
     * Read an errorful schedule out of $_POST, this $_POST is created
     * by process.php when the originally sinful user produces bad
     * data.
     */
    $errors_fix = TRUE;
    if (!empty($_POST['postData']))
      $postData = $_POST['postData'];
    if (!empty($postData['parent_schedule_id']))
      $parent_schedule_id = (int)$postData['parent_schedule_id'];
    if (!empty($postData['school']))
      {
	$school = school_load($postData['school']);
	if (!empty($school))
	  $inputPage_options['school'] = $school;
      }
    if (!empty($school) && !empty($postData['semester']))
      {
	$semesters = school_semesters($school);
	if (!empty($semesters[$postData['semester']]))
	  $inputPage_options['semester'] = $semester;
      }
    $creating_new_schedule = FALSE;
  }
/*
 * We cannot initialize the page object nor guess the school before
 * figuring loading a saved schedule because we'll default to that
 * saved_schedule's school/semester.
 */
$scripts = array('jQuery', 'jQueryUI', 'qTip2', 'schedInput');
$inputPage = page::page_create('Enter Courses', $scripts, $inputPage_options);
$school = $inputPage->get_school();
$semester = $inputPage->semester_get();
$my_hc = 'var slate_permutate_example_course_id = ' . json_encode(school_example_course_id($school)) . ';
jQuery(document).ready(
  function()
  {
    var class_last = 0;
';
if ($sch)
{
  foreach ($sch->courses_get() as $course)
    {
      $my_hc .= input_course_js($course, '    ');
    }
}
elseif ($errors_fix)
  {
    foreach ($_POST['postData'] as $course)
      if (is_array($course))
	{
	  $title = '';
	  if (!empty($course['title']))
	    $title = $course['title'];
	  if (empty($course['name']))
	    $my_hc .= '    class_last = add_class();' . PHP_EOL;
	  else
	    $my_hc .= '    class_last = add_class_n(' . json_encode($course['name']) . ', ' . json_encode($title) . ');' . PHP_EOL;
	  foreach ($course as $section)
	    if (is_array($section))
	      $my_hc .= '    add_section_n(class_last, ' . json_encode($section['letter']) . ', '
		. json_encode($section['synonym']) . ', ' . json_encode($section['start']) . ', '
		. json_encode($section['end']) . ', '
		. json_encode(array('m' => !empty($section['days'][0]), 't' => !empty($section['days'][1]), 'w' => !empty($section['days'][2]),
				    'h' => !empty($section['days'][3]), 'f' => !empty($section['days'][4]),
				    's' => !empty($section['days'][5])))
		. ', ' . json_encode($section['professor']) . ', '
		. json_encode($section['location']) . ', '
		. json_encode($section['type']) . ', '
		. json_encode($section['slot']) . ', '
		. json_encode(isset($section['credit_hours']) ? $section['credit_hours'] : -1) . ');' . PHP_EOL;
	  $my_hc .= PHP_EOL;
	}
  }
else
  {
    $default_courses = school_default_courses($school);
    foreach ($default_courses as $default_class)
      $my_hc .= input_course_js($default_class, '    ');
  }
$my_hc .= '    class_last = add_class();' . PHP_EOL;
if ($qtips_always || !isset($_SESSION['saw_qtips']))
  {
    $my_hc .= '    addTips();' . PHP_EOL;
    $_SESSION['saw_qtips'] = TRUE;
  }
$my_hc .= '  });
';
$inputPage->headcode_add('scheduleInput', $inputPage->script_wrap($my_hc), TRUE);
if ($school['id'] != 'default'
    && empty($_REQUEST['selectschool'])
    && empty($_REQUEST['selectsemester']))
  {
    /*
     * If we have chosen a school, set the canonical URL so that it
     * contains the school and, optionall, the specified
     * schedule. This way, when Google caches the input.php page, the
     * <title/> it sees will reflect the selected school.
     */
    $query = array('school' => $school['id']);
    if ($sch)
      {
	$query['s'] = $sch->id_get();
	/*
	 * When editing a schedule, also canonize on the
	 * semester. Changes to the selected schedule which are made
	 * when editing an existing schedule are not saved into the
	 * SESSION. Thus, for the user to be able to edit a schedule
	 * and load courses from an alternate semester, we must ensure
	 * that semester remains in GET.
	 */
	if (!empty($semester))
	  $query['semester'] = $semester['id'];
      }
    $inputPage->canonize('input.php', $query);
  }
$inputPage->head();
/*
 * Force a student to choose a school or declare he's a generic
 * student before displaying the input form. To do this, we need
 * another variable in $_SESSION: $_SESSION['school_chosen'].
 */
if (!empty($_REQUEST['school']) && !empty($_SESSION['school']) && !strcmp($_REQUEST['school'], $_SESSION['school']))
  $_SESSION['school_chosen'] = TRUE;
if (!empty($_REQUEST['selectschool'])
    || empty($school) || $school['id'] == 'default' && empty($_SESSION['school_chosen']))
  {
    $next_page = 'input.php?';
    if (isset($_GET['s']))
      $next_page .= 's=' . (int)$_GET['s'] . '&';
    if (isset($_GET['semester']))
      $next_page .= 'semester=' . htmlentities($$_GET['semester']) . '&';
?>
<h2>School Selection</h2>
<p>
  Choose the school you attend from the list below. <strong>If you cannot
  find your school</strong>, you may proceed using
  the <a href="<?php echo htmlentities($next_page); ?>school=default">generic
  settings</a>.
</p>
<?php
    $inputPage->showSchools($next_page);
    $inputPage->foot();
    exit;
  }
if (!empty($_REQUEST['selectsemester']))
  {
?>
<h2>Semester Selection</h2>
<p>
  Choose the semester for which you wish you make a schedule from the
  list below. If any semester is missing, please <a
  href="feedback.php?feedback=My+school+is+missing+the+<semester+name>+semester.">let us know</a>.
</p>
<?php
  $next_page = 'input.php?';
  if (isset($_GET['s']))
    $next_page .= 's=' . (int)$_GET['s'] . '&';
  if (!empty($_GET['school']))
    $next_page .= 'school=' . $_GET['school'] . '&';
  $inputPage->showSemesters($next_page);
  $inputPage->foot();
  exit;
  }
$inputPage->showSavedScheds($_SESSION);
?>
<?php if (!empty($input_warning_banner)): ?>
<div class="warning">
  <?php echo $input_warning_banner; ?>
</div>
<?php endif; ?>
<p>
  Welcome to SlatePermutate<?php $inputPage->addressStudent(', ', '', FALSE); ?>!
  <?php if (school_has_auto($inputPage->get_school())): ?>
  To get started, enter in a course identifier (e.g., <em>
  <?php echo school_example_course_id($inputPage->get_school()); ?></em>)
  and click the autosuggestion to automatically load available sections
  for each class.
  <?php else: ?>
  To get started, enter a course number and add some sections to it.
  Then specify each section's letter/number and what times it meets,
  add more courses, and click “Find a Schedule”.
  <!--'-->
  <?php endif; ?>
</p>
<form method="post" action="process.php" id="scheduleForm">
<p class="nospace" style="border-left: 5px solid #999; padding-left: 5px!important; padding-top: 5px!important;"><label>Schedule Name</label><br />
<input
    id="scheduleName"
    style="margin-bottom: 1em;"
    class="defText required input-submit-disable"
    type="text"
    size="25"
    title="My <?php echo $semester['name']; ?> Schedule"
    name="postData[name]"
    <?php
      if ($sch)
        echo 'value="' . htmlentities($sch->getName(), ENT_QUOTES) . '"';
      elseif ($errors_fix)
        echo 'value="' . htmlentities($_POST['postData']['name'], ENT_QUOTES) . '"';
    ?> />
  <?php if (!empty($parent_schedule_id)): ?>
  <input type="hidden" name="postData[parent_schedule_id]" value="<?php echo htmlentities($parent_schedule_id, ENT_QUOTES); ?>" />
  <input type="hidden" name="postData[school]" value="<?php echo htmlentities($school['id']); ?>" />
  <input type="hidden" name="postData[semester]" value="<?php echo htmlentities($semester['id']); ?>" />
  <?php endif; ?>
</p>
<table id="container">
  <tr>
    <td>
      <table id="jsrows">
	<!-- Allow CSS to apply to entire rows at a time. -->
	<colgroup>
	  <col />
	  <col />
	  <col />
	  <col />
	  <col />
	  <col class="sunday<?php if (school_has_auto($inputPage->get_school())) echo ' collapsed';?>" />
	  <col />
	  <col />
	  <col />
	  <col />
	  <col />
	  <col class="saturday<?php if (school_has_auto($inputPage->get_school())) echo ' collapsed';?>" />
	  <col />
	  <col />
	</colgroup>
        <!-- Header -->
        <tr>
          <td>Class ID</td>
          <td class="center" id="letterNumber">Section</td>
          <td class="center">Prof</td>
          <td class="center">Start Time</td>
          <td class="center">End Time</td>
	  <td class="center">Su</td>
          <td class="center">M</td>
          <td class="center">Tu</td>
          <td class="center">W</td>
          <td class="center">Th</td>
          <td class="center">F</td>
	  <td class="center">Sa</td>
          <td class="center"></td>
          <td class="center"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<div class="credit-hours-total">
  <p>Credit Hours: <span class="credit-hours-total-value">0</span></p>
</div>
<div class="paddingtop">
  <input class="button olive" type="submit" value="Find a schedule" />
</div>
</form>
<?php 
/* Show/hide Advanced Options: <p><span id="showadvanced" style="margin-left: 1em;"><a href="#">Advanced</a></span></p> */ 
?>
<div id="showInstructions" style="width: 100%; text-align: center;"><a href="#">Detailed Instructions...</a></div>
<?php
$inputPage->showSchoolInstructions();
$inputPage->foot();
function input_course_js(Course $course, $whitespace = '  ')
{
  $title = $course->title_get();
  if (empty($title))
    $title = '';
  $js = $whitespace . 'class_last = add_class_n(' . json_encode($course->getName()) . ', '
    . json_encode($title) . ');' . PHP_EOL;
  foreach ($course as $course_slot)
    foreach ($course_slot as $section)
      {
	$meetings = $section->getMeetings();
      foreach ($meetings as $meeting)
	{
	  $js .= $whitespace . 'add_section_n(class_last, ' . json_encode($section->getLetter()) . ', '
	    . json_encode($section->getSynonym()) . ', '
	    . json_encode($meeting->getStartTime()) . ', '
	    . json_encode($meeting->getEndTime()) . ', '
	    . json_encode(array('u' => $meeting->getDay(6), 'm' => $meeting->getDay(0), 't' => $meeting->getDay(1),
				'w' => $meeting->getDay(2), 'h' => $meeting->getDay(3), 'f' => $meeting->getDay(4),
				's' => $meeting->getDay(5))) . ', '
	    . json_encode($meeting->instructor_get()) . ', '
	    . json_encode($meeting->getLocation()) . ', '
	    . json_encode($meeting->type_get()) . ', '
	    . json_encode($course_slot->id_get()) . ', '
	    . json_encode($section->credit_hours_get()) . ');' . PHP_EOL;
	}
    }
  return $js;
}
 |