TYPO3 CMS  TYPO3_6-2
TableOperations.php
Go to the documentation of this file.
1 <?php
3 
22 
23  protected $extensionKey = 'rtehtmlarea';
24 
25  // The key of the extension that is extending htmlArea RTE
26  protected $pluginName = 'TableOperations';
27 
28  // The name of the plugin registered by the extension
30 
31  // Path to this main locallang file of the extension relative to the extension dir.
32  protected $relativePathToSkin = 'extensions/TableOperations/skin/htmlarea.css';
33 
34  // Path to the skin (css) file relative to the extension dir
35  protected $htmlAreaRTE;
36 
37  // Reference to the invoking object
38  protected $thisConfig;
39 
40  // Reference to RTE PageTSConfig
41  protected $toolbar;
42 
43  // Reference to RTE toolbar array
44  protected $LOCAL_LANG;
45 
46  // Frontend language array
48 
49  // TRUE if the registered plugin requires the PageTSConfig Classes configuration
50  protected $requiredPlugins = 'TYPO3Color,BlockStyle';
51 
52  // The comma-separated list of names of prerequisite plugins
53  protected $pluginButtons = 'table, toggleborders, tableproperties, tablerestyle, rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit,
54  columnproperties, columninsertbefore, columninsertafter, columndelete, columnsplit,
55  cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge';
56 
58  'table' => 'InsertTable',
59  'toggleborders' => 'TO-toggle-borders',
60  'tableproperties' => 'TO-table-prop',
61  'tablerestyle' => 'TO-table-restyle',
62  'rowproperties' => 'TO-row-prop',
63  'rowinsertabove' => 'TO-row-insert-above',
64  'rowinsertunder' => 'TO-row-insert-under',
65  'rowdelete' => 'TO-row-delete',
66  'rowsplit' => 'TO-row-split',
67  'columnproperties' => 'TO-col-prop',
68  'columninsertbefore' => 'TO-col-insert-before',
69  'columninsertafter' => 'TO-col-insert-after',
70  'columndelete' => 'TO-col-delete',
71  'columnsplit' => 'TO-col-split',
72  'cellproperties' => 'TO-cell-prop',
73  'cellinsertbefore' => 'TO-cell-insert-before',
74  'cellinsertafter' => 'TO-cell-insert-after',
75  'celldelete' => 'TO-cell-delete',
76  'cellsplit' => 'TO-cell-split',
77  'cellmerge' => 'TO-cell-merge'
78  );
79 
80  public function main($parentObject) {
81  $available = parent::main($parentObject);
82  if ($this->htmlAreaRTE->client['browser'] == 'opera') {
83  $this->thisConfig['hideTableOperationsInToolbar'] = 0;
84  }
85  return $available;
86  }
87 
94  public function buildJavascriptConfiguration($RTEcounter) {
95  global $TSFE, $LANG;
96  $registerRTEinJavascriptString = '';
97  if (in_array('table', $this->toolbar)) {
98  // Combining fieldset disablers as a list
99  $disabledFieldsets = array('Alignment', 'Borders', 'Color', 'Description', 'Layout', 'RowGroup', 'Spacing', 'Style');
100  foreach ($disabledFieldsets as $index => $fieldset) {
101  if (!trim($this->thisConfig[('disable' . $fieldset . 'FieldsetInTableOperations')])) {
102  unset($disabledFieldsets[$index]);
103  }
104  }
105  $disabledFieldsets = strtolower(implode(',', $disabledFieldsets));
106  // Dialogue fieldsets removal configuration
107  if ($disabledFieldsets) {
108  $dialogues = array('table', 'tableproperties', 'rowproperties', 'columnproperties', 'cellproperties');
109  foreach ($dialogues as $dialogue) {
110  if (in_array($dialogue, $this->toolbar)) {
111  if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][($dialogue . '.')])) {
112  $registerRTEinJavascriptString .= '
113  RTEarea[' . $RTEcounter . '].buttons.' . $dialogue . ' = new Object();
114  RTEarea[' . $RTEcounter . '].buttons.' . $dialogue . '.removeFieldsets = "' . $disabledFieldsets . '";';
115  } elseif ($this->thisConfig['buttons.'][$dialogue . '.']['removeFieldsets']) {
116  $registerRTEinJavascriptString .= '
117  RTEarea[' . $RTEcounter . '].buttons.' . $dialogue . '.removeFieldsets += ",' . $disabledFieldsets . '";';
118  } else {
119  $registerRTEinJavascriptString .= '
120  RTEarea[' . $RTEcounter . '].buttons.' . $dialogue . '.removeFieldsets = ",' . $disabledFieldsets . '";';
121  }
122  }
123  }
124  }
125  $registerRTEinJavascriptString .= '
126  RTEarea[' . $RTEcounter . '].hideTableOperationsInToolbar = ' . (trim($this->thisConfig['hideTableOperationsInToolbar']) ? 'true' : 'false') . ';';
127  }
128  return $registerRTEinJavascriptString;
129  }
130 
137  public function applyToolbarConstraints($show) {
138  // We will not allow any table operations button if the table button is not enabled
139  if (!in_array('table', $show)) {
140  return array_diff($show, \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->pluginButtons));
141  } else {
142  return $show;
143  }
144  }
145 
146 }
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
$TSFE
Definition: index_ts.php:72