From 38e498448913b013dac69e3d736a94649e17e3bb Mon Sep 17 00:00:00 2001 From: Jon Brown Date: Sat, 17 Oct 2020 15:20:44 +0100 Subject: [PATCH] closes #39 , closes #51 --- admin/access.xml | 8 +- admin/config.xml | 22 ++-- admin/controller.php | 10 +- .../{helloworld.php => project.php} | 12 +- .../{helloworlds.php => projects.php} | 8 +- admin/helpers/associations.php | 26 ++-- .../html/{helloworlds.php => projects.php} | 16 +-- .../{helloworld.php => qwhelloworld.php} | 42 +++---- admin/language/en-GB/en-GB.com_helloworld.ini | 118 ------------------ .../en-GB/en-GB.com_helloworld.sys.ini | 28 ----- .../language/en-GB/en-GB.com_qwhelloworld.ini | 117 +++++++++++++++++ .../en-GB/en-GB.com_qwhelloworld.sys.ini | 28 +++++ admin/layouts/position.php | 10 +- .../modal/{helloworld.php => project.php} | 34 ++--- .../fields/{helloworld.php => project.php} | 42 +++---- ...oworldordering.php => projectordering.php} | 18 +-- ...helloworldparent.php => projectparent.php} | 12 +- ...er_helloworlds.xml => filter_projects.xml} | 42 +++---- .../forms/{helloworld.js => project.js} | 2 +- .../forms/{helloworld.xml => project.xml} | 70 +++++------ admin/models/{helloworld.php => project.php} | 67 +++++----- .../models/{helloworlds.php => projects.php} | 18 +-- .../models/rules/{greeting.php => title.php} | 4 +- admin/{helloworld.php => qwhelloworld.php} | 12 +- admin/sql/install.mysql.utf8.sql | 44 +++---- admin/sql/uninstall.mysql.utf8.sql | 12 +- admin/sql/updates/mysql/0.0.12.sql | 2 +- admin/sql/updates/mysql/0.0.13.sql | 2 +- admin/sql/updates/mysql/0.0.14.sql | 2 +- admin/sql/updates/mysql/0.0.16.sql | 4 +- admin/sql/updates/mysql/0.0.17.sql | 2 +- admin/sql/updates/mysql/0.0.18.sql | 4 +- admin/sql/updates/mysql/0.0.20.sql | 8 +- admin/sql/updates/mysql/0.0.21.sql | 6 +- admin/sql/updates/mysql/0.0.24.sql | 4 +- admin/sql/updates/mysql/0.0.25.sql | 4 +- admin/sql/updates/mysql/0.0.26.sql | 14 +-- admin/sql/updates/mysql/0.0.27.sql | 10 +- admin/sql/updates/mysql/0.0.28.sql | 12 +- admin/sql/updates/mysql/0.0.29.sql | 8 +- admin/sql/updates/mysql/0.0.6.sql | 6 +- admin/tables/{helloworld.php => project.php} | 34 ++--- .../views/{helloworld => project}/index.html | 0 .../{helloworld => project}/submitbutton.js | 2 +- .../{helloworld => project}/tmpl/edit.php | 32 ++--- .../{helloworld => project}/tmpl/index.html | 0 .../{helloworld => project}/view.html.php | 42 +++---- .../{helloworlds => projects}/index.html | 0 .../tmpl/default.php | 50 ++++---- .../tmpl/default_batch_body.php | 2 +- .../tmpl/default_batch_footer.php | 2 +- .../{helloworlds => projects}/tmpl/index.html | 0 .../{helloworlds => projects}/tmpl/modal.php | 34 ++--- .../{helloworlds => projects}/view.html.php | 27 ++-- ...orlds-modal.js => admin-projects-modal.js} | 8 +- media/js/openstreetmap.js | 26 ++-- helloworld.xml => qwhelloworld.xml | 26 ++-- script.php | 14 +-- site/controller.php | 4 +- .../{helloworld.php => project.php} | 36 +++--- site/helpers/association.php | 18 +-- site/helpers/category.php | 8 +- site/helpers/route.php | 18 +-- site/language/en-GB/en-GB.com_helloworld.ini | 57 --------- .../language/en-GB/en-GB.com_qwhelloworld.ini | 57 +++++++++ site/models/category.php | 18 +-- site/models/form.php | 20 +-- site/models/forms/add-form.xml | 56 ++++----- site/models/forms/filter_category.xml | 18 +-- site/models/{helloworld.php => project.php} | 34 ++--- site/{helloworld.php => qwhelloworld.php} | 6 +- site/router.php | 18 +-- site/views/category/tmpl/default.php | 16 +-- site/views/category/tmpl/default.xml | 8 +- site/views/category/view.feed.php | 14 +-- site/views/category/view.html.php | 4 +- site/views/form/tmpl/edit.php | 12 +- site/views/form/tmpl/edit.xml | 4 +- site/views/form/view.html.php | 20 +-- site/views/helloworld/tmpl/default.xml | 20 --- site/views/{helloworld => project}/index.html | 0 .../{helloworld => project}/tmpl/default.php | 22 ++-- site/views/project/tmpl/default.xml | 20 +++ .../{helloworld => project}/tmpl/index.html | 0 .../{helloworld => project}/view.html.php | 22 ++-- .../{helloworld => project}/view.json.php | 8 +- 86 files changed, 876 insertions(+), 871 deletions(-) rename admin/controllers/{helloworld.php => project.php} (80%) rename admin/controllers/{helloworlds.php => projects.php} (75%) rename admin/helpers/html/{helloworlds.php => projects.php} (72%) rename admin/helpers/{helloworld.php => qwhelloworld.php} (63%) delete mode 100644 admin/language/en-GB/en-GB.com_helloworld.ini delete mode 100644 admin/language/en-GB/en-GB.com_helloworld.sys.ini create mode 100644 admin/language/en-GB/en-GB.com_qwhelloworld.ini create mode 100644 admin/language/en-GB/en-GB.com_qwhelloworld.sys.ini rename admin/models/fields/modal/{helloworld.php => project.php} (72%) rename admin/models/fields/{helloworld.php => project.php} (82%) rename admin/models/fields/{helloworldordering.php => projectordering.php} (68%) rename admin/models/fields/{helloworldparent.php => projectparent.php} (78%) rename admin/models/forms/{filter_helloworlds.xml => filter_projects.xml} (53%) rename admin/models/forms/{helloworld.js => project.js} (72%) rename admin/models/forms/{helloworld.xml => project.xml} (62%) rename admin/models/{helloworld.php => project.php} (81%) rename admin/models/{helloworlds.php => projects.php} (92%) rename admin/models/rules/{greeting.php => title.php} (87%) rename admin/{helloworld.php => qwhelloworld.php} (62%) rename admin/tables/{helloworld.php => project.php} (81%) rename admin/views/{helloworld => project}/index.html (100%) rename admin/views/{helloworld => project}/submitbutton.js (88%) rename admin/views/{helloworld => project}/tmpl/edit.php (76%) rename admin/views/{helloworld => project}/tmpl/index.html (100%) rename admin/views/{helloworld => project}/view.html.php (66%) rename admin/views/{helloworlds => projects}/index.html (100%) rename admin/views/{helloworlds => projects}/tmpl/default.php (84%) rename admin/views/{helloworlds => projects}/tmpl/default_batch_body.php (95%) rename admin/views/{helloworlds => projects}/tmpl/default_batch_footer.php (94%) rename admin/views/{helloworlds => projects}/tmpl/index.html (100%) rename admin/views/{helloworlds => projects}/tmpl/modal.php (81%) rename admin/views/{helloworlds => projects}/view.html.php (82%) rename media/js/{admin-helloworlds-modal.js => admin-projects-modal.js} (62%) rename helloworld.xml => qwhelloworld.xml (77%) rename site/controllers/{helloworld.php => project.php} (86%) delete mode 100644 site/language/en-GB/en-GB.com_helloworld.ini create mode 100644 site/language/en-GB/en-GB.com_qwhelloworld.ini rename site/models/{helloworld.php => project.php} (85%) rename site/{helloworld.php => qwhelloworld.php} (75%) delete mode 100644 site/views/helloworld/tmpl/default.xml rename site/views/{helloworld => project}/index.html (100%) rename site/views/{helloworld => project}/tmpl/default.php (72%) create mode 100644 site/views/project/tmpl/default.xml rename site/views/{helloworld => project}/tmpl/index.html (100%) rename site/views/{helloworld => project}/view.html.php (77%) rename site/views/{helloworld => project}/view.json.php (74%) diff --git a/admin/access.xml b/admin/access.xml index 32f9a00..ac4e1f6 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -1,5 +1,5 @@ - +
@@ -17,9 +17,9 @@
-
- - +
+ +
diff --git a/admin/config.xml b/admin/config.xml index 09f6543..c58a296 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -1,15 +1,15 @@
@@ -19,8 +19,8 @@ name="captcha" type="plugins" folder="captcha" - label="COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_LABEL" - description="COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_DESC" + label="COM_QWHELLOWORLD_PROJECT_FIELD_CAPTCHA_LABEL" + description="COM_QWHELLOWORLD_PROJECT_FIELD_CAPTCHA_DESC" default="0" filter="cmd" > @@ -30,8 +30,8 @@ @@ -60,7 +60,7 @@
diff --git a/admin/controller.php b/admin/controller.php index 247d430..4d8b33c 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -1,7 +1,7 @@ authorise( "core.edit", "com_helloworld.helloworld." . $id ); + return Factory::getUser()->authorise( "core.edit", "com_qwhelloworld.project." . $id ); } } public function batch($model = null) { - $model = $this->getModel('helloworld'); + $model = $this->getModel('project'); $this->setRedirect((string)Uri::getInstance()); return parent::batch($model); } diff --git a/admin/controllers/helloworlds.php b/admin/controllers/projects.php similarity index 75% rename from admin/controllers/helloworlds.php rename to admin/controllers/projects.php index a8840b3..a119471 100644 --- a/admin/controllers/helloworlds.php +++ b/admin/controllers/projects.php @@ -1,7 +1,7 @@ true)) + public function getModel($name = 'Project', $prefix = 'QwhelloworldModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); diff --git a/admin/helpers/associations.php b/admin/helpers/associations.php index a6281d6..0c29ad1 100644 --- a/admin/helpers/associations.php +++ b/admin/helpers/associations.php @@ -1,6 +1,6 @@ extension . '.item'; $catidField = 'catid'; - if ($typeName === 'helloworld') + if ($typeName === 'project') { - $context = 'com_helloworld.item'; + $context = 'com_qwhelloworld.item'; $catidField = 'catid'; } elseif ($typeName === 'category') @@ -90,8 +90,8 @@ public function getItem($typeName, $id) switch ($typeName) { - case 'helloworld': - $table = Table::getInstance('Helloworld', 'HelloworldTable'); + case 'project': + $table = Table::getInstance('Project', 'QwhelloworldTable'); break; case 'category': @@ -128,8 +128,8 @@ public function getType($typeName = '') { switch ($typeName) { - case 'helloworld': - $fields['title'] = 'a.greeting'; + case 'project': + $fields['title'] = 'a.title'; $fields['ordering'] = ''; $fields['access'] = ''; $fields['state'] = 'a.published'; @@ -142,10 +142,10 @@ public function getType($typeName = '') $support['category'] = true; $tables = array( - 'a' => '#__helloworld' + 'a' => '#__com_qwhelloworld' ); - $title = 'helloworld'; + $title = 'project'; break; case 'category': diff --git a/admin/helpers/html/helloworlds.php b/admin/helpers/html/projects.php similarity index 72% rename from admin/helpers/html/helloworlds.php rename to admin/helpers/html/projects.php index 6556e5d..4c97aff 100644 --- a/admin/helpers/html/helloworlds.php +++ b/admin/helpers/html/projects.php @@ -1,6 +1,6 @@ $associated) { @@ -44,7 +44,7 @@ public static function association($id) ->select('h.*') ->select('l.sef as lang_sef') ->select('l.lang_code') - ->from('#__helloworld as h') + ->from('#__com_qwhelloworld as h') ->select('cat.title as category_title') ->join('LEFT', '#__categories as cat ON cat.id=h.catid') ->where('h.id IN (' . implode(',', array_values($associations)) . ')') @@ -67,9 +67,9 @@ public static function association($id) foreach ($items as &$item) { $text = $item->lang_sef ? strtoupper($item->lang_sef) : 'XX'; - $url = Route::_('index.php?option=com_helloworld&task=helloworld.edit&id=' . (int) $item->id); + $url = Route::_('index.php?option=com_qwhelloworld&task=project.edit&id=' . (int) $item->id); - $tooltip = htmlspecialchars($item->greeting, ENT_QUOTES, 'UTF-8') . '
' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); + $tooltip = htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '
' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); $classes = 'hasPopover label label-association label-' . $item->lang_sef; $item->link = ''; + Text::_('COM_QWHELLOWORLD_BATCH_SETPOSITION_LABEL') . ''; $html[] = ''; $html[] = ''; + Text::_('COM_QWHELLOWORLD_PROJECT_FIELD_LATITUDE_LABEL') . ''; $html[] = ''; $html[] = ''; + Text::_('COM_QWHELLOWORLD_PROJECT_FIELD_LONGITUDE_LABEL') . ''; $html[] = ''; $html[] = ''; diff --git a/admin/models/fields/modal/helloworld.php b/admin/models/fields/modal/project.php similarity index 72% rename from admin/models/fields/modal/helloworld.php rename to admin/models/fields/modal/project.php index a6e2a4a..1a2e5d3 100644 --- a/admin/models/fields/modal/helloworld.php +++ b/admin/models/fields/modal/project.php @@ -9,10 +9,10 @@ use Joomla\CMS\Session\Session; /** - * Supports a modal for selecting a helloworld record + * Supports a modal for selecting a project record * */ -class FormFieldModal_Helloworld extends FormField +class JFormFieldModal_Project extends FormField { /** * Method to get the html for the input field. @@ -22,14 +22,14 @@ class FormFieldModal_Helloworld extends FormField protected function getInput() { // Load language - Factory::getLanguage()->load('com_helloworld', JPATH_ADMINISTRATOR); + Factory::getLanguage()->load('com_qwhelloworld', JPATH_ADMINISTRATOR); // $this->value is set if there's a default id specified in the xml file $value = (int) $this->value > 0 ? (int) $this->value : ''; // $this->id will be jform_request_xxx where xxx is the name of the field in the xml file // or jform_associations_xx_yy where xx_yy is the language code (hyphen replaced by underscore) for associations - $modalId = 'Helloworld_' . $this->id; + $modalId = 'Project_' . $this->id; // Add the modal field script to the document head. HTMLHelper::_('jquery.framework'); @@ -37,18 +37,18 @@ protected function getInput() // our callback function from the modal to the main window: Factory::getDocument()->addScriptDeclaration(" - function jSelectHelloworld_" . $this->id . "(id, title, catid, object, url, language) { - window.processModalSelect('Helloworld', '" . $this->id . "', id, title, catid, object, url, language); + function jSelectProject_" . $this->id . "(id, title, catid, object, url, language) { + window.processModalSelect('Project', '" . $this->id . "', id, title, catid, object, url, language); } "); - // if a default id is set, then get the corresponding greeting to display it + // if a default id is set, then get the corresponding project to display it if ($value) { $db = Factory::getDbo(); $query = $db->getQuery(true) - ->select($db->quoteName('greeting')) - ->from($db->quoteName('#__helloworld')) + ->select($db->quoteName('title')) + ->from($db->quoteName('#__com_qwhelloworld')) ->where($db->quoteName('id') . ' = ' . (int) $value); $db->setQuery($query); @@ -62,8 +62,8 @@ function jSelectHelloworld_" . $this->id . "(id, title, catid, object, url, lang } } - // display the default greeting or "Select" if no default specified - $title = empty($title) ? Text::_('COM_HELLOWORLD_MENUITEM_SELECT_HELLOWORLD') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + // display the default project or "Select" if no default specified + $title = empty($title) ? Text::_('COM_QWHELLOWORLD_MENUITEM_SELECT_PROJECT') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); $html = ''; $html .= ''; @@ -74,7 +74,7 @@ function jSelectHelloworld_" . $this->id . "(id, title, catid, object, url, lang . ' data-toggle="modal"' . ' role="button"' . ' href="#ModalSelect' . $modalId . '"' - . ' title="' . HTMLHelper::tooltipText('COM_HELLOWORLD_MENUITEM_SELECT_BUTTON_TOOLTIP') . '">' + . ' title="' . HTMLHelper::tooltipText('COM_QWHELLOWORLD_MENUITEM_SELECT_BUTTON_TOOLTIP') . '">' . ' ' . Text::_('JSELECT') . ''; @@ -90,11 +90,11 @@ function jSelectHelloworld_" . $this->id . "(id, title, catid, object, url, lang $html .= ''; // url for the iframe - $linkHelloworlds = 'index.php?option=com_helloworld&view=helloworlds&layout=modal&tmpl=component&' . Session::getFormToken() . '=1'; - $urlSelect = $linkHelloworlds . '&function=jSelectHelloworld_' . $this->id; + $linkProjects = 'index.php?option=com_qwhelloworld&view=projects&layout=modal&tmpl=component&' . Session::getFormToken() . '=1'; + $urlSelect = $linkProjects . '&function=jSelectProject_' . $this->id; // title to go in the modal header - $modalTitle = Text::_('COM_HELLOWORLD_MENUITEM_SELECT_MODAL_TITLE'); + $modalTitle = Text::_('COM_QWHELLOWORLD_MENUITEM_SELECT_MODAL_TITLE'); // if the form definition has a 'language' field then it's for the association // add the forcedLanguage parameter to the URL, and add the language to the modal title @@ -122,10 +122,10 @@ function jSelectHelloworld_" . $this->id . "(id, title, catid, object, url, lang // class='required' for client side validation. $class = $this->required ? ' class="required modal-value"' : ''; - // hidden input field to store the helloworld record id + // hidden input field to store the project record id $html .= ''; return $html; diff --git a/admin/models/fields/helloworld.php b/admin/models/fields/project.php similarity index 82% rename from admin/models/fields/helloworld.php rename to admin/models/fields/project.php index 870d1c4..0f0356e 100644 --- a/admin/models/fields/helloworld.php +++ b/admin/models/fields/project.php @@ -1,7 +1,7 @@ id != null) { - $associations = Associations::getAssociations('com_helloworld', '#__helloworld', 'com_helloworld.item', (int)$item->id); + $associations = Associations::getAssociations('com_qwhelloworld', '#__com_qwhelloworld', 'com_qwhelloworld.item', (int)$item->id); foreach ($associations as $tag => $association) { @@ -70,7 +70,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getTable($type = 'HelloWorld', $prefix = 'HelloWorldTable', $config = array()) + public function getTable($type = 'Project', $prefix = 'QwhelloworldTable', $config = array()) { return Table::getInstance($type, $prefix, $config); } @@ -89,8 +89,8 @@ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm( - 'com_helloworld.helloworld', - 'helloworld', + 'com_qwhelloworld.project', + 'project', array( 'control' => 'jform', 'load_data' => $loadData @@ -110,7 +110,7 @@ public function getForm($data = array(), $loadData = true) * * @return none */ - protected function preprocessForm(JForm $form, $data, $group = 'helloworld') + protected function preprocessForm(JForm $form, $data, $group = 'project') { // Association content items if (Associations::isEnabled()) @@ -129,7 +129,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'helloworld') { $field = $fieldset->addChild('field'); $field->addAttribute('name', $language->lang_code); - $field->addAttribute('type', 'modal_helloworld'); + $field->addAttribute('type', 'modal_project'); $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); @@ -148,7 +148,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'helloworld') */ public function getScript() { - return 'administrator/components/com_helloworld/models/forms/helloworld.js'; + return 'administrator/components/com_qwhelloworld/models/forms/project.js'; } /** @@ -162,7 +162,7 @@ protected function loadFormData() { // Check the session for previously entered form data. $data = Factory::getApplication()->getUserState( - 'com_helloworld.edit.helloworld.data', + 'com_qwhelloworld.edit.project.data', array() ); @@ -176,7 +176,7 @@ protected function loadFormData() /** * Method to override the AdminModel save() function to handle Save as Copy correctly * - * @param The helloworld record data submitted from the form. + * @param The project record data submitted from the form. * * @return parent::save() return value */ @@ -190,19 +190,19 @@ public function save($data) // validateCategoryId() returns 0 if the catid can't be found if ((int) $data['catid'] > 0) { - $data['catid'] = CategoriesHelper::validateCategoryId($data['catid'], 'com_helloworld'); + $data['catid'] = CategoriesHelper::validateCategoryId($data['catid'], 'com_qwhelloworld'); } - // Alter the greeting and alias for save as copy + // Alter the title and alias for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); - if ($data['greeting'] == $origTable->greeting) + if ($data['title'] == $origTable->title) { - list($greeting, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['greeting']); - $data['greeting'] = $greeting; + list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); + $data['title'] = $title; $data['alias'] = $alias; } else @@ -230,18 +230,18 @@ protected function canDelete($record) { if( !empty( $record->id ) ) { - return Factory::getUser()->authorise( "core.delete", "com_helloworld.helloworld." . $record->id ); + return Factory::getUser()->authorise( "core.delete", "com_qwhelloworld.project." . $record->id ); } } /** - * Prepare a helloworld record for saving in the database + * Prepare a project record for saving in the database */ protected function prepareTable($table) { } /** - * Save the record reordering after a record is dragged to a new position in the helloworlds view + * Save the record reordering after a record is dragged to a new position in the projects view */ public function saveorder($idArray = null, $lft_array = null) { diff --git a/admin/models/fields/helloworldordering.php b/admin/models/fields/projectordering.php similarity index 68% rename from admin/models/fields/helloworldordering.php rename to admin/models/fields/projectordering.php index 412ffc7..69010c0 100644 --- a/admin/models/fields/helloworldordering.php +++ b/admin/models/fields/projectordering.php @@ -1,6 +1,6 @@ getQuery(true) - ->select('a.id AS value, a.greeting AS text') - ->from('#__helloworld AS a') + ->select('a.id AS value, a.title AS text') + ->from('#__com_qwhelloworld AS a') ->where('a.parent_id =' . (int) $parent_id); $query->order('a.lft ASC'); @@ -53,9 +53,9 @@ protected function getOptions() } $options = array_merge( - array(array('value' => '-1', 'text' => Text::_('COM_HELLOWORLD_ITEM_FIELD_ORDERING_VALUE_FIRST'))), + array(array('value' => '-1', 'text' => Text::_('COM_QWHELLOWORLD_ITEM_FIELD_ORDERING_VALUE_FIRST'))), $options, - array(array('value' => '-2', 'text' => Text::_('COM_HELLOWORLD_ITEM_FIELD_ORDERING_VALUE_LAST'))) + array(array('value' => '-2', 'text' => Text::_('COM_QWHELLOWORLD_ITEM_FIELD_ORDERING_VALUE_LAST'))) ); // Merge any additional options in the XML definition. @@ -75,7 +75,7 @@ protected function getInput() { if ($this->form->getValue('id', 0) == 0) { - return '' . Text::_('COM_HELLOWORLD_ITEM_FIELD_ORDERING_TEXT') . ''; + return '' . Text::_('COM_QWHELLOWORLD_ITEM_FIELD_ORDERING_TEXT') . ''; } else { diff --git a/admin/models/fields/helloworldparent.php b/admin/models/fields/projectparent.php similarity index 78% rename from admin/models/fields/helloworldparent.php rename to admin/models/fields/projectparent.php index 931d4bc..1689d44 100644 --- a/admin/models/fields/helloworldparent.php +++ b/admin/models/fields/projectparent.php @@ -1,6 +1,6 @@ getQuery(true) - ->select('DISTINCT(a.id) AS value, a.greeting AS text, a.level, a.lft') - ->from('#__helloworld AS a'); + ->select('DISTINCT(a.id) AS value, a.title AS text, a.level, a.lft') + ->from('#__com_qwhelloworld AS a'); // Prevent parenting to children of this record, or to itself // If this record has lft = x and rgt = y, then its children have lft > x and rgt < y if ($id = $this->form->getValue('id')) { - $query->join('LEFT', $db->quoteName('#__helloworld') . ' AS h ON h.id = ' . (int) $id) + $query->join('LEFT', $db->quoteName('#__com_qwhelloworld') . ' AS h ON h.id = ' . (int) $id) ->where('NOT(a.lft >= h.lft AND a.rgt <= h.rgt)'); } diff --git a/admin/models/forms/filter_helloworlds.xml b/admin/models/forms/filter_projects.xml similarity index 53% rename from admin/models/forms/filter_helloworlds.xml rename to admin/models/forms/filter_projects.xml index 217dc78..4285fe6 100644 --- a/admin/models/forms/filter_helloworlds.xml +++ b/admin/models/forms/filter_projects.xml @@ -31,7 +31,7 @@ name="category_id" type="category" label="JOPTION_FILTER_CATEGORY" - extension="com_helloworld" + extension="com_qwhelloworld" onchange="this.form.submit();" published="0,1,2" > @@ -42,30 +42,30 @@ - - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/admin/models/forms/helloworld.js b/admin/models/forms/project.js similarity index 72% rename from admin/models/forms/helloworld.js rename to admin/models/forms/project.js index e8e168b..751b2d0 100644 --- a/admin/models/forms/helloworld.js +++ b/admin/models/forms/project.js @@ -1,5 +1,5 @@ jQuery(function() { - document.formvalidator.setHandler('greeting', + document.formvalidator.setHandler('title', function (value) { regex=/^[^\*]+$/; return regex.test(value); diff --git a/admin/models/forms/helloworld.xml b/admin/models/forms/project.xml similarity index 62% rename from admin/models/forms/helloworld.xml rename to admin/models/forms/project.xml index 9b64df0..e4f7197 100644 --- a/admin/models/forms/helloworld.xml +++ b/admin/models/forms/project.xml @@ -1,23 +1,23 @@
@@ -32,11 +32,11 @@ @@ -44,8 +44,8 @@ @@ -102,15 +102,15 @@
+ label="COM_QWHELLOWORLD_PROJECT_FIELD_IMAGE_LABEL" + description="COM_QWHELLOWORLD_PROJECT_FIELD_IMAGE_DESC" />
@@ -163,8 +163,8 @@ @@ -175,7 +175,7 @@
\ No newline at end of file diff --git a/admin/models/helloworld.php b/admin/models/project.php similarity index 81% rename from admin/models/helloworld.php rename to admin/models/project.php index 7b8bf8c..b3ab761 100644 --- a/admin/models/helloworld.php +++ b/admin/models/project.php @@ -1,7 +1,7 @@ 'batchPosition', ); /** * Method overriding batch in AdminModel so that we can include the additional batch processes - * which the helloworld component supports. + * which the Qwhelloworld component supports. */ public function batch($commands, $pks, $contexts) { - $this->batch_commands = array_merge($this->batch_commands, $this->helloworld_batch_commands); + $this->batch_commands = array_merge($this->batch_commands, $this->project_batch_commands); return parent::batch($commands, $pks, $contexts); } @@ -110,15 +110,20 @@ protected function batchPosition($value, $pks, $contexts) } /** - * Method to override generateTitle() because the helloworld component uses 'greeting' as the title field + * Method to override generateTitle() because the Qwhelloworld component uses 'greeting' as the title field + * + * Reverted to using title field + * + * @depreceated + * */ - public function generateTitle($categoryId, $table) + /*public function generateTitle($categoryId, $table) { // Alter the title & alias $data = $this->generateNewTitle($categoryId, $table->alias, $table->greeting); $table->greeting = $data['0']; $table->alias = $data['1']; - } + }*/ /** * Method to override getItem to allow us to convert the JSON-encoded image information @@ -137,7 +142,7 @@ public function getItem($pk = null) if (!empty($item->id)) { $tagsHelper = new TagsHelper; - $item->tags = $tagsHelper->getTagIds($item->id, 'com_helloworld.helloworld'); + $item->tags = $tagsHelper->getTagIds($item->id, 'com_qwhelloworld.project'); } // Load associated items @@ -147,7 +152,7 @@ public function getItem($pk = null) if ($item->id != null) { - $associations = Associations::getAssociations('com_helloworld', '#__helloworld', 'com_helloworld.item', (int)$item->id); + $associations = Associations::getAssociations('com_qwhelloworld', '#__com_qwhelloworld', 'com_qwhelloworld.item', (int)$item->id); foreach ($associations as $tag => $association) { @@ -169,7 +174,7 @@ public function getItem($pk = null) * * @since 1.6 */ - public function getTable($type = 'HelloWorld', $prefix = 'HelloWorldTable', $config = array()) + public function getTable($type = 'Project', $prefix = 'QwhelloworldTable', $config = array()) { return Table::getInstance($type, $prefix, $config); } @@ -188,8 +193,8 @@ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm( - 'com_helloworld.helloworld', - 'helloworld', + 'com_qwhelloworld.project', + 'project', array( 'control' => 'jform', 'load_data' => $loadData @@ -209,7 +214,7 @@ public function getForm($data = array(), $loadData = true) * * @return none */ - protected function preprocessForm(JForm $form, $data, $group = 'helloworld') + protected function preprocessForm(JForm $form, $data, $group = 'project') { // Association content items if (Associations::isEnabled()) @@ -228,7 +233,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'helloworld') { $field = $fieldset->addChild('field'); $field->addAttribute('name', $language->lang_code); - $field->addAttribute('type', 'modal_helloworld'); + $field->addAttribute('type', 'modal_project'); $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); @@ -247,7 +252,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'helloworld') */ public function getScript() { - return 'administrator/components/com_helloworld/models/forms/helloworld.js'; + return 'administrator/components/com_qwhelloworld/models/forms/project.js'; } /** @@ -261,7 +266,7 @@ protected function loadFormData() { // Check the session for previously entered form data. $data = Factory::getApplication()->getUserState( - 'com_helloworld.edit.helloworld.data', + 'com_qwhelloworld.edit.project.data', array() ); @@ -275,7 +280,7 @@ protected function loadFormData() /** * Method to override the AdminModel save() function to handle Save as Copy correctly * - * @param The helloworld record data submitted from the form. + * @param The project record data submitted from the form. * * @return parent::save() return value */ @@ -289,19 +294,19 @@ public function save($data) // validateCategoryId() returns 0 if the catid can't be found if ((int) $data['catid'] > 0) { - $data['catid'] = CategoriesHelper::validateCategoryId($data['catid'], 'com_helloworld'); + $data['catid'] = CategoriesHelper::validateCategoryId($data['catid'], 'com_qwhelloworld'); } - // Alter the greeting and alias for save as copy + // Alter the title and alias for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); - if ($data['greeting'] == $origTable->greeting) + if ($data['title'] == $origTable->title) { - list($greeting, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['greeting']); - $data['greeting'] = $greeting; + list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); + $data['title'] = $title; $data['alias'] = $alias; } else @@ -329,18 +334,18 @@ protected function canDelete($record) { if( !empty( $record->id ) ) { - return Factory::getUser()->authorise( "core.delete", "com_helloworld.helloworld." . $record->id ); + return Factory::getUser()->authorise( "core.delete", "com_qwhelloworld.project." . $record->id ); } } /** - * Prepare a helloworld record for saving in the database + * Prepare a project record for saving in the database */ protected function prepareTable($table) { } /** - * Save the record reordering after a record is dragged to a new position in the helloworlds view + * Save the record reordering after a record is dragged to a new position in the projects view */ public function saveorder($idArray = null, $lft_array = null) { @@ -359,6 +364,6 @@ public function saveorder($idArray = null, $lft_array = null) protected function cleanCache($group = null, $client_id = 0) { - parent::cleanCache('com_helloworld'); + parent::cleanCache('com_qwhelloworld'); } } \ No newline at end of file diff --git a/admin/models/helloworlds.php b/admin/models/projects.php similarity index 92% rename from admin/models/helloworlds.php rename to admin/models/projects.php index 8c9d6b4..33974ff 100644 --- a/admin/models/helloworlds.php +++ b/admin/models/projects.php @@ -1,7 +1,7 @@ select('a.id as id, a.greeting as greeting, a.published as published, a.created as created, a.access as access, + $query->select('a.id as id, a.title as title, a.published as published, a.created as created, a.access as access, a.checked_out as checked_out, a.checked_out_time as checked_out_time, a.catid as catid, a.lft as lft, a.rgt as rgt, a.parent_id as parent_id, a.level as level, a.path as path, a.image as imageInfo, a.latitude as latitude, a.longitude as longitude, a.alias as alias, a.language as language') - ->from($db->quoteName('#__helloworld', 'a')); + ->from($db->quoteName('#__com_qwhelloworld', 'a')); // Join over the categories. $query->select($db->quoteName('c.title', 'category_title')) @@ -116,7 +116,7 @@ protected function getListQuery() if (Associations::isEnabled()) { $query->select('COUNT(asso2.id)>1 as association') - ->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_helloworld.item')) + ->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_qwhelloworld.item')) ->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key') ->group('a.id'); } @@ -131,7 +131,7 @@ protected function getListQuery() if (!empty($search)) { $like = $db->quote('%' . $search . '%'); - $query->where('greeting LIKE ' . $like); + $query->where('title LIKE ' . $like); } // Filter by published state @@ -168,7 +168,7 @@ protected function getListQuery() $query->where('c.access IN (' . $userAccessLevels . ')'); } - // exclude root helloworld record + // exclude root project record $query->where('a.id > 1'); // Add the list ordering clause. diff --git a/admin/models/rules/greeting.php b/admin/models/rules/title.php similarity index 87% rename from admin/models/rules/greeting.php rename to admin/models/rules/title.php index e3c8244..a76ce41 100644 --- a/admin/models/rules/greeting.php +++ b/admin/models/rules/title.php @@ -1,7 +1,7 @@ addStyleDeclaration('.icon-helloworld {background-image: url(../media/com_helloworld/images/tux-16x16.png);}'); +$document->addStyleDeclaration('.icon-qwhelloworld {background-image: url(../media/com_qwhelloworld/images/tux-16x16.png);}'); // Access check: is this user allowed to access the backend of this component? -if (!Factory::getUser()->authorise('core.manage', 'com_helloworld')) +if (!Factory::getUser()->authorise('core.manage', 'com_qwhelloworld')) { throw new Exception(Text::_('JERROR_ALERTNOAUTHOR')); } // Require helper file -JLoader::register('HelloWorldHelper', JPATH_COMPONENT . '/helpers/helloworld.php'); +JLoader::register('QwhelloworldHelper', JPATH_COMPONENT . '/helpers/qwhelloworld.php'); -// Get an instance of the controller prefixed by HelloWorld -$controller = BaseController::getInstance('HelloWorld'); +// Get an instance of the controller prefixed by Qwhelloworld +$controller = BaseController::getInstance('Qwhelloworld'); // Perform the Request task $controller->execute(Factory::getApplication()->input->get('task')); diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index f33bd36..e5bf69b 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -1,25 +1,25 @@ -DROP TABLE IF EXISTS `#__helloworld`; +DROP TABLE IF EXISTS `#__com_qwhelloworld`; -CREATE TABLE `#__helloworld` ( +CREATE TABLE `#__com_qwhelloworld` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) NOT NULL DEFAULT '0', + `title` VARCHAR(255) NOT NULL, + `alias` VARCHAR(400) NOT NULL DEFAULT '', + `catid` int(11) NOT NULL DEFAULT '0', `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `created_by` INT(10) UNSIGNED NOT NULL DEFAULT '0', `checked_out` INT(10) NOT NULL DEFAULT '0', `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `greeting` VARCHAR(25) NOT NULL, - `description` VARCHAR(4000) NOT NULL DEFAULT '', - `alias` VARCHAR(40) NOT NULL DEFAULT '', + `published` tinyint(4) NOT NULL DEFAULT '1', + `access` tinyint(4) NOT NULL DEFAULT '0', `language` CHAR(7) NOT NULL DEFAULT '*', `parent_id` int(10) NOT NULL DEFAULT '1', `level` int(10) NOT NULL DEFAULT '0', `path` VARCHAR(400) NOT NULL DEFAULT '', `lft` int(11) NOT NULL DEFAULT '0', - `rgt` int(11) NOT NULL DEFAULT '0', - `published` tinyint(4) NOT NULL DEFAULT '1', - `access` tinyint(4) NOT NULL DEFAULT '0', - `catid` int(11) NOT NULL DEFAULT '0', + `rgt` int(11) NOT NULL DEFAULT '0', `params` VARCHAR(1024) NOT NULL DEFAULT '', + `description` VARCHAR(4000) NOT NULL DEFAULT '', `image` VARCHAR(1024) NOT NULL DEFAULT '', `latitude` DECIMAL(9,7) NOT NULL DEFAULT 0.0, `longitude` DECIMAL(10,7) NOT NULL DEFAULT 0.0, @@ -29,29 +29,29 @@ CREATE TABLE `#__helloworld` ( AUTO_INCREMENT =0 DEFAULT CHARSET =utf8; -CREATE UNIQUE INDEX `aliasindex` ON `#__helloworld` (`alias`, `catid`); +CREATE UNIQUE INDEX `aliasindex` ON `#__com_qwhelloworld` (`alias`, `catid`); -INSERT INTO `#__helloworld` (`greeting`,`alias`,`language`, `parent_id`, `level`, `path`, `lft`, `rgt`, `published`) VALUES -('helloworld root','helloworld-root-alias','en-GB', 0, 0, '', 0, 5, 1), -('Hello World!','hello-world','en-GB', 1, 1, 'hello-world', 1, 2, 0), -('Goodbye World!','goodbye-world','en-GB', 1, 1, 'goodbye-world', 3, 4, 0); +INSERT INTO `#__com_qwhelloworld` (`title`,`alias`, `published`, `language`, `parent_id`, `level`, `path`, `lft`, `rgt`) VALUES +('QWHelloWorld root','qwhelloworld-root-alias', 1, '*', 0, 0, '', 0, 5), +('Hello World!','hello-world', 0, 'en-GB', 1, 1, 'hello-world', 1, 2), +('Goodbye World!','goodbye-world', 0, 'en-GB', 1, 1, 'goodbye-world', 3, 4); INSERT INTO `#__content_types` (`type_title`, `type_alias`, `content_history_options`, `table`, `field_mappings`, `router`) VALUES -('Helloworld', 'com_helloworld.helloworld', -'{"formFile":"administrator\\/components\\/com_helloworld\\/models\\/forms\\/helloworld.xml", +('QWHelloWorld Project', 'com_qwhelloworld.project', +'{"formFile":"administrator\\/components\\/com_qwhelloworld\\/models\\/forms\\/project.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path"], "ignoreChanges":["checked_out", "checked_out_time", "path"], "convertToInt":[], "displayLookup":[ {"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"}, -{"sourceColumn":"parent_id","targetTable":"#__helloworld","targetColumn":"id","displayColumn":"greeting"}, +{"sourceColumn":"parent_id","targetTable":"#__com_qwhelloworld","targetColumn":"id","displayColumn":"title"}, {"sourceColumn":"catid","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"}]}', -'{"special":{"dbtable":"#__helloworld","key":"id","type":"Helloworld","prefix":"HelloworldTable","config":"array()"}, +'{"special":{"dbtable":"#__com_qwhelloworld","key":"id","type":"Project","prefix":"QwhelloworldTable","config":"array()"}, "common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}', '{"common": { "core_content_item_id": "id", - "core_title": "greeting", + "core_title": "title", "core_state": "published", "core_alias": "alias", "core_language":"language", @@ -60,8 +60,8 @@ VALUES "core_access": "access", "core_catid": "catid" }}', -'HelloworldHelperRoute::getHelloworldRoute'), -('Helloworld Category', 'com_helloworld.category', +'QwhelloworldHelperRoute::getQwhelloworldRoute'), +('QWHelloWorld Category', 'com_qwhelloworld.category', '{"formFile":"administrator\\/components\\/com_categories\\/models\\/forms\\/category.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path","extension"], "ignoreChanges":["modified_user_id", "modified_time", "checked_out", "checked_out_time", "version", "hits", "path"], @@ -106,4 +106,4 @@ VALUES "path":"path", "extension":"extension", "note":"note"}}', -'HelloworldHelperRoute::getCategoryRoute'); \ No newline at end of file +'QwhelloworldHelperRoute::getCategoryRoute'); \ No newline at end of file diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index b25a41a..7b40432 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,8 +1,8 @@ -DROP TABLE IF EXISTS `#__helloworld`; +DROP TABLE IF EXISTS `#__com_qwhelloworld`; DELETE FROM `#__ucm_history` WHERE ucm_type_id in - (select type_id from `#__content_types` where type_alias in ('com_helloworld.helloworld','com_helloworld.category')); + (select type_id from `#__content_types` where type_alias in ('com_qwhelloworld.project','com_qwhelloworld.category')); DELETE FROM `#__ucm_base` WHERE ucm_type_id in - (select type_id from `#__content_types` WHERE type_alias in ('com_helloworld.helloworld','com_helloworld.category')); -DELETE FROM `#__ucm_content` WHERE core_type_alias in ('com_helloworld.helloworld','com_helloworld.category'); -DELETE FROM `#__contentitem_tag_map`WHERE type_alias in ('com_helloworld.helloworld','com_helloworld.category'); -DELETE FROM `#__content_types` WHERE type_alias in ('com_helloworld.helloworld','com_helloworld.category'); \ No newline at end of file + (select type_id from `#__content_types` WHERE type_alias in ('com_qwhelloworld.project','com_qwhelloworld.category')); +DELETE FROM `#__ucm_content` WHERE core_type_alias in ('com_qwhelloworld.project','com_qwhelloworld.category'); +DELETE FROM `#__contentitem_tag_map`WHERE type_alias in ('com_qwhelloworld.project','com_qwhelloworld.category'); +DELETE FROM `#__content_types` WHERE type_alias in ('com_qwhelloworld.project','com_qwhelloworld.category'); \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.12.sql b/admin/sql/updates/mysql/0.0.12.sql index 175e7fe..de0071a 100644 --- a/admin/sql/updates/mysql/0.0.12.sql +++ b/admin/sql/updates/mysql/0.0.12.sql @@ -1 +1 @@ -ALTER TABLE `#__helloworld` ADD `catid` int(11) NOT NULL DEFAULT '0'; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` ADD `catid` int(11) NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.13.sql b/admin/sql/updates/mysql/0.0.13.sql index d1c0b2d..6f46c68 100644 --- a/admin/sql/updates/mysql/0.0.13.sql +++ b/admin/sql/updates/mysql/0.0.13.sql @@ -1 +1 @@ -ALTER TABLE `#__helloworld` ADD `params` VARCHAR(1024) NOT NULL DEFAULT ''; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` ADD `params` VARCHAR(1024) NOT NULL DEFAULT ''; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.14.sql b/admin/sql/updates/mysql/0.0.14.sql index b3c40a1..2585583 100644 --- a/admin/sql/updates/mysql/0.0.14.sql +++ b/admin/sql/updates/mysql/0.0.14.sql @@ -1 +1 @@ -ALTER TABLE `#__helloworld` ADD COLUMN `asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.16.sql b/admin/sql/updates/mysql/0.0.16.sql index 2adb0ef..916f4b7 100644 --- a/admin/sql/updates/mysql/0.0.16.sql +++ b/admin/sql/updates/mysql/0.0.16.sql @@ -1,2 +1,2 @@ -ALTER TABLE`#__helloworld` ADD COLUMN `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `asset_id`; -ALTER TABLE`#__helloworld` ADD COLUMN `created_by` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `created`; \ No newline at end of file +ALTER TABLE`#__com_qwhelloworld` ADD COLUMN `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `asset_id`; +ALTER TABLE`#__com_qwhelloworld` ADD COLUMN `created_by` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `created`; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.17.sql b/admin/sql/updates/mysql/0.0.17.sql index 6507574..7a459ff 100644 --- a/admin/sql/updates/mysql/0.0.17.sql +++ b/admin/sql/updates/mysql/0.0.17.sql @@ -1 +1 @@ -ALTER TABLE `#__helloworld` ADD `image` VARCHAR(1024) NOT NULL DEFAULT ''; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` ADD `image` VARCHAR(1024) NOT NULL DEFAULT ''; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.18.sql b/admin/sql/updates/mysql/0.0.18.sql index e940072..087656f 100644 --- a/admin/sql/updates/mysql/0.0.18.sql +++ b/admin/sql/updates/mysql/0.0.18.sql @@ -1,2 +1,2 @@ -ALTER TABLE `#__helloworld` ADD `latitude` DECIMAL(9,7) NOT NULL DEFAULT 0.0; -ALTER TABLE `#__helloworld` ADD `longitude` DECIMAL(10,7) NOT NULL DEFAULT 0.0; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` ADD `latitude` DECIMAL(9,7) NOT NULL DEFAULT 0.0; +ALTER TABLE `#__com_qwhelloworld` ADD `longitude` DECIMAL(10,7) NOT NULL DEFAULT 0.0; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.20.sql b/admin/sql/updates/mysql/0.0.20.sql index 8e4304b..0a24f05 100644 --- a/admin/sql/updates/mysql/0.0.20.sql +++ b/admin/sql/updates/mysql/0.0.20.sql @@ -1,4 +1,4 @@ -ALTER TABLE`#__helloworld` ADD COLUMN `alias` VARCHAR(40) NOT NULL DEFAULT '' AFTER `greeting`; -UPDATE `#__helloworld` AS h1 -SET alias = (SELECT CONCAT('id-', ID) FROM (SELECT * FROM `#__helloworld`) AS h2 WHERE h1.id = h2.id); -CREATE UNIQUE INDEX `aliasindex` ON `#__helloworld` (`alias`); \ No newline at end of file +ALTER TABLE`#__com_qwhelloworld` ADD COLUMN `alias` VARCHAR(40) NOT NULL DEFAULT '' AFTER `title`; +UPDATE `#__com_qwhelloworld` AS h1 +SET alias = (SELECT CONCAT('id-', ID) FROM (SELECT * FROM `#__com_qwhelloworld`) AS h2 WHERE h1.id = h2.id); +CREATE UNIQUE INDEX `aliasindex` ON `#__com_qwhelloworld` (`alias`); \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.21.sql b/admin/sql/updates/mysql/0.0.21.sql index 0e4e492..29670cf 100644 --- a/admin/sql/updates/mysql/0.0.21.sql +++ b/admin/sql/updates/mysql/0.0.21.sql @@ -1,4 +1,4 @@ -ALTER TABLE `#__helloworld` ADD COLUMN `language` CHAR(7) NOT NULL DEFAULT '*' AFTER `alias`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `language` CHAR(7) NOT NULL DEFAULT '*' AFTER `alias`; -DROP INDEX `aliasindex` on `#__helloworld`; -CREATE UNIQUE INDEX `aliasindex` ON `#__helloworld` (`alias`, `catid`); \ No newline at end of file +DROP INDEX `aliasindex` on `#__com_qwhelloworld`; +CREATE UNIQUE INDEX `aliasindex` ON `#__com_qwhelloworld` (`alias`, `catid`); \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.24.sql b/admin/sql/updates/mysql/0.0.24.sql index e46f4e2..2783b7a 100644 --- a/admin/sql/updates/mysql/0.0.24.sql +++ b/admin/sql/updates/mysql/0.0.24.sql @@ -1,2 +1,2 @@ -ALTER TABLE `#__helloworld` ADD COLUMN `checked_out` INT(10) NOT NULL DEFAULT '0' AFTER `created_by`; -ALTER TABLE `#__helloworld` ADD COLUMN `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `checked_out`; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `checked_out` INT(10) NOT NULL DEFAULT '0' AFTER `created_by`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `checked_out`; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.25.sql b/admin/sql/updates/mysql/0.0.25.sql index ae5ace4..5a53259 100644 --- a/admin/sql/updates/mysql/0.0.25.sql +++ b/admin/sql/updates/mysql/0.0.25.sql @@ -1,2 +1,2 @@ -ALTER TABLE`#__helloworld` ADD COLUMN `ordering` int(11) NOT NULL DEFAULT '0' AFTER `language`; -UPDATE `#__helloworld` SET `ordering` = `id`; \ No newline at end of file +ALTER TABLE`#__com_qwhelloworld` ADD COLUMN `ordering` int(11) NOT NULL DEFAULT '0' AFTER `language`; +UPDATE `#__com_qwhelloworld` SET `ordering` = `id`; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.26.sql b/admin/sql/updates/mysql/0.0.26.sql index 88ae126..75c937d 100644 --- a/admin/sql/updates/mysql/0.0.26.sql +++ b/admin/sql/updates/mysql/0.0.26.sql @@ -1,7 +1,7 @@ -ALTER TABLE `#__helloworld` DROP COLUMN `ordering`; -ALTER TABLE `#__helloworld` ADD COLUMN `parent_id` INT(10) NOT NULL DEFAULT '1' AFTER `language`; -ALTER TABLE `#__helloworld` ADD COLUMN `level` int(10) NOT NULL DEFAULT '0' AFTER `parent_id`; -ALTER TABLE `#__helloworld` ADD COLUMN `path` varchar(400) NOT NULL DEFAULT '' AFTER `level`; -ALTER TABLE `#__helloworld` ADD COLUMN `lft` int(11) NOT NULL DEFAULT '0' AFTER `path`; -ALTER TABLE `#__helloworld` ADD COLUMN `rgt` int(11) NOT NULL DEFAULT '0' AFTER `lft`; -UPDATE `#__helloworld` SET `path` = `alias`; \ No newline at end of file +ALTER TABLE `#__com_qwhelloworld` DROP COLUMN `ordering`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `parent_id` INT(10) NOT NULL DEFAULT '1' AFTER `language`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `level` int(10) NOT NULL DEFAULT '0' AFTER `parent_id`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `path` varchar(400) NOT NULL DEFAULT '' AFTER `level`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `lft` int(11) NOT NULL DEFAULT '0' AFTER `path`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `rgt` int(11) NOT NULL DEFAULT '0' AFTER `lft`; +UPDATE `#__com_qwhelloworld` SET `path` = `alias`; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.27.sql b/admin/sql/updates/mysql/0.0.27.sql index 7fdfa69..9a8f1ae 100644 --- a/admin/sql/updates/mysql/0.0.27.sql +++ b/admin/sql/updates/mysql/0.0.27.sql @@ -1,17 +1,17 @@ -ALTER TABLE `#__helloworld` ADD COLUMN `description` VARCHAR(4000) NOT NULL DEFAULT '' AFTER `greeting`; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `description` VARCHAR(4000) NOT NULL DEFAULT '' AFTER `title`; INSERT INTO `#__content_types` (`type_title`, `type_alias`, `content_history_options`) VALUES -('Helloworld', 'com_helloworld.helloworld', -'{"formFile":"administrator\\/components\\/com_helloworld\\/models\\/forms\\/helloworld.xml", +('QWHelloWorld Project', 'com_qwhelloworld.project', +'{"formFile":"administrator\\/components\\/com_qwhelloworld\\/models\\/forms\\/project.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path"], "ignoreChanges":["checked_out", "checked_out_time", "path"], "convertToInt":[], "displayLookup":[ {"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"}, -{"sourceColumn":"parent_id","targetTable":"#__helloworld","targetColumn":"id","displayColumn":"greeting"}, +{"sourceColumn":"parent_id","targetTable":"#__com_qwhelloworld","targetColumn":"id","displayColumn":"title"}, {"sourceColumn":"catid","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"}]}'), -('Helloworld Category', 'com_helloworld.category', +('QWHelloWorld Category', 'com_qwhelloworld.category', '{"formFile":"administrator\\/components\\/com_categories\\/models\\/forms\\/category.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path","extension"], "ignoreChanges":["modified_user_id", "modified_time", "checked_out", "checked_out_time", "version", "hits", "path"], diff --git a/admin/sql/updates/mysql/0.0.28.sql b/admin/sql/updates/mysql/0.0.28.sql index c3634b4..d87e222 100644 --- a/admin/sql/updates/mysql/0.0.28.sql +++ b/admin/sql/updates/mysql/0.0.28.sql @@ -1,10 +1,10 @@ UPDATE `#__content_types` SET -`table` = '{"special":{"dbtable":"#__helloworld","key":"id","type":"Helloworld","prefix":"HelloworldTable","config":"array()"}, +`table` = '{"special":{"dbtable":"#__com_qwhelloworld","key":"id","type":"Project","prefix":"QwhelloworldTable","config":"array()"}, "common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}', `field_mappings` = '{"common": { "core_content_item_id": "id", - "core_title": "greeting", + "core_title": "title", "core_state": "published", "core_alias": "alias", "core_language":"language", @@ -12,8 +12,8 @@ UPDATE `#__content_types` SET "core_body": "description", "core_catid": "catid" }}', -`router` = 'HelloworldHelperRoute::getHelloworldRoute' -WHERE `type_alias` = 'com_helloworld.helloworld'; +`router` = 'QwhelloworldHelperRoute::getQwhelloworldRoute' +WHERE `type_alias` = 'com_qwhelloworld.project'; UPDATE `#__content_types` SET `table` = '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"}, @@ -52,5 +52,5 @@ UPDATE `#__content_types` SET "path":"path", "extension":"extension", "note":"note"}}', -`router` = 'HelloworldHelperRoute::getCategoryRoute' -WHERE `type_alias` = 'com_helloworld.category'; \ No newline at end of file +`router` = 'QwhelloworldHelperRoute::getCategoryRoute' +WHERE `type_alias` = 'com_qwhelloworld.category'; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.29.sql b/admin/sql/updates/mysql/0.0.29.sql index d431ce1..4dd6aed 100644 --- a/admin/sql/updates/mysql/0.0.29.sql +++ b/admin/sql/updates/mysql/0.0.29.sql @@ -1,11 +1,11 @@ -ALTER TABLE `#__helloworld` ADD COLUMN `access` tinyint(4) NOT NULL DEFAULT '0' AFTER `published`; -UPDATE `#__helloworld` SET `access` = 1; +ALTER TABLE `#__com_qwhelloworld` ADD COLUMN `access` tinyint(4) NOT NULL DEFAULT '0' AFTER `published`; +UPDATE `#__com_qwhelloworld` SET `access` = 1; UPDATE `#__content_types` SET `field_mappings` = '{"common": { "core_content_item_id": "id", - "core_title": "greeting", + "core_title": "title", "core_state": "published", "core_alias": "alias", "core_language":"language", @@ -14,4 +14,4 @@ UPDATE `#__content_types` SET "core_access": "access", "core_catid": "catid" }}' -WHERE `type_alias` = 'com_helloworld.helloworld'; \ No newline at end of file +WHERE `type_alias` = 'com_qwhelloworld.project'; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.6.sql b/admin/sql/updates/mysql/0.0.6.sql index 41d9c0c..3aa479c 100644 --- a/admin/sql/updates/mysql/0.0.6.sql +++ b/admin/sql/updates/mysql/0.0.6.sql @@ -1,6 +1,6 @@ -DROP TABLE IF EXISTS `#__helloworld`; +DROP TABLE IF EXISTS `#__com_qwhelloworld`; -CREATE TABLE `#__helloworld` ( +CREATE TABLE `#__com_qwhelloworld` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(25) NOT NULL, `published` tinyint(4) NOT NULL DEFAULT '1', @@ -11,6 +11,6 @@ CREATE TABLE `#__helloworld` ( DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci -INSERT INTO `#__helloworld` (`greeting`) VALUES +INSERT INTO `#__com_qwhelloworld` (`title`) VALUES ('Hello World!'), ('Good bye World!'); \ No newline at end of file diff --git a/admin/tables/helloworld.php b/admin/tables/project.php similarity index 81% rename from admin/tables/helloworld.php rename to admin/tables/project.php index d9f2aa2..00c1fb6 100644 --- a/admin/tables/helloworld.php +++ b/admin/tables/project.php @@ -1,7 +1,7 @@ 'com_helloworld.helloworld')); - parent::__construct('#__helloworld', 'id', $db); - Tags::createObserver($this, array('typeAlias' => 'com_helloworld.helloworld')); + JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'QwhelloworldTableProject', array('typeAlias' => 'com_qwhelloworld.project')); + parent::__construct('#__com_qwhelloworld', 'id', $db); + Tags::createObserver($this, array('typeAlias' => 'com_qwhelloworld.project')); } /** * Overloaded bind function @@ -73,30 +73,30 @@ public function bind($array, $ignore = '') { // new record $this->setLocation($array['parent_id'], 'last-child'); } - elseif (isset($array['helloworldordering'])) + elseif (isset($array['projectordering'])) { // when saving a record load() is called before bind() so the table instance will have properties which are the existing field values if ($this->parent_id == $array['parent_id']) { // If first is chosen make the item the first child of the selected parent. - if ($array['helloworldordering'] == -1) + if ($array['projectordering'] == -1) { $this->setLocation($array['parent_id'], 'first-child'); } // If last is chosen make it the last child of the selected parent. - elseif ($array['helloworldordering'] == -2) + elseif ($array['projectordering'] == -2) { $this->setLocation($array['parent_id'], 'last-child'); } // Don't try to put an item after itself. All other ones put after the selected item. - elseif ($array['helloworldordering'] && $this->id != $array['helloworldordering']) + elseif ($array['projectordering'] && $this->id != $array['projectordering']) { - $this->setLocation($array['helloworldordering'], 'after'); + $this->setLocation($array['projectordering'], 'after'); } // Just leave it where it is if no change is made. - elseif ($array['helloworldordering'] && $this->id == $array['helloworldordering']) + elseif ($array['projectordering'] && $this->id == $array['projectordering']) { - unset($array['helloworldordering']); + unset($array['projectordering']); } } // Set the new parent id if parent id not matched and put in last position @@ -121,7 +121,7 @@ public function bind($array, $ignore = '') protected function _getAssetName() { $k = $this->_tbl_key; - return 'com_helloworld.helloworld.'.(int) $this->$k; + return 'com_qwhelloworld.project.'.(int) $this->$k; } /** * Method to return the title to use for the asset table. @@ -131,7 +131,7 @@ protected function _getAssetName() */ protected function _getAssetTitle() { - return $this->greeting; + return $this->title; } /** * Method to get the asset-parent-id of the item @@ -149,12 +149,12 @@ protected function _getAssetParentId(JTable $table = NULL, $id = NULL) if (($this->catid)&& !empty($this->catid)) { // The item has a category as asset-parent - $assetParent->loadByName('com_helloworld.category.' . (int) $this->catid); + $assetParent->loadByName('com_qwhelloworld.category.' . (int) $this->catid); } else { // The item has the component as asset-parent - $assetParent->loadByName('com_helloworld'); + $assetParent->loadByName('com_qwhelloworld'); } // Return the found asset-parent-id @@ -170,7 +170,7 @@ public function check() $this->alias = trim($this->alias); if (empty($this->alias)) { - $this->alias = $this->greeting; + $this->alias = $this->title; } $this->alias = OutputFilter::stringURLSafe($this->alias); return true; diff --git a/admin/views/helloworld/index.html b/admin/views/project/index.html similarity index 100% rename from admin/views/helloworld/index.html rename to admin/views/project/index.html diff --git a/admin/views/helloworld/submitbutton.js b/admin/views/project/submitbutton.js similarity index 88% rename from admin/views/helloworld/submitbutton.js rename to admin/views/project/submitbutton.js index 1d84914..d534b04 100644 --- a/admin/views/helloworld/submitbutton.js +++ b/admin/views/project/submitbutton.js @@ -28,7 +28,7 @@ Joomla.submitbutton = function(task) } else { - alert(Joomla.JText._('COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE', + alert(Joomla.JText._('COM_QWHELLOWORLD_PROJECT_ERROR_UNACCEPTABLE', 'Some values are unacceptable')); return false; } diff --git a/admin/views/helloworld/tmpl/edit.php b/admin/views/project/tmpl/edit.php similarity index 76% rename from admin/views/helloworld/tmpl/edit.php rename to admin/views/project/tmpl/edit.php index 78059cf..45cf916 100644 --- a/admin/views/helloworld/tmpl/edit.php +++ b/admin/views/project/tmpl/edit.php @@ -1,7 +1,7 @@ addScriptDeclaration(' jQuery(document).ready(function() { - greeting = jQuery("#jform_greeting").val(); - jQuery("#jform_title").val(greeting); + title = jQuery("#jform_title").val(); + jQuery("#jform_title").val(title); }); '); @@ -37,18 +37,18 @@ $input = Factory::getApplication()->input; $tmpl = $input->getCmd('tmpl', '') === 'component' ? '&tmpl=component' : ''; ?> -
- +
'details')); ?> item->id) ? Text::_('COM_HELLOWORLD_TAB_NEW_MESSAGE') : Text::_('COM_HELLOWORLD_TAB_EDIT_MESSAGE')); ?> + empty($this->item->id) ? Text::_('COM_QWHELLOWORLD_TAB_NEW_PROJECT') : Text::_('COM_QWHELLOWORLD_TAB_EDIT_PROJECT')); ?>
- +
form->renderFieldset('details'); ?> @@ -60,9 +60,9 @@
- +
- +
form->renderFieldset('image-info'); ?> @@ -71,9 +71,9 @@
- +
- +
form->renderFieldset('params'); ?> @@ -83,9 +83,9 @@ - +
- +
@@ -95,9 +95,9 @@ - +
- +
form->renderFieldset('accesscontrol'); ?> @@ -112,6 +112,6 @@
- + \ No newline at end of file diff --git a/admin/views/helloworld/tmpl/index.html b/admin/views/project/tmpl/index.html similarity index 100% rename from admin/views/helloworld/tmpl/index.html rename to admin/views/project/tmpl/index.html diff --git a/admin/views/helloworld/view.html.php b/admin/views/project/view.html.php similarity index 66% rename from admin/views/helloworld/view.html.php rename to admin/views/project/view.html.php index 40b76d7..6c5d560 100644 --- a/admin/views/helloworld/view.html.php +++ b/admin/views/project/view.html.php @@ -1,7 +1,7 @@ script = $this->get('Script'); // What Access Permissions does this user have? What can (s)he do? - $this->canDo = ContentHelper::getActions('com_helloworld', 'helloworld', $this->item->id); + $this->canDo = ContentHelper::getActions('com_qwhelloworld', 'project', $this->item->id); // Check for errors. if (count($errors = $this->get('Errors'))) @@ -83,49 +83,49 @@ protected function addToolBar() $isNew = ($this->item->id == 0); - ToolbarHelper::title($isNew ? Text::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW') - : Text::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'), 'helloworld'); + ToolbarHelper::title($isNew ? Text::_('COM_QWHELLOWORLD_MANAGER_PROJECT_NEW') + : Text::_('COM_QWHELLOWORLD_MANAGER_PROJECT_EDIT'), 'project'); // Build the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($this->canDo->get('core.create')) { - ToolbarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY'); - ToolbarHelper::save('helloworld.save', 'JTOOLBAR_SAVE'); - ToolbarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', + ToolbarHelper::apply('project.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('project.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::custom('project.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } - ToolbarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('project.cancel', 'JTOOLBAR_CANCEL'); } else { if ($this->canDo->get('core.edit')) { // We can save the new record - ToolbarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY'); - ToolbarHelper::save('helloworld.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('project.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('project.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see // if we can return to make a new one. if ($this->canDo->get('core.create')) { - ToolbarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', + ToolbarHelper::custom('project.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } $config = Factory::getConfig(); $save_history = $config->get('save_history', true); if ($save_history) { - ToolbarHelper::versions('com_helloworld.helloworld', $this->item->id); + ToolbarHelper::versions('com_qwhelloworld.project', $this->item->id); } } if ($this->canDo->get('core.create')) { - ToolbarHelper::custom('helloworld.save2copy', 'save-copy.png', 'save-copy_f2.png', + ToolbarHelper::custom('project.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } - ToolbarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('project.cancel', 'JTOOLBAR_CLOSE'); } } /** @@ -137,11 +137,11 @@ protected function setDocument() { $isNew = ($this->item->id < 1); $document = Factory::getDocument(); - $document->setTitle($isNew ? Text::_('COM_HELLOWORLD_HELLOWORLD_CREATING') : - Text::_('COM_HELLOWORLD_HELLOWORLD_EDITING')); + $document->setTitle($isNew ? Text::_('COM_QWHELLOWORLD_PROJECT_CREATING') : + Text::_('COM_QWHELLOWORLD_PROJECT_EDITING')); $document->addScript(Uri::root() . $this->script); - $document->addScript(Uri::root() . "/administrator/components/com_helloworld" - . "/views/helloworld/submitbutton.js"); - Text::script('COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE'); + $document->addScript(Uri::root() . "/administrator/components/com_qwhelloworld" + . "/views/project/submitbutton.js"); + Text::script('COM_QWHELLOWORLD_PROJECT_ERROR_UNACCEPTABLE'); } } \ No newline at end of file diff --git a/admin/views/helloworlds/index.html b/admin/views/projects/index.html similarity index 100% rename from admin/views/helloworlds/index.html rename to admin/views/projects/index.html diff --git a/admin/views/helloworlds/tmpl/default.php b/admin/views/projects/tmpl/default.php similarity index 84% rename from admin/views/helloworlds/tmpl/default.php rename to admin/views/projects/tmpl/default.php index 8a79d1e..1f4b4ac 100644 --- a/admin/views/helloworlds/tmpl/default.php +++ b/admin/views/projects/tmpl/default.php @@ -1,7 +1,7 @@ -
+
- +
- +
- + @@ -106,7 +106,7 @@ items)) : ?> items as $i => $row) : - $link = Route::_('index.php?option=com_helloworld&task=helloworld.edit&id=' . $row->id); + $link = Route::_('index.php?option=com_qwhelloworld&task=project.edit&id=' . $row->id); $row->image = new Registry; $row->image->loadString($row->imageInfo); // create a list of the parents up the hierarchy to the root @@ -138,7 +138,7 @@ @@ -209,7 +209,7 @@ created, 0, 10); ?>
- + - + - + - + - + - + - + - + - +
authorise('core.edit.state', 'com_helloworld.helloworld.' . $row->id); + $canReorder = $user->authorise('core.edit.state', 'com_qwhelloworld.project.' . $row->id); if (!$canReorder) { $iconClass = ' inactive'; @@ -164,10 +164,10 @@ checked_out) : ?> authorise('core.manage', 'com_checkin') || $row->checked_out == $userId; ?> - editor, $row->checked_out_time, 'helloworlds.', $canCheckin); ?> + editor, $row->checked_out_time, 'projects.', $canCheckin); ?> - - greeting; ?> + + title; ?> escape($row->alias)); ?> @@ -195,7 +195,7 @@ association) : ?> - id); ?> + id); ?> - published, $i, 'helloworlds.', true, 'cb'); ?> + published, $i, 'projects.', true, 'cb'); ?> id; ?> @@ -224,7 +224,7 @@ 'bootstrap.renderModal', 'collapseModal', array( - 'title' => Text::_('COM_HELLOWORLD_BATCH_OPTIONS'), + 'title' => Text::_('COM_QWHELLOWORLD_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer') ), $this->loadTemplate('batch_body') diff --git a/admin/views/helloworlds/tmpl/default_batch_body.php b/admin/views/projects/tmpl/default_batch_body.php similarity index 95% rename from admin/views/helloworlds/tmpl/default_batch_body.php rename to admin/views/projects/tmpl/default_batch_body.php index fcb1dac..f5bbbab 100644 --- a/admin/views/helloworlds/tmpl/default_batch_body.php +++ b/admin/views/projects/tmpl/default_batch_body.php @@ -16,7 +16,7 @@
- 'com_helloworld')); ?> + 'com_qwhelloworld')); ?>
diff --git a/admin/views/helloworlds/tmpl/default_batch_footer.php b/admin/views/projects/tmpl/default_batch_footer.php similarity index 94% rename from admin/views/helloworlds/tmpl/default_batch_footer.php rename to admin/views/projects/tmpl/default_batch_footer.php index 9a2d0c7..99257dc 100644 --- a/admin/views/helloworlds/tmpl/default_batch_footer.php +++ b/admin/views/projects/tmpl/default_batch_footer.php @@ -9,6 +9,6 @@ - \ No newline at end of file diff --git a/admin/views/helloworlds/tmpl/index.html b/admin/views/projects/tmpl/index.html similarity index 100% rename from admin/views/helloworlds/tmpl/index.html rename to admin/views/projects/tmpl/index.html diff --git a/admin/views/helloworlds/tmpl/modal.php b/admin/views/projects/tmpl/modal.php similarity index 81% rename from admin/views/helloworlds/tmpl/modal.php rename to admin/views/projects/tmpl/modal.php index 01f4c1e..e077eea 100644 --- a/admin/views/helloworlds/tmpl/modal.php +++ b/admin/views/projects/tmpl/modal.php @@ -1,6 +1,6 @@ 'auto', 'relative' => true)); +HTMLHelper::_('script', 'com_qwhelloworld/admin-projects-modal.js', array('version' => 'auto', 'relative' => true)); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $app = Factory::getApplication(); -$function = $app->input->getCmd('function', 'jSelectHelloworld'); +$function = $app->input->getCmd('function', 'jSelectProject'); $onclick = $this->escape($function); ?>
- + $this)); ?> @@ -37,30 +37,30 @@ - + @@ -100,16 +100,16 @@ - + id . ':' . $row->alias . '&catid=' . $row->catid . $query_lang); + $url = Route::_('index.php?option=com_qwhelloworld&view=project&id=' . $row->id . ':' . $row->alias . '&catid=' . $row->catid . $query_lang); ?> - + @@ -86,7 +86,7 @@
- + - + - + - + - + - + - + - +
pagination->getRowOffset($i); ?> id; + $link = 'index.php?option=com_qwhelloworld&view=project&id=' . $row->id; $attribs = 'data-function="' . $this->escape($onclick) . '"' . ' data-id="' . $row->id . '"' - . ' data-title="' . $this->escape(addslashes($row->greeting)) . '"' + . ' data-title="' . $this->escape(addslashes($row->title)) . '"' . ' data-uri="' . $link . '"' . ' data-language="' . $this->escape($lang) . '"' ; ?> > - escape($row->greeting); ?> + escape($row->title); ?> escape($row->alias)); ?> @@ -138,7 +138,7 @@ created, 0, 10); ?> - published, $i, 'helloworlds.', true, 'cb'); ?> + published, $i, 'projects.', true, 'cb'); ?> id; ?> diff --git a/admin/views/helloworlds/view.html.php b/admin/views/projects/view.html.php similarity index 82% rename from admin/views/helloworlds/view.html.php rename to admin/views/projects/view.html.php index 803e3bc..08f191c 100644 --- a/admin/views/helloworlds/view.html.php +++ b/admin/views/projects/view.html.php @@ -1,7 +1,7 @@ activeFilters = $this->get('ActiveFilters'); // What Access Permissions does this user have? What can (s)he do? - $this->canDo = ContentHelper::getActions('com_helloworld'); + $this->canDo = ContentHelper::getActions('com_qwhelloworld'); // Check for errors. if (count($errors = $this->get('Errors'))) @@ -58,7 +58,7 @@ function display($tpl = null) // Set the sidebar submenu and toolbar, but not on the modal window if ($this->getLayout() !== 'modal') { - HelloWorldHelper::addSubmenu('helloworlds'); + QwhelloworldHelper::addSubmenu('projects'); $this->addToolBar(); } else @@ -98,7 +98,7 @@ function display($tpl = null) */ protected function addToolBar() { - $title = Text::_('COM_HELLOWORLD_MANAGER_HELLOWORLDS'); + $title = Text::_('COM_QWHELLOWORLD_MANAGER_PROJECTS'); $bar = Toolbar::getInstance('toolbar'); @@ -107,22 +107,23 @@ protected function addToolBar() $title .= "(" . $this->pagination->total . ")"; } - ToolbarHelper::title($title, 'helloworld'); + ToolbarHelper::title($title, 'project');//ToolbarHelper::title($title, 'helloworld'); + if ($this->canDo->get('core.create')) { - ToolbarHelper::addNew('helloworld.add', 'JTOOLBAR_NEW'); + ToolbarHelper::addNew('project.add', 'JTOOLBAR_NEW'); } if ($this->canDo->get('core.edit')) { - ToolbarHelper::editList('helloworld.edit', 'JTOOLBAR_EDIT'); + ToolbarHelper::editList('project.edit', 'JTOOLBAR_EDIT'); } if ($this->canDo->get('core.delete')) { - ToolbarHelper::deleteList('', 'helloworlds.delete', 'JTOOLBAR_DELETE'); + ToolbarHelper::deleteList('', 'projects.delete', 'JTOOLBAR_DELETE'); } if ($this->canDo->get('core.edit') || Factory::getUser()->authorise('core.manage', 'com_checkin')) { - ToolbarHelper::checkin('helloworlds.checkin'); + ToolbarHelper::checkin('projects.checkin'); } // Add a batch button if ($this->canDo->get('core.create') && $this->canDo->get('core.edit') @@ -136,7 +137,7 @@ protected function addToolBar() if ($this->canDo->get('core.admin')) { ToolbarHelper::divider(); - ToolbarHelper::preferences('com_helloworld'); + ToolbarHelper::preferences('com_qwhelloworld'); } } /** @@ -147,6 +148,6 @@ protected function addToolBar() protected function setDocument() { $document = Factory::getDocument(); - $document->setTitle(Text::_('COM_HELLOWORLD_ADMINISTRATION')); + $document->setTitle(Text::_('COM_QWHELLOWORLD_ADMINISTRATION')); } } \ No newline at end of file diff --git a/media/js/admin-helloworlds-modal.js b/media/js/admin-projects-modal.js similarity index 62% rename from media/js/admin-helloworlds-modal.js rename to media/js/admin-projects-modal.js index cbad44a..8b6a73b 100644 --- a/media/js/admin-helloworlds-modal.js +++ b/media/js/admin-projects-modal.js @@ -1,10 +1,10 @@ (function() { "use strict"; /** - * Javascript to set up onclick listeners on the helloworld greetings - * When a greeting is clicked the listener invokes the function in the parent window - * which is given by the data-function attribute of the helloworld greeting html element - * In this way the identity of the helloworld record selected in the modal is passed to the field in the parent window + * Javascript to set up onclick listeners on the project title + * When a project is clicked the listener invokes the function in the parent window + * which is given by the data-function attribute of the project title html element + * In this way the identity of the project record selected in the modal is passed to the field in the parent window */ document.addEventListener('DOMContentLoaded', function(){ diff --git a/media/js/openstreetmap.js b/media/js/openstreetmap.js index 7a7cd41..5368e30 100644 --- a/media/js/openstreetmap.js +++ b/media/js/openstreetmap.js @@ -5,7 +5,7 @@ jQuery(document).ready(function() { // get the data passed from Joomla PHP // params is a Javascript object with properties for the map display: - // centre latitude, centre longitude and zoom, and the helloworld greeting + // centre latitude, centre longitude and zoom, and the project title const params = Joomla.getOptions('params'); ajaxurl = params.ajaxurl; @@ -38,10 +38,10 @@ jQuery(document).ready(function() { }) }); - // Now we add a marker for our Helloworld position + // Now we add a marker for our project position // To do that, we specify it as a Point Feature, and we add styling // to define how that Feature is presented on the map - var helloworldPoint = new ol.Feature({geometry: new ol.geom.Point(mapCentre)}); + var projectPoint = new ol.Feature({geometry: new ol.geom.Point(mapCentre)}); // we'll define the style as a red 5 point star with blue edging const redFill = new ol.style.Fill({ color: 'red' @@ -57,37 +57,37 @@ jQuery(document).ready(function() { radius1: 20, // outer radius of star radius2: 10, // inner radius of star }) - helloworldPoint.setStyle(new ol.style.Style({ + projectPoint.setStyle(new ol.style.Style({ image: star })); // now we add the feature to the map via a Vector source and Vector layer const vectorSource = new ol.source.Vector({}); - vectorSource.addFeature(helloworldPoint); + vectorSource.addFeature(projectPoint); const vector = new ol.layer.Vector({ source: vectorSource }); map.addLayer(vector); - // If a user clicks on the star, then we'll show the helloworld greeting - // The greeting will go into another HTML element, with id="greeting-container" + // If a user clicks on the star, then we'll show the project title + // The title will go into another HTML element, with id="title-container" // and this will be shown as an Overlay on the map var overlay = new ol.Overlay({ - element: document.getElementById('greeting-container'), + element: document.getElementById('title-container'), }); map.addOverlay(overlay); - // Finally we add the onclick listener to display the greeting when the star is clicked + // Finally we add the onclick listener to display the title when the star is clicked // The way this works is that the onclick listener is attached to the map, // and then it works out which Feature or Features have been hit map.on('click', function(e) { let markup = ''; let position; map.forEachFeatureAtPixel(e.pixel, function(feature) { // for each Feature hit - markup = params.greeting; + markup = params.title; position = feature.getGeometry().getCoordinates(); }, {hitTolerance: 5}); // tolerance of 5 pixels if (markup) { - document.getElementById('greeting-container').innerHTML = markup; + document.getElementById('title-container').innerHTML = markup; overlay.setPosition(position); } else { overlay.setPosition(); // this hides it, if we click elsewhere @@ -109,7 +109,7 @@ function searchHere() { var token = jQuery("#token").attr("name"); jQuery.ajax({ url: ajaxurl, - data: { [token]: "1", task: "mapsearch", view: "helloworld", format: "json", mapBounds: mapBounds }, + data: { [token]: "1", task: "mapsearch", view: "project", format: "json", mapBounds: mapBounds }, success: function(result, status, xhr) { displaySearchResults(result); }, error: function() { console.log('ajax call failed'); }, }); @@ -120,7 +120,7 @@ function displaySearchResults(result) { var html = ""; for (var i=0; i' + - result.data[i].greeting + '' + + result.data[i].title + '' + " @ " + result.data[i].latitude + ", " + result.data[i].longitude + "

