Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

SC_alt_main Class Reference

List of all members.

Public Member Functions

 init ()
 Initialization of the script class.
 generateJScode ()
 Generates the JavaScript code for the frameset.
 editPageHandling ()
 Checking if the "&edit" variable was sent so we can open for editing the page.
 main ()
 Creates the header and frameset of the backend interface.
 printContent ()
 Outputting the accumulated content to screen.

Public Attributes

 $content
 $mainJScode
 $loadModules
 $alt_menuObj
 $leftMenuFrameW = 130
 $selMenuFrame = 130
 $topFrameH = 32
 $shortcutFrameH = 30

Member Function Documentation

SC_alt_main::editPageHandling  ) 
 

Checking if the "&edit" variable was sent so we can open for editing the page.

Code based on code from "alt_shortcut.php"

Returns:
void

Definition at line 370 of file alt_main.php.

References t3lib_BEfunc::getRecord(), t3lib_BEfunc::getRecordsByField(), t3lib_extMgm::isLoaded(), and t3lib_BEfunc::openPageTree().

Referenced by generateJScode().

00370                                  {
00371       global $BE_USER;
00372 
00373       if (!t3lib_extMgm::isLoaded('cms')) return;
00374 
00375          // EDIT page:
00376       $editId = ereg_replace('[^[:alnum:]_]','',t3lib_div::_GET('edit'));
00377       $theEditRec = '';
00378 
00379       if ($editId)   {
00380 
00381             // Looking up the page to edit, checking permissions:
00382          $where = ' AND ('.$BE_USER->getPagePermsClause(2).' OR '.$BE_USER->getPagePermsClause(16).')';
00383          if (t3lib_div::testInt($editId)) {
00384             $theEditRec = t3lib_BEfunc::getRecord('pages',$editId,'*',$where);
00385          } else {
00386             $records = t3lib_BEfunc::getRecordsByField('pages','alias',$editId,$where);
00387             if (is_array($records)) {
00388                reset($records);
00389                $theEditRec = current($records);
00390             }
00391          }
00392 
00393             // If the page was accessible, then let the user edit it.
00394          if (is_array($theEditRec) && $BE_USER->isInWebMount($theEditRec['uid']))   {
00395                // Setting JS code to open editing:
00396             $this->mainJScode.='
00397       // Load page to edit:
00398    window.setTimeout("top.loadEditId('.intval($theEditRec['uid']).');",500);
00399          ';
00400                // Checking page edit parameter:
00401             if(!$BE_USER->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
00402 
00403                   // Expanding page tree:
00404                t3lib_BEfunc::openPageTree(intval($theEditRec['pid']),!$BE_USER->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
00405             }
00406          } else {
00407             $this->mainJScode.='
00408       // Warning about page editing:
00409    alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'),$editId)).');
00410          ';
00411          }
00412       }
00413    }

SC_alt_main::generateJScode  ) 
 

Generates the JavaScript code for the frameset.

Returns:
void

Function similar to PHPs rawurlencode();

String-replace function

TypoSetup object.

Functions for session-expiry detection:

Launcing information window for records/files (fileref as "table" argument)

Opens plain window with url

Loads a URL in the topmenuFrame

Loads a page id for editing in the page edit module:

Returns incoming URL (to a module) unless nextLoadModuleUrl is set. If that is the case nextLoadModuleUrl is returned (and cleared) Used by the shortcut frame to set a "intermediate URL"

Print properties of an object

Initialize login expiration warning object

Highlight module:

Function used to switch switch module.

Frameset Module object

Used in main modules with a frameset for submodules to keep the ID between modules Typically that is set by something like this in a Web>* sub module: if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'"; if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";

Definition at line 112 of file alt_main.php.

References editPageHandling(), isModuleSetInTBE_MODULES(), and table().

Referenced by main().

