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
00033 require_once(t3lib_extMgm::extPath("kickstarter")."class.tx_kickstarter_sectionbase.php");
00034
00035 class tx_kickstarter_section_cm extends tx_kickstarter_sectionbase {
00036 var $sectionID = 'cm';
00037
00041 function render_wizard() {
00042 $lines=array();
00043
00044 $action = explode(":",$this->wizard->modData["wizAction"]);
00045 if ($action[0]=="edit") {
00046 $this->regNewEntry($this->sectionID,$action[1]);
00047 $lines = $this->catHeaderLines($lines,$this->sectionID,$this->wizard->options[$this->sectionID]," ",$action[1]);
00048 $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]];
00049 $ffPrefix='['.$this->sectionID.']['.$action[1].']';
00050
00051
00052 $subContent="<strong>Title of the ClickMenu element:</strong><BR>".
00053 $this->renderStringBox_lang("title",$ffPrefix,$piConf);
00054 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00055
00056
00057 $optValues = array(
00058 "bottom" => "Insert in bottom",
00059 "top" => "Insert in top",
00060 "before_delete" => "Insert before the 'Delete' item",
00061 );
00062 $subContent="<strong>Options</strong><BR>".
00063 $this->renderSelectBox($ffPrefix."[options]",$piConf["options"],$optValues);
00064 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00065
00066
00067 $subContent =$this->resImg("cm.png");
00068 $subContent.= $this->renderCheckBox($ffPrefix."[second_level]",$piConf["second_level"])."Activate a second-level menu.<BR>";
00069 $subContent.= $this->renderCheckBox($ffPrefix."[only_page]",$piConf["only_page"])."Add only if the click menu is on a 'Page' (example)<BR>";
00070 $subContent.= $this->renderCheckBox($ffPrefix."[only_if_edit]",$piConf["only_if_edit"])."Only active if item is editable.<BR>";
00071 $subContent.= $this->renderCheckBox($ffPrefix."[remove_view]",$piConf["remove_view"])."Remove 'Show' element (example)<BR>";
00072 $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00073 }
00074
00075
00076 $this->process_hook('render_wizard', $lines);
00077
00078 $content = '<table border=0 cellpadding=2 cellspacing=2>'.implode("",$lines).'</table>';
00079 return $content;
00080 }
00081
00082
00083
00084
00085
00086
00087
00088
00092 function render_extPart($k,$config,$extKey) {
00093 $WOP = '[' . $this->sectionID . '][' . $k .']';
00094 $cN = $this->returnName($extKey,'class', $this->sectionID . $k);
00095 $filename = 'class.'.$cN.'.php';
00096 $pathSuffix = $this->sectionID . $k .'/';
00097
00098
00099 $this->wizard->ext_tables[]=$this->sPS('
00100 '.$this->WOPcomment('WOP:'.$WOP.':').'
00101 if (TYPO3_MODE=="BE") {
00102 $GLOBALS["TBE_MODULES_EXT"]["xMOD_alt_clickmenu"]["extendCMclasses"][]=array(
00103 "name" => "'.$cN.'",
00104 "path" => t3lib_extMgm::extPath($_EXTKEY)."'.$filename.'"
00105 );
00106 }
00107 ');
00108
00109 $this->addLocalConf($this->wizard->ext_locallang,$config,"title","cm",$k);
00110
00111
00112 $this->addFileToFileArray($pathSuffix."cm_icon.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound_module.gif"));
00113
00114
00115 $content = "";
00116 $content.=$this->sPS('
00117
00118 $LL = $this->includeLL();
00119
00120
00121
00122 $url = t3lib_extMgm::extRelPath("'.$extKey.'")."'.$pathSuffix.'index.php?id=".$uid;
00123 $localItems[] = $backRef->linkItem(
00124 $GLOBALS["LANG"]->getLLL("cm'.$k.'_title",$LL),
00125 $backRef->excludeIcon(\'<img src="\'.t3lib_extMgm::extRelPath("'.$extKey.'").\''.$pathSuffix.'cm_icon.gif" width="15" height="12" border=0 align=top>\'),
00126 $backRef->urlRefForCM($url),
00127 1
00128 );
00129 ');
00130 if ($config["second_level"]) {
00131 $secondContent = $content;
00132 $secondContent.=chr(10).'$menuItems=array_merge($menuItems,$localItems);';
00133
00134 $content = "";
00135 $content.=$this->sPS('
00136 $LL = $this->includeLL();
00137
00138 $localItems[]="spacer";
00139 $localItems["moreoptions_'.$cN.'"]=$backRef->linkItem(
00140 $GLOBALS["LANG"]->getLLL("cm'.$k.'_title_activate",$LL),
00141 $backRef->excludeIcon(\'<img src="\'.t3lib_extMgm::extRelPath("'.$extKey.'").\''.$pathSuffix.'cm_icon_activate.gif" width="15" height="12" border=0 align=top>\'),
00142 "top.loadTopMenu(\'".t3lib_div::linkThisScript()."&cmLevel=1&subname=moreoptions_'.$cN.'\');return false;",
00143 0,
00144 1
00145 );
00146 ');
00147
00148
00149 $this->addLocalConf($this->wizard->ext_locallang,array("title_activate"=>"...Second level ->"),"title_activate","cm",$k,0,1);
00150
00151 $this->addFileToFileArray($pathSuffix."cm_icon_activate.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound_module.gif"));
00152 }
00153
00154 if ($config["only_page"]) $content=$this->sPS('
00155
00156 if ($table!="pages") return $menuItems;
00157 ').$content;
00158
00159 $content.=$this->sPS('
00160 '.$this->WOPcomment('(WOP:'.$WOP.'[options] BEGIN) Inserts the item at the chosen location').'
00161 ');
00162 if ($config["options"]=="top") {
00163 $content.=$this->sPS('
00164 $menuItems=array_merge($localItems,$menuItems);
00165 ');
00166 } elseif ($config["options"]=="before_delete") {
00167 $content.=$this->sPS('
00168
00169 reset($menuItems);
00170 $c=0;
00171 while(list($k)=each($menuItems)) {
00172 $c++;
00173 if (!strcmp($k,"delete")) break;
00174 }
00175
00176 $c-=2;
00177
00178 array_splice(
00179 $menuItems,
00180 $c,
00181 0,
00182 $localItems
00183 );
00184 ');
00185 } else {
00186 $content.=$this->sPS('
00187
00188 $menuItems=array_merge($menuItems,$localItems);
00189 ');
00190 }
00191 $content.=$this->sPS('
00192 '.$this->WOPcomment('(WOP:'.$WOP.'[options] END)').'
00193 ');
00194
00195 if ($config["only_if_edit"]) $content=$this->wrapBody('
00196 if ($backRef->editOK) {
00197 ',$content,'
00198 }
00199 ');
00200
00201
00202 if ($config["remove_view"]) $content.=$this->sPS('
00203
00204 unset($menuItems["view"]);
00205 ');
00206
00207 $content=$this->wrapBody('
00208 if (!$backRef->cmLevel) {
00209 ',$content,'
00210 }
00211 ');
00212
00213 if ($config["second_level"]) {
00214 $content.=$this->wrapBody('
00215 else {
00216 ',$secondContent,'
00217 }
00218 ');
00219 }
00220
00221
00222
00223
00224
00225 $content=$this->wrapBody('
00226 function main(&$backRef,$menuItems,$table,$uid) {
00227 global $BE_USER,$TCA,$LANG;
00228
00229 $localItems = Array();
00230 ',$content,'
00231 return $menuItems;
00232 }
00233 ');
00234
00235 $content.=$this->addLLFunc($extKey);
00236
00237
00238 $content=$this->wrapBody('
00239 class '.$cN.' {
00240 ',$content,'
00241 }
00242 ');
00243
00244
00245 # $this->printPre($content);
00246
00247 $this->addFileToFileArray($filename,$this->PHPclassFile($extKey,$filename,$content,"Addition of an item to the clickmenu"));
00248
00249
00250 $cN = $this->returnName($extKey,"class","cm".$k);
00251 $this->writeStandardBE_xMod($extKey,$config,$pathSuffix,$cN,$k,"cm");
00252
00253 }
00254
00255 }
00256
00257
00258
00259 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_cm.php']) {
00260 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_cm.php']);
00261 }
00262
00263
00264 ?>