"; } diff --git a/helloworld.xml b/qwhelloworld.xml similarity index 77% rename from helloworld.xml rename to qwhelloworld.xml index c2d7e55..67a6f5c 100644 --- a/helloworld.xml +++ b/qwhelloworld.xml @@ -1,7 +1,7 @@ - COM_HELLOWORLD + COM_QWHELLOWORLD January 2018 John Doe @@ -10,9 +10,9 @@ Copyright Info License Info - 1.1.2 + 1.0.0 - COM_HELLOWORLD_DESCRIPTION + COM_QWHELLOWORLD_DESCRIPTION script.php @@ -39,7 +39,7 @@ in this section are copied from /site/ in the package --> index.html - helloworld.php + qwhelloworld.php controller.php router.php controllers @@ -49,11 +49,11 @@ - en-GB/en-GB.com_helloworld.ini - fr-FR/fr-FR.com_helloworld.ini + en-GB/en-GB.com_qwhelloworld.ini + fr-FR/fr-FR.com_qwhelloworld.ini - + index.html images js @@ -62,7 +62,7 @@ - COM_HELLOWORLD_MENU + COM_QWHELLOWORLD_MENU index.html config.xml - helloworld.php + qwhelloworld.php controller.php access.xml @@ -90,10 +90,10 @@ layouts - en-GB/en-GB.com_helloworld.ini - en-GB/en-GB.com_helloworld.sys.ini - fr-FR/fr-FR.com_helloworld.ini - fr-FR/fr-FR.com_helloworld.sys.ini + en-GB/en-GB.com_qwhelloworld.ini + en-GB/en-GB.com_qwhelloworld.sys.ini + fr-FR/fr-FR.com_qwhelloworld.ini + fr-FR/fr-FR.com_qwhelloworld.sys.ini diff --git a/script.php b/script.php index b1008be..1c651c8 100644 --- a/script.php +++ b/script.php @@ -9,7 +9,7 @@ * * The name of this class is dependent on the component being installed. * The class name should have the component's name, directly followed by - * the text InstallerScript (ex:. com_helloWorldInstallerScript). + * the text InstallerScript (ex:. Com_QwhelloworldInstallerScript). * * This class will be called by Joomla!'s installer, if specified in your component's * manifest file, and is used for custom automation actions in its installation process. @@ -19,12 +19,12 @@ * script.php * * @package Joomla.Administrator - * @subpackage com_helloworld + * @subpackage com_qwhelloworld * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ -class Com_HelloWorldInstallerScript +class Com_QwhelloworldInstallerScript { /** * This method is called after a component is installed. @@ -35,7 +35,7 @@ class Com_HelloWorldInstallerScript */ public function install($parent) { - $parent->getParent()->setRedirectURL('index.php?option=com_helloworld'); + $parent->getParent()->setRedirectURL('index.php?option=com_qwhelloworld'); } /** @@ -47,7 +47,7 @@ public function install($parent) */ public function uninstall($parent) { - echo '

