Exemplo n.º 1
0
 /**
  * Initiate the editor. Push scripts to document if needed
  *
  * @return     string
  */
 public function onInit()
 {
     if ($this->_pushscripts) {
         \Hubzero\Document\Assets::addPluginStylesheet('editors', $this->_name);
         \Hubzero\Document\Assets::addPluginScript('editors', $this->_name);
         $this->_pushscripts = false;
     }
     return '';
 }
Exemplo n.º 2
0
 /**
  * Gets the link domain name
  *
  * @param   int  $adid  The auth domain ID
  * @return  string
  **/
 public static function getLinkIndicator($adid)
 {
     \Hubzero\Document\Assets::addPluginStylesheet('authentication', 'shibboleth', 'shibboleth.css');
     $dbh = App::get('db');
     $dbh->setQuery('SELECT domain FROM `#__auth_domain` WHERE id = ' . (int) $adid);
     // oops ... hopefully not reachable
     if (!($idp = $dbh->loadResult()) || !($label = self::getInstitutionByEntityId($idp, 'label'))) {
         return 'InCommon';
     }
     return $label;
 }
Exemplo n.º 3
0
 /**
  * Assign curation
  *
  * @return  void
  */
 public function assignTask()
 {
     // Incoming
     $pid = $this->_id ? $this->_id : Request::getInt('id', 0);
     $vid = Request::getInt('vid', 0);
     $owner = Request::getInt('owner', 0);
     $confirm = Request::getInt('confirm', 0);
     $ajax = Request::getInt('ajax', 0);
     // Load publication model
     $this->_pub = new \Components\Publications\Models\Publication($pid, NULL, $vid);
     if (!$this->_pub->exists()) {
         if ($ajax) {
             $this->view = new \Hubzero\Component\View(array('name' => 'error', 'layout' => 'restricted'));
             $this->view->error = Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_LOAD');
             $this->view->title = $this->title;
             $this->view->display();
             return;
         }
         throw new Exception(Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_LOAD'), 404);
     }
     if (!$this->_pub->access('curator')) {
         if ($ajax) {
             $this->view = new \Hubzero\Component\View(array('name' => 'error', 'layout' => 'restricted'));
             $this->view->error = Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_UNAUTHORIZED');
             $this->view->title = $this->title;
             $this->view->display();
             return;
         }
         throw new Exception(Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_UNAUTHORIZED'), 403);
     }
     // Perform assignment
     if ($confirm) {
         $previousOwner = $this->_pub->version->get('curator');
         $selected = Request::getInt('selected', 0);
         // Make sure owner profile exists
         if ($owner) {
             $ownerProfile = User::getInstance($owner);
             if (!$ownerProfile) {
                 $this->setError(Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_ASSIGN_PROFILE'));
             }
         } elseif ($selected && Request::getVar('owner', '')) {
             $owner = $selected;
         }
         // Assign
         if (!$this->getError()) {
             $this->_pub->version->set('curator', $owner);
             if (!$this->_pub->version->store()) {
                 $this->setError(Lang::txt('COM_PUBLICATIONS_CURATION_ASSIGN_FAILED'));
             }
             // Notify curator
             if ($owner && $owner != $previousOwner) {
                 $item = '"' . html_entity_decode($this->_pub->version->title) . '"';
                 $item .= ' v.' . $this->_pub->version->version_label . ' ';
                 $item = htmlentities($item, ENT_QUOTES, "UTF-8");
                 $message = Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED') . ' ' . $item . "\n" . "\n";
                 $message .= Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED_CURATE') . ' ' . rtrim(Request::base(), DS) . DS . trim(Route::url($this->_pub->link('curate')), DS) . "\n" . "\n";
                 $message .= Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED_PREVIEW') . ' ' . rtrim(Request::base(), DS) . DS . trim(Route::url($this->_pub->link('version')), DS);
                 Helpers\Html::notify($this->_pub, array($owner), Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED_SUBJECT'), $message);
             }
             // Log assignment in history
             if (!$this->getError() && $owner != $previousOwner) {
                 $obj = new Tables\CurationHistory($this->database);
                 if (!empty($ownerProfile)) {
                     $changelog = '<p>Curation assigned to ' . $ownerProfile->get('name') . ' (' . $ownerProfile->get('username') . ')</p>';
                 } else {
                     $changelog = '<p>Curator assignment was removed</p>';
                 }
                 // Create new record
                 $obj->publication_version_id = $this->_pub->version->id;
                 $obj->created = Date::toSql();
                 $obj->created_by = User::get('id');
                 $obj->changelog = $changelog;
                 $obj->curator = 1;
                 $obj->newstatus = $this->_pub->version->state;
                 $obj->oldstatus = $this->_pub->version->state;
                 $obj->store();
             }
         }
     } else {
         if (!$ajax) {
             // Set page title
             $this->_buildTitle();
             // Set the pathway
             $this->_buildPathway();
             // Add plugin style
             \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'curation.css');
         }
         $this->view->pub = $this->_pub;
         $this->view->title = $this->_title;
         $this->view->option = $this->_option;
         $this->view->ajax = $ajax;
         $this->view->display();
         return;
     }
     $message = $this->getError() ? $this->getError() : Lang::txt('COM_PUBLICATIONS_CURATION_SUCCESS_ASSIGNED');
     $class = $this->getError() ? 'error' : 'success';
     // Redirect to main listing
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=curation'), $message, $class);
     return;
 }
Exemplo n.º 4
0
 /**
  * Build panel content
  *
  * @return  string  HTML
  */
 public function buildContent($pub = NULL, $viewname = 'edit')
 {
     $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft';
     // Get selector styles
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'team', 'selector');
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'authors'));
     // Get authors
     if (!isset($pub->_authors)) {
         $pAuthors = new \Components\Publications\Tables\Author($this->_parent->_db);
         $pub->_authors = $pAuthors->getAuthors($pub->version_id);
         $pub->_submitter = $pAuthors->getSubmitter($pub->version_id, $pub->created_by);
     }
     // Get creator groups
     $view->groups = \Hubzero\User\Helper::getGroups($pub->_project->get('owned_by_user'), 'members', 1);
     $view->pub = $pub;
     $view->manifest = $this->_manifest;
     $view->step = $this->_blockId;
     // Get team members
     $objO = new \Components\Projects\Tables\Owner($this->_parent->_db);
     $view->teamids = $objO->getIds($pub->_project->get('id'), 'all', 0, 0);
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     return $view->loadTemplate();
 }
