Skip to content

Commit

Permalink
Next beta (let's call it 2.3.7) - part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Heklaterriol committed Feb 3, 2023
1 parent 4bb8d75 commit 18ffd67
Show file tree
Hide file tree
Showing 20 changed files with 270 additions and 225 deletions.
6 changes: 4 additions & 2 deletions admin/controllers/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ protected function _formatcsvfield($type, $value)
case 'endtimes':
if ($value !== '' && strtoupper($value) !== 'NULL') {
$time = strtotime($value);
$field = strftime('%H:%M', $time);
// $field = strftime('%H:%M', $time);
$field = date('Y-m-d h:m:s',$time);
} else {
$field = null;
}
Expand All @@ -197,7 +198,8 @@ protected function _formatcsvfield($type, $value)
case 'recurrence_limit_date':
if ($value !== '' && strtoupper($value) !== 'NULL') {
$date = strtotime($value);
$field = strftime('%Y-%m-%d', $date);
// $field = strftime('%Y-%m-%d', $date);
$field = date('Y-m-d', $date);
} else {
$field = null;
}
Expand Down
10 changes: 7 additions & 3 deletions admin/controllers/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* @package JEM
*
*/
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

class JemControllerPlugins extends JControllerLegacy
{
/**
Expand All @@ -35,7 +38,7 @@ public function __construct()
*/
public function plugins()
{
$db = JFactory::getDBO();
$db = Factory::getDBO();

$query = $db->getQuery(true);
$query->select(array('count(*)'));
Expand All @@ -48,11 +51,12 @@ public function plugins()

//any plugins installed? if not redirect to installation screen
if ($total > 0){
$link = 'index.php?option=com_plugins&filter_search=jem';
// $link = 'index.php?option=com_plugins&filter_search=jem';
$link = 'index.php?option=com_plugins&filter[search]=jem';
$msg = "";
} else {
$link = 'index.php?option=com_installer';
$msg = JText::_("COM_JEM_PLUGINS_NOPLUGINSINSTALLED");
$msg = Text::_("COM_JEM_PLUGINS_NOPLUGINSINSTALLED");
}
$this->setRedirect($link, $msg);
}
Expand Down
32 changes: 21 additions & 11 deletions admin/helpers/html/jemhtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ static public function featured($i, $value = 0, $canChange = true)
$states = array(
0 => array(
'disabled.png',
'fa-star-o', //'fa-circle-o',
// 'fa-star-o', //'fa-circle-o',
'fas fa-star', //'fa-circle-o',
'events.featured',
'COM_JEM_EVENTS_UNFEATURED',
'COM_JEM_EVENTS_TOGGLE_TO_FEATURE'
Expand Down Expand Up @@ -178,7 +179,7 @@ static public function toggleAttendanceStatus($i, $value = 0, $canChange = true,
$states = array(
-99 => array( // fallback on wrong status value
'disabled.png',
'fa-circle-o',
'fa-circle',
'',
'COM_JEM_STATUS_UNKNOWN',
'COM_JEM_STATUS_UNKNOWN',
Expand Down Expand Up @@ -220,22 +221,22 @@ static public function toggleAttendanceStatus($i, $value = 0, $canChange = true,

$backend = (bool)Factory::getApplication()->isClient('administrator');
$state = \Joomla\Utilities\ArrayHelper::getValue($states, (int) $value, $states[-99]);

HTMLHelper::_('bootstrap.tooltip');
if (version_compare(JVERSION, '3.3', 'lt')) {
// on Joomla! 2.5/3.2 we use good old tooltips
// HTMLHelper::_('behavior.tooltip');
$attr = 'class="hasTip" title="'.Text::_('COM_JEM_STATUS').'::'.Text::_($state[$canChange ? 4 : 3]).'"';
// HTMLHelper::_('behavior.tooltip');

$attr = 'class="hasTip" data-bs-toggle="tooltip" title="'.Text::_('COM_JEM_STATUS').'::'.Text::_($state[$canChange ? 4 : 3]).'"';
} else {
// on Joomla! 3.3+ we must use the new tooltips
HTMLHelper::_('bootstrap.tooltip');
$attr = 'class="hasTooltip" title="'.HTMLHelper::tooltipText(Text::_('COM_JEM_STATUS'), Text::_($state[$canChange ? 4 : 3]), 0).'"';
$attr = 'class="hasTooltip" data-bs-toggle="tooltip" title="'.HTMLHelper::tooltipText(Text::_('COM_JEM_STATUS'), Text::_($state[$canChange ? 4 : 3]), 0).'"';
}

if ($print) {
$html = HTMLHelper::_('jemhtml.icon', 'com_jem/'.$state[0], 'fa fa-fw fa-lg '.$state[1].' jem-attendance-status-'.$state[1], $state[3], 'class="icon-inline-left"', $backend);
$html = jemhtml::icon('com_jem/'.$state[0], 'fa fa-fw fa-lg '.$state[1].' jem-attendance-status-'.$state[1], $state[3], 'class="icon-inline-left"', $backend);
$html .= Text::_($state[5]);
} elseif ($canChange && !empty($state[2])) {
$html = HTMLHelper::_('jemhtml.icon', 'com_jem/'.$state[0], 'fa fa-fw fa-lg '.$state[1].' jem-attendance-status-'.$state[1], $state[3], null, $backend);
$html = jemhtml::icon('com_jem/'.$state[0], 'fa fa-fw fa-lg '.$state[1].' jem-attendance-status-'.$state[1], $state[3], null, $backend);
if ($backend) {
$attr .= ' onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[2] . '\')"';
$url = '#';
Expand All @@ -244,9 +245,18 @@ static public function toggleAttendanceStatus($i, $value = 0, $canChange = true,
}
$html = HTMLHelper::_('link', $url, $html, $attr);
} else {
$html = HTMLHelper::_('jemhtml.icon', 'com_jem/'.$state[0], 'fa fa-fw fa-lg '.$state[1].' jem-attendance-status-'.$state[1], $state[3], $attr, $backend);
$html = jemhtml::icon('com_jem/'.$state[0], 'fa fa-fw fa-lg '.$state[1].' jem-attendance-status-'.$state[1], $state[3], $attr, $backend);
}

//-------------start added for tooltips initialize-----------
$html .= '<script>
jQuery(document).ready(function(){
var tooltipTriggerList = [].slice.call(document.querySelectorAll(\'[data-bs-toggle="tooltip"]\'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl,{html:true})
})
});
</script>';
//-------------end added for tooltips initialize-----------
return $html;
}

Expand Down
3 changes: 2 additions & 1 deletion admin/models/attendee.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public function store($data)
}
}

$row = $this->getTable('jem_register', '');
// $row = $this->getTable('jem_register', '');
$row = JTable::getInstance('jem_register', '');

if ($id > 0) {
$row->load($id);
Expand Down
2 changes: 1 addition & 1 deletion admin/models/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getItem($pk = null)
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();

$item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;
$item->articletext = ($item->fulltext && trim($item->fulltext) != '') ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;

$db = JFactory::getDbo();

Expand Down
6 changes: 4 additions & 2 deletions admin/models/fields/calendarjem.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ protected function getLayoutData()

// add hint regarding date/time format accepted in edit field
$exampleTimestamp = strtotime("NOW");
$hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', strftime($this->format, $exampleTimestamp));
// $hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', strftime($this->format, $exampleTimestamp));
$hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', date($this->format, $exampleTimestamp));

$extraData = array(
'hint' => $hint,
Expand Down Expand Up @@ -78,7 +79,8 @@ protected function getInput()
if (empty($this->hint)) {
// add hint regarding date/time format accepted in edit field
$exampleTimestamp = strtotime("NOW");
$this->hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', strftime($this->format, $exampleTimestamp));
// $this->hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', strftime($this->format, $exampleTimestamp));
$this->hint = JText::sprintf('COM_JEM_DATEFIELD_HINT', date($this->format, $exampleTimestamp));
}

return parent::getInput();
Expand Down
6 changes: 3 additions & 3 deletions admin/models/fields/modal/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
defined('_JEXEC') or die;

jimport('joomla.form.formfield');

use Joomla\CMS\Factory;
/**
* Contact select
*/
Expand Down Expand Up @@ -39,13 +39,13 @@ protected function getInput()
$script[] = ' }';

// Add to document head
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));

// Setup variables for display
$html = array();
$link = 'index.php?option=com_jem&amp;view=contactelement&amp;tmpl=component&amp;function=jSelectContact_'.$this->id;

$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('name');
$query->from('#__contact_details');
Expand Down
21 changes: 12 additions & 9 deletions admin/models/fields/modal/venue.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/

defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

jimport('joomla.form.formfield');

Expand All @@ -29,7 +32,7 @@ class JFormFieldModal_Venue extends JFormField
protected function getInput()
{
// Load modal behavior
// JHtml::_('behavior.modal', 'a.modal');
// HTMLHelper::_('behavior.modal', 'a.modal');

// Build the script
$script = array();
Expand All @@ -41,13 +44,13 @@ protected function getInput()
$script[] = ' }';

// Add to document head
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));

// Setup variables for display
$html = array();
$link = 'index.php?option=com_jem&amp;view=venueelement&amp;tmpl=component&amp;function=jSelectVenue_'.$this->id;

$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('venue');
$query->from('#__jem_venues');
Expand All @@ -68,7 +71,7 @@ protected function getInput()
}

if (empty($venue)) {
$venue = JText::_('COM_JEM_SELECTVENUE');
$venue = Text::_('COM_JEM_SELECTVENUE');
}
$venue = htmlspecialchars($venue, ENT_QUOTES, 'UTF-8');

Expand All @@ -80,20 +83,20 @@ protected function getInput()
// The venue select button
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
// $html[] = ' <a class="modal" title="'.JText::_('COM_JEM_SELECT').'" href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x:800, y:450}}">'.
// JText::_('COM_JEM_SELECT').'</a>';
$html[] = JHtml::_(
// $html[] = ' <a class="modal" title="'.Text::_('COM_JEM_SELECT').'" href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x:800, y:450}}">'.
// Text::_('COM_JEM_SELECT').'</a>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
'venue-modal-1',
array(
'url' => $link.'&amp;'.JSession::getFormToken().'=1',
'title' => JText::_('COM_JEM_SELECT'),
'title' => Text::_('COM_JEM_SELECT'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>'
)
);
$html[] ='<button type="button" class="btn btn-link" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#venue-modal-1">'.JText::_('COM_JEM_SELECT').'
$html[] ='<button type="button" class="btn btn-link" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#venue-modal-1">'.Text::_('COM_JEM_SELECT').'
</button>';
$html[] = ' </div>';
$html[] = '</div>';
Expand Down
2 changes: 1 addition & 1 deletion admin/models/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private function import($tablename, $prefix, $fieldsname, &$data, $replace = tru
// collect categories for each event; we get array( itemid => array( catid => ordering ) )
$events[$row[$itemidx]][$row[$catidx]] = ($orderidx !== false) ? $row[$orderidx] : 0;
}
echo "<pre/>";print_R($events);die;

// store data
return $this->storeCatsEventRelations($events, $replace);
}
Expand Down
6 changes: 3 additions & 3 deletions admin/models/source.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function populateState()
$id = $app->getUserState('com_jem.edit.source.id');

// Parse the template id out of the compound reference.
$temp = (base64_decode($id));
$temp = $id ? (base64_decode($id)) : $id;
$fileName = $temp;

$this->setState('filename', $fileName);
Expand Down Expand Up @@ -118,9 +118,9 @@ public function getSource()
$file = $fileName;
$filePath = JPath::clean(JPATH_ROOT . '/media/com_jem/css/' . $file);
}

$item = new stdClass;
if (file_exists($filePath)) {
if ($file && file_exists($filePath)) {
$item->custom = $custom !== false;
$item->filename = $file;
$item->source = file_get_contents($filePath);
Expand Down
2 changes: 1 addition & 1 deletion admin/sql/updates/2.1.7-dev1.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- insert new config values
INSERT IGNORE INTO `#__jem_config` (`keyname`, `value`)
VALUES ('formathour', '%H'), ('csv_separator', ';');
VALUES ('formathour', 'H'), ('csv_separator', ';');
6 changes: 4 additions & 2 deletions admin/tables/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public function __construct(&$db)
public function bind($array, $ignore = '')
{
// in here we are checking for the empty value of the checkbox

if (!isset($array['registra'])) {
$array['registra'] = 0 ;
}

if(isset($array['contactid'])){
$array['contactid'] = (int) $array['contactid'];
}
if (!isset($array['unregistra'])) {
$array['unregistra'] = 0 ;
}
Expand Down
24 changes: 20 additions & 4 deletions admin/views/attendee/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,28 @@
->useScript('form.validate');

$selectuser_link = Route::_('index.php?option=com_jem&task=attendee.selectuser&tmpl=component');
echo JHtml::_(
'bootstrap.renderModal',
'user-modal',
array(
'url' => $selectuser_link.'&amp;'.JSession::getFormToken().'=1',
'title' => JText::_('COM_JEM_SELECT'),
'width' => '800px',
'height' => '450px',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>'
)
);
?>

<script type="text/javascript">

function modalSelectUser(id, username)
{
$('uid').value = id;
$('username').value = username;
window.parent.SqueezeBox.close();
console.log(id,username);
$('#uid').val(id) ;
$('#username').val(username);
// window.parent.SqueezeBox.close();
$("#user-modal").modal("hide");
}

Joomla.submitbutton = function(task)
Expand Down Expand Up @@ -79,7 +92,10 @@ function modalSelectUser(id, username)
<td>
<input type="text" name="username" id="username" readonly="readonly" value="<?php echo $this->row->username; ?>" />
<input type="hidden" name="uid" id="uid" value="<?php echo $this->row->uid; ?>" />
<a class="usermodal" href="<?php echo $selectuser_link; ?>" rel="{handler: 'iframe', size: {x: 800, y: 500}}">
<!-- <a class="usermodal" href="<?php echo $selectuser_link; ?>" rel="{handler: 'iframe', size: {x: 800, y: 500}}">
<span><?php echo Text::_('COM_JEM_SELECT_USER')?></span>
</a> -->
<a class="usermodal" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#user-modal">
<span><?php echo Text::_('COM_JEM_SELECT_USER')?></span>
</a>
</td>
Expand Down
15 changes: 8 additions & 7 deletions admin/views/attendees/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));

$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
// $wa->useScript('table.columns');
Factory::getDocument()->addScriptDeclaration('
Joomla.submitbutton = function(task)
{
Expand All @@ -40,10 +41,10 @@ function submitName(node) {
?>
<form action="<?php echo Route::_('index.php?option=com_jem&view=attendees&eventid='.$this->event->id); ?>" method="post" name="adminForm" id="adminForm">
<?php if (isset($this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<!-- <div id="j-sidebar-container" class="span2">
<?php //echo $this->sidebar; ?>
</div> -->
<div id="j-main-container" class="span10 j-main-container">
<?php endif; ?>
<table class="adminlist" style="width:100%;">
<tr>
Expand Down Expand Up @@ -114,15 +115,15 @@ function submitName(node) {
<?php
$status = (int)$row->status;
if ($status === 1 && $row->waiting == 1) { $status = 2; }
echo HTMLHelper::_('jemhtml.toggleAttendanceStatus', $i, $status, $canChange);
echo jemhtml::toggleAttendanceStatus( $i, $status, $canChange);
?>
</td>
<?php if (!empty($this->jemsettings->regallowcomments)) : ?>
<?php $cmnt = (\Joomla\String\StringHelper::strlen($row->comment) > 16) ? (rtrim(\Joomla\String\StringHelper::substr($row->comment, 0, 14)).'&hellip;') : $row->comment; ?>
<td><?php if (!empty($cmnt)) { echo HTMLHelper::_('tooltip', $row->comment, null, null, $cmnt, null, null); } ?></td>
<?php endif; ?>
<td class="center">
<a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i;?>','attendees.remove')">
<a href="javascript: void(0);" onclick="return Joomla.listItemTask('cb<?php echo $i;?>','attendees.remove')">
<?php echo HTMLHelper::_('image','com_jem/publish_r.png',Text::_('COM_JEM_REMOVE'),NULL,true); ?>
</a>
</td>
Expand Down
Loading

0 comments on commit 18ffd67

Please sign in to comment.