/** * @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); }
/** * @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); }
/** * @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); }
/** * @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 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); }