/** * Perform the action. * * @param EcrProjectZiper $ziper * * @return \EcrProjectAction */ public function run(EcrProjectZiper $ziper) { $project = EcrProjectHelper::getProject(); $updateserver = new EcrProjectUpdateserver($project); $fileList = $ziper->getCreatedFiles(); if (0 == count($fileList)) { return $this->abort('ERROR: No files to transfer', $ziper); } $path = ECRPATH_UPDATESERVER . '/' . $project->comName . '/' . $this->releaseState; $urlPath = ECRPATH_UPDATESERVER_URL . '/' . $project->comName . '/' . $this->releaseState; $urls = array(); /* @ var EcrProjectZiperCreatedfile $f */ foreach ($fileList as $f) { $dest = $path . '/' . $f->name; if (false == JFile::copy($f->path, $dest)) { return $this->abort(sprintf('ERROR: Can not copy the file %s to %s', $f->path, $dest), $ziper); } $ziper->logger->log(sprintf('The file<br />%s<br />has been copied to<br />%s', $f->path, $dest)); $alternate = $f->alternateDownload; $urls[] = $alternate ?: $urlPath . '/' . $f->name; } $release = new EcrProjectUpdateserverRelease(); $release->state = $this->releaseState; $release->downloads = $urls; $release->description = 'Bescreibung...'; $updateserver->addRelease($release); return $this; }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @throws Exception * @return void */ public function display($tpl = null) { $input = JFactory::getApplication()->input; $task = $input->get('task'); $this->hideLangs = $input->get('hide_langs', array(), 'array'); $this->scope = $input->get('scope'); try { $this->project = EcrProjectHelper::getProject(); if ('ini' != $this->project->langFormat && !class_exists('g11nExtensionHelper')) { throw new Exception(sprintf('The g11n library must be available to process %s language files.', $this->project->langFormat)); } if ('ini' != $this->project->langFormat) { //-- Here goes g11n =;) echo $this->displayBarG11n($task); } else { if ('' == $this->scope) { $this->scope = 'site'; if ($this->project->type == 'plugin') { //-- @todo special treatment for plugins $this->scope = 'admin'; } } if (0 == count($this->project->langs)) { $this->easyLanguage = false; } else { $this->easyLanguage = new EcrLanguage($this->project, $this->scope, $this->hideLangs); if ($input->get('tmpl') != 'component') { //--draw selector echo $this->displayBar($task); } } } /** * Handle the 'task' value -> call a function * Softly exit on undefined */ if (in_array($task, get_class_methods($this))) { //--Execute the task $this->{$task}(); } else { if ($task) { echo 'UNDEFINED: ' . $task . '<br />'; EcrHtml::formEnd(); return; } } } catch (Exception $e) { EcrHtml::message($e); EcrHtml::formEnd(); return; } //try parent::display($tpl); EcrHtml::formEnd(); }
/** * Draws a project selector * * @return void */ public static function project() { $projects = EcrProjectHelper::getProjectList(); $projectTypes = EcrProjectHelper::getProjectTypes(); $ecr_project = JFactory::getApplication()->input->get('ecr_project'); $class = ''; if ($ecr_project == 'ecr_new_project') { $class = 'img3 icon16-add'; } else { if ($ecr_project == 'ecr_register_project') { $class = 'img3 icon16-import'; } else { if ($ecr_project) { try { $project = EcrProjectHelper::getProject(); $class = 'img3 icon12-' . $project->type; } catch (Exception $e) { $do = 'nothing'; unset($do); } } } } echo '<span class="' . $class . '">'; echo NL . '<select style="font-size: 1.2em;" name="ecr_project" id="ecr_project" onchange="switchProject();">'; echo NL . '<option value="">' . jgettext('Project') . '...</option>'; $selected = $ecr_project == 'ecr_new_project' ? ' selected="selected"' : ''; $class = ' class="img3 icon16-add"'; echo NL . '<option' . $class . ' value="ecr_new_project"' . $selected . '>' . jgettext('New Project') . '</option>'; $selected = $ecr_project == 'ecr_register_project' ? ' selected="selected"' : ''; $class = ' class="img3 icon16-import"'; echo NL . '<option' . $class . ' value="ecr_register_project"' . $selected . '>' . jgettext('Register Project') . '</option>'; /* @var EcrProjectBase $pType */ foreach ($projectTypes as $pTag => $pType) { if (isset($projects[$pTag]) && count($projects[$pTag])) { echo NL . '<optgroup label="' . $pType->translateTypePlural() . '">'; /* @var EcrProjectBase $project */ foreach ($projects[$pTag] as $project) { $displayName = $project->name; if ($project->scope) { $displayName .= ' (' . $project->scope . ')'; } $selected = $project->fileName == $ecr_project ? ' selected="selected"' : ''; $class = ' class="img12 icon12-' . $pTag . '"'; echo NL . '<option' . $class . ' value="' . $project->fileName . '" label="' . $project->name . '"' . $selected . '>' . $displayName . '</option>'; } echo NL . '</optgroup>'; } } echo NL . '</select></span>'; }
/** * Standard display method. * * @param null|string $tpl The name of the template file to parse; * * @throws Exception * @return mixed|void */ public function display($tpl = null) { $input = JFactory::getApplication()->input; ecrScript('stuffer'); $this->ecr_project = $input->get('ecr_project'); try { //-- Get the project $this->project = EcrProjectHelper::getProject(); if ('package' == $this->project->type && !$this->project->creationDate) { //-- This is a hack to detect that a package has no install manifest :( throw new Exception(jgettext('Invalid project')); } } catch (Exception $e) { EcrHtml::message($e); EcrHtml::formEnd(); return; } $task = $input->get('task', 'stuffer'); $tmpl = $input->get('tmpl'); //-- We are loosing the controller name when coming from other tasks - config :( $input->set('controller', 'stuffer'); if ($task != 'display_snip' && $task != 'aj_reflection' && $tmpl != 'component') { //-- Draw h1 header //EcrHtml::header(jgettext('Configure'), $this->project, 'ecr_settings'); //-- Draw the submenu if task is not for a raw view echo $this->displayBar($task); } if (in_array($task, get_class_methods($this))) { //-- Execute the task $this->{$task}(); if ($task == 'display_snip') { //-- Raw view parent::display($tpl); return; } } else { if ($task) { echo 'UNDEFINED..' . $task . '<br />'; } $this->stuffer(); } $this->task = $task; $this->tmpl = $tmpl; parent::display($tpl); EcrHtml::formEnd(); }
/** * Standard display method. * * @param null|string $tpl The name of the template file to parse; * * @return mixed|void */ public function display($tpl = null) { ecrLoadMedia('ziper'); $task = JFactory::getApplication()->input->get('task'); try { $this->project = EcrProjectHelper::getProject(); $this->preset = $this->project->presets['default']; } catch (Exception $e) { EcrHtml::message($e); EcrHtml::formEnd(); return; } if (in_array($task, get_class_methods($this))) { $this->{$task}(); } //-- Draw the submenu echo $this->displayBar(); parent::display($tpl); EcrHtml::formEnd(); }
/** * DoIt * * @throws Exception * @return void */ public function doExecute() { define('JPATH_BASE', THE_BUILD_PATH); define('JPATH_SITE', JPATH_BASE); define('JPATH_CACHE', JPATH_BASE . '/cache'); define('JPATH_ADMINISTRATOR', JPATH_BASE . '/administrator'); define('JPATH_COMPONENT', JPATH_ADMINISTRATOR . '/components/com_easycreator'); define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_COMPONENT); define('JPATH_INSTALLATION', ''); require JPATH_BASE . '/configuration.php'; require JPATH_BASE . '/libraries/cms/version/version.php'; $jversion = new JVersion(); define('JVERSION', $jversion->getShortVersion()); //-- Global constants require JPATH_COMPONENT . '/includes/defines.php'; //-- Global functions require JPATH_COMPONENT . '/includes/loader.php'; $buildOpts = array(); if ($this->input->get('v') || $this->input->get('verbose')) { $buildOpts[] = 'logging'; } if ($this->input->get('list')) { $this->printList(); return; } $projectName = $this->input->get('project'); if ('' == $projectName) { throw new Exception('Please specify a project with the option --project'); } $project = EcrProjectHelper::getProject($projectName); foreach ($project->buildOpts as $opt => $v) { //-- @todo this is ugly.. if ('1' == $v) { $buildOpts[] = $opt; } } $ziper = new EcrProjectZiper(); $preset = new EcrProjectModelBuildpreset(); $ziper->create($project, $preset, $buildOpts); $this->out('Finished =;)'); }
/** * Edit AutoCode. * * @return void */ public function edit() { $input = JFactory::getApplication()->input; try { //-- Get the project $project = EcrProjectHelper::getProject(); } catch (Exception $e) { EcrHtml::message($e); return; } //try $group = $input->get('group'); $part = $input->get('part'); $element = $input->get('element'); $scope = $input->get('scope'); $key = "{$scope}.{$group}.{$part}.{$element}"; $AutoCode = EcrProjectHelper::getAutoCode($key); if (!$AutoCode) { echo '<h4 style="color: red;">AutoCode not found</h4>'; echo $key; return; } if (!method_exists($AutoCode, 'edit')) { echo '<h4 style="color: red;">EDIT function not found</h4>'; echo $key; return; } if (!isset($project->autoCodes[$AutoCode->getKey()])) { echo '<h4 style="color: red;">AutoCode not found in project</h4>'; echo $AutoCode->getKey(); return; } echo '<div style="color: blue; font-weight: bold; text-align:center;">' . ucfirst($group) . ' - ' . ucfirst($part) . '</div>'; //-- Additional request vars echo '<input type="hidden" name="group" value="' . $group . '" />'; echo '<input type="hidden" name="part" value="' . $part . '" />'; echo $AutoCode->edit($project->autoCodes[$AutoCode->getKey()]); return; }
/** * Standard display method. * * @param string $tpl The name of the template file to parse; * * @throws Exception * @return mixed|void */ public function display($tpl = null) { $input = JFactory::getApplication()->input; //-- Add javascript ecrScript('codeeye', 'pollrequest', 'logconsole'); //-- Add css ecrStylesheet('codeeye'); $this->ecr_project = $input->get('ecr_project'); $this->task = $input->get('task'); //--Get the project try { $this->project = EcrProjectHelper::getProject(); if (0 == count($this->project->copies)) { throw new Exception(jgettext('No files found')); } } catch (Exception $e) { EcrHtml::message($e); EcrHtml::formEnd(); return; } if (in_array($this->task, get_class_methods($this))) { //--Execute the task $this->{$this->task}(); if ($this->task == 'display_snip') { //--Raw view parent::display($tpl); return; } } else { if ($this->task) { echo sprintf('UNDEFINED Task "%s" in %s', $this->task, __CLASS__) . '<br />'; } } //--Draw the submenu echo $this->displayBar(); parent::display($tpl); EcrHtml::formEnd(); }
/** * Standard display method. * * @param string $tpl The name of the template file to parse; * * @return void */ public function display($tpl = null) { $response = array(); //-- Get the project try { $project = EcrProjectHelper::getProject(); } catch (Exception $e) { $response['status'] = 0; $response['text'] = $e->getMessage(); EcrHtml::formEnd(); return; } //try $this->matrix = new EcrProjectMatrix($project, 'pcharts'); $response['status'] = 1; $files = array(); $size = array(); $lines = array(); foreach ($this->matrix->projectData as $type => $data) { $files[] = $data['files']; $size[] = $data['size']; if (isset($data['lines'])) { $lines[] = $data['lines']; } } //foreach $response['files'] = implode(',', $files); $response['size'] = implode(',', $size); $response['lines'] = implode(',', $lines); $response['labels'] = implode(',', array_keys($this->matrix->projectData)); ob_start(); parent::display(); $response['table'] = ob_get_contents(); ob_end_clean(); $response['text'] = 'Hi U'; echo json_encode($response); }
/** * Standard display method. * * @param null|string $tpl The name of the template file to parse; * * @return mixed|void */ public function display($tpl = null) { ecrStylesheet('deploy'); ecrScript('deploy', 'php2js', 'pollrequest'); $task = JFactory::getApplication()->input->get('task'); try { $this->project = EcrProjectHelper::getProject(); } catch (Exception $e) { EcrHtml::message($e); EcrHtml::formEnd(); return; } //-- Draw h1 header //EcrHtml::header(jgettext('Deploy'), $this->project, 'ecr_deploy'); if (in_array($task, get_class_methods($this))) { //-- Execute the task $this->{$task}(); $this->setLayout($task); } //-- Draw the submenu echo $this->displayBar(); parent::display($tpl); EcrHtml::formEnd(); }
public function runCli() { $project = EcrProjectHelper::getProject(); $path = JPath::clean($project->getExtensionPath() . '/' . $project->comName . '.php'); $args = JFactory::getApplication()->input->get('args', array(), 'array'); $response = new stdClass(); ob_start(); $console = new EcrPearHelperConsole(); $results = $console->cliExec('php ' . $path, $args); $response->text = ob_get_contents(); ob_end_clean(); $response->console = $results; echo json_encode($response); jexit(); }
/** * Deletes a translation. * * @throws Exception * @return void */ public function delete_translation() { $input = JFactory::getApplication()->input; ob_start(); try { if (!($scope = $input->get('scope'))) { throw new Exception(jgettext('No scope given')); } $project = EcrProjectHelper::getProject(); if (!count($project->langs)) { throw new Exception(jgettext('No languages found')); } $easyLanguage = new EcrLanguage($project, $scope, array()); $trans_lang = $input->get('trans_lang'); $trans_key = $input->getString('trans_key'); $easyLanguage->deleteTranslation($trans_lang, $trans_key); } catch (Exception $e) { $this->response['status'] = 1; $this->response['text'] .= $e->getMessage(); } //try $buffer = ob_get_clean(); if ($buffer) { $this->response['status'] = 1; $this->response['text'] .= $buffer; } echo json_encode($this->response); jexit(); }
/** * Process plugins in a package. * * @deprecated removed for J! 1.6 * * @throws Exception * @return EcrProjectManifest */ private function processPackagePlugins() { if (0 == count($this->project->plugins)) { return $this; } $pluginsElement = $this->manifest->addChild('plugins'); foreach ($this->project->plugins as $item) { //-- Get the project $project = EcrProjectHelper::getProject('plg_' . $item->scope . '_' . $item->name); $f = JPATH_ROOT . DS . EcrProjectHelper::findManifest($project); $plgElement = $pluginsElement->addChild('plugin'); $plgElement->addAttribute('plugin', $item->name); $plgElement->addAttribute('group', $item->scope); $plgElement->addAttribute('title', $item->title); if ($item->ordering) { $plgElement->addAttribute('order', $item->ordering); } $plgFilesElement = $plgElement->addChild('files'); $plgFilesElement->addAttribute('folder', 'plg_' . $item->scope . '_' . $item->name); foreach ($project->copies as $copy) { if (JFolder::exists($copy)) { $tName = str_replace('plugins' . DS . $item->scope . DS, '', $copy); $plgFolderElement = $plgFilesElement->addChild('folder', $tName); } else { if (JFile::exists($copy)) { $plgFileElement = $plgFilesElement->addChild('file', JFile::getName($copy)); } else { //-- @todo error $this->_addLog('Not found<br />SRC: ' . $copy, 'FILE NOT FOUND'); } } } if (count($project->langs)) { $plgLangsElement = $plgElement->addChild('languages'); $plgLangsElement->addAttribute('folder', 'plg_' . $item->scope . '_' . $item->name . '/language'); foreach ($project->langs as $tag => $scopes) { $plgFileElement = $plgLangsElement->addChild('language', $tag . '.' . $project->getLanguageFileName()); $plgFileElement->addAttribute('tag', $tag); } } $xml = EcrProjectHelper::getXML($f); if (false == $xml) { throw new Exception(sprintf(jgettext('Unable to load the xml file %s'), $f)); } $paramsElement = $plgElement->addChild('params'); if (isset($xml->params->param)) { foreach ($xml->params->param as $param) { $paramElement = $paramsElement->addChild('param'); foreach ($param->attributes() as $name => $value) { $paramElement->addAttribute($name, (string) $value); } if (isset($param->option)) { foreach ($param->option as $option) { $optionElement = $paramElement->addChild('option', (string) $option); foreach ($option->attributes() as $Name => $Value) { $optionElement->addAttribute($Name, (string) $Value); } } } } } } return $this; }
/** * DoIt * * @throws Exception * @return void */ public function doExecute() { require JPATH_BASE . '/helpers/loader.php'; require JPATH_BASE . '/includes/defines.php'; jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); var_dump(getcwd()); var_dump($this->input->args); // Known project types $types = EcrProjectHelper::getProjectTypes(); // Known project "Tags" - short forms $tags = EcrProjectHelper::getProjectTypesTags(); // Predefined actions $actions = $this->getActions(); var_dump($actions); var_dump($tags); // @todo What do you want to do today ? =;) return; $this->input->set('ecr_project', 'wap_fuuuschubidu'); $builder = new EcrProjectBuilder(); $type = 'webapp'; //getCmd('tpl_type'); $name = 'mvc_1'; //getCmd('tpl_name'); $comName = 'wap_gugugugu'; //getCmd('com_name'); if (in_array($type, array('cliapp', 'webapp'))) { define('JPATH_SITE', __DIR__); } $newProject = $builder->build($type, $name, $comName); if (!$newProject) { //-- Error $this->out('An error happened while creating your project'); // JFactory::getApplication()->enqueueMessage(jgettext('An error happened while creating your project'), 'error'); // $builder->printErrors(); $errors = $builder->getErrors(); var_dump($errors); //EcrHtml::formEnd(); return; } if ('test' == JFactory::getApplication()->input->get('ecr_test_mode')) { //-- Exiting in test mode echo '<h2>Exiting in test mode...</h2>'; echo $builder->printLog(); $builder->printErrors(); EcrHtml::formEnd(); return; } $ecr_project = JFile::stripExt($newProject->getEcrXmlFileName()); // $uri = 'index.php?option=com_easycreator&controller=stuffer&ecr_project='.$ecr_project; $this->out('Your project has been created'); echo ECRPATH_DATA; $project = EcrProjectHelper::getProject(); var_dump($project); }
/** * Copy the elements of a package. * * @throws EcrExceptionZiper * @return EcrProjectZiper */ private function copyPackageElements() { if ($this->project->type != 'package') { return $this; } if (0 == count($this->project->elements)) { return $this; } $this->logger->log('Copying Package elements'); foreach ($this->project->elements as $element => $path) { $this->ecr_project = JFactory::getApplication()->input->get('ecr_project'); //-- Get the project try { $project = EcrProjectHelper::getProject($element); } catch (Exception $e) { $this->logger->log('Unable to load the project ' . $element . ' - ' . $e->getMessage(), 'ERROR'); continue; } $ziper = new EcrProjectZiper(); $result = $ziper->create($project, $project->getPreset(), $this->buildopts); $files = $ziper->getCreatedFiles(); if (0 == count($files)) { $this->logger->log(sprintf('No packages files have been created for project %s', $element), 'ERROR', JLog::WARNING); continue; } $src = $files[0]->path; $fName = JFile::getName($src); //-- Set the elemnent path for manifest class $this->project->elements[$element] = $fName; $dest = $this->temp_dir . DS . $fName; if (JFile::copy($src, $dest)) { $this->logger->log(sprintf('Package %s copied from %s to %s', $element, $src, $dest)); } else { throw new EcrExceptionZiper(__METHOD__ . ' - ' . sprintf('Unable to create package %s try to copy from %s to %s', $element, $src, $dest)); } } return $this; }
/** * Prepare adding a part. * * Setup substitutes * * @param string $ecr_project Project name * @param array $substitutes Substitutes to add * * @return boolean */ public function prepareAddPart($ecr_project, $substitutes = array()) { try { $project = EcrProjectHelper::getProject($ecr_project); $this->addSubstitute('ECR_COM_NAME', $project->name); $this->addSubstitute('ECR_COM_COM_NAME', $project->comName); $this->addSubstitute('ECR_UPPER_COM_COM_NAME', strtoupper($project->comName)); $this->addSubstitute('ECR_AUTHORNAME', $project->author); $this->addSubstitute('ECR_AUTHORURL', $project->authorUrl); $this->addSubstitute('ECR_ACT_DATE', date('d-M-Y')); foreach ($substitutes as $key => $value) { $this->addSubstitute($key, $value); } $path = ECRPATH_EXTENSIONTEMPLATES . '/std/header/' . $project->headerType . '/header.txt'; //-- Read the header file $header = JFile::exists($path) ? JFile::read($path) : ''; //-- Replace vars in header $this->substitute($header); $this->addSubstitute('##*HEADER*##', $header); return true; } catch (Exception $e) { $this->logger->log('Unable to load the project ' . $ecr_project . ' - ' . $e->getMessage(), 'ERROR'); return false; } }
/** * @static * * @throws Exception * @return array */ public function syncFiles() { $project = EcrProjectHelper::getProject(); $syncList = array(); //-- Get the sync list foreach ($project->copies as $folder) { $path = str_replace(JPATH_ROOT, $this->credentials->directory, $folder); $syncList += $this->scan($path); } $this->writeSyncList($syncList); $fileList = $this->getSyncList(); return $fileList; }
/** * Creates a new file from request parameters. * * @return bool true on success * @throws Exception */ public static function createFileFromRequest() { $input = JFactory::getApplication()->input; $project = EcrProjectHelper::getProject(); if (!($scope = $input->get('lng_scope'))) { throw new Exception(jgettext('No scope given')); } if (!($lang = $input->get('lngcreate_lang'))) { throw new Exception(jgettext('No language given')); } $fileName = self::getFileName($lang, $scope, $project); $fileContents = ''; $fileContents .= '; @version $Id' . '$' . NL; //Splitted to avoid property being setted $fileContents .= '; ' . $project->comName . ' ' . $scope . ' language file' . NL; $fileContents .= '; @created on ' . date('d-M-Y') . NL; if (JFile::exists($fileName)) { throw new Exception(sprintf(jgettext('The file %s already exists'), $fileName)); } if (!JFile::write($fileName, $fileContents)) { throw new Exception(sprintf(jgettext('Unable to write the file %s'), $fileName)); } return true; }
/** * Create the files to sync list. * * @return array * @throws Exception */ public static function getSyncList() { $fileList = array(); $project = EcrProjectHelper::getProject(); $syncList = self::readSyncList(); if (false === $syncList) { throw new Exception(jgettext('No synchronization list found - Please synchronize with your remote')); } $allCopies = array(); foreach ($project->copies as $copy) { $files = JFolder::files($copy, '.', true, true); $allCopies = array_merge($files, $allCopies); foreach ($files as $file) { $fShort = str_replace(JPATH_ROOT . '/', '', $file); //-- File does not exist if (!array_key_exists($fShort, $syncList)) { $f = new stdClass(); $f->path = $fShort; $f->status = 'new'; $fileList[$fShort] = $f; } else { $f = $syncList[$fShort]; //-- File size is different if ($f->size != filesize($file)) { $f->status = 'changed'; $fileList[$fShort] = $f; } } } } foreach ($syncList as $item) { if (!in_array(JPATH_ROOT . '/' . $item->path, $allCopies)) { $f = new stdClass(); $f->path = $item->path; $f->status = 'deleted'; $fileList[$item->path] = $f; } } ksort($fileList); return $fileList; }
/** * Format a file name. * * @return void * @todo error handling */ public function updateProjectName() { try { $project = EcrProjectHelper::getProject(); $this->response->message = EcrProjectHelper::formatFileName($project, JFactory::getApplication()->input->getString('cst_format')); } catch (Exception $e) { $this->response->status = 1; $this->response->message = $e->getMessage(); $this->response->debug = $e->getTraceAsString(); } echo $this->response; jexit(); }
public function loadPreset() { try { $this->response->data = EcrProjectHelper::getProject()->getPreset(JFactory::getApplication()->input->get('preset'))->toJson(); } catch (Exception $e) { $this->response->message = $e->getMessage(); $this->response->debug = $e->getTraceAsString(); $this->response->status = 1; } echo $this->response; jexit(); }
public function g11nCreateTemplate() { $input = JFactory::getApplication()->input; try { $project = EcrProjectHelper::getProject(); $scope = $input->get('scope'); switch ($project->type) { case 'template': $comName = 'tpl_' . $project->comName; break; default: $comName = $project->comName; break; } $parts = explode('.', $scope); if (2 == count($parts)) { $scope = $parts[0]; $comName .= '.' . $parts[1]; } Ecrg11nHelper::createTemplate($comName, $scope, $project->version); } catch (Exception $e) { JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } $input->set('task', 'g11nUpdate'); parent::display(); }
public static function main() { $input = JFactory::getApplication()->input; /* // // * //--We start our form HERE ! this is for the whole app ! // * // // */ EcrHtml::formStart(); $task = $input->get('task', 'stuffer'); $ecr_project = $input->get('ecr_project'); $project = false; if ($ecr_project) { try { $project = EcrProjectHelper::getProject(); } catch (Exception $e) { echo ''; //-- To satisfy the sniffer - aka: do nothing. } } //--Menu highlighting... set css class _active $actives = array(); $tasks = array(); $rightTasks = array(); if ($project instanceof EcrProjectBase && $project->isValid) { //-- Left bar $tasks['stuffer'] = new stdClass(); $tasks['stuffer']->title = jgettext('Project'); $tasks['stuffer']->image = 'ecr_settings'; $tasks['stuffer']->tasks = array('stuffer', 'stufferstuff', 'projectinfo', 'files', 'save_config', 'projectparams', 'projectdelete', 'tables', 'install'); if ('package' != $project->type) { $tasks['languages'] = new stdClass(); $tasks['languages']->title = jgettext('Languages'); $tasks['languages']->image = 'ecr_languages'; $tasks['languages']->tasks = array('languages', 'translations', 'searchfiles', 'langcorrectdeforder', 'langcorrectorder', 'show_version', 'show_versions', 'language_check', 'create_langfile', 'convert', 'g11nUpdate'); $tasks['codeeye'] = new stdClass(); $tasks['codeeye']->title = jgettext('CodeEye'); $tasks['codeeye']->image = 'xeyes'; $tasks['codeeye']->tasks = array('codeeye', 'phpcs', 'phpcpd', 'phpunit', 'selenium', 'phpdoc', 'phploc', 'stats', 'stats2', 'reflection', 'runcli', 'runwap'); } $tasks['ziper'] = new stdClass(); $tasks['ziper']->title = jgettext('Package'); $tasks['ziper']->image = 'ecr_package'; $tasks['ziper']->tasks = array('ziper', 'delete', 'archive'); $tasks['deploy'] = new stdClass(); $tasks['deploy']->title = jgettext('Deploy'); $tasks['deploy']->image = 'ecr_deploy'; $tasks['deploy']->tasks = array('deploy', 'package'); foreach ($tasks as $k => $v) { $actives[$k] = in_array($task, $v->tasks) ? ' active' : ''; } } //-- Right bar $rightTasks['config'] = new stdClass(); $rightTasks['config']->title = jgettext('Configuration'); $rightTasks['config']->image = 'ecr_config'; $rightTasks['config']->tasks = array('config'); $rightTasks['templates'] = new stdClass(); $rightTasks['templates']->title = jgettext('Templates'); $rightTasks['templates']->image = 'wizard'; $rightTasks['templates']->tasks = array('templates', 'tplinstall', 'export'); $rightTasks['logfiles'] = new stdClass(); $rightTasks['logfiles']->title = jgettext('Logfiles'); $rightTasks['logfiles']->image = 'text'; $rightTasks['logfiles']->tasks = array('logfiles'); $rightTasks['help'] = new stdClass(); $rightTasks['help']->title = jgettext('Help'); $rightTasks['help']->image = 'ecr_help'; $rightTasks['help']->tasks = array('help', 'quicky', 'credits'); $rightTasks['sandbox'] = new stdClass(); $rightTasks['sandbox']->title = jgettext('Sandbox'); $rightTasks['sandbox']->image = 'sandbox'; $rightTasks['sandbox']->tasks = array(); $rightTasks['sandbox']->href = JURI::root() . 'index.php?option=com_easycreator'; $rightTasks['sandbox']->class = ' external'; $rightTasks['sandbox']->js = ''; $rightTasks['sandbox']->rel = ' target="_blank"'; $rTasks = array(); foreach ($rightTasks as $k => $v) { $actives[$k] = in_array($task, $v->tasks) ? ' active' : ''; $rTasks = array_merge($rTasks, $v->tasks); } $helpActive = 'jhelp' == $task ? ' active' : ''; ?> <div class="white_box"> <div style="float: right;"> <a class="btn<?php echo ECR_TBAR_SIZE . $helpActive; ?> " href="javascript:;" onclick="document.id('file_name').value=''; easySubmit('jhelp', 'help');"> <?php echo ECR_TBAR_ICONS ? '<div class="img32d icon32-JHelp_btn"></div>' : ''; ?> <?php echo jgettext('J! API'); ?> </a> </div> <?php echo ECR_DEBUG ? '<div class="debug_ON">Debug</div>' : ''; ?> <div style="float: left; margin-top: -7px;"><img src="<?php echo JURI::Root(); ?> media/com_easycreator/admin/images/ico/icon-64-easycreator.png" alt="EasyCreator Logo"/> </div> <div style="float: left; padding-left: 0.5em;"> <span class="ecrTopTitle" style="font-size: 1.4em; font-weight: bold;">EasyCreator</span> <br/> <?php EcrHtmlSelect::project(); ?> <br/> <span id="ecr_stat_project"></span> </div> <div style="float: left; width: 0.5em;"> </div> <div style="float: left;"><?php if ($ecr_project && $ecr_project != 'ecr_new_project' && $ecr_project != 'ecr_register_project') { ?> <div class="btn-group"> <?php foreach ($tasks as $k => $v) { echo '<a class="btn' . ECR_TBAR_SIZE . $actives[$k] . '" href="javascript:;"' . 'onclick="$(\'file_name\').value=\'\'; easySubmit(\'' . $k . '\', \'' . $k . '\');">'; echo ECR_TBAR_ICONS ? '<div class="img32d icon32-' . $v->image . '" title="' . $v->title . '"></div>' : ''; echo $v->title . NL; echo '</a>'; } ?> </div> <?php } ?> </div> <div style="float: left; width: 0.5em;"> </div> <?php if (false == in_array($task, $rTasks)) { ?> <a class="hasTip btn<?php echo ECR_TBAR_SIZE; ?> " href="javascript:;" title="<?php echo jgettext('More...') . '::' . jgettext('Click for more options'); ?> " onclick="this.setStyle('display', 'none'); ecr_options_box.toggle();"> <?php echo ECR_TBAR_ICONS ? '<i class="img icon16-add"></i>' : ''; ?> <?php echo jgettext('More...'); ?> </a> <?php } $stdJS = ''; $stdJS .= "\$('adminForm').value='';"; $stdJS .= "\$('file_name').value='';"; ?> <div id="ecr_options_box" class="btn-group" style="margin-left: 1em;"> <?php foreach ($rightTasks as $k => $v) { $controller = isset($v->controller) ? $v->controller : $k; $cJS = " easySubmit('" . $k . "', '" . $controller . "');"; $class = isset($v->class) ? $v->class : ''; $href = isset($v->href) ? $v->href : 'javascript:;'; $rel = isset($v->rel) ? $v->rel : ''; $js = isset($v->js) ? $v->js : 'onclick="' . $stdJS . $cJS . '"'; echo '<a class="btn ' . $class . ECR_TBAR_SIZE . $actives[$k] . '" href="' . $href . '" ' . $js . $rel . ' >' . NL; if (ECR_TBAR_ICONS) { echo '<div class="img32d icon32-' . $v->image . '" title="' . $v->title . '"></div>' . NL; } echo $v->title . NL; echo '</a>' . NL; ?> <?php } ?> </div> <?php if (false == in_array($task, $rTasks)) { ?> <script type="text/javascript"> var ecr_options_box = new Fx.Slide('ecr_options_box'); ecr_options_box.hide(); </script> <?php } ?> <div style="clear: both"></div> </div> <?php }