コード例 #1
0
 /**
  * Add commands that provide views on the folder.
  * @param FOLDER $folder Show commands for this folder.
  * @access private
  */
 protected function _add_viewers($folder)
 {
     $cmd = $this->make_command();
     $cmd->id = 'calendar';
     $cmd->caption = 'Calendar';
     $cmd->link = "view_calendar.php?id={$folder->id}";
     $cmd->icon = '{icons}buttons/calendar';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'print_preview';
     $cmd->caption = 'Print preview';
     $cmd->link = "multiple_print.php?id={$folder->id}";
     $entry_query = $folder->entry_query();
     $entry_query->set_type('journal');
     if ($entry_query->size()) {
         $cmd->link .= '&entry_type=journal';
     } else {
         $cmd->link .= '&entry_type=picture';
     }
     $cmd->icon = '{icons}buttons/print';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     parent::_add_viewers($folder);
 }
コード例 #2
0
 /**
  * Add commands that create items in the folder.
  * @param FOLDER $folder
  * @access private
  */
 protected function _add_creators($folder)
 {
     $cmd = $this->make_command();
     $cmd->id = 'new_job';
     $cmd->caption = 'New job';
     if ($folder->is_organizational()) {
         $cmd->link = "select_folder.php?page_name=create_job.php";
     } else {
         $cmd->link = "create_job.php?id={$folder->id}";
     }
     $cmd->icon = '{app_icons}buttons/new_job';
     $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_create, $folder);
     $cmd->importance = Command_importance_high + Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'new_change';
     $cmd->caption = 'New change';
     if ($folder->is_organizational()) {
         $cmd->link = "select_folder.php?page_name=create_change.php";
     } else {
         $cmd->link = "create_change.php?id={$folder->id}";
     }
     $cmd->icon = '{app_icons}buttons/new_change';
     $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_create, $folder);
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     if (!$folder->is_organizational()) {
         $cmd = $this->make_command();
         $cmd->id = 'new_release';
         $cmd->caption = 'New release';
         $cmd->icon = '{app_icons}buttons/new_release';
         $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $folder);
         $cmd->importance = Command_importance_low + Command_importance_increment;
         $this->append($cmd);
         $cmd->link = "create_release.php?id={$folder->trunk_id}";
         $cmd = $this->make_command();
         $cmd->id = 'new_branch';
         $cmd->caption = 'New branch';
         $branch = $folder->trunk();
         if (isset($branch)) {
             $cmd->link = "create_branch.php?id={$folder->id}&branch_id={$branch->id}";
         } else {
             $cmd->link = "create_branch.php?id={$folder->id}";
         }
         $cmd->icon = '{app_icons}buttons/new_branch';
         $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $folder);
         $cmd->importance = Command_importance_low + Command_importance_increment;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'new_component';
         $cmd->caption = 'New component';
         $cmd->link = "create_component.php?id={$folder->id}";
         $cmd->icon = '{app_icons}buttons/new_component';
         $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $folder);
         $cmd->importance = Command_importance_low + Command_importance_increment;
         $this->append($cmd);
     }
 }
コード例 #3
0
 /**
  * Store the form's values to this folder's permissions.
  * @param FOLDER $obj
  * @access private
  */
 public function commit($obj)
 {
     $security = $obj->security_definition();
     if ($security->inherited()) {
         $security->copy_and_store($this->value_for('copy_mode'));
     } else {
         $security->purge();
     }
 }
コード例 #4
0
    /**
     * @param FOLDER $obj
     * @access private
     */
    protected function _draw_box($obj)
    {
        $t = $obj->title_formatter();
        $t->max_visible_output_chars = 0;
        echo '<h3>' . $obj->title_as_link($t) . '</h3>';
        $entry_query = $obj->entry_query();
        $entry_query->set_filter(Visible);
        $size = $entry_query->size();
        if ($size) {
            $entry_query->set_limits(0, 10);
            /** @var ENTRY[] $entries */
            $entries = $entry_query->objects();
            $count = sizeof($entries);
            if ($count) {
                ?>
    <p>
      <?php 
                echo $size;
                ?>
 Articles
    </p>
    <ul class="detail">
  <?php 
                foreach ($entries as $entry) {
                    $t = $entry->title_formatter();
                    $f = $entry->time_created->formatter();
                    $f->type = Date_time_format_short_date;
                    $f->show_local_time = false;
                    $t->title = $entry->time_created->format($f);
                    ?>
      <li>
        <?php 
                    echo $entry->title_as_link($t);
                    ?>
      </li>
  <?php 
                }
                if ($size > 10) {
                    echo "<li>[<a href=\"view_folder.php?id={$obj->id}\">More</a>]</li>\n";
                }
                ?>
    </ul>
    <?php 
            }
        }
    }
コード例 #5
0
ファイル: panel.php プロジェクト: mvonballmo/earthli-webcore
 /**
  * FOLDER_PANEL_MANAGER constructor.
  * @param FOLDER $folder
  */
 public function __construct($folder)
 {
     $this->_folder = $folder;
     parent::__construct($folder->app);
     $this->page_link = $folder->replace_page_arguments($this->page_link);
 }
