Exemplo n.º 1
0
 /**
  * Get insert options.
  *
  * @return void
  */
 public function getOptions()
 {
     $db = JFactory::getDBO();
     $tables = $db->getTableList();
     $ajaxLink = 'index.php?option=com_easycreator&tmpl=component&controller=ajax&task=part_task';
     $ajaxLink .= '&group=tables&part=admin_map';
     $ajaxLink .= '&part_task=show_tablefields';
     $ajax = "new Request({ url: '" . $ajaxLink . "'+'&table_name='+this.value, update:'addPartTableFields', onComplete: function() '\n        .'{ div_new_element.show(); } }).send();";
     echo '<strong id="table_name_label">' . jgettext('Table') . ' :</strong>';
     echo '<select name="table_name" id="table_name" onchange="' . $ajax . '">';
     echo '<option value="">' . jgettext('Choose') . '...</option>';
     $prefix = $db->getPrefix();
     foreach ($tables as $table) {
         $v = str_replace($prefix, '', $table);
         echo '<option value="' . $v . '">' . $v . '</option>';
     }
     //foreach
     echo '</select>';
     echo '<div id="addPartTableFields"></div>';
     EcrHtmlSelect::name();
     echo '<strong>' . jgettext('Menu link') . ' :</strong><br />';
     echo '<input type="checkbox" name="create_menu_link" checked="checked"' . ' id="create_menu_link" value="create_menu_link">';
     echo '<label for="create_menu_link">' . jgettext('Create a menu link') . '</label><br />';
     echo '<hr />';
     EcrHtmlOptions::logging();
     $requireds = array('element_name', 'table_name');
     EcrHtmlButton::submitParts($requireds);
 }
Exemplo n.º 2
0
 /**
  * Get insert options.
  *
  * @return void
  */
 public function getOptions()
 {
     EcrHtmlSelect::scope();
     EcrHtmlSelect::name();
     EcrHtmlOptions::logging();
     $requireds = array('element_name', 'element_scope');
     EcrHtmlButton::submitParts($requireds);
 }
Exemplo n.º 3
0
 /**
  * Get insert options.
  *
  * @return void|boolean false on error
  */
 public function getOptions()
 {
     $ecr_project = JFactory::getApplication()->input->get('ecr_project');
     $basePathDest = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . $ecr_project;
     if (JFile::exists($basePathDest . DS . 'CHANGELOG.php')) {
         EcrHtml::message(jgettext('This project already has a changelog'), 'error');
         return false;
     }
     EcrHtmlOptions::logging();
     EcrHtmlButton::submitParts();
 }
Exemplo n.º 4
0
 /**
  * Get insert options.
  *
  * @return void|boolean false on error
  */
 public function getOptions()
 {
     // $project = EcrProjectHelper::getProject();
     $ecr_project = JFactory::getApplication()->input->get('ecr_project');
     $basePathDest = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . $ecr_project;
     if (JFile::exists($basePathDest . DS . 'install' . DS . 'script.php')) {
         EcrHtml::message(jgettext('This project already has an install file - consider removing it'), 'error');
         return false;
     }
     EcrHtmlOptions::logging();
     EcrHtmlButton::submitParts();
     return $this;
 }
Exemplo n.º 5
0
 /**
  * Display the check results.
  *
  * @param JObject $file A file object
  *
  * @return void
  */
 public static function displayResults(stdClass $file)
 {
     //--Check if file exists
     if ($file->exists) {
         echo '<span class="img icon16-check_ok hasTip" title="' . jgettext('Found') . '"/>';
     } else {
         echo '<span class="img icon16-check_fail hasTip" title="' . jgettext('Not found') . '" />';
         EcrHtmlButton::createLanguageFile($file->lang, $file->scope);
         return;
     }
     //--Check if file is UTF-8 encoded
     if ($file->isUFT8) {
         if ($file->isUFT8 == 'NOT CHECKED') {
             echo '<span class="img icon16-yellowled hasTip" title="' . jgettext('Not checked for UTF-8') . '" />';
         } else {
             echo '<span class="img icon16-check_ok hasTip" title="' . jgettext('UTF-8') . '" />';
         }
     } else {
         EcrHtml::message(array(jgettext('File is not UTF-8 encoded'), $file->name), 'error');
     }
     //--Detect BOM
     if ($file->hasBOM) {
         if ($file->hasBOM == 'NOT CHECKED') {
             echo '<span class="img icon16-yellowled hasTip" title="' . jgettext('Not checked for BOM') . '" />';
         } else {
             EcrHtmlButton::removeBOM($file->fileName);
         }
     } else {
         echo '<span class="img icon16-check_ok hasTip" title="' . jgettext('No BOM') . '" />';
     }
 }