Exemplo n.º 5
0
 /**
  * Build panel content
  *
  * @return  string  HTML
  */
 public function buildContent($pub = NULL, $viewname = 'edit')
 {
     $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft';
     // Get selector styles
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'license'));
     $view->pub = $pub;
     $view->manifest = $this->_manifest;
     $view->step = $this->_blockId;
     $objL = new \Components\Publications\Tables\License($this->_parent->_db);
     // Get selected license
     $view->license = $objL->getPubLicense($pub->version_id);
     $view->selections = $objL->getBlockLicenses($this->_manifest, $view->license);
     // Pre-select single available license
     if (!$view->license && count($view->selections) == 1) {
         $view->license = new \Components\Publications\Tables\License($this->_parent->_db);
         $view->license->load($view->selections[0]->id);
     }
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     return $view->loadTemplate();
 }
Exemplo n.º 6
0
 /**
  * Build panel content
  *
  * @return  string  HTML
  */
 public function buildContent($pub = NULL, $viewname = 'edit')
 {
     $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft';
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'citations'));
     // Get selector styles
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'links');
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'selector');
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');
     if (!isset($pub->_citations)) {
         // Get citations for this publication
         $c = new \Components\Citations\Tables\Citation($this->_parent->_db);
         $pub->_citations = $c->getCitations('publication', $pub->id);
     }
     $view->pub = $pub;
     $view->manifest = $this->_manifest;
     $view->step = $this->_blockId;
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     return $view->loadTemplate();
 }
Exemplo n.º 7
0
	<h4><?php 
echo Lang::txt('COM_PUBLICATIONS_ABSTRACT');
?>
</h4>
	<div class="pub-content">
		<?php 
echo $description;
?>
	</div>