コード例 #6
0
 /**
  * Execute action for a single folder.
  * @param FOLDER $fldr
  * @access private
  */
 protected function _folder_run($fldr)
 {
     $fldr->delete();
 }
コード例 #7
0
 /**
  * Return default handler objects for supported tasks.
  * @param string $handler_type Specific functionality required.
  * @param object $options
  * @return object
  * @access private
  */
 protected function _default_handler_for($handler_type, $options = null)
 {
     switch ($handler_type) {
         case Handler_print_renderer:
         case Handler_html_renderer:
         case Handler_text_renderer:
             include_once 'projects/gui/project_renderer.php';
             return new PROJECT_RENDERER($this->app, $options);
         case Handler_commands:
             include_once 'projects/cmd/project_commands.php';
             return new PROJECT_COMMANDS($this);
         case Handler_history_item:
             include_once 'projects/obj/project_history_items.php';
             return new PROJECT_HISTORY_ITEM($this->app);
         default:
             return parent::_default_handler_for($handler_type, $options);
     }
 }
コード例 #8
0
 /**
  * Execute action for a single folder.
  * @param FOLDER $fldr
  * @access private
  */
 protected function _folder_run($fldr)
 {
     $fldr->restore();
 }
コード例 #9
0
 /**
  * Description for a folder's history item for inheriting this option.
  * @param boolean $adding Is the option being added?
  * @param FOLDER $folder
  * @return string
  * @access private
  */
 protected function _history_item_description($adding, $folder)
 {
     return 'Security is now inherited from ' . $folder->title_as_plain_text() . '.';
 }
コード例 #10
0
 /**
  * Execute action for a single folder.
  * @param FOLDER $fldr
  * @access private
  */
 protected function _folder_run($fldr)
 {
     $fldr->purge($this->_purge_options_for($fldr));
 }
コード例 #11
0
ファイル: folder.php プロジェクト: mvonballmo/earthli-webcore
 /**
  * Attach this folder as a sub-folder here.
  * @param FOLDER $folder
  * @access private
  */
 public function add_sub_folder($folder)
 {
     $this->_sub_folders[] = $folder;
     $folder->set_parent_folder($this);
 }
コード例 #12
0
 /**
  * @param FOLDER $fldr
  * @param integer $state
  * @param string $title
  * @param integer $owner_id
  * @access private
  */
 protected function _add_entry($fldr, $state, $title, $owner_id)
 {
     $this->_log("Adding entry [{$title}]...");
     $entry = $fldr->new_object();
     $entry->title = $title;
     $entry->state = $state;
     $entry->store();
     $entry->owner_id = $owner_id;
     $entry->store();
     $this->_add_comment($entry, Visible, 'Vis1', Baseline_test_owner1_id);
     $this->_add_comment($entry, Visible, 'Vis2', Baseline_test_owner2_id);
     $this->_add_comment($entry, Hidden, 'Invis1', Baseline_test_owner1_id);
     $this->_add_comment($entry, Hidden, 'Invis2', Baseline_test_owner2_id);
 }
コード例 #13
0
 /**
  * Update "target_folder" to use settings from "source_folder".
  * If "creating" is set, the settings are being created and the target folder
  * should be updated to reflect the new setting.
  * @param FOLDER $target_folder
  * @param FOLDER $source_folder
  * @param boolean $creating
  * @access private
  */
 protected function _update_folder($target_folder, $source_folder, $creating)
 {
     $field_name = $this->_field_name;
     if ($this->create_history_item_for_self || $target_folder->id != $this->_folder->id) {
         $history_item = $target_folder->new_history_item();
         if ($target_folder->visible()) {
             $history_item->kind = History_item_updated;
         } else {
             $history_item->kind = History_item_hidden_update;
         }
         $history_item->title = $this->_history_item_title($creating);
         $history_item->record_difference($this->_history_item_description($creating, $source_folder));
         $history_item->store();
     }
     $target_folder->{$field_name} = $source_folder->id;
     $target_folder->store();
 }
コード例 #14
0
 /**
  * Return the node's parent node.
  * @param FOLDER $node
  * @return FOLDER
  * @access private
  */
 public function parent($node)
 {
     return $node->parent_folder();
 }
コード例 #15
0
 /**
  * Add a folder as the current location.
  * The folder itself is displayed as text, while its parents are listed to the left
  * of it as links.
  * @see add_folder_link()
  * @param FOLDER $folder
  */
 public function add_folder_text($folder)
 {
     $this->add_folder_link($folder->parent_folder());
     $t = $folder->title_formatter();
     $t->max_visible_output_chars = 0;
     $this->append($folder->title_as_html($t), '', $folder->icon_url);
 }
コード例 #16
0
 /**
  * @return FOLDER[]
  * @param FOLDER $obj
  * @access private
  */
 protected function _obj_sub_objects($obj)
 {
     return $obj->sub_folders();
 }