00112                               {
00113       global $BE_USER,$LANG;
00114 
00115       $pt3 = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
00116       $goToModule_switch = $this->alt_menuObj->topMenu($this->loadModules->modules,0,"",4);
00117       $fsMod = implode(chr(10),$this->alt_menuObj->fsMod);
00118 
00119          // If another page module was specified, replace the default Page module with the new one
00120       $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
00121       $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00122 
00123       $this->mainJScode='
00127    function rawurlencode(str) {  //
00128       var output = escape(str);
00129       output = str_replace("*","%2A", output);
00130       output = str_replace("+","%2B", output);
00131       output = str_replace("/","%2F", output);
00132       output = str_replace("@","%40", output);
00133       return output;
00134    }
00135 
00139    function str_replace(match,replace,string)   {  //
00140       var input = ""+string;
00141       var matchStr = ""+match;
00142       if (!matchStr) {return string;}
00143       var output = "";
00144       var pointer=0;
00145       var pos = input.indexOf(matchStr);
00146       while (pos!=-1)   {
00147          output+=""+input.substr(pointer, pos-pointer)+replace;
00148          pointer=pos+matchStr.length;
00149          pos = input.indexOf(match,pos+1);
00150       }
00151       output+=""+input.substr(pointer);
00152       return output;
00153    }
00154 
00158    function typoSetup() {  //
00159       this.PATH_typo3 = "'.$pt3.'";
00160       this.PATH_typo3_enc = "'.rawurlencode($pt3).'";
00161       this.username = "'.$BE_USER->user['username'].'";
00162       this.uniqueID = "'.t3lib_div::shortMD5(uniqid('')).'";
00163       this.navFrameWidth = 0;
00164    }
00165    var TS = new typoSetup();
00166 
00170    function busy()   {  //
00171       this.loginRefreshed = busy_loginRefreshed;
00172       this.checkLoginTimeout = busy_checkLoginTimeout;
00173       this.openRefreshWindow = busy_OpenRefreshWindow;
00174       this.busyloadTime=0;
00175       this.openRefreshW=0;
00176    }
00177    function busy_loginRefreshed()   {  //
00178       var date = new Date();
00179       this.busyloadTime = Math.floor(date.getTime()/1000);
00180       this.openRefreshW=0;
00181    }
00182    function busy_checkLoginTimeout()   {  //
00183       var date = new Date();
00184       var theTime = Math.floor(date.getTime()/1000);
00185       if (theTime > this.busyloadTime+'.intval($BE_USER->auth_timeout_field).'-10)  {
00186          return true;
00187       }
00188    }
00189    function busy_OpenRefreshWindow()   {  //
00190       vHWin=window.open("login_frameset.php","relogin","height=350,width=700,status=0,menubar=0,location=1");
00191       vHWin.focus();
00192       this.openRefreshW=1;
00193    }
00194    function busy_checkLoginTimeout_timer()   {  //
00195 
00196       if (busy.checkLoginTimeout()) {
00197          if (!busy.openRefreshW && confirm('.$GLOBALS['LANG']->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.refresh_login')).'))  {
00198             busy.openRefreshWindow();
00199          }
00200       }
00201       window.setTimeout("busy_checkLoginTimeout_timer();",2*1000);   // Each 2nd second is enough for checking. The popup will be triggered 10 seconds before the login expires (see above, busy_checkLoginTimeout())
00202 
00203          // Detecting the frameset module navigation frame widths (do this AFTER setting new timeout so that any errors in the code below does not prevent another time to be set!)
00204       if (top && top.content && top.content.nav_frame && top.content.nav_frame.document && top.content.nav_frame.document.body)  {
00205          TS.navFrameWidth = (top.content.nav_frame.document.documentElement && top.content.nav_frame.document.documentElement.clientWidth) ? top.content.nav_frame.document.documentElement.clientWidth : top.content.nav_frame.document.body.clientWidth;
00206       }
00207    }
00208 
00212    function launchView(table,uid,bP)   {  //
00213       var backPath= bP ? bP : "";
00214       var thePreviewWindow="";
00215       thePreviewWindow = window.open(TS.PATH_typo3+"show_item.php?table="+escape(table)+"&uid="+escape(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
00216       if (thePreviewWindow && thePreviewWindow.focus) {
00217          thePreviewWindow.focus();
00218       }
00219    }
00220 
00224    function openUrlInWindow(url,windowName)  {  //
00225       regularWindow = window.open(url,windowName,"status=1,menubar=1,resizable=1,location=1,directories=0,scrollbars=1,toolbar=1");
00226       regularWindow.focus();
00227       return false;
00228    }
00229 
00233    function loadTopMenu(url)  {  //
00234       top.topmenuFrame.location = url;
00235    }
00236 
00240    function loadEditId(id,addGetVars)  {  //
00241       top.fsMod.recentIds["web"]=id;
00242       top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_0";     // For highlighting
00243 
00244       if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)   {
00245          top.content.nav_frame.refresh_nav();
00246       }
00247 
00248       top.goToModule("'.$pageModule.'", 0, addGetVars?addGetVars:"");
00249    }
00250 
00255    var nextLoadModuleUrl="";
00256    function getModuleUrl(inUrl)  {  //
00257       var nMU;
00258       if (top.nextLoadModuleUrl) {
00259          nMU=top.nextLoadModuleUrl;
00260          top.nextLoadModuleUrl="";
00261          return nMU;
00262       } else {
00263          return inUrl;
00264       }
00265    }
00266 
00270    function debugObj(obj,name)   {  //
00271       var acc;
00272       for (i in obj) {
00273          if (obj[i]) {
00274             acc+=i+":  "+obj[i]+"\n";
00275          }
00276       }
00277       alert("Object: "+name+"\n\n"+acc);
00278    }
00279 
00283    var busy = new busy();
00284    busy.loginRefreshed();
00285    busy_checkLoginTimeout_timer();
00286 
00287 
00291    var currentlyHighLightedId = "";
00292    var currentlyHighLighted_restoreValue = "";
00293    function highlightModuleMenuItem(trId, mainModule) {  //
00294          // Get document object:
00295       if (top.menu && top.menu.document)  {
00296          var docObj = top.menu.document;
00297          var HLclass = mainModule ? "c-mainitem-HL" : "c-subitem-row-HL";
00298       } else if (top.topmenuFrame && top.topmenuFrame.document)   {
00299          var docObj = top.topmenuFrame.document;
00300          var HLclass = mainModule ? "c-mainitem-HL" : "c-subitem-HL";
00301       }
00302 
00303       if (docObj) {
00304             // Reset old:
00305          if (currentlyHighLightedId && docObj.getElementById(currentlyHighLightedId))  {
00306             docObj.getElementById(currentlyHighLightedId).attributes.getNamedItem("class").nodeValue = currentlyHighLighted_restoreValue;
00307          }
00308             // Set new:
00309          currentlyHighLightedId = trId;
00310          if (currentlyHighLightedId && docObj.getElementById(currentlyHighLightedId))  {
00311             var classAttribObject = docObj.getElementById(currentlyHighLightedId).attributes.getNamedItem("class");
00312             currentlyHighLighted_restoreValue = classAttribObject.nodeValue;
00313             classAttribObject.nodeValue = HLclass;
00314          }
00315       }
00316    }
00317 
00321    var currentModuleLoaded = "";
00322    function goToModule(modName,cMR_flag,addGetVars)   {  //
00323       var additionalGetVariables = "";
00324       if (addGetVars)   additionalGetVariables = addGetVars;
00325 
00326       var cMR = 0;
00327       if (cMR_flag)  cMR = 1;
00328 
00329       currentModuleLoaded = modName;
00330 
00331       switch(modName)   {'.$goToModule_switch.'
00332       }
00333    }
00334 
00343    function fsModules() {  //
00344       this.recentIds=new Array();               // used by frameset modules to track the most recent used id for list frame.
00345       this.navFrameHighlightedID=new Array();      // used by navigation frames to track which row id was highlighted last time
00346       this.currentMainLoaded="";
00347    }
00348    var fsMod = new fsModules();
00349    '.$fsMod.'
00350 
00351       // Used by Frameset Modules
00352    var condensedMode = '.($BE_USER->uc['condensedMode']?1:0).';
00353    var currentSubScript = "";
00354    var currentSubNavScript = "";
00355 
00356       // Used for tab-panels:
00357    var DTM_currentTabs = new Array();
00358       ';
00359 
00360          // Check editing of page:
00361       $this->editPageHandling();
00362    }

