2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
15 require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
16 require_once(AT_INCLUDE_PATH.'../mods/_core/cats_categories/lib/admin_categories.inc.php');
17 require_once(AT_INCLUDE_PATH.'lib/tinymce.inc.php');
18 //require_once(AT_INCLUDE_PATH.'lib/course_icon.inc.php');
20 $_GET['show_courses'] = $addslashes(intval($_GET['show_courses']));
21 $_GET['current_cat'] = $addslashes(intval($_GET['current_cat']));
23 if (!isset($_REQUEST['setvisual']) && !isset($_REQUEST['settext'])) {
24 if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 1) {
25 $_POST['formatting'] = 1;
26 $_REQUEST['settext'] = 0;
27 $_REQUEST['setvisual'] = 0;
29 } else if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 2) {
30 $_POST['formatting'] = 1;
31 $_POST['settext'] = 0;
32 $_POST['setvisual'] = 1;
34 } else { // else if == 0
35 $_POST['formatting'] = 0;
36 $_REQUEST['settext'] = 0;
37 $_REQUEST['setvisual'] = 0;
41 if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']) {
42 load_editor(false, 'banner');
45 if (!isset($isadmin, $course, $db)) {
49 if (isset($_POST['form_course'])) {
51 $row['course_id'] = $_POST['course'];
52 $row['title'] = $_POST['title'];
53 $row['primary_language'] = $_POST['primary_language'];
54 $row['member_id'] = $_POST['member_id'];
55 $row['description'] = $_POST['description'];
56 $row['course_dir_name'] = $_POST['course_dir_name'];
57 $row['cat_id'] = $_POST['cat_id'];
58 $row['content_packaging'] = $_POST['content_packaging'];
60 $row['access'] = $_POST['access'];
61 $row['notify'] = $_POST['notify'];
63 $row['max_quota'] = $_POST['max_quota'];
64 $row['max_file_size'] = $_POST['max_file_size'];
66 $row['created_date'] = date('Y-m-d H:i:s');
67 $row['primary_language'] = $_POST['pri_lang'];
68 $row['rss'] = $_POST['rss'];
70 $row['copyright'] = $_POST['copyright'];
71 $row['icon'] = $_POST['icon'];
72 $row['banner'] = stripcslashes($_POST['banner']);
74 if (intval($_POST['release_date'])) {
75 $day_release = intval($_POST['day_release']);
76 $month_release = intval($_POST['month_release']);
77 $year_release = intval($_POST['year_release']);
78 $hour_release = intval($_POST['hour_release']);
79 $min_release = intval($_POST['min_release']);
81 if (strlen($month_release) == 1){
82 $month_release = "0$month_release";
84 if (strlen($day_release) == 1){
85 $day_release = "0$day_release";
87 if (strlen($hour_release) == 1){
88 $hour_release = "0$hour_release";
90 if (strlen($min_release) == 1){
91 $min_release = "0$min_release";
93 $row['release_date'] = "$year_release-$month_release-$day_release $hour_release:$min_release:00";
95 $row['release_date'] = 0;
98 if (intval($_POST['end_date'])) {
99 $day_end = intval($_POST['day_end']);
100 $month_end = intval($_POST['month_end']);
101 $year_end = intval($_POST['year_end']);
102 $hour_end = intval($_POST['hour_end']);
103 $min_end = intval($_POST['min_end']);
105 if (strlen($month_end) == 1){
106 $month_end = "0$month_end";
108 if (strlen($day_end) == 1){
109 $day_end = "0$day_end";
111 if (strlen($hour_end) == 1){
112 $hour_end = "0$hour_end";
114 if (strlen($min_end) == 1){
115 $min_end = "0$min_end";
117 $row['end_date'] = "$year_end-$month_end-$day_end $hour_end:$min_end:00";
119 $row['end_date'] = 0;
122 } else if ($course) {
123 $sql = "SELECT *, DATE_FORMAT(release_date, '%Y-%m-%d %H:%i:00') AS release_date, DATE_FORMAT(end_date, '%Y-%m-%d %H:%i:00') AS end_date FROM ".TABLE_PREFIX."courses WHERE course_id=$course";
124 $result = mysql_query($sql, $db);
125 if (!($row = mysql_fetch_assoc($result))) {
126 echo _AT('no_course_found');
131 //new course defaults
132 $row['content_packaging'] = 'top';
133 $row['access'] = 'protected';
137 $row['max_quota'] = AT_COURSESIZE_DEFAULT;
138 $row['max_file_size'] = AT_FILESIZE_DEFAULT;
140 $row['primary_language'] = $_SESSION['lang'];
141 $row['created_date'] = date('Y-m-d H:i:s');
142 $row['rss'] = 0; // default to off
143 $row['release_date'] = '0';
144 $row['end_date'] = '0';
147 if (($_POST['setvisual'] || $_POST['settext']) && !$_POST['submit']){
153 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="course_form" enctype="multipart/form-data">
154 <input type="hidden" name="form_course" value="true" />
155 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_config['prof_pic_max_file_size']; ?>" />
156 <input type="hidden" name="course" value="<?php echo $course; ?>" />
157 <input type="hidden" name="old_access" value="<?php echo $row['access']; ?>" />
158 <input type="hidden" name="created_date" value="<?php echo $row['created_date']; ?>" />
159 <input type="hidden" name="show_courses" value="<?php echo $_GET['show_courses']; ?>" />
160 <input type="hidden" name="current_cat" value="<?php echo $_GET['current_cat']; ?>" />
161 <input type="submit" name="submit" style="display:none;"/>
163 <div class="input-form">
164 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('properties'); ?></legend>
165 <?php if ($isadmin): ?>
167 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="inst"><?php echo _AT('instructor'); ?></label><br />
169 $sql = "SELECT member_id, login FROM ".TABLE_PREFIX."members WHERE status=".AT_STATUS_INSTRUCTOR;
170 $result = mysql_query($sql, $db);
172 if ($instructor_row = mysql_fetch_assoc($result)) {
173 echo '<select name="instructor" id="inst">';
175 if ($instructor_row['member_id'] == $row['member_id']) {
176 echo '<option value="'.$instructor_row['member_id'].'" selected="selected">'.$instructor_row['login'].'</option>';
178 echo '<option value="'.$instructor_row['member_id'].'">'.$instructor_row['login'].'</option>';
180 } while($instructor_row = mysql_fetch_assoc($result));
183 echo '<span id="inst">'._AT('none_found').'</span>';
190 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="title"><?php echo _AT('title'); ?></label><br />
191 <input type="text" id="title" name="title" size="40" value="<?php echo htmlspecialchars($row['title']); ?>" />
195 <label for="pri_lang"><?php echo _AT('primary_language'); ?></label><br />
196 <?php $languageManager->printDropdown($row['primary_language'], 'pri_lang', 'pri_lang'); ?>
200 <label for="description"><?php echo _AT('description'); ?></label><br />
201 <textarea id="description" cols="45" rows="2" name="description"><?php echo $row['description']; ?></textarea>
204 <?php if ($_config['course_dir_name']): ?>
206 <label for="course_dir_name"><?php echo _AT('course_dir_name'); ?></label><br />
207 <input type="text" id="course_dir_name" name="course_dir_name" size="40" value="<?php echo htmlspecialchars($row['course_dir_name']); ?>" />
211 <?php $categories = get_categories(); ?>
212 <?php if (is_array($categories)): ?>
214 <label for="cat"><?php echo _AT('category'); ?></label><br />
215 <select name="category_parent" id="cat">
216 <option value="0"> [ <?php echo _AT('cats_uncategorized'); ?> ] </option>
217 <?php select_categories($categories, 0, $row['cat_id'], false); ?>
224 <?php echo _AT('export_content'); ?><br />
226 switch ($row['content_packaging']) {
228 $none = ' checked="checked"';
232 $top = ' checked="checked"';
236 $all = ' checked="checked"';
240 <label><input type="radio" name="content_packaging" value="none" id="none" <?php echo $none; ?> /><?php echo _AT('content_packaging_none'); ?></label><br />
241 <label><input type="radio" name="content_packaging" value="top" id="ctop" <?php echo $top; ?> /><?php echo _AT('content_packaging_top'); ?></label><br />
242 <label><input type="radio" name="content_packaging" value="all" id="all" <?php echo $all; ?> /><?php echo _AT('content_packaging_all'); ?></label>
246 <?php echo _AT('syndicate_announcements'); ?><br />
248 $rss_no = $rss_yes = '';
251 $rss_yes = ' checked="checked"';
253 $rss_no = ' checked="checked"';
256 <label><input type="radio" name="rss" value="1" id="rss_y" <?php echo $rss_yes; ?> /><?php echo _AT('enable_syndicate'); ?></label><br />
257 <label><input type="radio" name="rss" value="0" id="rss_n" <?php echo $rss_no; ?> /><?php echo _AT('disable_syndicate'); ?></label>
261 <?php echo _AT('access'); ?><br />
263 switch ($row['access']) {
265 $pub = ' checked="checked"';
266 $disable = 'disabled="disabled"'; // disable the nofity box
270 $prot = ' checked="checked"';
271 $disable = 'disabled="disabled"'; // disable the nofity box
275 $priv = ' checked="checked"';
279 if ($row['notify']) {
280 $notify = ' checked="checked"';
284 $hide = ' checked="checked"';
287 <input type="radio" name="access" value="public" id="pub" onclick="disableNotify();" <?php echo $pub; ?> /><label for="pub"><strong> <?php echo _AT('public'); ?>: </strong></label><?php echo _AT('about_public'); ?><br /><br />
289 <input type="radio" name="access" value="protected" id="prot" onclick="disableNotify();" <?php echo $prot; ?> /><label for="prot"><strong><?php echo _AT('protected'); ?>:</strong></label> <?php echo _AT('about_protected'); ?><br /><br />
291 <input type="radio" name="access" value="private" id="priv" onclick="enableNotify();" <?php echo $priv; ?> /><label for="priv"><strong><?php echo _AT('private'); ?>:</strong></label> <?php echo _AT('about_private'); ?><br />
292 <input type="checkbox" name="notify" id="notify" value="1" <?php
294 echo $notify; ?> /><label for="notify"><?php echo _AT('email_approvals'); ?></label>
296 <input type="checkbox" name="hide" id="hide" value="1" <?php
298 echo $hide; ?> /><label for="hide"><?php echo _AT('hide_course'); ?></label>.
302 <?php echo _AT('release_date'); ?><br />
304 $rel_no = $rel_yes = '';
306 if (intval($row['release_date'])) {
307 $rel_yes = ' checked="checked"';
309 $today_day = substr($row['release_date'], 8, 2);
310 $today_mon = substr($row['release_date'], 5, 2);
311 $today_year = substr($row['release_date'], 0, 4);
313 $today_hour = substr($row['release_date'], 11, 2);
314 $today_min = substr($row['release_date'], 14, 2);
316 $rel_no = ' checked="checked"';
317 $today_year = date('Y');
322 <input type="radio" name="release_date" value="0" id="release_now" <?php echo $rel_no; ?> /> <label for="release_now"><?php echo _AT('available_immediately'); ?></label><br />
325 <input type="radio" name="release_date" value="1" id="release_later" <?php echo $rel_yes; ?> /> <label for="release_later"><?php echo _AT('release_on'); ?></label>
328 require(AT_INCLUDE_PATH.'html/release_date.inc.php');
333 <?php echo _AT('end_date'); ?><br />
335 $end_no = $end_yes = '';
337 if (intval($row['end_date'])) {
338 $end_yes = ' checked="checked"';
340 $today_day = substr($row['end_date'], 8, 2);
341 $today_mon = substr($row['end_date'], 5, 2);
342 $today_year = substr($row['end_date'], 0, 4);
344 $today_hour = substr($row['end_date'], 11, 2);
345 $today_min = substr($row['end_date'], 14, 2);
347 $end_no = ' checked="checked"';
348 $today_year = date('Y')+1;
353 <input type="radio" name="end_date" value="0" id="end_now" <?php echo $end_no; ?> /> <label for="end_now"><?php echo _AT('no_end_date'); ?></label><br />
355 <input type="radio" name="end_date" value="1" id="end_later" <?php echo $end_yes; ?> /> <label for="end_later"><?php echo _AT('end_on'); ?></label>
358 require(AT_INCLUDE_PATH.'html/release_date.inc.php');
364 if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']){
365 echo '<input type="hidden" name="setvisual" value="'.$_POST['setvisual'].'" />';
366 echo '<input type="submit" name="settext" value="'._AT('switch_text').'" class="button"/>';
368 echo '<input type="submit" name="setvisual" value="'._AT('switch_visual').'" class="button"/>';
374 <label for="banner"><?php echo _AT('banner'); ?></label><br />
375 <textarea id="banner" cols="45" rows="15" name="banner"><?php echo $row['banner']; ?></textarea>
378 <?php if (!$course) : ?>
380 <label for="initial_content"><?php echo _AT('initial_content'); ?></label><br />
381 <select name="initial_content" id="initial_content" size="5">
382 <option value="0"><?php echo _AT('empty'); ?></option>
383 <option value="1" selected="selected"><?php echo _AT('create_basic'); ?></option>
385 $Backup = new Backup($db);
388 $sql = "SELECT course_id, title FROM ".TABLE_PREFIX."courses ORDER BY title";
390 $sql = "SELECT course_id, title FROM ".TABLE_PREFIX."courses WHERE member_id=$_SESSION[member_id] ORDER BY title";
393 $result = mysql_query($sql, $db);
395 if ($course_row = mysql_fetch_assoc($result)) {
397 $Backup->setCourseID($course_row['course_id']);
398 $list = $Backup->getAvailableList();
401 echo '<optgroup label="'. _AT('restore').': '.$course_row['title'].'">';
402 foreach ($list as $list_item) {
403 echo '<option value="'.$list_item['backup_id'].'_'.$list_item['course_id'].'">'.$list_item['file_name'].' - '.get_human_size($list_item['file_size']).'</option>';
407 } while ($course_row = mysql_fetch_assoc($result));
412 <?php endif; // !$course_id ?>
414 <?php if ($isadmin) : ?>
416 <?php echo _AT('course_quota'); ?><br />
418 if ($row['max_quota'] == AT_COURSESIZE_UNLIMITED) {
419 $c_unlim = ' checked="checked" ';
420 $c_oth2 = ' disabled="disabled" ';
421 } elseif ($row['max_quota'] == AT_COURSESIZE_DEFAULT) {
422 $c_def = ' checked="checked" ';
423 $c_oth2 = ' disabled="disabled" ';
425 $c_oth = ' checked="checked" ';
430 $course_size = dirsize(AT_CONTENT_DIR . $course.'/');
436 echo _AT('current_course_size') .': '.get_human_size($course_size).'<br />';
440 <input type="radio" id="c_default" name="quota" value="<?php echo AT_COURSESIZE_DEFAULT; ?>" onclick="disableOther();" <?php echo $c_def;?> /><label for="c_default"> <?php echo _AT('default') . ' ('.get_human_size($MaxCourseSize).')'; ?></label> <br />
441 <input type="radio" id="c_unlim" name="quota" value="<?php echo AT_COURSESIZE_UNLIMITED; ?>" onclick="disableOther();" <?php echo $c_unlim;?>/><label for="c_unlim"> <?php echo _AT('unlimited'); ?></label> <br />
442 <input type="radio" id="c_other" name="quota" value="2" onclick="enableOther();" <?php echo $c_oth;?>/><label for="c_other"> <?php echo _AT('other'); ?> </label> -
443 <input type="text" id="quota_entered" name="quota_entered" <?php echo $c_oth2?> value="<?php if ($row['max_quota']!=AT_COURSESIZE_UNLIMITED && $row['max_quota']!=AT_COURSESIZE_DEFAULT) { echo bytes_to_megabytes($row['max_quota']); } ?>" size="4" /> <?php echo _AT('mb'); ?>
447 <?php echo _AT('max_file_size'); ?><br />
449 $max_allowed = megabytes_to_bytes(substr(ini_get('upload_max_filesize'), 0, -1));
451 if ($row['max_file_size'] == AT_FILESIZE_DEFAULT) {
452 $f_def = ' checked="checked" ';
453 $f_oth2 = ' disabled="disabled" ';
454 } elseif ($row['max_file_size'] == AT_FILESIZE_SYSTEM_MAX) {
455 $f_max = ' checked="checked" ';
456 $f_oth2 = ' disabled="disabled" ';
458 $f_oth = ' checked="checked" ';
462 <input type="radio" id="f_default" name="filesize" value="<?php echo AT_FILESIZE_DEFAULT; ?>" onclick="disableOther2();" <?php echo $f_def;?> /><label for="f_default"> <?php echo _AT('default') . ' ('.get_human_size($MaxFileSize).')'; ?></label> <br />
463 <input type="radio" id="f_maxallowed" name="filesize" value="<?php echo AT_FILESIZE_SYSTEM_MAX; ?>" onclick="disableOther2();" <?php echo $f_max;?>/><label for="f_maxallowed"> <?php echo _AT('max_file_size_system') . ' ('.get_human_size($max_allowed).')'; ?></label> <br />
464 <input type="radio" id="f_other" name="filesize" value="2" onclick="enableOther2();" <?php echo $f_oth;?>/><label for="f_other"> <?php echo _AT('other'); ?> </label> -
465 <input type="text" id="filesize_entered" name="filesize_entered" <?php echo $f_oth2?> value="<?php if ($row['max_file_size']!=AT_FILESIZE_DEFAULT && $row['max_file_size']!=AT_FILESIZE_SYSTEM_MAX) { echo bytes_to_megabytes($row['max_file_size']); } ?>" size="4" /> <?php echo _AT('mb'); ?>
469 <input type="hidden" name="quota" value="<?php echo $row['max_quota']; ?>" />
470 <input type="hidden" name="filesize" value="<?php echo $row['max_file_size']; ?>" />
471 <input type="hidden" name="tracking" value="<?php echo $row['tracking']; ?>" />
475 <label for="copyright"><?php echo _AT('course_copyright'); ?></label><br />
476 <textarea name="copyright" rows="2" cols="65" id="copyright"><?php echo $row['copyright']; ?></textarea>
480 if ($row['icon'] != ''):
481 $path = AT_CONTENT_DIR.$row['course_id']."/custom_icons/";
482 if (file_exists($path.$row['icon'])) {
483 if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {
484 $custom_icon_path = 'get_course_icon.php/?id='.$row['course_id'];
486 $_base_href = 'content/' . $row['course_id'] . '/';
489 $_base_href = "images/courses/"; //$_base_href = 'get_course_icon.php/?id='.$row['course_id'];
492 $force_get = (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) ? true : false;
493 echo "<input type='hidden' name='boolForce' id='boolForce' value='$force_get' />";
495 //include(AT_INCLUDE_PATH.'html/course_icon.inc.php');
497 <img id="i0" src="<?php echo ($custom_icon_path=='')?$_base_href.$row['icon']:$custom_icon_path; ?>" alt="<?php echo $row['icon']; ?>" border="1" height="79" width="79" style="float: left; margin: 2px;" />
500 <img id="i0" src="images/clr.gif" alt="" style="float: left; margin: 2px;" border="1" height="79" width="79" />
501 <input type='hidden' name='boolForce' id='boolForce' value='' />
503 <div style="width:40%; float:left;">
504 <label for="icons"><?php echo _AT('icon'); ?></label><br />
505 <select name="icon" id="icons" onchange="SelectImg()">
506 <option value=""><?php echo _AT('no_icon'); ?></option>
507 <?php // ------------- custom course icons
508 $path = AT_CONTENT_DIR.$row['course_id']."/custom_icons/";
513 $boolCustom = true; // true if custom icons are uploaded, otherwise false
515 /*$files = scandir($path); //SCANDIR STOPS ATUTOR WHEN RUN AS INSTRUCTOR, BUT NOT AS ADMIN. WHY? -Gorzan */
517 /* PHP 4 REPLACEMENT FOR SCANDIR */
518 $dh = opendir($path);
519 while (false !== ($filename = readdir($dh))) {
520 $files[] = $filename;
523 /*END PHP 4 REPLACEMENT FOR SCANDIR*/
524 echo "<optgroup label='"._AT('custom_icons')."'>";
525 foreach($files as $val) {
526 $file_ext = substr(strtolower($val), -3);
527 if ($file_ext == "jpg" || $file_ext == "png" || $file_ext == "gif") {
529 echo "<option value='".$val."'";
530 if ($val == $row['icon']) {
531 echo 'selected="selected"';
533 echo ">".$val."</option>";
540 <?php // ------------- other icons
542 $course_imgs = array();
543 if ($dir = opendir(AT_INCLUDE_PATH.'../images/courses/')) {
544 while (false !== ($file = readdir($dir)) ) {
545 if( ($file == '.') || ($file == '..')) {
548 $course_imgs[] = $file;
553 if ($boolCustom == true) {
554 echo "<optgroup label='"._AT('builtin_icons')."'>";
556 foreach ($course_imgs as $file) {
557 echo '<option value="' . $file . '" ';
558 if ($file == $row['icon']) {
559 echo 'selected="selected"';
561 echo ' >' . $file . '</option>';
563 if ($boolCustom == true) {
567 </select><?php echo " "._AT('or'); ?>
569 <!-- div class="row" style="float:right;width:40%;">
570 <?php echo _AT('upload_icon'); ?><br />
571 <input type="file" name="customicon" id="customicon" value="<?php echo $_POST['customicon']; ?>"/><br />
572 <small><?php echo _AT('upload_icon_text'); ?></small>
575 <?php require_once(AT_INCLUDE_PATH.'../mods/_core/courses/html/course_icon.inc.php'); ?>
577 <br style="clear: left;" />
581 <div style="clear: both;"></div>
585 <div class="buttons">
587 echo "<input type='hidden' name='custOptCount' id='custOptCount' value='".$optCount."' />";
588 echo "<input type='hidden' name='courseId' id='courseId' value='".$row['course_id']."' />";
591 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
592 <input type="submit" name="cancel" value="<?php echo _AT('cancel');?>" />
600 if ($_POST['customicon']) {
601 echo "<script language='javascript' type='text/javascript'>document.getElementById('uploadform').focus();</script>";
605 <script language="javascript" type="text/javascript">
607 function enableNotify() {
608 document.course_form.notify.disabled = false;
609 document.course_form.hide.disabled = false;
612 function disableNotify() {
613 document.course_form.notify.disabled = true;
614 document.course_form.hide.disabled = true;
617 function enableOther() { document.course_form.quota_entered.disabled = false; }
618 function disableOther() { document.course_form.quota_entered.disabled = true; }
619 function enableOther2() { document.course_form.filesize_entered.disabled = false; }
620 function disableOther2() { document.course_form.filesize_entered.disabled = true; }
622 function enableRelease() {
623 document.course_form.day_release.disabled = false;
624 document.course_form.month_release.disabled = false;
625 document.course_form.year_release.disabled = false;
626 document.course_form.hour_release.disabled = false;
627 document.course_form.min_release.disabled = false;
629 function disableRelease() {
630 document.course_form.day_release.disabled = true;
631 document.course_form.month_release.disabled = true;
632 document.course_form.year_release.disabled = true;
633 document.course_form.hour_release.disabled = true;
634 document.course_form.min_release.disabled = true;
637 function SelectImg() {
638 // UPDATED by Martin Turlej - for custom course icon
640 var boolForce = document.getElementById('boolForce').value;
641 if (document.course_form.icon.options[document.course_form.icon.selectedIndex].value == "") {
642 document.getElementById('i0').src = "images/clr.gif";
643 document.getElementById('i0').alt = "";
645 var iconIndx = document.course_form.icon.selectedIndex;
646 var custIndx = document.getElementById('custOptCount').value;
647 var courseId = document.getElementById('courseId').value;
649 // if icon is part of custom icons choose corresponding directory
650 if (iconIndx <= custIndx && boolForce != '') {
651 var dir = (boolForce == 1) ? "get_course_icon.php/?id="+courseId : "/content/"+courseId+"/custom_icons/";
653 var dir = "images/courses/";
656 document.getElementById('i0').src = dir + document.course_form.icon.options[iconIndx].value;
657 document.getElementById('i0').alt = document.course_form.icon.options[iconIndx].value;
661 function toggleFrm(id) {
662 if (document.getElementById(id).style.display == "none") {
664 document.getElementById(id).style.display='';
666 if (id == "c_folder") {
667 document.form0.new_folder_name.focus();
668 } else if (id == "upload") {
669 document.form0.file.focus();
674 document.getElementById(id).style.display='none';