/** * @param ENTRY $entry Will be attached to this object. */ public function __construct($entry) { $folder = $entry->parent_folder(); parent::__construct($folder); $this->_entry = $entry; $field = new TEXT_FIELD(); $field->id = 'type'; $field->caption = 'Type'; $field->required = true; $field->visible = false; $this->add_field($field); $field = new BOOLEAN_FIELD(); $field->id = 'create_thumbnail'; $field->caption = 'Generate thumbnail'; $field->sticky = true; $this->add_field($field); $field = new INTEGER_FIELD(); $field->id = 'thumbnail_size'; $field->caption = 'Thumbnail'; $field->min_value = 32; $field->max_value = 400; $field->sticky = true; $this->add_field($field); $field = new BOOLEAN_FIELD(); $field->id = 'overwrite'; $field->caption = 'Overwrite existing file'; $field->sticky = true; $this->add_field($field); $field = new UPLOAD_FILE_FIELD(); $field->id = 'file_name'; $field->caption = 'File'; $field->required = true; $this->add_field($field); }
/** * @param ENTRY $entry Retrieve comments from this entry. */ public function __construct($entry) { parent::__construct($entry->parent_folder()); $this->_entry = $entry; }
/** * Execute action for a single entry * @param ENTRY $entry * @access private */ protected function _entry_run($entry) { $entry->set_state(Visible, true); }
/** * Execute action for a single entry * @param ENTRY $entry * @access private */ protected function _entry_run($entry) { $entry->restore(); }
/** * Execute action for a single entry. * @param ENTRY $entry * @access private */ protected function _entry_run($entry) { $entry->purge($this->_purge_options_for($entry)); }
/** * Perform any setup needed on each returned object. * @param ENTRY $obj * @access private */ protected function _prepare_object($obj) { $obj->set_parent_folder($this->_user->folder_at_id($this->db->f('folder_id'))); }
/** * Execute action for a single entry * @param ENTRY $entry * @access private */ protected function _entry_run($entry) { $entry->set_state(Abandoned, true); }
/** * Execute action for a single entry * @param ENTRY $entry * @access private */ protected function _entry_run($entry) { $entry->delete(); }
/** * Execute action for a single entry * @param ENTRY $entry * @access private */ protected function _entry_run($entry) { $entry->set_state(Queued, true); }
/** * Draws {@link COMMENT}s and {@link ATTACHMENT}s. * @param ENTRY $obj * @param OBJECT_RENDERER_OPTIONS $options */ public function display($obj, $options = null) { $folder = $obj->parent_folder(); if ($this->login->is_allowed(Privilege_set_attachment, Privilege_view, $folder)) { $attachment_query = $obj->attachment_query(); if ($attachment_query->size()) { ?> <h2 id="attachments"> Attachments </h2> <div class="grid-content"> <?php $class_name = $this->app->final_class_name('ATTACHMENT_GRID', 'webcore/gui/attachment_grid.php'); /** @var $grid ATTACHMENT_GRID */ $grid = new $class_name($this->app); $grid->pager->page_anchor = 'attachments'; $grid->pager->page_number_var_name = 'attachment_page_number'; $grid->set_page_size(Default_page_size); $grid->set_query($attachment_query); $grid->display(); ?> </div> <?php } } if ($this->login->is_allowed(Privilege_set_comment, Privilege_view, $folder)) { $com_query = $obj->comment_query(); if ($com_query->size()) { $class_name = $this->app->final_class_name('COMMENT_LIST_RENDERER', 'webcore/gui/comment_renderer.php'); /** @var $com_renderer COMMENT_LIST_RENDERER */ $com_renderer = new $class_name($com_query, $obj); ?> <h2 id="comments" class="clear-both"> Comments </h2> <?php $commands = $com_renderer->make_commands(); if ($commands->num_executable_commands() > 0) { ?> <div class="button-content"> <span class="field"><?php echo $com_renderer->size(); ?> </span> Replies <?php $menu_renderer = $this->app->make_menu_renderer(); $menu_renderer->content_mode = Menu_show_as_buttons; $menu_renderer->display($commands); ?> </div> <?php } ?> <div class="grid-content"> <?php $com_renderer->display(); ?> </div> <?php } } }
/** * Draw the title for the object. * Object renderers don't draw the title, so the print preview does that. * @param ENTRY $entry */ protected function _draw_title($entry) { ?> <h2><?php echo $entry->title_as_link(); ?> </h2> <?php }
/** * Attach this comment to an entry. * Does not store to the database. Sets up both the entry and the folder information * for this comment; used during object setup when retrieved from database. * @param ENTRY $entry */ public function set_entry($entry) { $this->set_parent_folder($entry->parent_folder()); $this->_entry = $entry; $this->entry_id = $entry->id; }
/** * Copy properties from the given object. * @param DRAFTABLE_ENTRY $other * @access private */ protected function copy_from($other) { parent::copy_from($other); $this->time_published = clone $other->time_published; }
/** * Set properties for the entry associated with a comment. * This is usually just the bare minimum of properties needed to display a * link to the entry. This avoids retrieving all the entry data when only the * link needs to be displayed (since this query shows comments, not full * entries). * @param ENTRY $entry The entry whose properties should be set. * @access private */ protected function _prepare_entry($entry) { $entry->set_parent_folder($this->_folder); $entry->id = $this->db->f('entry_id'); }
/** * Set properties for the entry associated with a comment. * This is usually just the bare minimum of properties needed to display a * link to the entry. This avoids retrieving all the entry data when only the * link needs to be displayed (since this query shows comments, not full * entries). * @param ENTRY $entry The entry whose properties should be set. * @access private */ protected function _prepare_entry($entry) { $db = $this->db; $entry->id = $db->f('entry_id'); $entry->title = $db->f('entry_title'); $entry->state = $db->f('entry_state'); $entry->set_parent_folder($this->_user->folder_at_id($this->db->f('folder_id'))); }
/** * @param PURGE_OPTIONS $options * @access private */ protected function _purge($options) { $tname = $this->secondary_table_name(); $this->db->logged_query("DELETE LOW_PRIORITY FROM {$tname} WHERE entry_id = {$this->id}"); parent::_purge($options); }
/** * Add commands that provide views on the entry. * @param ENTRY $entry * @access private */ protected function _add_viewers($entry) { $folder_id = $entry->parent_folder_id(); $cmd = $this->make_command(); $cmd->id = 'print'; $cmd->caption = 'Print'; $cmd->link = "multiple_print.php?id={$folder_id}&entry_ids={$entry->id}"; $cmd->icon = '{icons}buttons/print'; $cmd->executable = true; $cmd->importance = Command_importance_high - Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'send'; $cmd->caption = 'Send'; $cmd->link = "send_entry.php?id={$entry->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 = 'plain_text'; $cmd->caption = 'Plain text'; $cmd->link = "view_entry_plain_text.php?id={$entry->id}"; $cmd->icon = '{icons}indicators/text'; $cmd->executable = true; $cmd->importance = Command_importance_high - Command_importance_increment * 2; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'source'; $cmd->caption = 'Source'; $cmd->link = "view_entry_source.php?id={$entry->id}"; $cmd->icon = '{icons}buttons/source'; $cmd->executable = true; $cmd->importance = Command_importance_high - Command_importance_increment * 2; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'history'; $cmd->caption = 'History'; $cmd->link = "view_entry_history.php?id={$entry->id}"; $cmd->icon = '{icons}buttons/history'; $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_view_history, $entry); $cmd->importance = Command_importance_low; $this->append($cmd); }
/** * Title for an associated history item. * Override this function to show other information for an history item's object in the title. The subscriber * for whom the title is prepared is also sent, so that any subscriber settings can be used to render the * title. * @param ENTRY $obj * @param SUBSCRIBER $subscriber * @return string */ public function title_for_history_item($obj, $subscriber) { $type_info = $this->type_info(); $type_info->singular_title; $kind = $obj->supported_kind_as_text(); if ($kind) { $Result = $type_info->singular_title . ' ' . $kind; } else { if ($subscriber->show_history_item_as_subject) { $Result = $obj->title_as_plain_text(); } else { $Result = $type_info->singular_title . ' updated'; } } $location = $this->object_url_as_text(); return $Result . " ({$location})"; }
/** * @param ENTRY $entry * @param integer $state * @param string $title * @param integer $owner_id * @access private */ protected function _add_comment($entry, $state, $title, $owner_id) { $this->_log("Adding comment [{$title}]..."); $comment = $entry->new_comment(0); $comment->title = $title; $comment->state = $state; $comment->store(); $comment->owner_id = $owner_id; $comment->store(); }
/** * @param SUBSCRIBER $subscriber * @param ENTRY $obj * @param integer[] $kinds * @param OBJECT_RENDERER_OPTIONS $options */ protected function _display($obj, $subscriber, $kinds, $options) { $this->show_subscription($subscriber, $obj->parent_folder(), 'subscribe_to_folder.php', in_array(Subscribe_folder, $kinds), true, ''); $this->show_subscription($subscriber, $obj, 'subscribe_to_entry.php', in_array(Subscribe_entry, $kinds), false, ''); $this->show_subscription($subscriber, $obj->creator(), 'subscribe_to_user.php', in_array(Subscribe_user, $kinds), true, 'creator'); }