SC_alt_main::init  ) 
 

Initialization of the script class.

Returns:
void

Definition at line 90 of file alt_main.php.

References $TBE_STYLES.

00090                      {
00091       global $TBE_MODULES,$TBE_STYLES;
00092 
00093          // Initializes the backend modules structure for use later.
00094       $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00095       $this->loadModules->load($TBE_MODULES);
00096 
00097          // Instantiates thee menu object which will generate some JavaScript for the goToModule() JS function in this frameset.
00098       $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
00099 
00100          // Check for distances defined in the styles array:
00101       if ($TBE_STYLES['dims']['leftMenuFrameW'])      $this->leftMenuFrameW = $TBE_STYLES['dims']['leftMenuFrameW'];
00102       if ($TBE_STYLES['dims']['topFrameH'])     $this->topFrameH = $TBE_STYLES['dims']['topFrameH'];
00103       if ($TBE_STYLES['dims']['shortcutFrameH'])      $this->shortcutFrameH = $TBE_STYLES['dims']['shortcutFrameH'];
00104       if ($TBE_STYLES['dims']['selMenuFrame'])     $this->selMenuFrame = $TBE_STYLES['dims']['selMenuFrame'];
00105    }

SC_alt_main::main  ) 
 

Creates the header and frameset of the backend interface.

Returns:
void

Definition at line 420 of file alt_main.php.

References $TYPO3_CONF_VARS, generateJScode(), and icons().

