24 require_once
"./classes/class.ilObjectGUI.php";
48 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
50 define (
"ILINC_DEFAULT_HTTP_PORT",80);
51 define (
"ILINC_DEFAULT_SSL_PORT",443);
52 define (
"ILINC_DEFAULT_TIMEOUT",30);
53 $lng->loadLanguageModule(
"delic");
54 $lng->loadLanguageModule(
"gmaps");
55 $lng->loadLanguageModule(
"jsmath");
67 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
69 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
76 $this->tpl->setVariable(
"FORMACTION",
77 $this->ctrl->getFormAction($this));
78 $this->tpl->setVariable(
"TXT_EXTT_TITLE", $this->lng->txt(
"extt_title_configure"));
80 $this->tpl->setVariable(
"TXT_EXTT_NAME", $this->lng->txt(
"extt_name"));
81 $this->tpl->setVariable(
"TXT_EXTT_ACTIVE", $this->lng->txt(
"active").
"?");
82 $this->tpl->setVariable(
"TXT_EXTT_DESC", $this->lng->txt(
"description"));
84 $this->tpl->setVariable(
"TXT_CONFIGURE", $this->lng->txt(
"extt_configure"));
85 $this->tpl->setVariable(
"TXT_EXTT_REMARK", $this->lng->txt(
"extt_remark"));
88 $this->tpl->setVariable(
"TXT_EXTT_ILINC_NAME", $this->lng->txt(
"extt_ilinc"));
89 $this->tpl->setVariable(
"TXT_EXTT_ILINC_DESC", $this->lng->txt(
"extt_ilinc_desc"));
93 $icon_ok =
"<img src=\"".ilUtil::getImagePath(
"icon_ok.gif").
"\" alt=\"".$this->lng->txt(
"enabled").
"\" title=\"".$this->lng->txt(
"enabled").
"\" border=\"0\" vspace=\"0\"/>";
94 $icon_not_ok =
"<img src=\"".ilUtil::getImagePath(
"icon_not_ok.gif").
"\" alt=\"".$this->lng->txt(
"disabled").
"\" title=\"".$this->lng->txt(
"disabled").
"\" border=\"0\" vspace=\"0\"/>";
96 $this->tpl->setVariable(
"EXTT_ILINC_ACTIVE", $this->ilias->getSetting(
'ilinc_active') ? $icon_ok : $icon_not_ok);
102 $this->ctrl->redirect($this,
"view");
119 $this->ctrl->setParameter($this,
"ref_id",$this->object->getRefId());
121 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
123 $tabs_gui->addTarget(
"settings",
124 $this->ctrl->getLinkTarget($this,
"view"),
125 array(
"view",
"editiLinc",
"editDelicious",
"editGoogleMaps",
"editjsMath",
""),
"",
"");
127 $this->lng->loadLanguageModule(
'ecs');
128 $tabs_gui->addTarget(
'ecs_server_settings',
129 $this->ctrl->getLinkTargetByClass(
'ilecssettingsgui',
'settings'));
133 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
135 $tabs_gui->addTarget(
"perm_settings",
136 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
147 global $rbacsystem, $rbacreview;
149 if (!$rbacsystem->checkAccess(
"write",$this->object->getRefId()))
151 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
158 if (
$_SESSION[
"error_post_vars"][
"ilinc"][
"active"] ==
"1")
160 $this->tpl->setVariable(
"CHK_ILINC_ACTIVE",
"checked=\"checked\"");
163 if (
$_SESSION[
"error_post_vars"][
"ilinc"][
"akclassvalues_active"] ==
"1")
165 $this->tpl->setVariable(
"CHK_ILINC_AKCLASSVALUES_ACTIVE",
"checked=\"checked\"");
168 if (
$_SESSION[
"error_post_vars"][
"ilinc"][
"akclassvalues_required"] ==
"1")
170 $this->tpl->setVariable(
"CHK_ILINC_AKCLASSVALUES_REQUIRED",
"checked=\"checked\"");
173 $this->tpl->setVariable(
"ILINC_SERVER",
$_SESSION[
"error_post_vars"][
"ilinc"][
"server"]);
174 $this->tpl->setVariable(
"ILINC_REGISTRAR_LOGIN",
$_SESSION[
"error_post_vars"][
"ilinc"][
"registrar_login"]);
175 $this->tpl->setVariable(
"ILINC_REGISTRAR_PASSWD",
$_SESSION[
"error_post_vars"][
"ilinc"][
"registrar_passwd"]);
176 $this->tpl->setVariable(
"ILINC_CUSTOMER_ID",
$_SESSION[
"error_post_vars"][
"ilinc"][
"customer_id"]);
181 $settings = $this->ilias->getAllSettings();
183 if ($settings[
"ilinc_active"] ==
"1")
185 $this->tpl->setVariable(
"CHK_ILINC_ACTIVE",
"checked=\"checked\"");
188 $this->tpl->setVariable(
"ILINC_SERVER", $settings[
"ilinc_server"].$settings[
"ilinc_path"]);
189 $this->tpl->setVariable(
"ILINC_REGISTRAR_LOGIN", $settings[
"ilinc_registrar_login"]);
190 $this->tpl->setVariable(
"ILINC_REGISTRAR_PASSWD", $settings[
"ilinc_registrar_passwd"]);
191 $this->tpl->setVariable(
"ILINC_CUSTOMER_ID", $settings[
"ilinc_customer_id"]);
193 if (empty($settings[
"ilinc_port"]))
195 $this->tpl->setVariable(
"ILINC_PORT", ILINC_DEFAULT_HTTP_PORT);
199 $this->tpl->setVariable(
"ILINC_PORT", $settings[
"ilinc_port"]);
202 if ($settings[
"ilinc_protocol"] ==
"https")
204 $this->tpl->setVariable(
"ILINC_PROTOCOL_SSL_SEL",
"selected=\"selected\"");
208 $this->tpl->setVariable(
"ILINC_PROTOCOL_HTTP_SEL",
"selected=\"selected\"");
211 if (empty($settings[
"ilinc_timeout"]))
213 $this->tpl->setVariable(
"ILINC_TIMEOUT", ILINC_DEFAULT_TIMEOUT);
217 $this->tpl->setVariable(
"ILINC_TIMEOUT", $settings[
"ilinc_timeout"]);
220 if ($settings[
"ilinc_akclassvalues_active"] ==
"1")
222 $this->tpl->setVariable(
"CHK_ILINC_AKCLASSVALUES_ACTIVE",
"checked=\"checked\"");
225 if ($settings[
"ilinc_akclassvalues_required"] ==
"1")
227 $this->tpl->setVariable(
"CHK_ILINC_AKCLASSVALUES_REQUIRED",
"checked=\"checked\"");
233 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
234 $this->tpl->setVariable(
"TXT_ILINC_TITLE", $this->lng->txt(
"extt_ilinc_configure"));
235 $this->tpl->setVariable(
"TXT_ILINC_ACTIVE", $this->lng->txt(
"extt_ilinc_enable"));
236 $this->tpl->setVariable(
"TXT_ILINC_CONNECTION_DATA", $this->lng->txt(
"extt_ilinc_connection_data"));
237 $this->tpl->setVariable(
"TXT_ILINC_ADDITIONAL_OPTIONS", $this->lng->txt(
"extt_ilinc_additional_options"));
238 $this->tpl->setVariable(
"TXT_ILINC_SERVER", $this->lng->txt(
"extt_ilinc_server"));
239 $this->tpl->setVariable(
"TXT_ILINC_PROTOCOL_PORT", $this->lng->txt(
"extt_ilinc_protocol_port"));
240 $this->tpl->setVariable(
"TXT_ILINC_TIMEOUT", $this->lng->txt(
"extt_ilinc_timeout"));
241 $this->tpl->setVariable(
"ILINC_DEFAULT_HTTP_PORT", ILINC_DEFAULT_HTTP_PORT);
242 $this->tpl->setVariable(
"ILINC_DEFAULT_SSL_PORT", ILINC_DEFAULT_SSL_PORT);
243 $this->tpl->setVariable(
"TXT_HTTP", $this->lng->txt(
'http'));
244 $this->tpl->setVariable(
"TXT_SSL", $this->lng->txt(
'ssl'));
246 $this->tpl->setVariable(
"TXT_SECONDS", $this->lng->txt(
"seconds"));
247 $this->tpl->setVariable(
"TXT_ILINC_REGISTRAR_LOGIN", $this->lng->txt(
"extt_ilinc_registrar_login"));
248 $this->tpl->setVariable(
"TXT_ILINC_REGISTRAR_PASSWD", $this->lng->txt(
"extt_ilinc_registrar_passwd"));
249 $this->tpl->setVariable(
"TXT_ILINC_CUSTOMER_ID", $this->lng->txt(
"extt_ilinc_customer_id"));
251 $this->tpl->setVariable(
"TXT_ILINC_AKCLASSVALUES_ACTIVE", $this->lng->txt(
"extt_ilinc_akclassvalues_active"));
252 $this->tpl->setVariable(
"TXT_ILINC_AKCLASSVALUES_ACTIVE_INFO", $this->lng->txt(
"extt_ilinc_akclassvalues_active_info"));
253 $this->tpl->setVariable(
"TXT_ILINC_AKCLASSVALUES_REQUIRED", $this->lng->txt(
"extt_ilinc_akclassvalues_required"));
254 $this->tpl->setVariable(
"TXT_ILINC_AKCLASSVALUES_REQUIRED_INFO", $this->lng->txt(
"extt_ilinc_akclassvalues_required_info"));
256 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
257 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
258 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
259 $this->tpl->setVariable(
"CMD_SUBMIT",
"saveiLinc");
272 if (!$_POST[
"ilinc"][
"server"] or !$_POST[
"ilinc"][
"port"] or !$_POST[
"ilinc"][
"registrar_login"] or !$_POST[
"ilinc"][
"registrar_passwd"] or !$_POST[
"ilinc"][
"customer_id"])
274 $this->ilias->raiseError($this->lng->txt(
"fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
278 if ((preg_match(
"/^[0-9]{0,5}$/",$_POST[
"ilinc"][
"port"])) ==
false)
280 $this->ilias->raiseError($this->lng->txt(
"err_invalid_port"),$this->ilias->error_obj->MESSAGE);
283 if (substr($_POST[
"ilinc"][
"server"],0,8) !=
"https://" and substr($_POST[
"ilinc"][
"server"],0,7) !=
"http://")
285 $_POST[
"ilinc"][
"server"] = $_POST[
"ilinc"][
"protocol"].
"://".$_POST[
"ilinc"][
"server"];
288 $url = parse_url($_POST[
"ilinc"][
"server"]);
292 $this->ilias->raiseError($this->lng->txt(
"err_invalid_server"),$this->ilias->error_obj->MESSAGE);
295 if (is_numeric($_POST[
"ilinc"][
"timeout"]))
297 $this->ilias->setSetting(
"ilinc_timeout", $_POST[
"ilinc"][
"timeout"]);
301 $this->ilias->setSetting(
"ilinc_server", $url[
"host"]);
302 $this->ilias->setSetting(
"ilinc_path", $url[
"path"]);
303 $this->ilias->setSetting(
"ilinc_protocol", $_POST[
"ilinc"][
"protocol"]);
304 $this->ilias->setSetting(
"ilinc_port", $_POST[
"ilinc"][
"port"]);
305 $this->ilias->setSetting(
"ilinc_active", $_POST[
"ilinc"][
"active"]);
306 $this->ilias->setSetting(
"ilinc_registrar_login", $_POST[
"ilinc"][
"registrar_login"]);
307 $this->ilias->setSetting(
"ilinc_registrar_passwd", $_POST[
"ilinc"][
"registrar_passwd"]);
308 $this->ilias->setSetting(
"ilinc_customer_id", $_POST[
"ilinc"][
"customer_id"]);
310 $this->ilias->setSetting(
"ilinc_akclassvalues_active", $_POST[
"ilinc"][
"akclassvalues_active"]);
311 $this->ilias->setSetting(
"ilinc_akclassvalues_required", $_POST[
"ilinc"][
"akclassvalues_required"]);
314 $this->ctrl->redirect($this,
'editiLinc');
330 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
332 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
337 if ($d_set->get(
"add_info_links") ==
"1")
339 $this->tpl->setVariable(
"CHK_ADD_LINKS_ACTIVE",
"checked=\"checked\"");
342 if ($d_set->get(
"user_profile") ==
"1")
344 $this->tpl->setVariable(
"CHK_ADD_PROFILE_ACTIVE",
"checked=\"checked\"");
347 $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
348 $this->tpl->setVariable(
"TXT_DELICIOUS_SETTINGS", $lng->txt(
"delic_settings"));
349 $this->tpl->setVariable(
"TXT_ADD_DELICIOUS_LINK", $lng->txt(
"delic_add_info_links"));
350 $this->tpl->setVariable(
"TXT_ALLOW_PROFILE", $lng->txt(
"delic_user_profile"));
351 $this->tpl->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
352 $this->tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"save"));
353 $this->tpl->setVariable(
"CMD_SUBMIT",
"saveDelicious");
366 $d_set->set(
"add_info_links", $_POST[
"add_info_links"]);
367 $d_set->set(
"user_profile", $_POST[
"user_profile"]);
368 $ilCtrl->redirect($this,
"editDelicious");
381 $jsMathSetting =
new ilSetting(
"jsMath");
382 $path_to_jsmath = array_key_exists(
"path_to_jsmath",
$_GET) ?
$_GET[
"path_to_jsmath"] : $jsMathSetting->get(
"path_to_jsmath");
384 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
386 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
391 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
393 $form->setFormAction($ilCtrl->getFormAction($this));
394 $form->setTitle($lng->txt(
"jsmath_settings"));
398 $enable->
setChecked($jsMathSetting->get(
"enable"));
399 $enable->setInfo($lng->txt(
"jsmath_enable_jsmath_info"));
400 $form->addItem($enable);
402 $text_prop =
new ilTextInputGUI($lng->txt(
"jsmath_path_to_jsmath"),
"path_to_jsmath");
403 $text_prop->
setInfo($lng->txt(
"jsmath_path_to_jsmath_desc"));
404 $text_prop->setValue($path_to_jsmath);
405 $text_prop->setRequired(TRUE);
406 $text_prop->setMaxLength(400);
407 $text_prop->setSize(80);
408 $form->addItem($text_prop);
411 $enable->
setChecked($jsMathSetting->get(
"makedefault"));
412 $enable->setInfo($lng->txt(
"jsmath_default_setting_info"));
413 $form->addItem($enable);
415 $form->addCommandButton(
"savejsMath", $lng->txt(
"save"));
416 $form->addCommandButton(
"view", $lng->txt(
"cancel"));
418 $tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
430 while (strrpos($path_to_jsmath,
"/") == strlen($path_to_jsmath)-1)
432 $path_to_jsmath = substr($path_to_jsmath, 0, strlen($path_to_jsmath)-1);
435 if (file_exists($path_to_jsmath .
"/" .
"jsMath.js"))
441 if (strlen($path_to_jsmath) == 0)
447 $ilCtrl->setParameter($this,
"path_to_jsmath", $path_to_jsmath);
454 $jsMathSetting =
new ilSetting(
"jsMath");
455 $jsMathSetting->set(
"path_to_jsmath", $path_to_jsmath);
460 $ilCtrl->redirect($this,
"editjsMath");
474 if (!$ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
476 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
481 $api_key = $gm_set->get(
"api_key");
482 $std_latitude = $gm_set->get(
"std_latitude");
483 $std_longitude = $gm_set->get(
"std_longitude");
484 $std_zoom = $gm_set->get(
"std_zoom");
485 $api_url =
"http://www.google.com/apis/maps/signup.html";
487 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
489 $form->setFormAction($ilCtrl->getFormAction($this));
490 $form->setTitle($lng->txt(
"gmaps_settings"));
495 $enable->setInfo($lng->txt(
"gmaps_enable_gmaps_info"));
496 $form->addItem($enable);
499 $text_prop =
new ilTextInputGUI($lng->txt(
"gmaps_api_key"),
"api_key");
500 $text_prop->
setInfo($lng->txt(
"gmaps_api_key_desc").
' <a href="'.$api_url.
'">'.$api_url.
'</a>');
501 $text_prop->setValue($api_key);
502 $text_prop->setRequired(
false);
503 $text_prop->setMaxLength(200);
504 $text_prop->setSize(60);
505 $form->addItem($text_prop);
511 $loc_prop->setLongitude($std_longitude);
512 $loc_prop->setZoom($std_zoom);
513 $form->addItem($loc_prop);
515 $form->addCommandButton(
"saveGoogleMaps", $lng->txt(
"save"));
516 $form->addCommandButton(
"view", $lng->txt(
"cancel"));
518 $tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
537 $ilCtrl->redirect($this,
"editGoogleMaps");
543 $ilinc = ($a_cmd ==
'editiLinc') ?
true :
false;
544 $overview = ($a_cmd ==
'view' or $a_cmd ==
'') ?
true :
false;
545 $delicious = ($a_cmd ==
'editDelicious') ?
true :
false;
546 $gmaps = ($a_cmd ==
'editGoogleMaps') ?
true :
false;
547 $jsmath = ($a_cmd ==
'editjsMath') ?
true :
false;
549 $this->tabs_gui->addSubTabTarget(
"overview", $this->ctrl->getLinkTarget($this,
"view"),
550 "",
"",
"", $overview);
551 $this->tabs_gui->addSubTabTarget(
"delic_extt_delicious", $this->ctrl->getLinkTarget($this,
"editDelicious"),
552 "",
"",
"", $delicious);
553 $this->tabs_gui->addSubTabTarget(
"jsmath_extt_jsmath", $this->ctrl->getLinkTarget($this,
"editjsMath"),
554 "",
"",
"", $jsmath);
555 $this->tabs_gui->addSubTabTarget(
"gmaps_extt_gmaps", $this->ctrl->getLinkTarget($this,
"editGoogleMaps"),
557 $this->tabs_gui->addSubTabTarget(
"extt_ilinc", $this->ctrl->getLinkTarget($this,
"editiLinc"),
564 $next_class = $this->ctrl->getNextClass($this);
565 $cmd = $this->ctrl->getCmd();
570 case 'ilecssettingsgui':
571 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettingsGUI.php');
573 $this->tabs_gui->setTabActive(
'ecs_server_settings');
576 case 'ilpermissiongui':
577 include_once(
"./classes/class.ilPermissionGUI.php");
579 $ret =& $this->ctrl->forwardCommand($perm_gui);
580 $this->tabs_gui->setTabActive(
'perm_settings');
584 $this->tabs_gui->setTabActive(
'settings');