/** * @access private */ protected function _draw_scripts() { parent::_draw_scripts(); ?> function on_inherit_changed (ctrl) { var ctrls_disabled = is_selected (ctrl, 0); enable_items( ctrl.form.assignee_group_type, ! ctrls_disabled); enable_items( ctrl.form.reporter_group_type, ! ctrls_disabled); enable_items( ctrl.form.seconds_until_deadline, ! ctrls_disabled); on_group_type_changed (ctrl.form.assignee_group_type, ctrl.form.assignee_group_id); on_group_type_changed (ctrl.form.reporter_group_type, ctrl.form.reporter_group_id); } function on_group_type_changed (ctrl, group_ctrl) { var ctrls_disabled = ! is_selected (ctrl, <?php echo Project_user_group; ?> ); group_ctrl.disabled = ctrls_disabled; } function on_organizational_changed (ctrl) { ctrl.form.trunk_id.disabled = ctrl.checked; } <?php }
/** * @access private */ protected function _draw_scripts() { parent::_draw_scripts(); ?> function on_day_mode_changed (ctrl) { var form = <?php echo $this->js_form_name(); ?> ; var now_as_text = format_date_time (new Date (), '<?php echo $this->app->date_time_toolkit->formatter->format_string_for(Date_time_format_short_date); ?> '); switch (ctrl.value) { case '<?php echo Album_is_single_day; ?> ': form.first_day.disabled = false; form.last_day.disabled = true; form.last_day.value = form.first_day.value; break; case '<?php echo Album_is_journal; ?> ': form.first_day.disabled = false; form.last_day.disabled = true; form.last_day.value = now_as_text; break; case '<?php echo Album_is_span; ?> ': form.first_day.disabled = false; form.last_day.disabled = false; break; case '<?php echo Album_is_adjusted; ?> ': form.first_day.disabled = true; form.last_day.disabled = true; form.first_day.value = now_as_text; form.last_day.value = now_as_text; break; } } function on_pic_size_constraint_changed (ctrl) { var ctrls_disabled = ! ctrl.checked; var form = <?php echo $this->js_form_name(); ?> ; form.max_picture_width.disabled = ctrls_disabled; form.max_picture_height.disabled = ctrls_disabled; } function ensure_trailing_delimiter (path) { if (path.charAt (path.length - 1) != '/') { path += '/'; } return path; } function on_url_root_changed (ctrl) { ctrl.value = ensure_trailing_delimiter (ctrl.value.toLowerCase ()); } function on_url_root_enabled_changed (ctrl) { var form = <?php echo $this->js_form_name(); ?> ; form.url_root.disabled = ! ctrl.checked; } <?php $adjust_url_root = intval(!$this->object_exists()); /** @var ALBUM $folder */ $folder = $this->_folder; $parent_url = new URL($folder->url_root); $parent_url->ensure_ends_with_delimiter(); $parent_url_root = $parent_url->path(); ?> var adjust_url_root = <?php echo $adjust_url_root; ?> ; var parent_url_root = "<?php echo $parent_url_root; ?> "; var last_title = "<?php echo $this->value_for('title'); ?> "; function normalize_string (s) { if (s) { re = /[ ]+/g; s = s.replace (re, '_'); re = /[^a-zA-Z0-9_]+/g s = s.replace (re, ''); re = /[_]+/g; s = s.replace (re, '_'); s += '/'; } return s.toLowerCase (); } function on_title_changed (ctrl) { /* Basically, if the current url root (path) is the same as the one that would be automatically set (based on the previous title), then keep the url root in sync. If the user has modified the URL root, then do nothing. */ if (adjust_url_root && is_selected (ctrl.form.location, 'local')) { var auto_url_root = parent_url_root + normalize_string (last_title); var current_url = ensure_trailing_delimiter (ctrl.form.url_root.value); if ((current_url == auto_url_root) || ((current_url == parent_url_root))) { ctrl.form.url_root.value = parent_url_root + normalize_string (ctrl.value); } last_title = ctrl.value; } } <?php }