/**
  * @param FOLDER $folder Return commands for this object.
  */
 public function __construct($folder)
 {
     parent::__construct($folder->app);
     $cmd = $this->make_command();
     $cmd->id = 'subscribe';
     $cmd->caption = 'Subscribe';
     $cmd->link = 'subscribe_to_folder.php?id=' . $folder->id . '&email=' . $this->login->email . '&subscribed=1';
     $cmd->icon = '{icons}indicators/subscribed';
     $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_view, $folder);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $this->append_group('Create');
     $this->_add_creators($folder);
     $cmd = $this->make_command();
     $cmd->id = 'new';
     $cmd->caption = 'New folder';
     $cmd->link = "create_folder.php?id={$folder->id}";
     $cmd->icon = '{icons}buttons/new_folder';
     $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_create, $folder);
     $cmd->importance = Command_importance_high + Command_importance_increment;
     $this->append($cmd);
     $this->append_group('Edit');
     $this->_add_editors($folder);
     $this->append_group('View');
     $this->_add_viewers($folder);
 }
 /**
  * @param APPLICATION $context
  */
 public function __construct($context)
 {
     parent::__construct($context);
     $cmd = $this->make_command();
     $cmd->id = 'create';
     $cmd->caption = 'New user';
     $cmd->link = "create_user.php";
     $cmd->icon = '{icons}buttons/create';
     $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_create);
     $cmd->importance = Command_importance_high + Command_importance_increment;
     $this->append($cmd);
     $link_url = new URL($this->env->url(Url_part_no_host_path));
     $link_url->replace_argument('show_anon', '');
     $cmd = $this->make_command();
     $cmd->id = 'show_registered';
     $cmd->caption = 'Show registered users';
     $cmd->link = $link_url->as_text();
     $cmd->icon = '{icons}buttons/login';
     $cmd->executable = read_var('show_anon');
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $link_url->replace_argument('show_anon', 1);
     $cmd = $this->make_command();
     $cmd->id = 'show_anonymous';
     $cmd->caption = 'Show anonymous users';
     $cmd->link = $link_url->as_text();
     $cmd->icon = '{icons}buttons/anonymous';
     $cmd->executable = !read_var('show_anon');
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
 }
 /**
  * @param APPLICATION $context
  */
 public function __construct($context)
 {
     parent::__construct($context);
     $cmd = $this->make_command();
     $cmd->id = 'print';
     $cmd->caption = 'Print';
     $url = new URL($this->env->url(Url_part_no_host_path));
     $url->add_argument('printable', '1');
     $cmd->link = $url->as_text();
     $cmd->icon = '{icons}/buttons/print';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $show_date = read_var('show_date', true);
     $cmd = $this->make_command();
     $cmd->id = 'show_dates';
     if ($show_date) {
         $cmd->caption = 'Hide Dates';
     } else {
         $cmd->caption = 'Show Dates';
     }
     $url = new URL($this->env->url(Url_part_no_host_path));
     $url->replace_argument('show_date', !$show_date);
     $cmd->link = $url->as_text();
     $cmd->icon = '{icons}/buttons/calendar';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $show_user = read_var('show_user', true);
     $cmd = $this->make_command();
     $cmd->id = 'show_users';
     if ($show_user) {
         $cmd->caption = 'Hide Users';
     } else {
         $cmd->caption = 'Show Users';
     }
     $url = new URL($this->env->url(Url_part_no_host_path));
     $url->replace_argument('show_user', !$show_user);
     $cmd->link = $url->as_text();
     $cmd->icon = '{icons}/buttons/login';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $show_description = read_var('show_description', true);
     $cmd = $this->make_command();
     $cmd->id = 'show_descriptions';
     if ($show_description) {
         $cmd->caption = 'Hide descriptions';
     } else {
         $cmd->caption = 'Show descriptions';
     }
     $url = new URL($this->env->url(Url_part_no_host_path));
     $url->replace_argument('show_description', !$show_description);
     $cmd->link = $url->as_text();
     $cmd->icon = '{icons}indicators/text';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
 }
 /**
  * @param FOLDER $folder Configure commands for this object.
  * @param string $form_name Commands are created using this form name.
  */
 public function __construct($folder, $form_name)
 {
     parent::__construct($folder->app);
     $cmd = $this->make_command();
     $cmd->id = 'print';
     $cmd->caption = 'Print';
     $cmd->link = '#';
     $cmd->on_click = "submit_explorer_form ('{$form_name}', 'multiple_print.php')";
     $cmd->icon = '{icons}buttons/print';
     $cmd->executable = true;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'move';
     $cmd->caption = 'Move';
     $cmd->link = '#';
     $cmd->on_click = "submit_explorer_form ('{$form_name}', 'multiple_move.php')";
     $cmd->icon = '{icons}buttons/move';
     $cmd->executable = $this->app->login->is_allowed(Privilege_set_folder, Privilege_delete, $folder) || $this->app->login->is_allowed(Privilege_set_entry, Privilege_delete, $folder);
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'copy';
     $cmd->caption = 'Copy';
     $cmd->link = '#';
     $cmd->on_click = "submit_explorer_form ('{$form_name}', 'multiple_copy.php')";
     $cmd->icon = '{icons}buttons/copy';
     $cmd->executable = true;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = '#';
     $cmd->on_click = "submit_explorer_form ('{$form_name}', 'multiple_delete.php')";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->importance = Command_importance_low;
     $cmd->executable = $this->app->login->is_allowed(Privilege_set_folder, Privilege_delete, $folder) || $this->app->login->is_allowed(Privilege_set_entry, Privilege_delete, $folder);
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'restore';
     $cmd->caption = 'Restore';
     $cmd->link = '#';
     $cmd->on_click = "submit_explorer_form ('{$form_name}', 'multiple_restore.php')";
     $cmd->icon = '{icons}buttons/restore';
     $cmd->importance = Command_importance_low;
     $cmd->executable = $this->app->login->is_allowed(Privilege_set_folder, Privilege_view_hidden, $folder) && ($this->app->login->is_allowed(Privilege_set_entry, Privilege_create, $folder) || $this->app->login->is_allowed(Privilege_set_folder, Privilege_create, $folder));
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'purge';
     $cmd->caption = 'Purge';
     $cmd->link = '#';
     $cmd->on_click = "submit_explorer_form ('{$form_name}', 'multiple_purge.php')";
     $cmd->icon = '{icons}buttons/purge';
     $cmd->importance = Command_importance_low;
     $cmd->executable = $this->app->login->is_allowed(Privilege_set_folder, Privilege_purge, $folder) || $this->app->login->is_allowed(Privilege_set_entry, Privilege_purge, $folder);
     $this->append($cmd);
 }