' . Text::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '

'; + echo '

' . Text::_('COM_QWHELLOWORLD_UNINSTALL_TEXT') . '

'; } /** @@ -59,7 +59,7 @@ public function uninstall($parent) */ public function update($parent) { - echo '

' . Text::sprintf('COM_HELLOWORLD_UPDATE_TEXT', $parent->get('manifest')->version) . '

'; + echo '

' . Text::sprintf('COM_QWHELLOWORLD_UPDATE_TEXT', $parent->get('manifest')->version) . '

'; } /** @@ -76,7 +76,7 @@ public function update($parent) */ public function preflight($type, $parent) { - echo '

' . Text::_('COM_HELLOWORLD_PREFLIGHT_' . $type . '_TEXT') . '

'; + echo '

' . Text::_('COM_QWHELLOWORLD_PREFLIGHT_' . $type . '_TEXT') . '

'; } /** diff --git a/site/controller.php b/site/controller.php index 6443730..d977401 100644 --- a/site/controller.php +++ b/site/controller.php @@ -1,7 +1,7 @@ input; - $this->view_item = $input->get("view", "helloworld", "string"); + $this->view_item = $input->get("view", "project", "string"); parent::__construct($config); } @@ -49,12 +49,12 @@ public function cancel($key = null) // set up the redirect back to the same form $this->setRedirect( (string)Uri::getInstance(), - Text::_(COM_HELLOWORLD_ADD_CANCELLED) + Text::_(COM_QWHELLOWORLD_ADD_CANCELLED) ); } /* - * Function handing the save for adding a new helloworld record + * Function handing the save for adding a new project record * Based on the save() function in the FormController' class */ public function save($key = null, $urlVar = null) @@ -71,7 +71,7 @@ public function save($key = null, $urlVar = null) $currentUri = (string)Uri::getInstance(); // Check that this user is allowed to add a new record - if (!Factory::getUser()->authorise( "core.create", "com_helloworld")) + if (!Factory::getUser()->authorise( "core.create", "com_qwhelloworld")) { $app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); $app->setHeader('status', 403, true); @@ -148,7 +148,7 @@ public function save($key = null, $urlVar = null) { if ($file['error'] > 0) { - $app->enqueueMessage(Text::sprintf('COM_HELLOWORLD_ERROR_FILEUPLOAD', $file['error']), 'warning'); + $app->enqueueMessage(Text::sprintf('COM_QWHELLOWORLD_ERROR_FILEUPLOAD', $file['error']), 'warning'); return false; } @@ -157,7 +157,7 @@ public function save($key = null, $urlVar = null) if (!isset($file['name'])) { // No filename (after the name was cleaned by File::makeSafe) - $app->enqueueMessage(Text::_('COM_HELLOWORLD_ERROR_BADFILENAME'), 'warning'); + $app->enqueueMessage(Text::_('COM_QWHELLOWORLD_ERROR_BADFILENAME'), 'warning'); return false; } @@ -179,7 +179,7 @@ public function save($key = null, $urlVar = null) if (File::exists($absolutePathname)) { // A file with this name already exists - $app->enqueueMessage(Text::_('COM_HELLOWORLD_ERROR_FILE_EXISTS'), 'warning'); + $app->enqueueMessage(Text::_('COM_QWHELLOWORLD_ERROR_FILE_EXISTS'), 'warning'); return false; } @@ -187,7 +187,7 @@ public function save($key = null, $urlVar = null) if (!File::upload($file['tmp_name'], $absolutePathname)) { // Error in upload - $app->enqueueMessage(Text::_('COM_HELLOWORLD_ERROR_UNABLE_TO_UPLOAD_FILE')); + $app->enqueueMessage(Text::_('COM_QWHELLOWORLD_ERROR_UNABLE_TO_UPLOAD_FILE')); return false; } @@ -212,7 +212,7 @@ public function save($key = null, $urlVar = null) // data has been saved ok, so clear the data in the form $app->setUserState($context . '.data', null); - // notify the administrator that a new helloworld message has been added on the front end + // notify the administrator that a new project has been added on the front end // get the id of the person to notify from global config $params = $app->getParams(); @@ -234,8 +234,8 @@ public function save($key = null, $urlVar = null) // get the Mailer object, set up the email to be sent, and send it $mailer = Factory::getMailer(); $mailer->addRecipient($to_address); - $mailer->setSubject("New helloworld message added by " . $current_username); - $mailer->setBody("New greeting is " . $validData['greeting']); + $mailer->setSubject("New project added by " . $current_username); + $mailer->setBody("New title is " . $validData['title']); try { $mailer->send(); @@ -247,7 +247,7 @@ public function save($key = null, $urlVar = null) $this->setRedirect( $currentUri, - Text::_('COM_HELLOWORLD_ADD_SUCCESSFUL') + Text::_('COM_QWHELLOWORLD_ADD_SUCCESSFUL') ); return true; @@ -259,7 +259,7 @@ public function getModel($name = '', $prefix = '', $config = array('ignore_reque if (empty($name)) { $input = Factory::getApplication()->input; - $modelname = $input->get("modelname", "helloworld", "string"); + $modelname = $input->get("modelname", "project", "string"); return parent::getModel($modelname, $prefix, $config); } diff --git a/site/helpers/association.php b/site/helpers/association.php index 03b3b7b..632af47 100644 --- a/site/helpers/association.php +++ b/site/helpers/association.php @@ -1,6 +1,6 @@ get('view') : $view; $id = empty($id) ? $input->getInt('id') : $id; - if ($view === 'helloworld') + if ($view === 'project') { if ($id) { - $associations = Associations::getAssociations('com_helloworld', '#__helloworld', 'com_helloworld.item', $id); + $associations = Associations::getAssociations('com_qwhelloworld', '#__com_qwhelloworld', 'com_qwhelloworld.item', $id); $return = array(); foreach ($associations as $tag => $item) { - $link = 'index.php?option=com_helloworld&view=helloworld&id=' . $item->id . '&catid=' . $item->catid; + $link = 'index.php?option=com_qwhelloworld&view=project&id=' . $item->id . '&catid=' . $item->catid; if ($item->language && $item->language !== '*' && Multilanguage::isEnabled()) { $link .= '&lang=' . $item->language; @@ -55,7 +55,7 @@ public static function getAssociations($id = 0, $view = null) if ($view === 'category' || $view === 'categories') { - return self::getCategoryAssociations($id, 'com_helloworld'); + return self::getCategoryAssociations($id, 'com_qwhelloworld'); } return array(); diff --git a/site/helpers/category.php b/site/helpers/category.php index b808430..9341168 100644 --- a/site/helpers/category.php +++ b/site/helpers/category.php @@ -1,19 +1,19 @@ id; - $url = Route::_("index.php?Itemid=$itemid&view=helloworld&format=json"); + $url = Route::_("index.php?Itemid=$itemid&view=project&format=json"); return $url; } else @@ -51,13 +51,13 @@ public static function getAjaxURL() } /** - * Helper function for generating the URL to a Helloworld page + * Helper function for generating the URL to a project page * This is needed for the Tags functionality */ - public static function getHelloworldRoute($id, $catid = 0, $language = 0) + public static function getQwhelloworldRoute($id, $catid = 0, $language = 0) { // Create the link - $link = 'index.php?option=com_helloworld&view=helloworld&id=' . $id; + $link = 'index.php?option=com_qwhelloworld&view=project&id=' . $id; if ((int) $catid > 1) { @@ -73,7 +73,7 @@ public static function getHelloworldRoute($id, $catid = 0, $language = 0) } /** - * Helper function for generating the URL to a Helloworld Category page + * Helper function for generating the URL to a Category page * This is needed for the Tags functionality */ public static function getCategoryRoute($catid, $language = 0) @@ -93,7 +93,7 @@ public static function getCategoryRoute($catid, $language = 0) } else { - $link = 'index.php?option=com_helloworld&view=category&id=' . $id; + $link = 'index.php?option=com_qwhelloworld&view=category&id=' . $id; if ($language && $language !== '*' && Multilanguage::isEnabled()) { diff --git a/site/language/en-GB/en-GB.com_helloworld.ini b/site/language/en-GB/en-GB.com_helloworld.ini deleted file mode 100644 index 2d37bca..0000000 --- a/site/language/en-GB/en-GB.com_helloworld.ini +++ /dev/null @@ -1,57 +0,0 @@ -; add new message form -COM_HELLOWORLD_LEGEND_DETAILS="New Helloworld Message Details" -COM_HELLOWORLD_HELLOWORLD_CREATING="Add message" -COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE="Sorry, you have an error" -COM_HELLOWORLD_HELLOWORLD_DETAILS="Message details" -COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL="Greeting" -COM_HELLOWORLD_HELLOWORLD_GREETING_DESC="Please specify the greeting to add" -COM_HELLOWORLD_HELLOWORLD_GREETING_HINT="Any characters allowed" -COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL="Category" -COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC="Please select the associated category" -COM_HELLOWORLD_HELLOWORLD_MESSAGE_LABEL="Reason" -COM_HELLOWORLD_HELLOWORLD_MESSAGE_DESC="Please say why you're adding this greeting" -COM_HELLOWORLD_HELLOWORLD_MESSAGE_HINT="No HTML tags!" -COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_LABEL="Spam protection" -COM_HELLOWORLD_HELLOWORLD_FIELD_CAPTCHA_DESC="Prove you're a real person!" -COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL="Display category or not?" -COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC="Select if you want the category displayed too" -COM_HELLOWORLD_HELLOWORLD_IMAGE_LABEL="Image information" -COM_HELLOWORLD_HELLOWORLD_PICTURE_LABEL="Image file to upload" -COM_HELLOWORLD_HELLOWORLD_PICTURE_DESC="Select the file with the image to upload" -COM_HELLOWORLD_HELLOWORLD_CAPTION_LABEL="Caption" -COM_HELLOWORLD_HELLOWORLD_CAPTION_DESC="Text to use as a caption for the image" -COM_HELLOWORLD_HELLOWORLD_ALTTEXT_LABEL="Alt text" -COM_HELLOWORLD_HELLOWORLD_ALTTEXT_DESC="Text to display if image cannot be shown" -COM_HELLOWORLD_HELLOWORLD_FIELD_PARENT_LABEL="Parent" -COM_HELLOWORLD_HELLOWORLD_FIELD_PARENT_DESC="Select the record which is to be the parent" -; save and cancel confirmation messages -COM_HELLOWORLD_ADD_SUCCESSFUL="New greeting successfully saved" -COM_HELLOWORLD_ADD_CANCELLED="New greeting cancelled ok" -; file upload error conditions -COM_HELLOWORLD_ERROR_FILEUPLOAD="PHP Error %s encountered when uploading file" -COM_HELLOWORLD_ERROR_FILETOOLARGE="Upload file exceeds max size configured in Joomla" -COM_HELLOWORLD_ERROR_BADFILENAME="Upload file has an invalid filename" -COM_HELLOWORLD_ERROR_FILE_EXISTS="Upload file already exists" -COM_HELLOWORLD_ERROR_UNABLE_TO_UPLOAD_FILE="Error creating uploaded file" -; helloworld greeting page -COM_HELLOWORLD_PARENT="Parent" -COM_HELLOWORLD_CHILDREN="Children" -COM_HELLOWORLD_SEARCH_HERE_BUTTON="Search here" -; Ajax handling errors -COM_HELLOWORLD_ERROR_NO_RECORDS="Didn't get any records" -COM_HELLOWORLD_ERROR_NO_MAP_BOUNDS="Error: no map bounds" -; category view, search and ordering fields and headings -COM_HELLOWORLD_SORT_BY="Sort by ..." -COM_HELLOWORLD_ORDERING_ASC="Ordering asc" -COM_HELLOWORLD_ORDERING_DESC="Ordering desc" -COM_HELLOWORLD_GREETING_ASC="Greeting asc" -COM_HELLOWORLD_GREETING_DESC="Greeting desc" -COM_HELLOWORLD_ID_ASC="id asc" -COM_HELLOWORLD_ID_DESC="id desc" -COM_HELLOWORLD_ALIAS_ASC="alias asc" -COM_HELLOWORLD_ALIAS_DESC="alias desc" -COM_HELLOWORLD_HELLOWORLD_ALIAS_LABEL="Alias" -COM_HELLOWORLD_HELLOWORLD_FIELD_URL_LABEL="URL" -COM_HELLOWORLD_HEADER_SUBCATEGORIES="Subcategories" -; Access errors -COM_HELLOWORLD_MUST_LOGIN="You must login before trying to view this item" \ No newline at end of file diff --git a/site/language/en-GB/en-GB.com_qwhelloworld.ini b/site/language/en-GB/en-GB.com_qwhelloworld.ini new file mode 100644 index 0000000..bc740b3 --- /dev/null +++ b/site/language/en-GB/en-GB.com_qwhelloworld.ini @@ -0,0 +1,57 @@ +; add new message form +COM_QWHELLOWORLD_LEGEND_DETAILS="New QWHelloWorld Project Details" +COM_QWHELLOWORLD_PROJECT_CREATING="Add project" +COM_QWHELLOWORLD_PROJECT_ERROR_UNACCEPTABLE="Sorry, you have an error" +COM_QWHELLOWORLD_PROJECT_DETAILS="Project details" +COM_QWHELLOWORLD_PROJECT_TITLE_LABEL="Title" +COM_QWHELLOWORLD_PROJECT_TITLE_DESC="Specify the title for the project" +COM_QWHELLOWORLD_PROJECT_TITLE_HINT="Any characters allowed" +COM_QWHELLOWORLD_PROJECT_FIELD_CATID_LABEL="Category" +COM_QWHELLOWORLD_PROJECT_FIELD_CATID_DESC="Please select the associated category" +COM_QWHELLOWORLD_PROJECT_MESSAGE_LABEL="Reason" +COM_QWHELLOWORLD_PROJECT_MESSAGE_DESC="Please say why you're adding this project" +COM_QWHELLOWORLD_PROJECT_MESSAGE_HINT="No HTML tags!" +COM_QWHELLOWORLD_PROJECT_FIELD_CAPTCHA_LABEL="Spam protection" +COM_QWHELLOWORLD_PROJECT_FIELD_CAPTCHA_DESC="Prove you're a real person!" +COM_QWHELLOWORLD_PROJECT_FIELD_SHOW_CATEGORY_LABEL="Display category or not?" +COM_QWHELLOWORLD_PROJECT_FIELD_SHOW_CATEGORY_DESC="Select if you want the category displayed too" +COM_QWHELLOWORLD_PROJECT_IMAGE_LABEL="Image information" +COM_QWHELLOWORLD_PROJECT_PICTURE_LABEL="Image file to upload" +COM_QWHELLOWORLD_PROJECT_PICTURE_DESC="Select the file with the image to upload" +COM_QWHELLOWORLD_PROJECT_CAPTION_LABEL="Caption" +COM_QWHELLOWORLD_PROJECT_CAPTION_DESC="Text to use as a caption for the image" +COM_QWHELLOWORLD_PROJECT_ALTTEXT_LABEL="Alt text" +COM_QWHELLOWORLD_PROJECT_ALTTEXT_DESC="Text to display if image cannot be shown" +COM_QWHELLOWORLD_PROJECT_FIELD_PARENT_LABEL="Parent" +COM_QWHELLOWORLD_PROJECT_FIELD_PARENT_DESC="Select the record which is to be the parent" +; save and cancel confirmation messages +COM_QWHELLOWORLD_ADD_SUCCESSFUL="New project successfully saved" +COM_QWHELLOWORLD_ADD_CANCELLED="New project cancelled ok" +; file upload error conditions +COM_QWHELLOWORLD_ERROR_FILEUPLOAD="PHP Error %s encountered when uploading file" +COM_QWHELLOWORLD_ERROR_FILETOOLARGE="Upload file exceeds max size configured in Joomla" +COM_QWHELLOWORLD_ERROR_BADFILENAME="Upload file has an invalid filename" +COM_QWHELLOWORLD_ERROR_FILE_EXISTS="Upload file already exists" +COM_QWHELLOWORLD_ERROR_UNABLE_TO_UPLOAD_FILE="Error creating uploaded file" +; Project page +COM_QWHELLOWORLD_PARENT="Parent" +COM_QWHELLOWORLD_CHILDREN="Children" +COM_QWHELLOWORLD_SEARCH_HERE_BUTTON="Search here" +; Ajax handling errors +COM_QWHELLOWORLD_ERROR_NO_RECORDS="Didn't get any records" +COM_QWHELLOWORLD_ERROR_NO_MAP_BOUNDS="Error: no map bounds" +; category view, search and ordering fields and headings +COM_QWHELLOWORLD_SORT_BY="Sort by ..." +COM_QWHELLOWORLD_ORDERING_ASC="Ordering asc" +COM_QWHELLOWORLD_ORDERING_DESC="Ordering desc" +COM_QWHELLOWORLD_TITLE_ASC="title asc" +COM_QWHELLOWORLD_TITLE_DESC="Title desc" +COM_QWHELLOWORLD_ID_ASC="id asc" +COM_QWHELLOWORLD_ID_DESC="id desc" +COM_QWHELLOWORLD_ALIAS_ASC="alias asc" +COM_QWHELLOWORLD_ALIAS_DESC="alias desc" +COM_QWHELLOWORLD_PROJECT_ALIAS_LABEL="Alias" +COM_QWHELLOWORLD_PROJECT_FIELD_URL_LABEL="URL" +COM_QWHELLOWORLD_HEADER_SUBCATEGORIES="Subcategories" +; Access errors +COM_QWHELLOWORLD_MUST_LOGIN="You must login before trying to view this item" \ No newline at end of file diff --git a/site/models/category.php b/site/models/category.php index e7eb77c..95fd597 100644 --- a/site/models/category.php +++ b/site/models/category.php @@ -1,6 +1,6 @@ getQuery(true); $catid = $this->getState('category.id'); - $query->select('id, greeting, alias, catid, access, description, image') - ->from($db->quoteName('#__helloworld')) + $query->select('id, title, alias, catid, access, description, image') + ->from($db->quoteName('#__com_qwhelloworld')) ->where('catid = ' . $catid); if (Multilanguage::isEnabled()) @@ -65,7 +65,7 @@ protected function getListQuery() public function getCategoryName() { $catid = $this->getState('category.id'); - $categories = Categories::getInstance('Helloworld', array('access' => false)); + $categories = Categories::getInstance('Qwhelloworld', array('access' => false)); $categoryNode = $categories->get($catid); return $categoryNode->title; } @@ -73,7 +73,7 @@ public function getCategoryName() public function getSubcategories() { $catid = $this->getState('category.id'); - $categories = Categories::getInstance('Helloworld', array('access' => false)); + $categories = Categories::getInstance('Qwhelloworld', array('access' => false)); $categoryNode = $categories->get($catid); $subcats = $categoryNode->getChildren(); @@ -97,7 +97,7 @@ public function getSubcategories() public function getCategoryAccess() { $catid = $this->getState('category.id'); - $categories = Categories::getInstance('Helloworld', array('access' => false)); + $categories = Categories::getInstance('Qwhelloworld', array('access' => false)); $categoryNode = $categories->get($catid); return $categoryNode->access; } @@ -153,7 +153,7 @@ public function getItems() public function getCategory() { - $categories = Categories::getInstance('Helloworld', array()); + $categories = Categories::getInstance('Qwhelloworld', array()); $category = $categories->get($this->getState('category.id', 'root')); return $category; } diff --git a/site/models/form.php b/site/models/form.php index c3db78e..31836ab 100644 --- a/site/models/form.php +++ b/site/models/form.php @@ -1,7 +1,7 @@ loadForm( - 'com_helloworld.form', + 'com_qwhelloworld.form', 'add-form', array( 'control' => 'jform', @@ -83,7 +83,7 @@ protected function loadFormData() { // Check the session for previously entered form data. $data = Factory::getApplication()->getUserState( - 'com_helloworld.edit.helloworld.data', + 'com_qwhelloworld.edit.project.data', array() ); @@ -92,17 +92,17 @@ protected function loadFormData() /** * Method to get the script that have to be included on the form - * This returns the script associated with helloworld field greeting validation + * This returns the script associated with project field title validation * * @return string Script files */ public function getScript() { - return 'administrator/components/com_helloworld/models/forms/helloworld.js'; + return 'administrator/components/com_qwhelloworld/models/forms/project.js'; } /** - * Prepare a helloworld record for saving in the database + * Prepare a project record for saving in the database */ protected function prepareTable($table) { @@ -110,6 +110,6 @@ protected function prepareTable($table) protected function cleanCache($group = null, $client_id = 0) { - parent::cleanCache('com_helloworld'); + parent::cleanCache('com_qwhelloworld'); } } \ No newline at end of file diff --git a/site/models/forms/add-form.xml b/site/models/forms/add-form.xml index f5dd8b0..fdb7009 100644 --- a/site/models/forms/add-form.xml +++ b/site/models/forms/add-form.xml @@ -1,26 +1,26 @@
- + @@ -64,8 +64,8 @@ @@ -91,17 +91,17 @@ type="textarea" rows="5" cols="80" - label="COM_HELLOWORLD_HELLOWORLD_MESSAGE_LABEL" - description="COM_HELLOWORLD_HELLOWORLD_MESSAGE_DESC" - hint="COM_HELLOWORLD_HELLOWORLD_MESSAGE_HINT" + label="COM_QWHELLOWORLD_PROJECT_MESSAGE_LABEL" + description="COM_QWHELLOWORLD_PROJECT_MESSAGE_DESC" + hint="COM_QWHELLOWORLD_PROJECT_MESSAGE_HINT" required="true" > @@ -109,8 +109,8 @@ @@ -120,9 +120,9 @@ diff --git a/site/models/forms/filter_category.xml b/site/models/forms/filter_category.xml index 2c5cfc0..1828b5f 100644 --- a/site/models/forms/filter_category.xml +++ b/site/models/forms/filter_category.xml @@ -7,15 +7,15 @@ onchange="this.form.submit();" default="lft ASC" > - - - - - - - - - + + + + + + + + + getState('message.id') : $id; $db = Factory::getDbo(); $query = $db->getQuery(true); - $query->select('h.greeting, h.params, h.image as image, c.title as category, c.access as catAccess, + $query->select('h.title, h.params, h.image as image, c.title as category, c.access as catAccess, h.latitude as latitude, h.longitude as longitude, h.access as access, h.id as id, h.alias as alias, h.catid as catid, h.parent_id as parent_id, h.level as level, h.description as description') - ->from('#__helloworld as h') + ->from('#__com_qwhelloworld as h') ->leftJoin('#__categories as c ON h.catid=c.id') ->where('h.id=' . (int)$id); @@ -135,7 +135,7 @@ public function getItem($id = null) } else { - throw new Exception('Helloworld id not found', 404); + throw new Exception('Project id not found', 404); } } return $this->item; @@ -145,19 +145,19 @@ public function getMapParams() { if ($this->item) { - $url = HelloworldHelperRoute::getAjaxURL(); + $url = QwhelloworldHelperRoute::getAjaxURL(); $this->mapParams = array( 'latitude' => $this->item->latitude, 'longitude' => $this->item->longitude, 'zoom' => 10, - 'greeting' => $this->item->greeting, + 'title' => $this->item->title, 'ajaxurl' => $url ); return $this->mapParams; } else { - throw new Exception('No helloworld details available for map', 500); + throw new Exception('No project details available for map', 500); } } @@ -174,7 +174,7 @@ public function getMapSearchResults($mapbounds) $lang = Factory::getLanguage()->getTag(); $cacheId .= $lang; } - $cache = Factory::getCache('com_helloworld', 'callback'); + $cache = Factory::getCache('com_qwhelloworld', 'callback'); $results = $cache->get(array($this, '_getMapSearchResults'), array($mapbounds), md5($cacheId), false); return $results; } @@ -190,8 +190,8 @@ public function _getMapSearchResults($mapbounds) { $db = Factory::getDbo(); $query = $db->getQuery(true); - $query->select('h.id, h.alias, h.catid, h.greeting, h.latitude, h.longitude, h.access') - ->from('#__helloworld as h') + $query->select('h.id, h.alias, h.catid, h.title, h.latitude, h.longitude, h.access') + ->from('#__com_qwhelloworld as h') ->where('h.latitude > ' . $mapbounds['minlat'] . ' AND h.latitude < ' . $mapbounds['maxlat'] . ' AND h.longitude > ' . $mapbounds['minlng'] . @@ -234,7 +234,7 @@ public function _getMapSearchResults($mapbounds) for ($i = 0; $i < count($results); $i++) { - $results[$i]->url = Route::_('index.php?option=com_helloworld&view=helloworld&id=' . $results[$i]->id . + $results[$i]->url = Route::_('index.php?option=com_qwhelloworld&view=project&id=' . $results[$i]->id . ":" . $results[$i]->alias . '&catid=' . $results[$i]->catid . $query_lang); } diff --git a/site/helloworld.php b/site/qwhelloworld.php similarity index 75% rename from site/helloworld.php rename to site/qwhelloworld.php index 9dc6583..4ba00f3 100644 --- a/site/helloworld.php +++ b/site/qwhelloworld.php @@ -1,7 +1,7 @@ input; diff --git a/site/router.php b/site/router.php index a7754b3..c8782f6 100644 --- a/site/router.php +++ b/site/router.php @@ -8,7 +8,7 @@ use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Multilanguage; -class HelloworldRouter implements RouterInterface +class QwhelloworldRouter implements RouterInterface { public function build(&$query) @@ -35,7 +35,7 @@ public function build(&$query) { // We're on the /message menuitem. // Check we've got the right parameters then set url segment = id : alias - if ($query['view'] == "helloworld" && isset($query['id'])) + if ($query['view'] == "project" && isset($query['id'])) { // we'll support the passed id being in the form id:alias $segments[] = $query['id']; @@ -57,7 +57,7 @@ public function build(&$query) unset($query['id']); } } - elseif ($query['view'] == "helloworld" && isset($query['catid']) && isset($query['id'])) + elseif ($query['view'] == "project" && isset($query['catid']) && isset($query['id'])) { // set this part of the url to be of the form /subcat1/subcat2/.../hello-world $pathSegments = $this->getCategorySegments($query['catid']); @@ -85,7 +85,7 @@ public function build(&$query) private function getCategorySegments($catid) { - $categories = Categories::getInstance('Helloworld', array()); + $categories = Categories::getInstance('Qwhelloworld', array()); $categoryNode = $categories->get($catid); if ($categoryNode) { @@ -110,22 +110,22 @@ public function parse(&$segments) if (isset($activeMenuitem) && $activeMenuitem->note == "Ajax") { - // Expect 1 segment of the form id:alias for the helloworld record + // Expect 1 segment of the form id:alias for the project record if ($nSegments == 1) { $vars['id'] = $segments[0]; - $vars['view'] = 'helloworld'; + $vars['view'] = 'project'; } } else { // Try to match the categories in the segments, starting at the root - $categories = Categories::getInstance('Helloworld', array()); + $categories = Categories::getInstance('Qwhelloworld', array()); $matchingCategory = $categories->get('root'); // Go through the category tree, try to get a match between each segment // and the id:alias of one of the children - // The last segment may be a category id:alias or a helloworld record id:alias + // The last segment may be a category id:alias or a project record id:alias for ($i=0; $i < $nSegments; $i++) { $children = $matchingCategory->getChildren(); @@ -144,7 +144,7 @@ public function parse(&$segments) if ($i == $nSegments - 1) // all but last segment are categories { $vars['id'] = $segments[$i]; - $vars['view'] = 'helloworld'; + $vars['view'] = 'project'; } else // something went wrong - didn't get a match at this level { diff --git a/site/views/category/tmpl/default.php b/site/views/category/tmpl/default.php index 7823877..3f67e36 100644 --- a/site/views/category/tmpl/default.php +++ b/site/views/category/tmpl/default.php @@ -1,6 +1,6 @@
- + - + - + @@ -69,14 +69,14 @@ items as $i => $row) : if (isset($row->canAccess) && !$row->canAccess) : ?>
greeting . " - " . Text::_('COM_HELLOWORLD_MUST_LOGIN'); ?>title . " - " . Text::_('COM_QWHELLOWORLD_MUST_LOGIN'); ?>
pagination->getRowOffset($i); ?>greeting; ?>title; ?> alias; ?> id; ?>
-

