Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Translation and code style work.

  • Loading branch information...
commit 36786fe6d1aff03d5ef69d25d946c12e9d901cff 1 parent dd8f152
@realityking authored
View
1  .gitignore
@@ -0,0 +1 @@
+.DS_Store
View
BIN  admin/.DS_Store
Binary file not shown
View
6 admin/controllers/entry.php
@@ -103,7 +103,7 @@ function remove()
//Load model and delete entry - redirect afterwards
$model = $this->getModel( 'entry' );
if (!$model->delete()) {
- $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_NOT_DELETED');
+ $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_DELETED');
$type = 'error';
} else {
$msg = JText::_('COM_HELPDESK_ENTRY_DELETED');
@@ -120,7 +120,7 @@ function publish()
$msg = JText::_('COM_HELPDESK_ENTRY_PUBLISHED');
$type = 'message';
} else {
- $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_NOT_PUBLISHED')." - " .$model->getError();
+ $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS')." - " .$model->getError();
$type = 'error';
}
$this->setRedirect( JRoute::_('index.php?option=com_helpdesk', false), $msg, $type );
@@ -130,7 +130,7 @@ function unpublish()
{
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = $this->getModel('entry');
- if($model->publish(0)) {
+ if ($model->publish(0)) {
$msg = JText::_('COM_HELPDESK_ENTRY_UNPUBLISHED');
$type = 'message';
} else {
View
BIN  admin/images/.DS_Store
Binary file not shown
View
BIN  admin/language/.DS_Store
Binary file not shown
View
6 admin/language/en-GB.com_helpdesk.ini
@@ -27,14 +27,14 @@ COM_HELPDESK_MANAGER_ENTRY="Entry"
COM_HELPDESK_DECLINE_MAIL_SENT="Decline mail was sent"
COM_HELPDESK_ERROR_SAVING_ENTRY="Error saving entry"
-COM_HELPDESK_ENTRY_DELETED="Entry Deleted"
+COM_HELPDESK_ENTRY_DELETED="Entry deleted"
COM_HELPDESK_ENTRY_PUBLISHED="Entry published"
COM_HELPDESK_ENTRY_UNPUBLISHED="Entry unpublished"
-COM_HELPDESK_ERROR_ENTRY_NOT_DELETED="Error: Entry could not be deleted"
+COM_HELPDESK_ERROR_ENTRY_DELETED="Error: Entry could not be deleted"
COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS="Error: Could not change publish status"
COM_HELPDESK_ENTRY_DECLINED_MAIL_SUBJECT="Helpdesk entry was declined"
-COM_HELPDESK_ENTRY_DECLINED_MAIL_BODY="Yours helpdeskentry was declined"
+COM_HELPDESK_ENTRY_DECLINED_MAIL_BODY="Your helpdeskentry was declined"
COM_HELPDESK_CONFIGURATION="Helpdesk Configuration"
COM_HELPDESK_CONFIG_GENERAL_SETTINGS_LABEL="General"
View
BIN  admin/models/.DS_Store
Binary file not shown
View
12 admin/models/entry.php
@@ -34,11 +34,11 @@ function __construct()
/**
* Method to set the entry identifier
*
- * @access public
* @param int Entry identifier
+ *
* @return void
*/
- function setId($id)
+ public function setId($id)
{
// Set id and wipe data
$this->_id = $id;
@@ -47,6 +47,7 @@ function setId($id)
/**
* Method to get a entry
+ *
* @return object with data
*/
function getData()
@@ -69,10 +70,9 @@ function getData()
/**
* Method to store a record
*
- * @access public
* @return boolean True on success
*/
- function store()
+ public function store()
{
$row =& $this->getTable();
$data = JRequest::get('post');
@@ -98,7 +98,7 @@ function store()
return true;
}
- function delete()
+ public function delete()
{
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$row =& $this->getTable();
@@ -114,7 +114,7 @@ function delete()
}
// Publishes an entry or unpublishes it
- function publish($state)
+ public function publish($state)
{
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$row =& $this->getTable();
View
2  admin/models/forms/entry.xml
@@ -21,7 +21,7 @@
description="COM_HELPDESK_EMAIL_DESC" size="30"
required="true" />
- <field name="published" type="list" label="JGLOBAL_STATE"
+ <field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
filter="intval" size="1" default="0">
<option value="1">JPUBLISHED</option>
View
10 admin/models/helpdesk.php
@@ -49,7 +49,7 @@ function __construct()
* Returns the query
* @return string The query to be used to retrieve the rows from the database
*/
- function _buildQuery()
+ private function _buildQuery()
{
$query = "SELECT * FROM #__helpdesk"
. " ORDER BY hdate DESC";
@@ -59,9 +59,10 @@ function _buildQuery()
/**
* Retrieves the helpdesk entrys
+ *
* @return array Array of objects containing the data from the database
*/
- function getData()
+ public function getData()
{
// Lets load the data if it doesn't already exist
if (empty( $this->_data )) {
@@ -72,7 +73,7 @@ function getData()
return $this->_data;
}
- function getPagination()
+ public function getPagination()
{
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
@@ -83,9 +84,10 @@ function getPagination()
}
/**
* Retrieves the count of helpdesk entrys
+ *
* @return array Array of objects containing the data from the database
*/
- function getTotal()
+ public function getTotal()
{
if (empty($this->_total)) {
$query = $this->_buildQuery();
View
BIN  admin/views/.DS_Store
Binary file not shown
View
BIN  admin/views/entry/.DS_Store
Binary file not shown
View
BIN  admin/views/entry/tmpl/.DS_Store
Binary file not shown
View
BIN  admin/views/helpdesk/.DS_Store
Binary file not shown
View
BIN  media/.DS_Store
Binary file not shown
View
BIN  media/css/.DS_Store
Binary file not shown
View
BIN  media/images/.DS_Store
Binary file not shown
View
BIN  site/.DS_Store
Binary file not shown
View
56 site/controllers/entry.php
@@ -92,15 +92,15 @@ function save()
$upload_maxsize = $params->get('file_size', '10000000');
if ((!$id && $canAdd) || ($id && $canEdit)) {
- $model = $this->getModel( 'entry' );
+ $model = $this->getModel('entry');
if ($model->store()) {
//Set redirection options
if ($params->get('default_published', true)) {
- $msg .= JText::_( 'Entry Saved' );
+ $msg .= JText::_('COM_HELPDESK_ENTRY_SAVED');
$type = 'message';
} else {
- $msg .= JText::_( 'Entry saved but has to be approved');
+ $msg .= JText::_('COM_HELPDESK_ENTRY_NEEDS_APPROVAL');
$type = 'notice';
}
$link = JRoute::_( 'index.php?option=com_helpdesk&view=helpdesk', false );
@@ -125,7 +125,8 @@ function save()
$upload_base = str_replace(" ", "_", $base[0]);
$new_filename = $upload_location . $filename;
- while (file_exists($new_filename)) {
+ while (file_exists($new_filename))
+ {
$upload_base = $upload_base . "_" . $unique_suffix++;
$new_filename = $upload_location . $upload_base . $ext;
}
@@ -152,7 +153,7 @@ function save()
$db->query();
}
} else {
- $msg .= "<br />" . JText::sprintf('Error with upload', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
+ $msg .= "<br />" . JText::sprintf('COM_HELPDESK_ERROR_UPLOAD', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
$link = JRoute::_( 'index.php?option=com_helpdesk&controller=entry&task=add&retry=true', false );
$type = 'notice';
$ferror = true;
@@ -161,9 +162,9 @@ function save()
//Send information-mail to administrators
if ( (!$id AND $params->get('send_mail', true)) && (!$ferror) ) {
- $mail->setSubject( JTEXT::_( 'New Helpdesk entry' ) );
- $mail->setBody( JTEXT::sprintf( 'A new helpdeskentry has been written', $uri->base(), $name, $text ) );
- $mail->addBCC( $admins );
+ $mail->setSubject(JTEXT::_('COM_HELPDESK_ENTRY_NEW_MAIL_SUBJECT'));
+ $mail->setBody(JTEXT::sprintf('COM_HELPDESK_ENTRY_NEW_MAIL_BODY', $uri->base(), $name, $text));
+ $mail->addBCC($admins);
$mail->Send();
}
} else {
@@ -181,17 +182,17 @@ function save()
if (($filetypeok > 0) && ($filesize < $upload_maxsize)){
} else {
- $msg .= JText::sprintf('Error with upload', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
+ $msg .= JText::sprintf('COM_HELPDESK_ERROR_UPLOAD', $ext) . "<br />" . JText::_('Allowed types') . ": " . $upload_filetypes . "<br />" . JText::_('File max size') . " (kb): " . ($upload_maxsize / 1024)."<br />";
}
}
- $msg .= JText::_( 'Error: Please validate your inputs' );
- $link = JRoute::_( 'index.php?option=com_helpdesk&controller=entry&task=add&retry=true', false );
+ $msg .= JText::_('COM_HELPDESK_ERROR_VALIDATE_INPUTS');
+ $link = JRoute::_('index.php?option=com_helpdesk&controller=entry&task=add&retry=true', false );
$type = 'notice';
}
- $this->setRedirect( $link, $msg, $type );
+ $this->setRedirect($link, $msg, $type);
} else {
- JError::raiseError( 403, JText::_( 'ALERTNOTAUTH' ) );
+ JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
}
@@ -215,44 +216,45 @@ function comment()
function remove()
{
//Load model and delete entry - redirect afterwards
- $model = $this->getModel( 'entry' );
+ $model = $this->getModel('entry');
if(!$model->delete()) {
- $msg = JText::_( 'Error: Entry could not be deleted' );
+ $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_DELETED');
$type = 'error';
} else {
- $msg = JText::_( 'Entry Deleted' );
+ $msg = JText::_('COM_HELPDESK_ENTRY_DELETED');
$type = 'message';
}
$this->setRedirect( JRoute::_( 'index.php?option=com_helpdesk', false ), $msg, $type );
}
function publish() {
- $model = $this->getModel( 'entry' );
+ $model = $this->getModel('entry' ;
switch($model->publish()) {
- case -1: $msg = JText::_( 'Error: Could not change publish status' );
+ case -1: $msg = JText::_('COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS');
$type = 'error';
break;
- case 0: $msg = JText::_( 'Entry unpublished' );
+ case 0: $msg = JText::_('COM_HELPDESK_ENTRY_UNPUBLISHED');
$type = 'message';
break;
- case 1: $msg = JText::_( 'Entry published' );
+ case 1: $msg = JText::_('COM_HELPDESK_ENTRY_PUBLISHED');
$type = 'message';
break;
}
- $this->setRedirect( JRoute::_( 'index.php?option=com_helpdesk', false ), $msg, $type );
+ $this->setRedirect( JRoute::_('index.php?option=com_helpdesk', false), $msg, $type );
}
/**
* save a comment
- * @return void
- */
- function savecomment() {
- $model = $this->getModel( 'entry' );
+ * @return void
+ */
+ function savecomment()
+ {
+ $model = $this->getModel('entry');
if(!$model->savecomment()) {
- $msg = JText::_( 'Error: Could not save comment' );
+ $msg = JText::_('COM_HELPDESK_COMMENT_ERROR_NOT_SAVED');
$type = 'error';
} else {
- $msg = JText::_( 'Comment saved' );
+ $msg = JText::_('COM_HELPDESK_COMMENT_SAVED');
$type = 'message';
}
$this->setRedirect( JRoute::_( 'index.php?option=com_helpdesk', false ), $msg, $type );
View
3  site/helpers/helpdesk.php
@@ -10,7 +10,8 @@ class HelpdeskHelper {
/**
* Get the actions
*/
- public static function getActions() {
+ public static function getActions()
+ {
$user = JFactory::getUser();
$result = new JObject;
View
BIN  site/language/.DS_Store
Binary file not shown
View
18 site/language/en-GB.com_helpdesk.ini
@@ -6,4 +6,20 @@ COM_HELPDESK_DECLINED="Declined"
COM_HELPDESK_FINISHED="Finished"
COM_HELPDESK_IN_PROGRESS="Under progress"
COM_HELPDESK_NOT_IN_PROGRESS="Not in progress"
-COM_HELPDESK_ADMIN_COMMENT="Admin comment"
+COM_HELPDESK_ADMIN_COMMENT="Admin comment"
+
+COM_HELPDESK_ENTRY_NEEDS_APPROVAL="Entry saved but has to be approved"
+COM_HELPDESK_ENTRY_SAVED="Entry saved"
+COM_HELPDESK_ENTRY_DELETED="Entry deleted"
+COM_HELPDESK_ENTRY_PUBLISHED="Entry published"
+COM_HELPDESK_ENTRY_UNPUBLISHED="Entry unpublished"
+COM_HELPDESK_ERROR_ENTRY_DELETED="Error: Entry could not be deleted"
+COM_HELPDESK_ERROR_ENTRY_CHANGE_PUBLISH_STATUS="Error: Could not change publish status"
+COM_HELPDESK_ERROR_VALIDATE_INPUTS="Error: Please validate your inputs"
+COM_HELPDESK_ERROR_UPLOAD="Error with upload"
+
+COM_HELPDESK_ENTRY_NEW_MAIL_SUBJECT="New Helpdesk entry"
+COM_HELPDESK_ENTRY_NEW_MAIL_BODY="A new helpdeskentry has been written"
+
+COM_HELPDESK_COMMENT_SAVED="Comment saved"
+COM_HELPDESK_COMMENT_ERROR_NOT_SAVED="Error: Could not save comment"
View
22 site/models/entry.php
@@ -53,13 +53,13 @@ function getData()
$app = JFactory::getApplication();
$user =& JFactory::getUser();
- if( JRequest::getVar('retry') == 'true' ) {
+ if ( JRequest::getVar('retry') == 'true' ) {
$this->_data = $this->getTable();
$this->_data->bind($app->getUserState('eb_validation_data'));
}
// Load the data
- if(empty( $this->_data )) {
+ if (empty( $this->_data )) {
$query = ' SELECT * FROM #__helpdesk '.
' WHERE id = '.$this->_id;
$this->_db->setQuery( $query );
@@ -70,7 +70,7 @@ function getData()
$this->_data = $this->getTable();
$this->_data->id = 0;
//Insert name and email of the registred user
- if($user->get('id')) {
+ if ($user->get('id')) {
$this->_data->hname = $user->get('name');;
$this->_data->hmail = $user->get('email');;
}
@@ -96,10 +96,10 @@ function store()
$date =& JFactory::getDate();
// Set Default Values
- if(!$data['id']) {
+ if (!$data['id']) {
$data['hdate'] = $date->toMysql();
$data['published'] = $params->get('default_published', 1);
- if($params->get('enable_log', true)) {
+ if ($params->get('enable_log', true)) {
$data['hip'] = getenv('REMOTE_ADDR');
} else {
$data['hip'] = "0.0.0.0";
@@ -153,7 +153,8 @@ function publish()
return (int)!$status;
}
- function validate(&$data) {
+ function validate(&$data)
+ {
$app = JFactory::getApplication();
$params = &$app->getParams('com_helpdesk');
$user = &JFactory::getUser();
@@ -213,17 +214,18 @@ function validate(&$data) {
}
if ($error) {
- $app->setUserState( 'eb_validation_errors', $errors);
- $app->setUserState( 'eb_validation_data' , $data);
+ $app->setUserState('eb_validation_errors', $errors);
+ $app->setUserState('eb_validation_data' , $data);
return false;
} else {
return true;
}
}
- function savecomment() {
+ function savecomment()
+ {
$row =& $this->getTable();
- $data = JRequest::get( 'post' );
+ $data = JRequest::get('post');
// Bind the form fields to the table
if (!$row->bind($data)) {
View
31 site/router.php
@@ -8,26 +8,22 @@ function HelpdeskBuildRoute(&$query)
{
$segments = array();
- if(isset($query['controller']))
- {
+ if(isset($query['controller'])) {
$segments[] = $query['controller'];
unset($query['controller']);
}
- if(isset($query['task']))
- {
+ if(isset($query['task'])) {
$segments[] = $query['task'];
unset($query['task']);
};
- if(isset($query['cid']))
- {
+ if(isset($query['cid'])) {
$segments[] = $query['cid'];
unset($query['cid']);
};
- if(isset($query['view']))
- {
+ if(isset($query['view'])) {
if(!isset($query['Itemid'])) {
$segments[] = $query['view'];
}
@@ -44,52 +40,49 @@ function HelpdeskParseRoute($segments)
//Handle View and Identifier
- if ( $segments[0] == 'entry')
- {
- switch($segments[1])
- {
+ if ( $segments[0] == 'entry') {
+ switch($segments[1]) {
case 'add':
{
$vars['controller'] = 'entry';
$vars['task'] = 'add';
} break;
-
+
case 'remove':
{
$vars['controller'] = 'entry';
$vars['task'] = 'remove';
$vars['cid'] = $segments[2];
} break;
-
+
case 'publish':
{
$vars['controller'] = 'entry';
$vars['task'] = 'publish';
$vars['cid'] = $segments[2];
} break;
-
+
case 'unpublish':
{
$vars['controller'] = 'entry';
$vars['task'] = 'unpublish';
$vars['cid'] = $segments[2];
} break;
-
+
case 'edit':
{
$vars['controller'] = 'entry';
$vars['task'] = 'edit';
$vars['cid'] = $segments[2];
} break;
-
+
case 'comment':
{
$vars['controller'] = 'entry';
$vars['task'] = 'comment';
$vars['cid'] = $segments[2];
} break;
-
-
+
}
return $vars;
}
View
BIN  site/views/.DS_Store
Binary file not shown
View
BIN  site/views/entry/.DS_Store
Binary file not shown
View
BIN  site/views/entry/tmpl/.DS_Store
Binary file not shown
View
BIN  site/views/helpdesk/.DS_Store
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.