Exemplo n.º 6
0
 * @package       EasyCreator
 * @subpackage    Help
 * @author        Nikolai Plath (elkuku)
 * @author        Created on 15-Jul-2009
 * @license       GNU/GPL, see JROOT/LICENSE.php
 */
//-- No direct access
defined('_JEXEC') || die('=;)');
$input = JFactory::getApplication()->input;
$pathHelp = JPATH_COMPONENT . DS . 'helpers' . DS . 'jclasslists';
$fName = 'jclasslist_' . str_replace('.', '_', JVERSION);
//-- Add javascript
ecrScript('jhelp', 'php2js');
if (false == JFile::exists($pathHelp . DS . $fName . '.php')) {
    //-- Class list not found
    EcrHtmlButton::createClassList();
    echo '<div id="jsonDebug"></div>';
    return;
}
JLoader::import($fName, $pathHelp);
JHTML::_('behavior.tooltip');
$out_format = $input->get('out_format', 'source');
if ($out_format == '') {
    $out_format = 'source';
}
$className = $input->get('className');
$methodName = $input->get('methodName');
$packageName = $input->get('packageName');
$formats = array(array('Source', 'source', 'source', 'local'), array('api.joomla.org', 'api.joomla.org/Joomla-Platform/[package]/[class].html#[method]', 'api', 'remote'), array('docs.joomla.org', 'docs.joomla.org/[class]/[method]', 'docs', 'remote'), array('wiki.joomla-nafu.de', 'wiki.joomla-nafu.de/joomla-dokumentation/Joomla!_Programmierung/Framework/[class]/[method]', 'nafu', 'remote'), array('Google', 'google.com/search?q=joomla!+framework+[class]+[method]', 'googlecom', 'remote'));
$local_api_copy = JComponentHelper::getParams('com_easycreator')->get('local_api_copy');
if ($local_api_copy) {
Exemplo n.º 7
0
 /**
  * Open the part for edit.
  *
  * @param EcrProjectAutocode $AutoCode TheAutocode
  *
  * @return void
  */
 public function edit(EcrProjectAutocode $AutoCode)
 {
     $var_scope = $AutoCode->options['varscope'];
     /* Array with required fields */
     $requireds = array();
     $requireds[] = EcrHtmlSelect::scope($this->scope);
     echo '<input type="hidden" name="element" value="' . $this->element . '" />';
     /* Draws an input box for a name field */
     $requireds[] = EcrHtmlSelect::name($this->element, jgettext('Table'));
     echo '<strong>Var Scope:</strong><br />';
     foreach ($this->varScopes as $vScope) {
         $checked = $vScope == $var_scope ? ' checked="checked"' : '';
         echo '<input type="radio" name="var_scope" value="' . $vScope . '"' . ' id="vscope-' . $vScope . '"' . $checked . '> <label for="vscope-' . $vScope . '">' . $vScope . '</label><br />';
     }
     //foreach
     $tableFields = EcrTableHelper::getTableColumns($this->element);
     $acFields = $AutoCode->fields[$AutoCode->getKey() . '.var'];
     echo '<table>';
     echo '<tr>';
     echo '<th>' . jgettext('Field') . '</th>';
     echo '<th>' . jgettext('Label') . '</th>';
     echo '</tr>';
     foreach ($tableFields as $name => $tableField) {
         if (array_key_exists($name, $acFields)) {
             //-- Autocode present
             $value = $acFields[$name]->label;
         } else {
             //-- New field
             $value = $tableField[$name]->field;
         }
         echo '<tr>';
         echo '<th>';
         echo '<input type="hidden" name="field[' . $name . '][name]" value="' . $name . '" />';
         echo $name;
         echo '</th>';
         echo '<td>';
         echo '<input type="text" name="field[' . $name . '][label]" value="' . $value . '" />';
         echo '</td>';
         echo '</tr>';
     }
     //foreach
     echo '</table>';
     /* Draws the submit button */
     EcrHtmlButton::autoCode($requireds);
 }
Exemplo n.º 8
0
 /**
  * Edit the AutoCode.
  *
  * @param object $AutoCode The AutoCode
  *
  * @return boolean
  */
 public function edit($AutoCode)
 {
     $input = JFactory::getApplication()->input;
     EcrHtmlSelect::scope($this->_scope);
     echo '<input type="hidden" name="element" value="' . $this->_element . '" />';
     /* Draws an input box for a name field */
     EcrHtmlSelect::name($this->_element, jgettext('Table'));
     $ecr_project = $input->get('ecr_project');
     $element_name = $input->get('element');
     $table_name = $input->get('table_name');
     //$req_table_fields = JxRequest::getVar('table_fields', array());
     //$req_table_fields_edits = JxRequest::getVar('table_fields_edits', array());
     //$req_table_fields_types = JxRequest::getVar('table_fields_types', array());
     if (!$table_name) {
         $table_name = $element_name;
     }
     if (!$table_name) {
         echo 'No table given';
         return false;
     }
     $basePath = $this->_scope == 'admin' ? JPATH_ADMINISTRATOR : JPATH_SITE;
     $basePath .= DS . 'components' . DS . $ecr_project . DS . 'views' . DS . $table_name;
     if (!JFolder::exists($basePath)) {
         JFactory::getApplication()->enqueueMessage(jgettext('View not found'), 'error');
         return false;
     }
     $key = '##ECR_OPTIONS##';
     $this->show_tablefields($table_name, $AutoCode->fields[$key]);
     EcrHtmlButton::submitParts();
 }
Exemplo n.º 9
0
 /**
  * Open the AutoCode for edit.
  *
  * @param EcrProjectAutocode $AutoCode The AutoCode
  *
  * @return void
  */
 public function edit(EcrProjectAutocode $AutoCode)
 {
     JFactory::getApplication()->enqueueMessage(__METHOD__ . ' not finished', 'warning');
     /* Array with required fields */
     $requireds = array();
     $requireds[] = EcrHtmlSelect::scope($this->scope);
     echo '<input type="hidden" name="element" value="' . $this->element . '" />';
     /* Draws an input box for a name field */
     $requireds[] = EcrHtmlSelect::name($this->element, jgettext('Table'));
     $tableFields = EcrTableHelper::getTableColumns($this->element);
     $elements = array('header', 'cell');
     echo '<br />';
     /*
      * Header
      */
     $key = $AutoCode->getKey() . '.header';
     if (array_key_exists($key, $AutoCode->fields)) {
         $acFields = $AutoCode->fields[$key];
     } else {
         $acFields = array();
     }
     echo '<div style="background-color: #f3fbe6;">Header</div>';
     echo '<table>';
     echo '<tr>';
     echo '<th>' . jgettext('Field') . '</th>';
     echo '<th>' . jgettext('Label') . '</th>';
     echo '<th>' . jgettext('Display') . '</th>';
     echo '<th>' . jgettext('Width') . '</th>';
     echo '</tr>';
     foreach ($tableFields as $name => $tableField) {
         if (array_key_exists($name, $acFields)) {
             //-- Autocode present
             $label = $acFields[$name]->label;
             $display = $acFields[$name]->display;
             $width = $acFields[$name]->width;
         } else {
             //-- New field
             $label = $tableField->Field;
             $display = 'on';
             $width = 0;
         }
         echo '<tr>';
         echo '<th>';
         echo $name;
         echo '</th>';
         echo '<td>';
         echo '<input type="text" name="field[header][' . $name . '][label]" value="' . $label . '" />';
         echo '</td>';
         echo '<td>';
         echo '<select name="field[header][' . $name . '][display]">';
         $selected = $display == 'on' ? ' selected="selected"' : '';
         echo '<option value="on"' . $selected . '>' . jgettext('On') . '</option>';
         $selected = $display == 'off' ? ' selected="selected"' : '';
         echo '<option value="off"' . $selected . '>' . jgettext('Off') . '</option>';
         echo '</select>';
         echo '</td>';
         echo '<td>';
         echo '<input type="text" name="field[header][' . $name . '][width]" value="' . $width . '" />';
         echo '</td>';
         echo '</tr>';
     }
     //foreach
     echo '</table>';
     /*
      * Cell
      */
     $key = $AutoCode->getKey() . '.cell';
     if (array_key_exists($key, $AutoCode->fields)) {
         $acFields = $AutoCode->fields[$key];
     } else {
         $acFields = array();
     }
     echo '<div style="background-color: #f3fbe6;">Cell</div>';
     echo '<table>';
     echo '<tr>';
     echo '<th>' . jgettext('Field') . '</th>';
     //            echo '<th>'.jgettext('Label').'</th>';
     echo '</tr>';
     foreach ($tableFields as $name => $tableField) {
         if (array_key_exists($name, $acFields)) {
             //-- Autocode present
             $value = $acFields[$name]->label;
         } else {
             //-- New field
             $value = $tableField->Field;
         }
         echo '<tr>';
         echo '<th>';
         echo $name;
         echo '<input type="hidden" name="field[cell][' . $name . '][name]" value="' . $name . '" />';
         echo '</th>';
         echo '</tr>';
     }
     //foreach
     echo '</table>';
     /* Draws the submit button */
     EcrHtmlButton::autoCode($requireds);
 }
Exemplo n.º 10
0
 /**
  * Open the AutoCode for edit.
  *
  * @param EcrProjectAutocode $AutoCode The AutoCode
  *
  * @return void
  */
 public function edit(EcrProjectAutocode $AutoCode)
 {
     /* Array with required fields */
     $requireds = array();
     $requireds[] = EcrHtmlSelect::scope($this->scope);
     echo '<input type="hidden" name="element" value="' . $this->element . '" />';
     /* Draws an input box for a name field */
     $requireds[] = EcrHtmlSelect::name($this->element, jgettext('Table'));
     $tableFields = EcrTableHelper::getTableColumns($this->element);
     echo '<br />';
     $key = $AutoCode->getKey() . '.row';
     if (array_key_exists($key, $AutoCode->fields)) {
         $acFields = $AutoCode->fields[$key];
     } else {
         $acFields = array();
     }
     echo '<div style="background-color: #f3fbe6;">Header</div>';
     echo '<table>';
     echo '<tr>';
     echo '<th>' . jgettext('Field') . '</th>';
     echo '<th>' . jgettext('Label') . '</th>';
     echo '<th>' . jgettext('Input type') . '</th>';
     echo '</tr>';
     foreach ($tableFields as $name => $tableField) {
         if (array_key_exists($name, $acFields)) {
             //-- Autocode present
             $label = $acFields[$name]->label;
             $inputType = $acFields[$name]->inputType;
             $width = $acFields[$name]->width;
         } else {
             //-- New field
             $label = $tableField->Field;
             $inputType = 'text';
             $width = 0;
         }
         echo '<tr>';
         echo '<th>';
         echo $name;
         echo '</th>';
         echo '<td>';
         echo '<input type="text" name="field[' . $name . '][label]" value="' . $label . '" />';
         echo '</td>';
         echo '<td>';
         echo '<select name="field[' . $name . '][input_type]">';
         $selected = $inputType == 'text' ? ' selected="selected"' : '';
         echo '<option value="text"' . $selected . '>&lt;text&gt;</option>';
         $selected = $inputType == 'hidden' ? ' selected="selected"' : '';
         echo '<option value="hidden"' . $selected . '>&lt;hidden&gt;</option>';
         $selected = $inputType == 'category' ? ' selected="selected"' : '';
         echo '<option value="category"' . $selected . '>Catergory select</option>';
         echo '</select>';
         echo '</td>';
         echo '</tr>';
     }
     //foreach
     echo '</table>';
     /* Draws the submit button */
     EcrHtmlButton::autoCode($requireds);
 }
Exemplo n.º 11
0
 /**
  * Edit the AutoCode.
  *
  * @param object $AutoCode The AutoCode
  *
  * @return boolean
  */
 public function edit($AutoCode)
 {
     /* Array with required fields */
     $requireds = array();
     $requireds[] = EcrHtmlSelect::scope($this->_scope);
     echo '<input type="hidden" name="element" value="' . $this->_element . '" />';
     /* Draws an input box for a name field */
     $requireds[] = EcrHtmlSelect::name($this->_element, jgettext('Table'));
     //        JLoader::import('helpers.autocode', JPATH_COMPONENT);
     //        $AutoCode = new EcrProjectAutocode;
     $ecr_project = $input->get('ecr_project');
     $element_name = $input->get('element');
     $table_name = $input->get('table_name');
     if (!$table_name) {
         $table_name = $element_name;
     }
     //$req_table_fields = JxRequest::getVar('table_fields', array());
     //$req_table_fields_edits = JxRequest::getVar('table_fields_edits', array());
     //$req_table_fields_types = JxRequest::getVar('table_fields_types', array());
     if (!$table_name) {
         JFactory::getApplication()->enqueueMessage(jgettext('No table given'), 'error');
         return false;
     }
     if (!($scope = $input->get('scope'))) {
         JFactory::getApplication()->enqueueMessage(jgettext('No scope given'), 'error');
         return false;
     }
     $basePath = $scope == 'admin' ? JPATH_ADMINISTRATOR : JPATH_SITE;
     $basePath .= DS . 'components' . DS . $ecr_project . DS . 'views' . DS . $table_name . 's';
     if (!JFolder::exists($basePath)) {
         JFactory::getApplication()->enqueueMessage(jgettext('View not found'), 'error');
         return false;
     }
     $fileList = JFolder::files($basePath, '.', true, true);
     $fields = array();
     if (count($fileList)) {
         foreach ($fileList as $fileName) {
             $file = new stdClass();
             $file->path = str_replace(JPATH_ROOT . DS, '', $fileName);
             $file->autoCodes = $AutoCode->getContents(JFile::read($fileName));
             foreach ($file->autoCodes as $key => $content) {
                 $fields[$key] = $AutoCode->getFields($this->patterns[$key], $content, array($this->keys[$key]));
             }
             //foreach
         }
         //foreach
     }
     $selecteds = isset($fields['##ECR_VIEW1_TMPL1_THS##']) ? $fields['##ECR_VIEW1_TMPL1_THS##'] : array(array());
     $key = key($this->keys);
     if (isset($AutoCode->fields[$key]) && count($AutoCode->fields[$key])) {
         $selecteds = $AutoCode->fields[$key];
     }
     $this->show_tablefields($table_name, $selecteds);
     EcrHtmlButton::submitParts();
 }
Exemplo n.º 12
0
 /**
  * Open the part for edit.
  *
  * @param object $AutoCode The AutoCode
  *
  * @return void
  */
 public function edit($AutoCode)
 {
     $var_scope = $AutoCode->options['varScope'];
     /* Array with required fields */
     $requireds = array();
     $requireds[] = EcrHtmlSelect::scope($this->_scope);
     echo '<input type="hidden" name="element" value="' . $this->_element . '" />';
     /* Draws an input box for a name field */
     $requireds[] = EcrHtmlSelect::name($this->_element, jgettext('Table'));
     echo '<strong>Var Scope:</strong><br />';
     foreach ($this->_varScopes as $vScope) {
         $checked = $vScope == $var_scope ? ' checked="checked"' : '';
         echo '<input type="radio" name="var_scope" value="' . $vScope . '" id="vscope-' . $vScope . '"' . $checked . '> <label for="vscope-' . $vScope . '">' . $vScope . '</label><br />';
     }
     //foreach
     /* Draws the submit button */
     EcrHtmlButton::submitParts($requireds);
 }