+

subcategories as $subcategory) : ?>

title; ?>

description; ?>

diff --git a/site/views/category/tmpl/default.xml b/site/views/category/tmpl/default.xml index a169429..90a7707 100644 --- a/site/views/category/tmpl/default.xml +++ b/site/views/category/tmpl/default.xml @@ -1,22 +1,22 @@ - + - +
diff --git a/site/views/category/view.feed.php b/site/views/category/view.feed.php index 67856d5..6a7690e 100644 --- a/site/views/category/view.feed.php +++ b/site/views/category/view.feed.php @@ -1,6 +1,6 @@ form->getFieldsets('com_fields'); ?> -
- +
form->renderFieldset('details'); ?> @@ -42,12 +42,12 @@ ?>
-
-
diff --git a/site/views/form/tmpl/edit.xml b/site/views/form/tmpl/edit.xml index 4c8fbbc..c690b1d 100644 --- a/site/views/form/tmpl/edit.xml +++ b/site/views/form/tmpl/edit.xml @@ -1,6 +1,6 @@ - - COM_HELLOWORLD_ADD_VIEW_DESC + + COM_QWHELLOWORLD_ADD_VIEW_DESC \ No newline at end of file diff --git a/site/views/form/view.html.php b/site/views/form/view.html.php index 045a960..0bad589 100644 --- a/site/views/form/view.html.php +++ b/site/views/form/view.html.php @@ -1,7 +1,7 @@ form->setFieldAttribute('language', 'default', $lang); } - // Check that the user has permissions to create a new helloworld record - $this->canDo = ContentHelper::getActions('com_helloworld'); + // Check that the user has permissions to create a new project record + $this->canDo = ContentHelper::getActions('com_qwhelloworld'); if (!($this->canDo->get('core.create'))) { $app = Factory::getApplication(); @@ -80,10 +80,10 @@ public function display($tpl = null) protected function setDocument() { $document = Factory::getDocument(); - $document->setTitle(Text::_('COM_HELLOWORLD_HELLOWORLD_CREATING')); + $document->setTitle(Text::_('COM_QWHELLOWORLD_PROJECT_CREATING')); $document->addScript(Uri::root() . $this->script); - $document->addScript(Uri::root() . "/administrator/components/com_helloworld" - . "/views/helloworld/submitbutton.js"); - Text::script('COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE'); + $document->addScript(Uri::root() . "/administrator/components/com_qwhelloworld" + . "/views/project/submitbutton.js"); + Text::script('COM_QWHELLOWORLD_PROJECT_ERROR_UNACCEPTABLE'); } } \ No newline at end of file diff --git a/site/views/helloworld/tmpl/default.xml b/site/views/helloworld/tmpl/default.xml deleted file mode 100644 index 666d898..0000000 --- a/site/views/helloworld/tmpl/default.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC - - -
- -
-
-
\ No newline at end of file diff --git a/site/views/helloworld/index.html b/site/views/project/index.html similarity index 100% rename from site/views/helloworld/index.html rename to site/views/project/index.html diff --git a/site/views/helloworld/tmpl/default.php b/site/views/project/tmpl/default.php similarity index 72% rename from site/views/helloworld/tmpl/default.php rename to site/views/project/tmpl/default.php index 5bf891e..ba92c6c 100644 --- a/site/views/helloworld/tmpl/default.php +++ b/site/views/project/tmpl/default.php @@ -1,7 +1,7 @@ -