Example #5
0
 /**
  * Create and configure a {@link COMMAND}.
  * @param string $caption Text of the command.
  * @param string $url Link for the command action.
  * @param string $icon Path to the icon for the command.
  * @param bool $selected Renders as selected without the link if
  * <code>True</code>.
  * @param $link_title string The title to use for the url if the command is not selected.
  * @return COMMAND
  * @access private
  */
 protected function _make_command($caption, $url, $icon, $selected, $link_title)
 {
     $Result = $this->commands->make_command();
     $Result->id = 'item_' . mt_rand();
     if ($selected) {
         $Result->caption = "<span class=\"selected\">{$caption}</span>";
     } else {
         $Result->caption = $caption;
         $Result->link = $url;
         $Result->link_title = $link_title;
     }
     $Result->icon = $icon;
     return $Result;
 }
 /**
  * @param ENTRY $entry Configure commands for this object.
  */
 public function __construct($entry)
 {
     parent::__construct($entry->app);
     $cmd = $this->make_command();
     $cmd->id = 'subscribe';
     $cmd->caption = 'Subscribe';
     $cmd->link = 'subscribe_to_entry.php?id=' . $entry->id . '&email=' . $this->login->email . '&subscribed=1';
     $cmd->icon = '{icons}indicators/subscribed';
     $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_view, $entry);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $this->append_group('Create');
     $this->_add_creators($entry);
     $this->append_group('Edit');
     $this->_add_editors($entry);
     $this->append_group('View');
     $this->_add_viewers($entry);
 }
 /**
  * @param ATTACHMENT $attachment Configure commands for this attachment.
  */
 public function __construct($attachment)
 {
     parent::__construct($attachment->app);
     $cmd = $this->make_command();
     $cmd->id = 'edit';
     $cmd->caption = 'Edit';
     $cmd->link = "edit_attachment.php?id={$attachment->id}&type={$attachment->type}";
     $cmd->icon = '{icons}buttons/edit';
     $cmd->executable = $this->login->is_allowed(Privilege_set_attachment, Privilege_modify, $attachment);
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = "delete_attachment.php?id={$attachment->id}&type={$attachment->type}";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = !$attachment->deleted() && $this->login->is_allowed(Privilege_set_attachment, Privilege_delete, $attachment);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'purge';
     $cmd->caption = 'Purge';
     $cmd->link = "purge_attachment.php?id={$attachment->id}&type={$attachment->type}";
     $cmd->icon = '{icons}buttons/purge';
     $cmd->executable = $this->login->is_allowed(Privilege_set_attachment, Privilege_purge, $attachment);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'send';
     $cmd->caption = 'Send';
     $cmd->link = "send_attachment.php?id={$attachment->id}&type={$attachment->type}";
     $cmd->icon = '{icons}buttons/send';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'history';
     $cmd->caption = 'History';
     $cmd->link = "view_attachment_history.php?id={$attachment->id}&type={$attachment->type}";
     $cmd->icon = '{icons}buttons/history';
     $cmd->executable = $this->login->is_allowed(Privilege_set_attachment, Privilege_view_history, $attachment);
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
 }
 /**
  * @param THEME $theme Configure commands for this object.
  */
 public function __construct($theme)
 {
     parent::__construct($theme->context);
     $cmd = $this->make_command();
     $cmd->id = 'edit';
     $cmd->caption = 'Edit';
     $cmd->link = "edit_theme.php?id={$theme->id}";
     $cmd->icon = '{icons}buttons/edit';
     $cmd->executable = $this->login->is_allowed(Privilege_set_global, Privilege_resources);
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = "delete_theme.php?id={$theme->id}";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = $this->login->is_allowed(Privilege_set_global, Privilege_resources);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
 }
 /**
  * @param FORM $form The form to which these commands belong.
  * @param string $field_name The name of the field to select/de-select.
  */
 public function __construct($form, $field_name)
 {
     $this->assert(isset($form), "[form] cannot be empty.", '__construct', 'SELECTION_COMMANDS');
     parent::__construct($form->context);
     $ctrl_name = $form->js_name($field_name);
     $command = $this->app->make_command();
     $command->id = 'select_all';
     $command->caption = 'Select all';
     $command->link = '#';
     $command->executable = true;
     $command->on_click = "select_all ({$ctrl_name})";
     $this->append($command);
     $command = $this->app->make_command();
     $command->id = 'select_none';
     $command->caption = 'Select none';
     $command->link = '#';
     $command->executable = true;
     $command->on_click = "select_none ({$ctrl_name})";
     $this->append($command);
 }
 /**
  * @param SEARCH $search Configure commands for this object.
  */
 public function __construct($search)
 {
     parent::__construct($search->app);
     $cmd = $this->make_command();
     $cmd->id = 'edit';
     $cmd->caption = 'Edit';
     $cmd->link = "edit_search.php?id={$search->id}";
     $cmd->icon = '{icons}buttons/edit';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = "delete_search.php?id={$search->id}";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
 }
 /**
  * Returns a list of commands for this renderer.
  * @return \COMMANDS
  */
 public function make_commands()
 {
     $Result = new COMMANDS($this->context);
     if ($this->_comment_query->size() > 1) {
         $command = $Result->make_command();
         $Result->append($command);
         switch ($this->comment_mode) {
             case Comment_render_flat:
                 $command->caption = 'Show Threaded';
                 $command->link = $this->_obj->home_page() . "&comment_mode=threaded#comments";
                 break;
             case Comment_render_threaded:
                 $command->caption = 'Show Flat';
                 $command->link = $this->_obj->home_page() . "&comment_mode=flat#comments";
                 break;
         }
     }
     return $Result;
 }
 /**
  * Draw the commands inside a vertical drop-down menu.
  * Uses JavaScript for browsers that don't support {@link Browser_CSS_2}. Uses
  * {@link _draw_vertical_menu()} to draw the contents of the drop-down.
  * @param COMMANDS $commands
  * @access private
  */
 protected function _draw_drop_down($commands)
 {
     $trigger_class = 'menu-trigger';
     $menu_class = 'menu-dropdown';
     $menu_tag = '';
     $trigger = '';
     if ($this->options & Menu_options_show_trigger_title) {
         if ($this->options & Menu_options_show_selected_as_trigger_title) {
             foreach ($commands->command_list() as $command) {
                 if (empty($command->link)) {
                     // TODO Add support for setting the selected item instead of just assuming that the one without a link is selected
                     // TODO Should we show the icon of the selected item in the trigger as well? Should we use the menu icon as a badge?
                     $trigger = $command->caption;
                 }
             }
         } else {
             $trigger = $this->trigger_title;
         }
     }
     echo '<li class="' . $trigger_class . '"' . $menu_tag . '><div class="' . $this->trigger_button_css_class . '">';
     if ($this->options & Menu_options_show_trigger_icon) {
         if (empty($trigger)) {
             echo $this->context->resolve_icon_as_html($this->trigger_icon, Sixteen_px, '');
         } else {
             echo $this->context->get_icon_with_text($this->trigger_icon, Sixteen_px, $trigger);
         }
     } else {
         echo $trigger;
     }
     echo '<div class="' . $menu_class . '">';
     $this->_draw_vertical_menu($commands, false);
     echo '</div></div></li>';
 }
 public function make_commands($context)
 {
     $Result = new COMMANDS($context);
     if ($this->enabled && $this->file_name) {
         $url = new URL($this->page->resolve_file($this->file_name, Force_root_on));
         foreach ($this->formats as $format => $format_title) {
             foreach ($this->content_formats as $content => $content_texts) {
                 $content_title = $content_texts[0];
                 $content_description = $content_texts[1];
                 $url->replace_argument('format', $format);
                 $url->replace_argument('content', $content);
                 $cmd = $Result->make_command();
                 $cmd->id = $format . '_' . $content;
                 $cmd->caption = '<b>' . $content_title . '</b> (' . $format_title . ')';
                 if ($format == 'rss') {
                     $cmd->icon = '{icons}indicators/newsfeed_rss';
                 } else {
                     $cmd->icon = '{icons}indicators/newsfeed_atom';
                     $cmd->description = $content_description;
                 }
                 $cmd->link = $url->as_text();
                 $Result->append($cmd);
             }
         }
     }
     return $Result;
 }
 /**
  * @param USER $user Configure commands for this object.
  */
 public function __construct($user)
 {
     parent::__construct($user->app);
     $title = urlencode($user->title);
     if (!$this->login->is_anonymous()) {
         $cmd = $this->make_command();
         $cmd->id = 'subscribe';
         $cmd->caption = 'Subscribe';
         $cmd->link = 'subscribe_to_user.php?name=' . $title . '&email=' . $this->login->email . '&subscribed=1';
         $cmd->icon = '{icons}indicators/subscribed';
         $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_view, $user);
         $cmd->importance = Command_importance_high - Command_importance_increment;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'edit';
         $cmd->caption = 'Edit';
         $cmd->link = 'edit_user.php?name=' . $title;
         $cmd->icon = '{icons}buttons/edit';
         $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_modify, $user);
         $cmd->importance = Command_importance_high;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'password';
         $cmd->caption = 'Change password';
         $cmd->link = 'edit_password.php?name=' . $title;
         $cmd->icon = '{icons}buttons/password';
         $cmd->executable = $this->login->is_allowed(Privilege_set_global, Privilege_password, $user);
         $cmd->importance = Command_importance_high - Command_importance_increment;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'subscriptions';
         $cmd->caption = 'Manage subscriptions';
         $cmd->link = 'view_user_subscriptions.php?email=' . urlencode($user->email);
         $cmd->icon = '{icons}buttons/subscriptions';
         $cmd->executable = $user->email && $this->login->is_allowed(Privilege_set_global, Privilege_subscribe, $user);
         $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'history';
         $cmd->caption = 'History';
         $cmd->link = 'view_user_history.php?name=' . $title;
         $cmd->icon = '{icons}buttons/history';
         $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_view_history, $user);
         $cmd->importance = Command_importance_low;
         $this->append($cmd);
     }
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = 'delete_user.php?name=' . $title;
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_delete, $user) && $this->app->user_options->users_can_be_deleted;
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'secure';
     $cmd->caption = 'Security';
     $cmd->link = 'edit_user_permissions.php?name=' . $title;
     $cmd->icon = '{icons}buttons/security';
     $cmd->executable = $this->login->is_allowed(Privilege_set_user, Privilege_secure);
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
 }
 /**
  * @param COMMENT $comment Configure commands for this object.
  */
 public function __construct($comment)
 {
     parent::__construct($comment->app);
     $cmd = $this->make_command();
     $cmd->id = 'reply';
     $cmd->caption = 'Reply';
     $cmd->link = "create_comment.php?id={$comment->entry_id}&parent_id={$comment->id}";
     $cmd->icon = '{icons}buttons/reply';
     $cmd->executable = $this->login->is_allowed(Privilege_set_comment, Privilege_create, $comment);
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'subscribe';
     $cmd->caption = 'Subscribe';
     $cmd->link = 'subscribe_to_comment.php?id=' . $comment->id . '&email=' . $this->login->email . '&subscribed=1';
     $cmd->icon = '{icons}indicators/subscribed';
     $cmd->executable = $this->login->is_allowed(Privilege_set_comment, Privilege_view, $comment);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'edit';
     $cmd->caption = 'Edit';
     $cmd->link = "edit_comment.php?id={$comment->id}";
     $cmd->icon = '{icons}buttons/edit';
     $cmd->executable = $this->login->is_allowed(Privilege_set_comment, Privilege_modify, $comment);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = "delete_comment.php?id={$comment->id}";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = !$comment->deleted() && $this->login->is_allowed(Privilege_set_comment, Privilege_delete, $comment);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'purge';
     $cmd->caption = 'Purge';
     $cmd->link = "purge_comment.php?id={$comment->id}";
     $cmd->icon = '{icons}buttons/purge';
     $cmd->executable = $this->login->is_allowed(Privilege_set_comment, Privilege_purge, $comment);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'attach';
     $cmd->caption = 'Attach';
     $cmd->link = "create_attachment.php?id={$comment->id}&type=" . History_item_comment;
     $cmd->icon = '{icons}buttons/attach';
     $cmd->executable = $this->login->is_allowed(Privilege_set_attachment, Privilege_create, $comment) && $this->login->is_allowed(Privilege_set_attachment, Privilege_upload, $comment);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'send';
     $cmd->caption = 'Send';
     $cmd->link = "send_comment.php?id={$comment->id}";
     $cmd->icon = '{icons}buttons/send';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'history';
     $cmd->caption = 'History';
     $cmd->link = "view_comment_history.php?id={$comment->id}";
     $cmd->icon = '{icons}buttons/history';
     $cmd->executable = $this->login->is_allowed(Privilege_set_comment, Privilege_view_history, $comment);
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
 }
 /**
  * @param RELEASE $obj Configure commands for this object.
  */
 public function __construct($obj)
 {
     parent::__construct($obj->app);
     $folder = $obj->parent_folder();
     $branch = $obj->branch();
     if (!$folder->is_organizational()) {
         $this->append_group('Add');
         $cmd = $this->make_command();
         $cmd->id = 'new_job';
         $cmd->caption = 'New job';
         $cmd->link = "create_job.php?id={$folder->id}&branch_id={$branch->id}&release_id={$obj->id}";
         $cmd->icon = '{app_icons}buttons/new_job';
         $cmd->executable = !$obj->locked() && $this->login->is_allowed(Privilege_set_entry, Privilege_create, $obj);
         $cmd->importance = Command_importance_high + Command_importance_increment;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'new_change';
         $cmd->caption = 'New change';
         $cmd->link = "create_change.php?id={$folder->id}&branch_id={$branch->id}&release_id={$obj->id}";
         $cmd->icon = '{app_icons}buttons/new_change';
         $cmd->executable = !$obj->locked() && $this->login->is_allowed(Privilege_set_entry, Privilege_create, $obj);
         $cmd->importance = Command_importance_high + Command_importance_increment;
         $this->append($cmd);
     }
     $this->append_group('Edit');
     $cmd = $this->make_command();
     $cmd->id = 'edit';
     $cmd->caption = 'Edit';
     $cmd->link = "edit_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/edit';
     $cmd->executable = $this->login->is_allowed(Privilege_set_release, Privilege_modify, $obj);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = "delete_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = !$obj->deleted() && $this->login->is_allowed(Privilege_set_release, Privilege_delete, $obj);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'purge';
     $cmd->caption = 'Purge';
     $cmd->link = "purge_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/purge';
     $cmd->executable = $this->login->is_allowed(Privilege_set_release, Privilege_purge, $obj);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'ship';
     $cmd->caption = 'Ship';
     $cmd->link = "ship_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/ship';
     $cmd->executable = $obj->planned() && $this->login->is_allowed(Privilege_set_release, Privilege_modify, $obj);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $this->append_group('View');
     $cmd = $this->make_command();
     $cmd->id = 'print';
     $cmd->caption = 'Print';
     $cmd->link = "view_release_change_log.php?id={$obj->id}&printable=1";
     $cmd->icon = '{icons}buttons/print';
     $cmd->executable = true;
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'send';
     $cmd->caption = 'Send';
     $cmd->link = "send_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/send';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'history';
     $cmd->caption = 'View history';
     $cmd->link = "view_release_history.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/history';
     $cmd->executable = $this->login->is_allowed(Privilege_set_release, Privilege_view_history, $obj);
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'change_log';
     $cmd->caption = 'View change log';
     $cmd->link = "view_release_change_log.php?id={$obj->id}";
     $cmd->icon = '{app_icons}buttons/change_log';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
 }
 /**
  * Draw a single-line text control with a 'browse' button onto a separate row in the form.
  *
  * @param string $id The id of the field to render.
  * @param FORM_LIST_ITEM[] $items The items to include as options in the chooser.
  * @param FORM_TEXT_CONTROL_OPTIONS $options Override the default text control rendering; can be null.
  * @param string $css_class The class to apply to the overall container.
  * @return string
  */
 public function text_line_with_chooser_as_html($id, $items, $options = null, $css_class = 'browse')
 {
     $result = '<span class="' . $css_class . '">';
     $result .= $this->text_line_as_html($id, $options);
     $commands = new COMMANDS($this->context);
     foreach ($items as $item) {
         $cmd = $commands->make_command();
         $cmd->id = $item->text;
         $cmd->caption = $item->title;
         $cmd->on_click = 'set_control_value(event, \'' . $id . '\', \'' . $item->value . '\')';
         $cmd->link = '#';
         $commands->append($cmd);
     }
     $menu_renderer = $this->context->make_menu_renderer();
     $menu_renderer->set_size(Menu_size_minimal);
     $menu_renderer->menu_class .= ' chooser';
     ob_start();
     $menu_renderer->display($commands);
     $result .= ob_get_contents();
     ob_end_clean();
     $result .= '</span>';
     return $result;
 }