?> <div class="supportingdocs"> <h3> <a name="supportingdocs"></a> <?php echo Lang::txt('PLG_PUBLICATION_SUPPORTINGDOCS'); ?> </h3> <?php // Get elements in primary and supporting role $prime = $this->publication->_curationModel->getElements(1); $second = $this->publication->_curationModel->getElements(2); $elements = array_merge($prime, $second); // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($database); if ($elements) { // Draw list $list = $attModel->listItems($elements, $this->publication, $this->authorized); echo $list ? $list : '<p class="noresults">' . Lang::txt('PLG_PUBLICATION_SUPPORTINGDOCS_NONE_FOUND') . '</p>'; } else { ?> <p class="noresults"><?php echo Lang::txt('PLG_PUBLICATION_SUPPORTINGDOCS_NONE_FOUND'); ?> </p> <?php } ?> </div><!-- / .supportingdocs -->
$shorten = $aboutTxt && strlen($aboutTxt) > 200 ? 1 : 0; if ($shorten) { $about = \Hubzero\Utility\String::truncate($aboutTxt, 200); $about .= ' <a href="#more-' . $elName . '" class="more-content">' . Lang::txt('COM_PUBLICATIONS_READ_MORE') . '</a>'; $about .= ' <div class="hidden">'; $about .= ' <div class="full-content" id="more-' . $elName . '">' . $aboutTxt . '</div>'; $about .= ' </div>'; } else { $about = $aboutTxt; } // Get version params and extract bundle name $bundleName = $this->pub->params->get($elName . 'bundlename', $defaultTitle); $bundleName = $bundleName ? $bundleName : 'bundle'; $bundleName .= '.zip'; // Get attachment model $modelAttach = new \Components\Publications\Models\Attachments($this->database); // Get handler model $modelHandler = new \Components\Publications\Models\Handlers($this->database); // Is there handler choice? $handlers = $this->manifest->params->typeParams->handlers; // Is there handler assigned? $handler = $this->manifest->params->typeParams->handler; $useHandles = $handlers || $handler ? true : false; if ($handler) { // Load handler $handler = $modelHandler->ini($handler); } $bundleUrl = Route::url($this->pub->link('serve') . '&el=' . $this->elementId . '&download=1'); // Get curator status if ($this->name == 'curator') { $curatorStatus = $this->pub->_curationModel->getCurationStatus($this->pub, $this->master->blockId, $this->elementId, 'curator');
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ // No direct access defined('_HZEXEC_') or die; // Get requirements $element = $this->publication->curation('blocks', $this->step, 'elements', $this->element); $params = $element->params; // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->database); // Get attached items $attachments = $this->publication->attachments(); $attachments = isset($attachments['elements'][$this->element]) ? $attachments['elements'][$this->element] : NULL; $attachments = $attModel->getElementAttachments($this->element, $attachments, $params->type); // Get preselected items $selected = array(); if ($attachments) { foreach ($attachments as $attach) { $selected[] = $attach->object_name; } } ?> <div id="abox-content-wrap"> <div id="abox-content"> <script src="/core/plugins/projects/publications/assets/js/selector.js"></script>
?> </p> <?php echo \Components\Publications\Helpers\Html::showSubInfo($this->publication); // Show published date and category ?> </div><!-- / .overviewcontainer --> <div class="col span4 omega launcharea"> <?php // Sort out primary files and draw a launch button if ($this->tab != 'play') { // Get primary elements $elements = $this->publication->_curationModel->getElements(1); // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->database); if ($elements) { $element = $elements[0]; // Draw button $launcher = $attModel->drawLauncher($element->manifest->params->type, $this->publication, $element, $elements, $this->publication->access('view-all')); $html .= $launcher; } } // Show additional docs $html .= $this->tab != 'play' ? \Components\Publications\Helpers\Html::drawSupportingItems($this->publication) : ''; // Show version information $html .= $this->tab != 'play' ? \Components\Publications\Helpers\Html::showVersionInfo($this->publication) : ''; // Show license information $html .= $this->tab != 'play' && $this->publication->license() && $this->publication->license()->name != 'standard' ? \Components\Publications\Helpers\Html::showLicense($this->publication, 'play') : ''; echo $html; ?>
// No direct access defined('_HZEXEC_') or die; $pub = $this->pub; $database = App::get('db'); if (!$pub->_attachments) { return '<p class="notice">' . Lang::txt('COM_PUBLICATIONS_NO_CONTENT') . '</p>'; } $html = ''; $prime = $pub->_attachments[1]; $second = $pub->_attachments[2]; if (isset($pub->_curationModel)) { $prime = $pub->_curationModel->getElements(1); $second = $pub->_curationModel->getElements(2); $gallery = $pub->_curationModel->getElements(3); // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($database); // Draw list of primary elements $html .= '<h5>' . Lang::txt('COM_PUBLICATIONS_PRIMARY_CONTENT') . '</h5>'; $list = $attModel->listItems($prime, $pub, 'administrator'); $html .= $list ? $list : '<p class="notice">' . Lang::txt('COM_PUBLICATIONS_NO_CONTENT') . '</p>'; // Draw list of secondary elements $html .= '<h5>' . Lang::txt('COM_PUBLICATIONS_SUPPORTING_CONTENT') . '</h5>'; $list = $attModel->listItems($second, $pub, 'administrator'); $html .= $list ? $list : '<p class="notice">' . Lang::txt('COM_PUBLICATIONS_NO_CONTENT') . '</p>'; // Draw list of gallery elements $html .= '<h5>' . Lang::txt('COM_PUBLICATIONS_GALLERY') . '</h5>'; $list = $attModel->listItems($gallery, $pub, 'administrator'); $html .= $list ? $list : '<p class="notice">' . Lang::txt('COM_PUBLICATIONS_NO_CONTENT') . '</p>'; } else { $html .= '<h5>' . Lang::txt('COM_PUBLICATIONS_PRIMARY_CONTENT') . '</h5>'; if ($prime) {
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ // No direct access defined('_HZEXEC_') or die; if (!$this->ajax) { $this->css('selector'); } // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->database); // Filter URL $route = $this->model->isProvisioned() ? 'index.php?option=com_publications&task=submit&active=files' : $this->model->link('files'); $filterUrl = Route::url($route) . '?action=filter&pid=' . $this->publication->get('id') . '&vid=' . $this->publication->get('version_id') . '&p=' . $this->props . '&ajax=1&no_html=1'; $elId = $this->element; // Get requirements $element = $this->publication->curation('blocks', $this->step, 'elements', $this->element); $params = $element->params; $max = $params->max; $min = $params->min; $required = $params->required; $role = $params->role; $allowed = $params->typeParams->allowed_ext; $reqext = $params->typeParams->required_ext; $reuse = isset($params->typeParams->reuse) ? $params->typeParams->reuse : 1; $minName = \Components\Projects\Helpers\Html::getNumberName($min);
/** * Load entry by version and path * * @param integer $vid pub version id * @param string $identifier content path or object id/name * @return boolean */ public function deleteAttachment($vid = NULL, $identifier = NULL, $type = 'file') { if (!$vid) { $vid = $this->publication_version_id; } if (!$vid) { return false; } if (!$identifier) { return false; } $attach = new \Components\Publications\Models\Attachments($this->_db); $prop = $attach->connector($type); $prop = $prop ? $prop : 'path'; $query = "DELETE FROM {$this->_tbl} WHERE publication_version_id=" . $this->_db->quote($vid); $query .= " AND " . $prop . "=" . $this->_db->quote($identifier); $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } return true; }
/** * Draw file selector * * @return object */ public function drawSelector($elementId, $manifest, $pub = NULL, $status = NULL, $active = 0, $collapse = 0, $total = 0, $master = NULL, $order = 0) { // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->_parent->_db); // Make sure we have attachments if (!isset($pub->_attachments)) { // Get attachments $pContent = new \Components\Publications\Tables\Attachment($this->_parent->_db); $pub->_attachments = $pContent->sortAttachments($pub->version_id); } // Get attached items $attachments = $pub->_attachments; $attachments = isset($attachments['elements'][$elementId]) ? $attachments['elements'][$elementId] : NULL; $attachments = $attModel->getElementAttachments($elementId, $attachments, $manifest->params->type, $manifest->params->role); $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => 'blockelement', 'layout' => 'dataselector')); $view->type = $manifest->params->type; $view->path = $this->path; $view->pub = $pub; $view->manifest = $manifest; $view->status = $status; $view->elementId = $elementId; $view->attachments = $attachments; $view->active = $active; $view->collapse = $collapse; $view->total = $total; $view->master = $master; $view->database = $this->_parent->_db; $view->order = $order; $view->viewer = 'edit'; $view->git = $this->_git; return $view->loadTemplate(); }
/** * Delete attachment record * * @return void */ public function deleteItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0, $aid = 0) { $aid = $aid ? $aid : Request::getInt('aid', 0); // Load attachment $row = new \Components\Publications\Tables\Attachment($this->_parent->_db); // We need attachment record if (!$aid || !$row->load($aid)) { $this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_CONTENT_ERROR_EDIT_CONTENT')); return false; } // Attachment type $type = $row->type; // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->_parent->_db); // Save incoming attachment info $attModel->remove($type, $row, $pub, $actor, $elementId, $manifest->elements->{$elementId}, $manifest->params); // Set success message if ($attModel->get('_message')) { $this->set('_message', $attModel->get('_message')); } // Set request to update curation record if ($attModel->get('_update')) { $this->_parent->set('_update', 1); } return true; }