00001 <?php
00002
00006 require_once "oxajax.php";
00007
00012 class oxAdminDetails extends oxAdminView
00013 {
00019 protected $_oEditor = null;
00020
00026 public function render()
00027 {
00028 $sReturn = parent::render();
00029
00030
00031 $myConfig = $this->getConfig();
00032 $sDir = $myConfig->getConfigParam( 'sShopDir' ) . '/documentation/admin';
00033 if ( is_dir( $sDir ) ) {
00034 $sDir = $myConfig->getConfigParam( 'sShopURL' ) . 'documentation/admin';
00035 } else {
00036
00037 $oShop = oxNew( 'oxshop' );
00038 $oShop->load( oxSession::getVar( 'actshop' ) );
00039
00040 $sDir = "http://docu.oxid-esales.com/PE/{$oShop->oxshops__oxversion->value}/" . oxLang::getInstance()->getTplLanguage() . '/admin';
00041 }
00042
00043 $this->_aViewData['sHelpURL'] = $sDir;
00044
00045 return $sReturn;
00046 }
00047
00059 protected function _generateTextEditor( $iWidth, $iHeight, $oObject, $sField, $sStylesheet = null )
00060 {
00061 $myConfig = $this->getConfig();
00062
00063
00064 $sEditorPath = 'wysiwigpro';
00065 $sEditorFile = getShopBasePath()."admin/".$sEditorPath . '/wysiwygPro.class.php';
00066
00067
00068
00069 $sEditObjectValue = '';
00070 if ( $oObject ) {
00071 $sInitialValue = '';
00072 if ($oObject->$sField instanceof oxField) {
00073 $sInitialValue = $oObject->$sField->getRawValue();
00074 } else {
00075 $sInitialValue = $oObject->$sField->value;
00076 }
00077 $oObject->$sField = new oxField(str_replace( '[{$shop->currenthomedir}]', $myConfig->getCurrentShopURL(), $sInitialValue ), oxField::T_RAW);
00078 $sEditObjectValue = $oObject->$sField->value;
00079 }
00080
00081
00082 if (!$sEditorFile || !file_exists($sEditorFile)) {
00083 if (strpos($iWidth, '%') === false) {
00084 $iWidth .= 'px';
00085 }
00086 if (strpos($iHeight, '%') === false) {
00087 $iHeight .= 'px';
00088 }
00089 return "<textarea id='editor_{$sField}' style='width:{$iWidth}; height:{$iHeight};'>$sEditObjectValue</textarea>";
00090 }
00091
00092 include_once ($sEditorFile);
00093
00094
00095 $this->_oEditor = new wysiwygPro();
00096
00097
00098 $sEditorUrl = $myConfig->getConfigParam( 'sShopURL' ).$myConfig->getConfigParam( 'sAdminDir' )."/{$sEditorPath}/";
00099 if ( $sAdminSSLURL = $myConfig->getConfigParam( 'sAdminSSLURL' ) ) {
00100 $sEditorUrl = "{$sAdminSSLURL}/{$sEditorPath}/";
00101 }
00102
00103 $this->_oEditor->editorURL = $sEditorUrl;
00104 $this->_oEditor->urlFormat = 'absolute';
00105
00106
00107 $this->_oEditor->documentDir = $this->_oEditor->imageDir = $myConfig->getPictureDir( false ).'wysiwigpro/';
00108 $this->_oEditor->documentURL = $this->_oEditor->imageURL = $myConfig->getPictureUrl( null, false ).'wysiwigpro/';
00109
00110
00111 $this->_oEditor->upload = true;
00112
00113
00114 $this->_oEditor->deleteFiles = true;
00115 $this->_oEditor->deleteFolders = true;
00116
00117
00118 $this->_oEditor->allowedImageExtensions = '.jpg, .jpeg, .gif, .png';
00119
00120
00121 $this->_oEditor->allowedDocExtensions = '.html, .htm, .pdf, .doc, .rtf, .txt, .xl, .xls, .ppt, .pps, .zip, .tar, .swf, .wmv, .rm, .mov, .jpg, .jpeg, .gif, .png';
00122
00123
00124 $this->_oEditor->name = $sField;
00125
00126
00127 $this->_oEditor->lang = oxLang::getInstance()->translateString( 'editor_language', oxLang::getInstance()->getTplLanguage() );
00128
00129
00130 if ( $sEditObjectValue ) {
00131 $this->_oEditor->value = $sEditObjectValue;
00132 }
00133
00134
00135 $this->setAdminMode( false );
00136 $sCSSPath = $myConfig->getResourcePath("styles/{$sStylesheet}", false );
00137 $sCSSUrl = $myConfig->getResourceUrl("styles/{$sStylesheet}", false );
00138
00139 $aCSSPaths = array();
00140
00141
00142 $aCSSPaths[] = $myConfig->getResourcePath("oxid.css", false );
00143
00144 $this->setAdminMode( true );
00145
00146 if (is_file($sCSSPath)) {
00147
00148 $aCSSPaths[] = $sCSSUrl;
00149
00150 if (is_readable($sCSSPath)) {
00151 $aCSS = @file( $sCSSPath);
00152 if ( isset( $aCSS) && $aCSS) {
00153 $aClasses = array();
00154 foreach ( $aCSS as $key => $sLine ) {
00155 $sLine = trim($sLine);
00156
00157 if ( $sLine[0] == '.' && !strstr( $sLine, 'default' ) ) {
00158
00159 $sTag = substr( $sLine, 1);
00160 $iEnd = strpos( $sTag, ' ' );
00161 if ( !isset( $iEnd ) || !$iEnd ) {
00162 $iEnd = strpos( $sTag, '\n' );
00163 }
00164
00165 if ( $sTag = substr( $sTag, 0, $iEnd ) ) {
00166 $aClasses["span class='{$sTag}'"] = $sTag;
00167 }
00168 }
00169 }
00170
00171 $this->_oEditor->stylesMenu = $aClasses;
00172 }
00173 }
00174 }
00175
00176 foreach ( $aCSSPaths as $sCssPath ) {
00177 $this->_oEditor->addStylesheet( $sCssPath );
00178 }
00179
00180
00181
00182 $this->_oEditor->loadPlugin( 'templateFilter' );
00183 $this->_oEditor->plugins['templateFilter']->protect( '[{', '}]' );
00184 if ( $myConfig->getConfigParam( 'bl_perfParseLongDescinSmarty' ) ) {
00185 $this->_oEditor->plugins['templateFilter']->assign( '[{$shop->currenthomedir}]', $myConfig->getShopURL() );
00186 $this->_oEditor->plugins['templateFilter']->assign( '[{$shop->currenthomedir}]', $myConfig->getSSLShopURL() );
00187 }
00188
00189
00190 return $this->_oEditor->fetch( $iWidth, $iHeight );
00191 }
00192
00198 public function resetNrOfCatArticles()
00199 {
00200
00201 oxUtils::getInstance()->oxResetFileCache();
00202 }
00203
00209 public function resetNrOfVendorArticles()
00210 {
00211
00212 oxUtils::getInstance()->oxResetFileCache();
00213 }
00214
00227 protected function _getCategoryTree( $sTplVarName, $sSelectedCatId, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null )
00228 {
00229
00230 if ( !isset( $this->oCatTree ) || $blForceNonCache ) {
00231 $this->oCatTree = oxNew( 'oxCategoryList' );
00232 $this->oCatTree->setShopID( $iTreeShopId );
00233 $this->oCatTree->buildList( $this->getConfig()->getConfigParam( 'bl_perfLoadCatTree' ) );
00234 }
00235
00236
00237 $oCatTree = $this->oCatTree;
00238
00239 if ( $sEditCatId && isset( $oCatTree[$sEditCatId] ) ) {
00240 unset( $oCatTree[$sEditCatId] );
00241 }
00242
00243
00244 $oRoot = oxNew( 'oxcategory' );
00245 $oRoot->oxcategories__oxtitle = new oxField('--');
00246
00247 $oCatTree->assign( array_merge( array( '' => $oRoot ), $oCatTree->getArray() ) );
00248
00249
00250 if ( $sSelectedCatId ) {
00251
00252 foreach ($oCatTree as $oCategory) {
00253 if ($oCategory->getId() == $sSelectedCatId ) {
00254 $oCategory->selected = 1;
00255 }
00256 }
00257 } else {
00258 $oCatTree->rewind();
00259 if ( $oCat = $oCatTree->current() ) {
00260 $oCat->selected = 1;
00261 $sSelectedCatId = $oCat->getId();
00262 }
00263 }
00264
00265
00266 $this->_aViewData[$sTplVarName] = $oCatTree;
00267
00268 return $sSelectedCatId;
00269 }
00270
00276 public function changeFolder()
00277 {
00278 $sFolder = oxConfig::getParameter( 'setfolder' );
00279 $sFolderClass = oxConfig::getParameter( 'folderclass' );
00280
00281 if ( $sFolderClass == 'oxcontent' && $sFolder == 'CMSFOLDER_NONE' ) {
00282 $sFolder = '';
00283 }
00284
00285 $oObject = oxNew( $sFolderClass );
00286 if ( $oObject->load( oxConfig::getParameter( 'oxid' ) ) ) {
00287 $oObject->{$oObject->getCoreTableName() . '__oxfolder'} = new oxField($sFolder);
00288 $oObject->save();
00289 }
00290 }
00291
00299 protected function _setupNavigation( $sNode )
00300 {
00301
00302 if ( $sNode ) {
00303
00304 $myAdminNavig = $this->getNavigation();
00305
00306
00307 $this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab( $sNode, $this->_iDefEdit );
00308
00309
00310 $this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn( $sNode );
00311 }
00312 }
00313 }