00420                      {
00421       global $BE_USER,$TYPO3_CONF_VARS;
00422 
00423          // Set doktype:
00424       $GLOBALS['TBE_TEMPLATE']->docType='xhtml_frames';
00425 
00426          // Make JS:
00427       $this->generateJScode();
00428       $GLOBALS['TBE_TEMPLATE']->JScode= '
00429          <script type="text/javascript" src="md5.js"></script>
00430          <script type="text/javascript" src="t3lib/jsfunc.evalfield.js"></script>
00431          ';
00432       $GLOBALS['TBE_TEMPLATE']->JScode.=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->mainJScode);
00433 
00434          // Title:
00435       $title = $TYPO3_CONF_VARS['SYS']['sitename'] ? $TYPO3_CONF_VARS['SYS']['sitename'].' [TYPO3 '.TYPO3_version.']' : 'TYPO3 '.TYPO3_version;
00436 
00437          // Start page header:
00438       $this->content.=$GLOBALS['TBE_TEMPLATE']->startPage($title);
00439 
00440          // Creates frameset
00441       $fr_content = '<frame name="content" src="'.($BE_USER->uc['startInTaskCenter']&&t3lib_extMgm::isLoaded('taskcenter')?t3lib_extMgm::extRelPath('taskcenter').'task/frameset.php':'alt_intro.php').'" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />';
00442       $fr_toplogo = '<frame name="toplogo" src="alt_toplogo.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />';
00443       $fr_topmenu = '<frame name="topmenuFrame" src="alt_topmenu_dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />';
00444 
00445       $shortcutFrame=array();
00446       if ($BE_USER->getTSConfigVal('options.shortcutFrame'))   {
00447          $shortcutFrame['rowH']=','.$this->shortcutFrameH;
00448          $shortcutFrame['frameDef']='<frame name="shortcutFrame" src="alt_shortcut.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />';
00449       }
00450 
00451          // XHTML notice: ' framespacing="0" frameborder="0" border="0"' in FRAMESET elements breaks compatibility with XHTML-frames, but HOW ELSE can I control the visual appearance?
00452       if ($GLOBALS['BE_USER']->uc['noMenuMode'])   {
00453          $this->content.= '
00454          <frameset rows="'.$this->topFrameH.',*'.$shortcutFrame['rowH'].'" framespacing="0" frameborder="0" border="0">
00455             '.(!strcmp($BE_USER->uc['noMenuMode'],'icons') ? '
00456             <frameset cols="'.$this->leftMenuFrameW.',*" framespacing="0" frameborder="0" border="0">
00457                '.$fr_toplogo.'
00458                '.$fr_topmenu.'
00459             </frameset>' : '
00460             <frameset cols="'.$this->leftMenuFrameW.','.$this->selMenuFrame.',*" framespacing="0" frameborder="0" border="0">
00461                '.$fr_toplogo.'
00462                <frame name="menu" src="alt_menu_sel.php" scrolling="no" noresize="noresize" />
00463                '.$fr_topmenu.'
00464             </frameset>').'
00465             '.$fr_content.'
00466             '.$shortcutFrame['frameDef'].'
00467          </frameset>
00468          ';
00469       } else {
00470          $this->content.='
00471          <frameset rows="'.$this->topFrameH.',*'.$shortcutFrame['rowH'].'" framespacing="0" frameborder="0" border="0">
00472             <frameset cols="'.$this->leftMenuFrameW.',*" framespacing="0" frameborder="0" border="0">
00473                '.$fr_toplogo.'
00474                '.$fr_topmenu.'
00475             </frameset>
00476             <frameset cols="'.$this->leftMenuFrameW.',*" framespacing="0" frameborder="0" border="0">
00477                <frame name="menu" src="alt_menu.php" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
00478                '.$fr_content.'
00479             </frameset>
00480             '.$shortcutFrame['frameDef'].'
00481          </frameset>
00482          ';
00483       }
00484       $this->content.='
00485 
00486 </html>';
00487    }

SC_alt_main::printContent  ) 
 

Outputting the accumulated content to screen.

Returns:
void

Definition at line 494 of file alt_main.php.

00494                            {
00495       echo $this->content;
00496    }


Member Data Documentation

SC_alt_main::$alt_menuObj
 

Definition at line 77 of file alt_main.php.

SC_alt_main::$content
 

Definition at line 74 of file alt_main.php.

SC_alt_main::$leftMenuFrameW = 130
 

Definition at line 80 of file alt_main.php.

SC_alt_main::$loadModules
 

Definition at line 76 of file alt_main.php.

SC_alt_main::$mainJScode
 

Definition at line 75 of file alt_main.php.

SC_alt_main::$selMenuFrame = 130
 

Definition at line 81 of file alt_main.php.

SC_alt_main::$shortcutFrameH = 30
 

Definition at line 83 of file alt_main.php.

SC_alt_main::$topFrameH = 32
 

Definition at line 82 of file alt_main.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:06:27 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913