<?php 
// List all content?
$listAll = isset($this->publication->_curationModel->_manifest->params->list_all) ? $this->publication->_curationModel->_manifest->params->list_all : 0;
$listLabel = isset($this->publication->_curationModel->_manifest->params->list_label) ? $this->publication->_curationModel->_manifest->params->list_label : Lang::txt('COM_PUBLICATIONS_CONTENT_LIST');
// Add plugin style
\Hubzero\Document\Assets::addPluginStylesheet('publications', 'supportingdocs');
if ($listAll) {
    // 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($this->database);
    if ($elements) {
        $append = NULL;
        // Get file path
        $path = \Components\Publications\Helpers\Html::buildPubPath($this->publication->id, $this->publication->version_id, $webpath, '', 1);
        $licFile = $path . DS . 'LICENSE.txt';
        if (file_exists($licFile)) {
            $licenseUrl = Route::url('index.php?option=' . $this->option . '&id=' . $this->publication->id . '&task=license' . '&v=' . $this->publication->version_id);
            $append = '<li><a href="' . $licenseUrl . '" class="license-terms play" rel="external">' . Lang::txt('COM_PUBLICATIONS_LICENSE_TERMS') . '</a></li>';
Exemplo n.º 8
0
 /**
  * Browser within publications NEW
  *
  * @return     string
  */
 public function select()
 {
     // Incoming
     $props = Request::getVar('p', '');
     $ajax = Request::getInt('ajax', 0);
     $pid = Request::getInt('pid', 0);
     $vid = Request::getInt('vid', 0);
     $filter = urldecode(Request::getVar('filter', ''));
     // Parse props for curation
     $parts = explode('-', $props);
     $block = isset($parts[0]) ? $parts[0] : 'content';
     $step = isset($parts[1]) && is_numeric($parts[1]) && $parts[1] > 0 ? $parts[1] : 1;
     $element = isset($parts[2]) && is_numeric($parts[2]) && $parts[2] > 0 ? $parts[2] : 1;
     // Provisioned project?
     $prov = $this->model->isProvisioned() ? 1 : 0;
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'databases', 'name' => 'selector', 'layout' => 'default'));
     $view->publication = new \Components\Publications\Models\Publication($pid, NULL, $vid);
     // On error
     if (!$view->publication->exists()) {
         // Output error
         $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'error'));
         $view->title = '';
         $view->option = $this->_option;
         $view->setError(Lang::txt('PLG_PROJECTS_DATABASES_SELECTOR_ERROR_NO_PUBID'));
         return $view->loadTemplate();
     }
     $view->publication->attachments();
     // Get curation model
     $view->publication->setCuration();
     // Make sure block exists, else use default
     $view->publication->_curationModel->setBlock($block, $step);
     // Set pub assoc and load curation
     $view->publication->_curationModel->setPubAssoc($view->publication);
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'databases', 'selector');
     if (!$ajax) {
         \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');
     }
     $view->option = $this->_option;
     $view->database = $this->_database;
     $view->model = $this->model;
     $view->uid = $this->_uid;
     $view->ajax = $ajax;
     $view->element = $element;
     $view->block = $block;
     $view->step = $step;
     $view->props = $props;
     $view->filter = $filter;
     // Get databases to choose from
     $objPD = new \Components\Projects\Tables\Database($this->_database);
     $view->items = $objPD->getItems($this->model->get('id'), array());
     // Get messages	and errors
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     $arr = array('html' => $view->loadTemplate(), 'metadata' => '', 'msg' => '', 'referer' => '');
     return $arr;
 }
Exemplo n.º 9
0
 /**
  * Get disk space
  *
  * @param      object  	$model
  *
  * @return     string
  */
 public function pubDiskSpace($model)
 {
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => 'diskspace'));
     // Include styling and js
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'diskspace');
     \Hubzero\Document\Assets::addPluginScript('projects', 'files', 'diskspace');
     $database = App::get('db');
     // Build query
     $filters = array();
     $filters['limit'] = Request::getInt('limit', 25);
     $filters['start'] = Request::getInt('limitstart', 0);
     $filters['sortby'] = Request::getVar('t_sortby', 'title');
     $filters['sortdir'] = Request::getVar('t_sortdir', 'ASC');
     $filters['project'] = $model->get('id');
     $filters['ignore_access'] = 1;
     $filters['dev'] = 1;
     // get dev versions
     // Instantiate project publication
     $objP = new \Components\Publications\Tables\Publication($database);
     // Get all publications
     $view->rows = $objP->getRecords($filters);
     // Get used space
     $view->dirsize = \Components\Publications\Helpers\Html::getDiskUsage($view->rows);
     $view->params = $model->params;
     $view->quota = $view->params->get('pubQuota') ? $view->params->get('pubQuota') : \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('pubQuota', '1')), 'GB', 'b');
     // Get total count
     $view->total = $objP->getCount($filters);
     $view->project = $model;
     $view->option = $this->_option;
     $view->title = isset($this->_area['title']) ? $this->_area['title'] : '';
     return $view->loadTemplate();
 }
Exemplo n.º 10
0
 * 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.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Shawn Rice <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access.
