00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 require('init.php');
00069 require('template.php');
00070 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00071 require_once(PATH_t3lib.'class.t3lib_loadmodules.php');
00072 require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 class SC_alt_shortcut {
00087
00088
00089 var $modName;
00090 var $M_modName;
00091 var $URL;
00092 var $editSC;
00093 var $deleteCategory;
00094 var $editName;
00095 var $editGroup;
00096 var $whichItem;
00097
00098
00099
00100
00101
00102
00103
00104 var $loadModules;
00105 protected $isAjaxCall;
00106
00107
00108
00109
00110
00111
00112 var $doc;
00113
00114
00115 var $content;
00116 var $lines;
00117
00118 var $editLoaded;
00119 var $editError;
00120 var $editPath;
00121 var $editSC_rec;
00122 var $theEditRec;
00123 var $editPage;
00124 var $selOpt;
00125 var $searchFor;
00126 var $groupLabels=array();
00127
00128 var $alternativeTableUid = array();
00129
00130
00131
00132
00133
00134
00135
00136
00137 function preinit() {
00138 global $TBE_MODULES;
00139
00140
00141 $this->isAjaxCall = (boolean) t3lib_div::_GP('ajax');
00142 $this->modName = t3lib_div::_GP('modName');
00143 $this->M_modName = t3lib_div::_GP('motherModName');
00144 $this->URL = t3lib_div::_GP('URL');
00145 $this->editSC = t3lib_div::_GP('editShortcut');
00146
00147 $this->deleteCategory = t3lib_div::_GP('deleteCategory');
00148 $this->editPage = t3lib_div::_GP('editPage');
00149 $this->changeWorkspace = t3lib_div::_GP('changeWorkspace');
00150 $this->changeWorkspacePreview = t3lib_div::_GP('changeWorkspacePreview');
00151 $this->editName = t3lib_div::_GP('editName');
00152 $this->editGroup = t3lib_div::_GP('editGroup');
00153 $this->whichItem = t3lib_div::_GP('whichItem');
00154
00155
00156 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00157 $this->loadModules->load($TBE_MODULES);
00158 }
00159
00160
00161
00162
00163
00164
00165 function preprocess() {
00166 global $BE_USER;
00167 $description = '';
00168 $url = urldecode($this->URL);
00169
00170
00171 $page_id = $this->getLinkedPageId($url);
00172 if (t3lib_div::testInt($page_id)) {
00173 if (preg_match('/\&edit\[(.*)\]\[(.*)\]=edit/',$url,$matches)) {
00174
00175 $description = '';
00176 } else {
00177
00178 $pageRow = t3lib_BEfunc::getRecord('pages',$page_id);
00179 if (count($pageRow)) {
00180
00181 $description = $pageRow['title'];
00182 }
00183 }
00184 } else {
00185 if (preg_match('/\/$/', $page_id)) {
00186
00187 $description = basename($page_id);
00188 }
00189 }
00190
00191
00192
00193 if ($this->modName && $this->URL) {
00194 $fields_values = array(
00195 'userid' => $BE_USER->user['uid'],
00196 'module_name' => $this->modName.'|'.$this->M_modName,
00197 'url' => $this->URL,
00198 'description' => $description,
00199 'sorting' => time(),
00200 );
00201 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fields_values);
00202 }
00203
00204
00205 $addUSERWhere = (!$BE_USER->isAdmin()?' AND userid='.intval($BE_USER->user['uid']):'');
00206
00207
00208 if (strcmp($this->deleteCategory,'')) {
00209 if (t3lib_div::testInt($this->deleteCategory)) {
00210 $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'sc_group='.intval($this->deleteCategory).$addUSERWhere);
00211 }
00212 }
00213
00214
00215 if (is_array($_POST)) {
00216
00217 if (isset($_POST['_savedok_x']) || isset($_POST['_saveclosedok_x'])) {
00218 $fields_values = array(
00219 'description' => $this->editName,
00220 'sc_group' => intval($this->editGroup)
00221 );
00222 if ($fields_values['sc_group']<0 && !$BE_USER->isAdmin()) {
00223 $fields_values['sc_group']=0;
00224 }
00225
00226 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_be_shortcuts', 'uid='.intval($this->whichItem).$addUSERWhere, $fields_values);
00227 }
00228
00229 if (isset($_POST['_savedok_x'])) {
00230 $this->editSC=$this->whichItem;
00231 }
00232
00233 if (isset($_POST['_deletedok_x'])) {
00234 $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_be_shortcuts', 'uid='.intval($this->whichItem).$addUSERWhere);
00235
00236 if (!$this->editSC) $this->editSC=-1;
00237 }
00238 }
00239
00240 }
00241
00242
00243
00244
00245
00246
00247 function init() {
00248 global $BACK_PATH;
00249
00250 $this->doc = t3lib_div::makeInstance('template');
00251 $this->doc->backPath = $BACK_PATH;
00252 $this->doc->form='<form action="alt_shortcut.php" name="shForm" method="post">';
00253 $this->doc->divClass='typo3-shortcut';
00254 $this->doc->JScode.=$this->doc->wrapScriptTags('
00255 function jump(url,modName,mainModName) {
00256
00257 top.fsMod.navFrameHighlightedID = new Array();
00258 if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
00259 top.content.nav_frame.refresh_nav();
00260 }
00261
00262 top.nextLoadModuleUrl = url;
00263 top.goToModule(modName);
00264 }
00265 function editSh(uid) {
00266 window.location.href="alt_shortcut.php?editShortcut="+uid;
00267 }
00268 function submitEditPage(id) {
00269 window.location.href="alt_shortcut.php?editPage="+top.rawurlencodeAndRemoveSiteUrl(id);
00270 }
00271 function changeWorkspace(workspaceId) {
00272 window.location.href="alt_shortcut.php?changeWorkspace="+top.rawurlencodeAndRemoveSiteUrl(workspaceId);
00273 }
00274 function changeWorkspacePreview(newstate) {
00275 window.location.href="alt_shortcut.php?changeWorkspacePreview="+newstate;
00276 }
00277 function refreshShortcuts() {
00278 window.location.href = document.URL;
00279 }
00280
00281 ');
00282 $this->content.=$this->doc->startPage('Shortcut frame');
00283 }
00284
00285
00286
00287
00288
00289
00290 function main() {
00291 global $BE_USER,$LANG,$TCA;
00292
00293
00294 $this->groupLabels=array(
00295 1 => 1,
00296 2 => 1,
00297 3 => 1,
00298 4 => 1,
00299 5 => 1,
00300 );
00301
00302 $shortCutGroups = $BE_USER->getTSConfig('options.shortcutGroups');
00303 if (is_array($shortCutGroups['properties']) && count($shortCutGroups['properties'])) {
00304 foreach ($shortCutGroups['properties'] as $k=>$v) {
00305 if (strcmp('',$v) && strcmp('0',$v)) {
00306 $this->groupLabels[$k] = (string)$v;
00307 } elseif ($BE_USER->isAdmin()) {
00308 unset($this->groupLabels[$k]);
00309 }
00310 }
00311 }
00312
00313
00314 $globalGroups = -100;
00315 if (count($this->groupLabels)) {
00316 $globalGroups .= ','.implode(',',array_keys($this->groupLabels));
00317 $globalGroups = str_replace(',',',-',$globalGroups);
00318 }
00319
00320
00321 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_be_shortcuts', '((userid='.$BE_USER->user['uid'].' AND sc_group>=0) OR sc_group IN ('.$globalGroups.'))', '', 'sc_group,sorting');
00322
00323
00324 $this->lines=array();
00325 $this->linesPre=array();
00326 $this->editSC_rec='';
00327 $this->selOpt=array();
00328 $formerGr='';
00329
00330
00331 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00332 $mParts = explode('|',$row['module_name']);
00333 $row['module_name']=$mParts[0];
00334 $row['M_module_name']=$mParts[1];
00335 $mParts = explode('_',$row['M_module_name']?$row['M_module_name']:$row['module_name']);
00336 $qParts = parse_url($row['url']);
00337
00338 if (!$BE_USER->isAdmin()) {
00339
00340 if (!isset($LANG->moduleLabels['tabs_images'][implode('_',$mParts).'_tab'])) {
00341 continue;
00342 }
00343
00344 $page_id = $this->getLinkedPageId($row['url']);
00345 if (t3lib_div::testInt($page_id)) {
00346
00347 if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) continue;
00348
00349
00350 $pageRow = t3lib_BEfunc::getRecord('pages',$page_id);
00351 if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow,$perms=1)) continue;
00352 }
00353 }
00354
00355 if ($this->editSC && $row['uid']==$this->editSC) {
00356 $this->editSC_rec=$row;
00357 }
00358
00359 $sc_group = $row['sc_group'];
00360 if ($sc_group && strcmp($formerGr,$sc_group)) {
00361 if ($sc_group!=-100) {
00362 if ($this->groupLabels[abs($sc_group)] && strcmp('1',$this->groupLabels[abs($sc_group)])) {
00363 $label = $this->groupLabels[abs($sc_group)];
00364 } else {
00365 $label = $LANG->getLL('shortcut_group_'.abs($sc_group),1);
00366 if (!$label) $label = $LANG->getLL('shortcut_group',1).' '.abs($sc_group);
00367 }
00368
00369 if ($sc_group>=0) {
00370 $onC = 'if (confirm('.$GLOBALS['LANG']->JScharCode($LANG->getLL('shortcut_delAllInCat')).')){window.location.href=\'alt_shortcut.php?deleteCategory='.$sc_group.'\';}return false;';
00371 $this->linesPre[]='<td> </td><td class="bgColor5"><a href="#" onclick="'.htmlspecialchars($onC).'" title="'.$LANG->getLL('shortcut_delAllInCat',1).'">'.$label.'</a></td>';
00372 } else {
00373 $label = $LANG->getLL('shortcut_global',1).': '.($label ? $label : abs($sc_group));
00374 $this->lines[]='<td> </td><td class="bgColor5">'.$label.'</td>';
00375 }
00376 unset($label);
00377 }
00378 }
00379
00380 $bgColorClass = $row['uid']==$this->editSC ? 'bgColor5' : ($row['sc_group']<0 ? 'bgColor6' : 'bgColor4');
00381
00382 if ($row['description']&&($row['uid']!=$this->editSC)) {
00383 $label = $row['description'];
00384 } else {
00385 $label = t3lib_div::fixed_lgd(rawurldecode($qParts['query']),150);
00386 }
00387 $titleA = $this->itemLabel($label,$row['module_name'],$row['M_module_name']);
00388
00389 $editSH = ($row['sc_group']>=0 || $BE_USER->isAdmin()) ? 'editSh('.intval($row['uid']).');' : "alert('".$LANG->getLL('shortcut_onlyAdmin')."')";
00390 $jumpSC = 'jump(unescape(\''.rawurlencode($row['url']).'\'),\''.implode('_',$mParts).'\',\''.$mParts[0].'\');';
00391 $onC = 'if (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){'.$editSH.'}else{'.$jumpSC.'}return false;';
00392 if ($sc_group>=0) {
00393 $this->linesPre[]='<td class="'.$bgColorClass.'"><a href="#" onclick="'.htmlspecialchars($onC).'"><img src="'.$this->getIcon($row['module_name']).'" title="'.htmlspecialchars($titleA).'" alt="" /></a></td>';
00394 } else {
00395 $this->lines[]='<td class="'.$bgColorClass.'"><a href="#" onclick="'.htmlspecialchars($onC).'"><img src="'.$this->getIcon($row['module_name']).'" title="'.htmlspecialchars($titleA).'" alt="" /></a></td>';
00396 }
00397 if (trim($row['description'])) {
00398 $kkey = strtolower(substr($row['description'],0,20)).'_'.$row['uid'];
00399 $this->selOpt[$kkey]='<option value="'.htmlspecialchars($jumpSC).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['description'],50)).'</option>';
00400 }
00401 $formerGr=$row['sc_group'];
00402 }
00403 ksort($this->selOpt);
00404 array_unshift($this->selOpt,'<option>['.$LANG->getLL('shortcut_selSC',1).']</option>');
00405
00406 $this->editLoadedFunc();
00407 $this->editPageIdFunc();
00408
00409 if (!$this->editLoaded && t3lib_extMgm::isLoaded('cms')) {
00410 $editIdCode = '<td nowrap="nowrap">'.$LANG->getLL('shortcut_editID',1).': <input type="text" value="'.($this->editError?htmlspecialchars($this->editPage):'').'" name="editPage"'.$this->doc->formWidth(15).' onchange="submitEditPage(this.value);" />'.
00411 ($this->editError?' <strong><span class="typo3-red">'.htmlspecialchars($this->editError).'</span></strong>':'').
00412 (is_array($this->theEditRec)?' <strong>'.$LANG->getLL('shortcut_loadEdit',1).' \''.t3lib_BEfunc::getRecordTitle('pages',$this->theEditRec,TRUE).'\'</strong> ('.htmlspecialchars($this->editPath).')':'').
00413 ($this->searchFor?' '.$LANG->getLL('shortcut_searchFor',1).' <strong>\''.htmlspecialchars($this->searchFor).'\'</strong>':'').
00414 '</td>';
00415 } else $editIdCode = '';
00416
00417
00418 $editIdCode.= '<td> '.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'shortcuts', $GLOBALS['BACK_PATH'],'',TRUE).'</td>';
00419
00420
00421 $this->content.='
00422
00423 <table border="0" cellpadding="0" cellspacing="0" width="99%">
00424 <tr>
00425 <td>
00426 <!--
00427 Shortcut Display Table:
00428 -->
00429 <table border="0" cellpadding="0" cellspacing="2" id="typo3-shortcuts">
00430 <tr>
00431 '.implode('
00432 ',$this->lines).$editIdCode.'
00433 </tr>
00434 </table>
00435 </td>
00436 <td align="right">';
00437 if ($this->hasWorkspaceAccess()) {
00438 $this->content .= $this->workspaceSelector() .
00439 t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'],'',TRUE);
00440 }
00441 $this->content .= '
00442 </td>
00443 </tr>
00444 </table>
00445 ';
00446
00447
00448 if ($this->theEditRec['uid']) {
00449 $this->content.=$this->doc->wrapScriptTags('top.loadEditId('.$this->theEditRec['uid'].');');
00450
00451 }
00452
00453
00454 if (count($this->alternativeTableUid)==2 && isset($TCA[$this->alternativeTableUid[0]]) && t3lib_div::testInt($this->alternativeTableUid[1])) {
00455 $JSaction = t3lib_BEfunc::editOnClick('&edit['.$this->alternativeTableUid[0].']['.$this->alternativeTableUid[1].']=edit','','dummy.php');
00456 $this->content.=$this->doc->wrapScriptTags('function editArbitraryElement() { top.content.'.$JSaction.'; } editArbitraryElement();');
00457 }
00458
00459
00460 if ($this->searchFor) {
00461 $firstMP = intval($GLOBALS['WEBMOUNTS'][0]);
00462 $this->content.= $this->doc->wrapScriptTags('jump(unescape("'.rawurlencode('db_list.php?id='.$firstMP.'&search_field='.rawurlencode($this->searchFor).'&search_levels=4').'"),"web_list","web");');
00463 }
00464 }
00465
00466
00467
00468
00469
00470
00471 function editLoadedFunc() {
00472 global $BE_USER,$LANG;
00473
00474 $this->editLoaded=0;
00475 if (is_array($this->editSC_rec) && ($this->editSC_rec['sc_group']>=0 || $BE_USER->isAdmin())) {
00476 $this->editLoaded=1;
00477
00478 $opt=array();
00479 $opt[]='<option value="0"></option>';
00480
00481 foreach($this->groupLabels as $k=>$v) {
00482 if ($v && strcmp('1',$v)) {
00483 $label = $v;
00484 } else {
00485 $label = $LANG->getLL('shortcut_group_'.$k,1);
00486 if (!$label) $label = $LANG->getLL('shortcut_group',1).' '.$k;
00487 }
00488 $opt[]='<option value="'.$k.'"'.(!strcmp($this->editSC_rec['sc_group'],$k)?' selected="selected"':'').'>'.$label.'</option>';
00489 }
00490
00491 if ($BE_USER->isAdmin()) {
00492 foreach($this->groupLabels as $k=>$v) {
00493 if ($v && strcmp('1',$v)) {
00494 $label = $v;
00495 } else {
00496 $label = $LANG->getLL('shortcut_group_'.$k,1);
00497 if (!$label) $label = $LANG->getLL('shortcut_group',1).' '.$k;
00498 }
00499 $label = $LANG->getLL('shortcut_global',1).': '.$label;
00500
00501 $opt[]='<option value="-'.$k.'"'.(!strcmp($this->editSC_rec['sc_group'],'-'.$k)?' selected="selected"':'').'>'.$label.'</option>';
00502 }
00503 $opt[]='<option value="-100"'.(!strcmp($this->editSC_rec['sc_group'],'-100')?' selected="selected"':'').'>'.$LANG->getLL('shortcut_global',1).': '.$LANG->getLL('shortcut_all',1).'</option>';
00504 }
00505
00506
00507 $manageForm='
00508
00509 <!--
00510 Shortcut Editing Form:
00511 -->
00512 <table border="0" cellpadding="0" cellspacing="0" id="typo3-shortcuts-editing">
00513 <tr>
00514 <td> </td>
00515 <td><input type="image" class="c-inputButton" name="_savedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif','').' title="'.$LANG->getLL('shortcut_save',1).'" /></td>
00516 <td><input type="image" class="c-inputButton" name="_saveclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->getLL('shortcut_saveClose',1).'" /></td>
00517 <td><input type="image" class="c-inputButton" name="_closedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/closedok.gif','').' title="'.$LANG->getLL('shortcut_close',1).'" /></td>
00518 <td><input type="image" class="c-inputButton" name="_deletedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/deletedok.gif','').' title="'.$LANG->getLL('shortcut_delete',1).'" /></td>
00519 <td><input name="editName" type="text" value="'.htmlspecialchars($this->editSC_rec['description']).'"'.$this->doc->formWidth(15).' /></td>
00520 <td><select name="editGroup">'.implode('',$opt).'</select></td>
00521 </tr>
00522 </table>
00523 <input type="hidden" name="whichItem" value="'.$this->editSC_rec['uid'].'" />
00524
00525 ';
00526 } else $manageForm='';
00527
00528 if (!$this->editLoaded && count($this->selOpt)>1) {
00529 $this->lines[]='<td> </td>';
00530 $this->lines[]='<td><select name="_selSC" onchange="eval(this.options[this.selectedIndex].value);this.selectedIndex=0;">'.implode('',$this->selOpt).'</select></td>';
00531 }
00532
00533
00534 $this->lines = array_merge($this->linesPre,$this->lines);
00535
00536 if (count($this->lines)) {
00537 if (!$BE_USER->getTSConfigVal('options.mayNotCreateEditShortcuts')) {
00538 $this->lines=array_merge(array('<td><input type="checkbox" id="editShortcut_check" name="editShortcut_check" value="1"'.($this->editSC?' checked="checked"':'').' /> <label for="editShortcut_check">'.$LANG->getLL('shortcut_edit',1).'</label> </td>'),$this->lines);
00539 $this->lines[]='<td>'.$manageForm.'</td>';
00540 }
00541 $this->lines[]='<td><img src="clear.gif" width="10" height="1" alt="" /></td>';
00542 }
00543 }
00544
00545
00546
00547
00548
00549
00550
00551 function editPageIdFunc() {
00552 global $BE_USER,$LANG;
00553
00554 if (!t3lib_extMgm::isLoaded('cms')) return;
00555
00556
00557 $this->editPage = trim($LANG->csConvObj->conv_case($LANG->charSet,$this->editPage,'toLower'));
00558 $this->editError = '';
00559 $this->theEditRec = '';
00560 $this->searchFor = '';
00561 if ($this->editPage) {
00562
00563
00564 $this->alternativeTableUid = explode(':',$this->editPage);
00565 if (!(count($this->alternativeTableUid)==2 && $BE_USER->isAdmin())) {
00566
00567 $where = ' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
00568 if (t3lib_div::testInt($this->editPage)) {
00569 $this->theEditRec = t3lib_BEfunc::getRecordWSOL('pages',$this->editPage,'*',$where);
00570 } else {
00571 $records = t3lib_BEfunc::getRecordsByField('pages','alias',$this->editPage,$where);
00572 if (is_array($records)) {
00573 reset($records);
00574 $this->theEditRec = current($records);
00575 t3lib_BEfunc::workspaceOL('pages',$this->theEditRec);
00576 }
00577 }
00578 if (!is_array($this->theEditRec)) {
00579 unset($this->theEditRec);
00580 $this->searchFor = $this->editPage;
00581 } elseif (!$BE_USER->isInWebMount($this->theEditRec['uid'])) {
00582 unset($this->theEditRec);
00583 $this->editError=$LANG->getLL('shortcut_notEditable');
00584 } else {
00585
00586
00587 $perms_clause = $BE_USER->getPagePermsClause(1);
00588 $this->editPath = t3lib_BEfunc::getRecordPath($this->theEditRec['pid'], $perms_clause, 30);
00589
00590 if(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
00591
00592
00593 t3lib_BEfunc::openPageTree($this->theEditRec['pid'],!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
00594 }
00595 }
00596 }
00597 }
00598 }
00599
00600
00601
00602
00603
00604
00605 function printContent() {
00606 $content = '';
00607
00608 $this->content.= $this->doc->endPage();
00609 $this->content = $this->doc->insertStylesAndJS($this->content);
00610
00611 if($this->editPage && $this->isAjaxCall) {
00612 $data = array();
00613
00614
00615 if($this->theEditRec['uid']) {
00616 $data['type'] = 'page';
00617 $data['editRecord'] = $this->theEditRec['uid'];
00618 }
00619
00620
00621 if(count($this->alternativeTableUid) == 2
00622 && isset($GLOBALS['TCA'][$this->alternativeTableUid[0]])
00623 && t3lib_div::testInt($this->alternativeTableUid[1])) {
00624 $data['type'] = 'alternative';
00625 $data['alternativeTable'] = $this->alternativeTableUid[0];
00626 $data['alternativeUid'] = $this->alternativeTableUid[1];
00627 }
00628
00629
00630 if($this->searchFor) {
00631 $data['type'] = 'search';
00632 $data['firstMountPoint'] = intval($GLOBALS['WEBMOUNTS'][0]);
00633 $data['searchFor'] = rawurlencode($this->searchFor);
00634 }
00635
00636 $content = json_encode($data);
00637
00638 header('Content-type: application/json; charset=utf-8');
00639 header('X-JSON: '.$content);
00640 } else {
00641 $content = $this->content;
00642 }
00643
00644 echo $content;
00645 }
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666 function workspaceSelector() {
00667 global $TYPO3_DB,$BE_USER,$LANG;
00668
00669
00670 if (strlen($this->changeWorkspace)) {
00671 $BE_USER->setWorkspace($this->changeWorkspace);
00672 return $this->doc->wrapScriptTags('top.location.href="'. t3lib_BEfunc::getBackendScript() . '";');
00673 }
00674
00675 if (strlen($this->changeWorkspacePreview)) {
00676 $BE_USER->setWorkspacePreview($this->changeWorkspacePreview);
00677 }
00678
00679
00680 $options = array();
00681 if ($BE_USER->checkWorkspace(array('uid' => 0))) {
00682 $options[0] = '['.$LANG->getLL('shortcut_onlineWS').']';
00683 }
00684 if ($BE_USER->checkWorkspace(array('uid' => -1))) {
00685 $options[-1] = '['.$LANG->getLL('shortcut_offlineWS').']';
00686 }
00687
00688
00689 $workspaces = $TYPO3_DB->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'),'','title');
00690 if (count($workspaces)) {
00691 foreach ($workspaces as $rec) {
00692 if ($BE_USER->checkWorkspace($rec)) {
00693 $options[$rec['uid']] = $rec['uid'].': '.$rec['title'];
00694 }
00695 }
00696 }
00697
00698
00699 if (count($options)) {
00700 foreach($options as $value => $label) {
00701 $selected = ((int)$BE_USER->workspace===$value ? ' selected="selected"' : '');
00702 $options[$value] = '<option value="'.htmlspecialchars($value).'"'.$selected.'>'.htmlspecialchars($label).'</option>';
00703 }
00704 } else {
00705 $options[] = '<option value="-99">'.$LANG->getLL('shortcut_noWSfound',1).'</option>';
00706 }
00707
00708 $selector = '';
00709
00710 if ($BE_USER->workspace!==0) {
00711 $selector.= '<label for="workspacePreview">Frontend Preview:</label> <input type="checkbox" name="workspacePreview" id="workspacePreview" onclick="changeWorkspacePreview('.($BE_USER->user['workspace_preview'] ? 0 : 1).')"; '.($BE_USER->user['workspace_preview'] ? 'checked="checked"' : '').'/> ';
00712 }
00713
00714 $selector.= '<a href="mod/user/ws/index.php" target="content">'.
00715 t3lib_iconWorks::getIconImage('sys_workspace',array(),$this->doc->backPath,'align="top"').
00716 '</a>';
00717 if (count($options) > 1) {
00718 $selector .= '<select name="_workspaceSelector" onchange="changeWorkspace(this.options[this.selectedIndex].value);">'.implode('',$options).'</select>';
00719 }
00720
00721 return $selector;
00722 }
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743 function mIconFilename($Ifilename,$backPath) {
00744
00745 $Ifilename = str_replace ('mod/file/list/list.gif', 'mod/file/file.gif', $Ifilename);
00746
00747 if (t3lib_div::isAbsPath($Ifilename)) {
00748 $Ifilename = '../'.substr($Ifilename,strlen(PATH_site));
00749 }
00750 return $backPath.$Ifilename;
00751 }
00752
00753
00754
00755
00756
00757
00758
00759 function getIcon($modName) {
00760 global $LANG;
00761 if ($LANG->moduleLabels['tabs_images'][$modName.'_tab']) {
00762 $icon = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$modName.'_tab'],'');
00763 } elseif ($modName=='xMOD_alt_doc.php') {
00764 $icon = 'gfx/edit2.gif';
00765 } elseif ($modName=='xMOD_file_edit.php') {
00766 $icon = 'gfx/edit_file.gif';
00767 } elseif ($modName=='xMOD_wizard_rte.php') {
00768 $icon = 'gfx/edit_rtewiz.gif';
00769 } else {
00770 $icon = 'gfx/dummy_module.gif';
00771 }
00772 return $icon;
00773 }
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783 function itemLabel($inlabel,$modName,$M_modName='') {
00784 global $LANG;
00785 if (substr($modName,0,5)=='xMOD_') {
00786 $label=substr($modName,5);
00787 } else {
00788 $split = explode('_',$modName);
00789 $label = $LANG->moduleLabels['tabs'][$split[0].'_tab'];
00790 if (count($split)>1) {
00791 $label.='>'.$LANG->moduleLabels['tabs'][$modName.'_tab'];
00792 }
00793 }
00794 if ($M_modName) $label.=' ('.$M_modName.')';
00795 $label.=': '.$inlabel;
00796 return $label;
00797 }
00798
00799
00800
00801
00802
00803
00804
00805 function getLinkedPageId($url) {
00806 return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
00807 }
00808
00809
00810
00811
00812
00813
00814 function hasWorkspaceAccess() {
00815 $MCONF = array();
00816 include('mod/user/ws/conf.php');
00817 return $GLOBALS['BE_USER']->modAccess(array('name' => 'user', 'access' => 'user,group'), false) && $GLOBALS['BE_USER']->modAccess($MCONF, false);
00818 }
00819 }
00820
00821
00822 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_shortcut.php']) {
00823 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_shortcut.php']);
00824 }
00825
00826
00827
00828
00829 $SOBE = t3lib_div::makeInstance('SC_alt_shortcut');
00830 $SOBE->preinit();
00831 $SOBE->preprocess();
00832 $SOBE->init();
00833 $SOBE->main();
00834 $SOBE->printContent();
00835
00836 ?>