/** * Event call to determine if this plugin should return data * * @return array Plugin name and title */ public function &onProjectAreas($alias = NULL) { //default areas returned to nothing $area = array(); // Check if plugin is restricted to certain projects $projects = $this->params->get('restricted') ? \Components\Projects\Helpers\Html::getParamArray($this->params->get('restricted')) : array(); if (!empty($projects) && $alias) { if (!in_array($alias, $projects)) { return $area; } } // Hide section completely if not configured if ($this->_checkConfig() == false) { return $area; } $area = array('name' => 'databases', 'title' => 'Databases', 'submenu' => 'Assets', 'show' => true); return $area; }
/** * Event call to return data for a specific project * * @param object $model Project model * @param string $action Plugin task * @param string $areas Plugins to return data * @return array Return array of html */ public function onProject($model, $action = '', $areas = null) { $returnhtml = true; $arr = array('html' => '', 'metadata' => '', 'message' => '', 'error' => ''); // Get this area details $this->_area = $this->onProjectAreas(); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (empty($this->_area) || !in_array($this->_area['name'], $areas)) { return; } } // Check authorization if ($model->exists() && !$model->access('member')) { return $arr; } // Model $this->model = $model; // Incoming $this->_task = Request::getVar('action', ''); $this->_pid = Request::getInt('pid', 0); if (!$this->_task) { $this->_task = $this->_pid ? 'publication' : $action; } $this->_uid = User::get('id'); $this->_database = App::get('db'); $this->_config = $this->model->config(); $this->_pubconfig = Component::params('com_publications'); // Common extensions (for gallery) $this->_image_ext = \Components\Projects\Helpers\Html::getParamArray($this->params->get('image_types', 'bmp, jpeg, jpg, png')); $this->_video_ext = \Components\Projects\Helpers\Html::getParamArray($this->params->get('video_types', 'avi, mpeg, mov, wmv')); // Check if exists or new if (!$this->model->exists()) { // Contribute process outside of projects $this->model->set('provisioned', 1); $ajax_tasks = array('showoptions', 'save', 'showitem'); $this->_task = $action == 'start' ? 'start' : 'contribute'; if ($action == 'publication') { $this->_task = 'publication'; } elseif (in_array($action, $ajax_tasks)) { $this->_task = $action; } } elseif ($this->model->isProvisioned()) { // No browsing within provisioned project $this->_task = $action == 'browse' ? 'contribute' : $action; } \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications'); \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'curation'); \Hubzero\Document\Assets::addPluginScript('projects', 'publications', 'curation'); // Actions switch ($this->_task) { case 'browse': default: $arr['html'] = $this->browse(); break; case 'start': case 'new': $arr['html'] = $this->startDraft(); break; case 'edit': case 'publication': case 'continue': case 'review': $arr['html'] = $this->editDraft(); break; case 'newversion': case 'savenew': $arr['html'] = $this->newVersion(); break; case 'checkstatus': $arr['html'] = $this->checkStatus(); break; case 'select': $arr['html'] = $this->select(); break; case 'saveparam': $arr['html'] = $this->saveParam(); break; // Change publication state // Change publication state case 'publish': case 'republish': case 'archive': case 'revert': case 'post': $arr['html'] = $this->publishDraft(); break; case 'apply': case 'save': case 'rewind': case 'reorder': case 'deleteitem': case 'additem': case 'dispute': case 'skip': case 'undispute': case 'saveitem': $arr['html'] = $this->saveDraft(); break; // Individual items editing // Individual items editing case 'edititem': case 'editauthor': $arr['html'] = $this->editItem(); break; case 'suggest_license': case 'save_license': $arr['html'] = $this->_suggestLicense(); break; // Show all publication versions // Show all publication versions case 'versions': $arr['html'] = $this->versions(); break; // Unpublish/delete // Unpublish/delete case 'cancel': $arr['html'] = $this->cancelDraft(); break; // Contribute process outside of projects // Contribute process outside of projects case 'contribute': $arr['html'] = $this->contribute(); break; // Show stats // Show stats case 'stats': $arr['html'] = $this->_stats(); break; case 'diskspace': $arr['html'] = $this->pubDiskSpace($this->model); break; // Handlers // Handlers case 'handler': $arr['html'] = $this->handler(); break; } // Return data return $arr; }
* 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; $google = $this->connect->getConfigs('google'); $dropbox = $this->connect->getConfigs('dropbox'); // Some connection active $active = $google['active'] || $dropbox['active'] ? 1 : 0; $on = $google['on'] || $dropbox['on'] ? 1 : 0; // Project creator $creator = $this->model->access('owner') ? 1 : 0; $limited = $this->params->get('connectedProjects') ? \Components\Projects\Helpers\Html::getParamArray($this->params->get('connectedProjects')) : array(); $authorized = empty($limited) || !empty($limited) && in_array($this->model->get('alias'), $limited) ? true : false; $connected = $google && $this->oparams->get('google_token') || $dropbox && $this->oparams->get('dropbox_token') ? 1 : 0; if ($on && (($google || $dropbox) && $active || !$active && $creator && $authorized)) { ?> <p id="connector"> <span> <?php if (!$active || !$connected) { ?> <?php if ($google) { ?> <span class="google"></span> <?php }