defined('_HZEXEC_') or die;
// Import share CSS to style share features on right side of trifold
\Hubzero\Document\Assets::addPluginStylesheet('resources', 'share');
$this->css()->js()->js('tagbrowser');
?>
<header id="content-header">
	<h2><?php 
echo $this->title;
?>
</h2>

	<?php 
foreach ($this->types as $type) {
    ?>
		<?php 
    if ($type->id == $this->filters['type'] && $type->contributable) {
        ?>
		<div id="content-header-extra">
Exemplo n.º 11
0
 public static function onRenderOption($return, $title = 'With an affiliated institution:')
 {
     // hide the login box if the plugin is in "debug mode" and the special key is not set in the request
     $params = Plugin::params('authentication', 'shibboleth');
     if (($testKey = $params->get('testkey', NULL)) && !array_key_exists($testKey, $_GET)) {
         return '<span />';
     }
     // saved id provider? use it as the default
     $prefill = isset($_COOKIE['shib-entity-id']) ? $_COOKIE['shib-entity-id'] : NULL;
     if (!$prefill && ($host = self::getHostByAddress(isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'], $params->get('dns', '8.8.8.8'))) && preg_match('/[.]([^.]*?[.][a-z0-9]+?)$/', $host, $ma)) {
         // hostname lookup seems php jsonrational (not an ip address, has a few dots in it
         // try to look up a provider to pre-select based on the user's hostname
         foreach (self::getInstitutions() as $inst) {
             if (fnmatch('*' . $ma[1], $inst['host'])) {
                 $prefill = $inst['entity_id'];
                 break;
             }
         }
     }
     // attach style and scripts
     foreach (array('bootstrap.min.js', 'bootstrap-select.min.js', 'shibboleth.js', 'bootstrap.min.css', 'bootstrap-select.min.css', 'bootstrap-theme.min.css', 'shibboleth.css') as $asset) {
         $isJs = preg_match('/[.]js$/', $asset);
         if ($isJs) {
             \Hubzero\Document\Assets::addPluginScript('authentication', 'shibboleth', $asset);
         } else {
             \Hubzero\Document\Assets::addPluginStylesheet('authentication', 'shibboleth', $asset);
         }
     }
     list($a, $h) = self::htmlify();
     // make a dropdown/button combo that (hopefully) gets prettied up client-side into a bootstrap dropdown
     $html = array();
     $html[] = '<form class="shibboleth account incommon-color" action="' . Route::url('index.php?option=com_users&view=login') . '" method="get">';
     $html[] = '<div class="default-icon"></div>';
     $html[] = '<select title="' . $a($title) . '" name="idp">';
     $html[] = '<option class="placeholder">' . $h($title) . '</option>';
     foreach (self::getInstitutions() as $idp) {
         $logo = isset($idp['logo_data']) && $idp['logo_data'] ? '<img src="' . $idp['logo_data'] . '" />' : '<span class="logo-placeholder"></span>';
         $html[] = '<option ' . ($prefill == $idp['entity_id'] ? 'selected="selected" ' : '') . 'value="' . $a($idp['entity_id']) . '" data-content="' . $a($logo . ' ' . $h($idp['label'])) . '">' . $h($idp['label']) . '</option>';
     }
     $html[] = '</select>';
     $html[] = '<input type="hidden" name="authenticator" value="shibboleth" />';
     if ($return) {
         $html[] = '<input type="hidden" name="return" value="' . $a(preg_replace('/^.return=/', '', $return)) . '" />';
     }
     $html[] = '<button class="submit" type="submit">Sign in</button>';
     $html[] = '</form>';
     return $html;
 }
Exemplo n.º 12
0
 /**
  * Browser within publications NEW
  *
  * @return     string
  */
 public function select()
 {
     // Incoming
     $props = Request::getVar('p', '');
     $ajax = Request::getInt('ajax', 0);
     $pid = Request::getInt('pid', 0);
     $vid = Request::getInt('vid', 0);
     // Parse props for curation
     $parts = explode('-', $props);
     $block = isset($parts[0]) && in_array($parts[0], array('content', 'extras')) ? $parts[0] : 'authors';
     $step = isset($parts[1]) && is_numeric($parts[1]) && $parts[1] > 0 ? $parts[1] : 1;
     $layout = $this->_task == 'newauthor' || $this->model->isProvisioned() ? 'newauthor' : 'default';
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'team', 'name' => 'selector', 'layout' => $layout));
     $view->publication = new \Components\Publications\Models\Publication($pid, NULL, $vid);
     if (!$view->publication->exists()) {
         $this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_SELECTOR_ERROR_NO_PUBID'));
         // Output error
         $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'error'));
         $view->title = '';
         $view->option = $this->_option;
         $view->setError($this->getError());
         return $view->loadTemplate();
     }
     // Set curation
     $view->publication->setCuration();
     // Make sure block exists, else use default
     if (!$view->publication->_curationModel->setBlock($block, $step)) {
         $block = 'authors';
     }
     // Get css
     if (!$ajax) {
         \Hubzero\Document\Assets::addPluginStylesheet('projects', 'team', 'selector');
     }
     // Instantiate project owner
     $objO = $this->model->table('Owner');
     $view->filters['limit'] = 0;
     $view->filters['start'] = Request::getInt('t_limitstart', 0);
     $view->filters['sortby'] = Request::getVar('t_sortby', 'name');
     $view->filters['sortdir'] = Request::getVar('t_sortdir', 'ASC');
     $view->filters['status'] = 'active';
     $view->filters['pub_versionid'] = $vid;
     // Get all active team members
     $view->team = $objO->getOwners($this->model->get('id'), $view->filters);
     // Get current authors
     $pa = $view->publication->table('Author');
     $view->authors = $pa->getAuthors($vid);
     // Exclude any owners?
     $view->exclude = array();
     $view->mc = Event::trigger('hubzero.onGetSingleEntry', array(array('members', 'uid', 'uid')));
     $view->option = $this->model->isProvisioned() ? 'com_publications' : $this->_option;
     $view->database = $this->_database;
     $view->model = $this->model;
     $view->uid = $this->_uid;
     $view->ajax = $ajax;
     $view->task = $this->_task;
     $view->block = $block;
     $view->step = $step;
     $view->props = $props;
     // Get messages	and errors
     $view->msg = $this->_msg;
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     return $view->loadTemplate();
 }
