toolbar.php
5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
/**
* @copyright Copyright (c) 2009-2017 Ryan Demmer. All rights reserved
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses
*/
defined('_JEXEC') or die('RESTRICTED');
abstract class WFToolbarHelper
{
public static function createClick($link, $w, $h)
{
return "Joomla.modal(this, '".$link."', ".$w.', '.$h.');return false;';
}
public static function help($type)
{
jimport('joomla.plugin.helper');
$language = JFactory::getLanguage();
$tag = $language->getTag();
$sub = explode('.', $type);
$category = array_shift($sub);
$article = implode('.', $sub);
$link = 'index.php?option=com_jce&view=help&tmpl=component&section=admin&category='.$category.'&article='.$article.'&lang='.substr($tag, 0, strpos($tag, '-'));
$bar = JToolBar::getInstance('toolbar');
$w = 780;
$h = 560;
JHtml::_('behavior.modal');
if (class_exists('JHtmlSidebar')) {
$html = '<button onclick="'.self::createClick($link, $w, $h).'" class="btn btn-small" title="'.WFText::_('WF_HELP').'"><i class="icon-help"></i> '.WFText::_('WF_HELP').'</button>';
} else {
$html = '<a href="'.$link.'" target="_blank" onclick="'.self::createClick($link, $w, $h).'" class="help" title="'.WFText::_('WF_HELP').'">';
$html .= '<span class="icon-32-help" title="'.WFText::_('WF_HELP').'"></span>'.WFText::_('WF_HELP').'</a>';
}
$bar->appendButton('Custom', $html, 'help');
}
/**
* Writes a configuration button and invokes a cancel operation (eg a checkin).
*
* @param string The name of the component, eg, com_content
* @param int The height of the popup
* @param int The width of the popup
* @param string The name of the button
* @param string An alternative path for the configuation xml relative to JPATH_SITE
*
* @since 1.0
*/
public static function preferences()
{
if (defined('JPATH_PLATFORM')) {
JToolbarHelper::preferences('com_jce');
} else {
$bar = JToolBar::getInstance('toolbar');
$link = 'index.php?option=com_jce&view=preferences&tmpl=component';
$w = 780;
$h = 560;
$html = '<a href="'.$link.'" target="_blank" onclick="'.self::createClick($link, $w, $h).'" class="preferences" title="'.WFText::_('WF_PREFERENCES_TITLE').'">';
$html .= '<span class="icon-32-config icon-32-options" title="'.WFText::_('WF_PREFERENCES_TITLE').'"></span>'.WFText::_('WF_PREFERENCES').'</a>';
$bar->appendButton('Custom', $html, 'config');
}
}
/**
* Writes a configuration button and invokes a cancel operation (eg a checkin).
*
* @param string The name of the component, eg, com_content
* @param int The height of the popup
* @param int The width of the popup
* @param string The name of the button
* @param string An alternative path for the configuation xml relative to JPATH_SITE
*
* @since 1.0
*/
public static function updates($enabled = false)
{
$bar = JToolBar::getInstance('toolbar');
// Add a configuration button
$w = 780;
$h = 560;
if (defined('JPATH_PLATFORM')) {
return false;
}
$link = 'index.php?option=com_jce&view=updates&tmpl=component';
if ($enabled) {
JHtml::_('behavior.modal');
$html = '<a href="'.$link.'" target="_blank" onclick="'.self::createClick($link, $w, $h).'" class="updates" title="'.WFText::_('WF_UPDATES').'">';
$html .= '<span class="icon-32-default icon-32-update" title="'.WFText::_('WF_HELP').'"></span>'.WFText::_('WF_UPDATES').'</a>';
$bar->appendButton('Custom', $html, 'updates');
}
}
public static function export()
{
if (class_exists('JHtmlSidebar')) {
$icon = 'download';
} else {
$icon = defined('JPATH_PLATFORM') ? 'export' : 'unarchive';
}
self::custom('export', $icon, $icon.'_f2', 'WF_PROFILES_EXPORT', true);
}
public static function save($task = 'save')
{
return JToolBarHelper::save($task);
}
public static function apply($task = 'apply')
{
return JToolbarHelper::apply($task);
}
public static function cancel($task = 'cancel')
{
return JToolbarHelper::cancel($task);
}
public static function editListx($task = 'edit')
{
if (method_exists('JToolbarHelper', 'editListx')) {
return JToolbarHelper::editListx($task);
}
return JToolbarHelper::editList($task);
}
public static function addNewx($task = 'add')
{
if (method_exists('JToolbarHelper', 'addNewx')) {
return JToolbarHelper::addNewx($task);
}
return JToolbarHelper::addNew($task);
}
public static function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true, $x = false)
{
return JToolbarHelper::custom($task, $icon, $iconOver, $alt, $listSelect, $x);
}
public static function publishList($task = 'publish')
{
return JToolbarHelper::publishList($task);
}
public static function unpublishList($task = 'unpublish')
{
return JToolbarHelper::unpublishList($task);
}
public static function deleteList($msg = '', $task = 'remove', $alt = '')
{
return JToolbarHelper::deleteList($msg, $task, $alt);
}
}