item->greeting.(($this->item->category and $this->item->params->get('show_category')) +

item->title.(($this->item->category and $this->item->params->get('show_category')) ? (' ('.$this->item->category.')') : ''); ?>

parentItem->id > 1) : ?> -

+

- parentItem->id . ':' . $this->parentItem->alias . '&catid=' . $this->parentItem->catid . $query_lang); ?> - parentItem->greeting; ?> + parentItem->id . ':' . $this->parentItem->alias . '&catid=' . $this->parentItem->catid . $query_lang); ?> + parentItem->title; ?>

children) : $baseLevel = $this->item->level; ?> -

+

children as $i => $child) : ?>

$child->level - $baseLevel)); ?> - id . ':' . $child->alias . '&catid=' . $child->catid . $query_lang); ?> - greeting; ?> + id . ':' . $child->alias . '&catid=' . $child->catid . $query_lang); ?> + title; ?>

@@ -79,7 +79,7 @@ echo $this->item->afterDisplayContent; JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); - $fields = FieldsHelper::getFields('com_helloworld.helloworld', $this->item, true); + $fields = FieldsHelper::getFields('com_qwhelloworld.project', $this->item, true); echo "

Fields set to not display automatically:

"; foreach ($fields as $field) { @@ -91,11 +91,11 @@ } ?>
-
+
'; ?>
diff --git a/site/views/project/tmpl/default.xml b/site/views/project/tmpl/default.xml new file mode 100644 index 0000000..d1142be --- /dev/null +++ b/site/views/project/tmpl/default.xml @@ -0,0 +1,20 @@ + + + + COM_QWHELLOWORLD_PROJECT_VIEW_DEFAULT_DESC + + +
+ +
+
+
\ No newline at end of file diff --git a/site/views/helloworld/tmpl/index.html b/site/views/project/tmpl/index.html similarity index 100% rename from site/views/helloworld/tmpl/index.html rename to site/views/project/tmpl/index.html diff --git a/site/views/helloworld/view.html.php b/site/views/project/view.html.php similarity index 77% rename from site/views/helloworld/view.html.php rename to site/views/project/view.html.php index 55a03d2..4e3b9ea 100644 --- a/site/views/helloworld/view.html.php +++ b/site/views/project/view.html.php @@ -1,7 +1,7 @@ item; $item->text = null; - $dispatcher->trigger('onContentPrepare', array ('com_helloworld.helloworld', &$item, &$item->params, null)); + $dispatcher->trigger('onContentPrepare', array ('com_qwhelloworld.project', &$item, &$item->params, null)); - $results = $dispatcher->trigger('onContentAfterTitle', array('com_helloworld.helloworld', &$item, &$item->params, null)); + $results = $dispatcher->trigger('onContentAfterTitle', array('com_qwhelloworld.project', &$item, &$item->params, null)); $item->afterDisplayTitle = trim(implode("\n", $results)); - $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_helloworld.helloworld', &$item, &$item->params, null)); + $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_qwhelloworld.project', &$item, &$item->params, null)); $item->beforeDisplayContent = trim(implode("\n", $results)); - $results = $dispatcher->trigger('onContentAfterDisplay', array('com_helloworld.helloworld', &$item, &$item->params, null)); + $results = $dispatcher->trigger('onContentAfterDisplay', array('com_qwhelloworld.project', &$item, &$item->params, null)); $item->afterDisplayContent = trim(implode("\n", $results)); // Check for errors. @@ -80,7 +80,7 @@ function display($tpl = null) { $return = base64_encode(Uri::getInstance()); $login_url_with_return = Route::_('index.php?option=com_users&return=' . $return, false); - $app->enqueueMessage(Text::_('COM_HELLOWORLD_MUST_LOGIN'), 'notice'); + $app->enqueueMessage(Text::_('COM_QWHELLOWORLD_MUST_LOGIN'), 'notice'); $app->redirect($login_url_with_return, 403); } } @@ -88,7 +88,7 @@ function display($tpl = null) $this->addMap(); $tagsHelper = new TagsHelper; - $this->item->tags = $tagsHelper->getItemTags('com_helloworld.helloworld' , $this->item->id); + $this->item->tags = $tagsHelper->getItemTags('com_qwhelloworld.project' , $this->item->id); $model = $this->getModel(); $this->parentItem = $model->getItem($this->item->parent_id); @@ -112,8 +112,8 @@ function addMap() $document->addStyleSheet("https://cdnjs.cloudflare.com/ajax/libs/openlayers/4.6.4/ol.css"); // ... and our own JS and CSS - $document->addScript(Uri::root() . "media/com_helloworld/js/openstreetmap.js"); - $document->addStyleSheet(Uri::root() . "media/com_helloworld/css/openstreetmap.css"); + $document->addScript(Uri::root() . "media/com_qwhelloworld/js/openstreetmap.js"); + $document->addStyleSheet(Uri::root() . "media/com_qwhelloworld/css/openstreetmap.css"); // get the data to pass to our JS code $params = $this->get("mapParams"); diff --git a/site/views/helloworld/view.json.php b/site/views/project/view.json.php similarity index 74% rename from site/views/helloworld/view.json.php rename to site/views/project/view.json.php index dd98a32..dc43491 100644 --- a/site/views/helloworld/view.json.php +++ b/site/views/project/view.json.php @@ -12,10 +12,10 @@ use Joomla\CMS\MVC\View\HtmlView; use Joomla\CMS\Response\JsonResponse; -class HelloWorldViewHelloWorld extends HtmlView +class QwhelloworldViewProject extends HtmlView { /** - * This display function returns in json format the Helloworld greetings + * This display function returns in json format the Project titles * found within the latitude and longitude boundaries of the map. * These bounds are provided in the parameters * minlat, minlng, maxlat, maxlng @@ -35,13 +35,13 @@ function display($tpl = null) } else { - echo new JsonResponse(null, Text::_('COM_HELLOWORLD_ERROR_NO_RECORDS'), true); + echo new JsonResponse(null, Text::_('COM_QWHELLOWORLD_ERROR_NO_RECORDS'), true); } } else { $records = array(); - echo new JsonResponse(null, Text::_('COM_HELLOWORLD_ERROR_NO_MAP_BOUNDS'), true); + echo new JsonResponse(null, Text::_('COM_QWHELLOWORLD_ERROR_NO_MAP_BOUNDS'), true); } } } \ No newline at end of file