Exemplo n.º 13
0
 /**
  * Browser within publications NEW
  *
  * @return     string
  */
 public function select()
 {
     // Incoming
     $props = Request::getVar('p', '');
     $ajax = Request::getInt('ajax', 0);
     $pid = Request::getInt('pid', 0);
     $vid = Request::getInt('vid', 0);
     $filter = urldecode(Request::getVar('filter', ''));
     // Parse props for curation
     $parts = explode('-', $props);
     $block = isset($parts[0]) ? $parts[0] : 'content';
     $step = isset($parts[1]) && is_numeric($parts[1]) && $parts[1] > 0 ? $parts[1] : 1;
     $element = isset($parts[2]) && is_numeric($parts[2]) && $parts[2] > 0 ? $parts[2] : 1;
     $layout = $this->_task == 'newcite' ? 'edit' : 'default';
     // Output HTML
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'links', 'name' => 'selector', 'layout' => $layout));
     $view->publication = new \Components\Publications\Models\Publication($pid, NULL, $vid);
     // On error
     if (!$view->publication->exists()) {
         // Output error
         $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'error'));
         $view->title = '';
         $view->option = $this->_option;
         $view->setError(Lang::txt('PLG_PROJECTS_FILES_SELECTOR_ERROR_NO_PUBID'));
         return $view->loadTemplate();
     }
     $view->publication->attachments();
     // Get curation model
     $view->publication->setCuration();
     // Make sure block exists, else use default
     if (!$view->publication->_curationModel->setBlock($block, $step)) {
         $block = 'content';
         $step = 1;
     }
     // Add css?
     if (!$ajax) {
         \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');
     }
     if ($this->_task == 'newcite') {
         // Incoming
         $cid = Request::getInt('cid', 0);
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'type.php';
         include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'citation.php';
         // Load the object
         $view->row = new \Components\Citations\Tables\Citation($this->_database);
         $view->row->load($cid);
         // get the citation types
         $ct = new \Components\Citations\Tables\Type($this->_database);
         $view->types = $ct->getType();
     }
     $view->option = $this->_option;
     $view->database = $this->_database;
     $view->model = $this->model;
     $view->uid = $this->_uid;
     $view->ajax = $ajax;
     $view->task = $this->_task;
     $view->element = $element;
     $view->block = $block;
     $view->step = $step;
     $view->props = $props;
     $view->filter = $filter;
     // Get messages	and errors
     if ($this->getError()) {
         $view->setError($this->getError());
     }
     return $view->loadTemplate();
 }
Exemplo n.º 14
0
 /**
  * Edit project info
  *
  * @return     void
  */
 public function editTask()
 {
     // Incoming project ID
     $id = Request::getVar('id', array(0));
     if (is_array($id)) {
         $id = $id[0];
     }
     // Push some styles to the template
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'diskspace.css');
     \Hubzero\Document\Assets::addPluginScript('projects', 'files', 'diskspace.js');
     \Hubzero\Document\Assets::addPluginScript('projects', 'files');
     $this->view = $this->view;
     $this->view->config = $this->config;
     $model = new Models\Project($id);
     $objAC = $model->table('Activity');
     if ($id) {
         if (!$model->exists()) {
             App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_PROJECTS_NOTICE_ID_NOT_FOUND'), 'error');
             return;
         }
     }
     if (!$id) {
         App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_PROJECTS_NOTICE_NEW_PROJECT_FRONT_END'), 'error');
         return;
     }
     // Get project types
     $objT = $model->table('Type');
     $this->view->types = $objT->getTypes();
     // Get activity counts
     $counts = Event::trigger('projects.onProjectCount', array($model, 1));
     $counts = Helpers\Html::getCountArray($counts);
     $counts['activity'] = $objAC->getActivityCount($model->get('id'), User::get('id'));
     $this->view->counts = $counts;
     // Get team
     $objO = $model->table('Owner');
     // Sync with system group
     $objO->sysGroup($model->get('alias'), $this->config->get('group_prefix', 'pr-'));
     // Get members and managers
     $this->view->managers = $objO->getOwnerNames($id, 0, '1', 1);
     $this->view->members = $objO->getOwnerNames($id, 0, '0', 1);
     $this->view->authors = $objO->getOwnerNames($id, 0, '2', 1);
     $this->view->reviewers = $objO->getOwnerNames($id, 0, '5', 1);
     // Get last activity
     $afilters = array('limit' => 1);
     $last_activity = $objAC->getActivities($id, $afilters);
     $this->view->last_activity = count($last_activity) > 0 ? $last_activity[0] : '';
     // Was project suspended?
     $this->view->suspended = false;
     $setup_complete = $this->config->get('confirm_step', 0) ? 3 : 2;
     if ($model->isInactive()) {
         $this->view->suspended = $objAC->checkActivity($id, Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_SUSPENDED'));
     }
     // Get project params
     $this->view->params = $model->params;
     $content = Event::trigger('projects.diskspace', array($model, 'local', 'admin'));
     $this->view->diskusage = isset($content[0]) ? $content[0] : '';
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Get tags on this item
     $cloud = new Models\Tags($id);
     $this->view->tags = $cloud->render('string');
     // Output the HTML
     $this->view->model = $model;
     $this->view->publishing = $this->_publishing;
     $this->view->display();
 }
Exemplo n.º 15
0
<?php

// no direct access
defined('_HZEXEC_') or die;
$this->css()->css('jquery.fancybox.css', 'system')->js();
// Add projects stylesheet
\Hubzero\Document\Assets::addComponentStylesheet('com_projects');
\Hubzero\Document\Assets::addComponentScript('com_projects');
\Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'uploader');
\Hubzero\Document\Assets::addPluginScript('projects', 'files', 'jquery.fileuploader.js');
\Hubzero\Document\Assets::addPluginScript('projects', 'files', 'jquery.queueuploader.js');
?>
<header id="content-header">
	<h2><?php 
echo $this->title;
?>
</h2>
</header><!-- / #content-header -->

<?php 
if ($this->pid && !empty($this->project) && $this->project->get('created_by_user') == User::get('id')) {
    ?>
	<p class="contrib-options">
		<?php 
    echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_NEED_A_PROJECT');
    ?>
		<a href="<?php 
    echo Route::url('index.php?option=com_projects&alias=' . $this->project->get('alias') . '&action=activate');
    ?>
">
		<?php 
Exemplo n.º 16
0
 /**
  * Build panel content
  *
  * @return  string  HTML
  */
 public function buildContent($pub = NULL, $viewname = 'edit', $status, $master)
 {
     $html = '';
     // Get selector styles
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector');
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'links');
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'selector');
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'databases', 'selector');
     // Get block element model
     $elModel = new \Components\Publications\Models\BlockElements($this->_parent->_db);
     // Build each element
     $o = 1;
     foreach ($this->_manifest->elements as $elementId => $element) {
         $html .= $elModel->drawElement($element->name, $elementId, $element, $master, $pub, $status, $viewname, $o);
         $o++;
     }
     return $html;
 }