00001 <?php
00002
00006 require_once "oxajax.php";
00007
00011 class oxAdminDetails extends oxAdminView
00012 {
00018 protected $_oEditor = null;
00019
00025 public function render()
00026 {
00027 $sReturn = parent::render();
00028
00029
00030 $myConfig = $this->getConfig();
00031 $sDir = $myConfig->getConfigParam( 'sShopDir' ) . '/documentation/admin';
00032 if ( is_dir( $sDir ) ) {
00033 $sDir = $myConfig->getConfigParam( 'sShopURL' ) . 'documentation/admin';
00034 } else {
00035
00036 $oShop = $this->_getEditShop( oxSession::getVar( 'actshop' ) );
00037
00038 $sDir = "http://docu.oxid-esales.com/PE/{$oShop->oxshops__oxversion->value}/" . oxLang::getInstance()->getTplLanguage() . '/admin';
00039 }
00040
00041 $this->_aViewData['sHelpURL'] = $sDir;
00042
00043 return $sReturn;
00044 }
00045
00057 protected function _generateTextEditor( $iWidth, $iHeight, $oObject, $sField, $sStylesheet = null )
00058 {
00059 $myConfig = $this->getConfig();
00060
00061
00062 $sEditorPath = 'wysiwigpro';
00063 $sEditorFile = getShopBasePath()."admin/".$sEditorPath . '/wysiwygPro.class.php';
00064
00065
00066
00067 $sEditObjectValue = '';
00068 if ( $oObject ) {
00069 $sInitialValue = '';
00070 if ($oObject->$sField instanceof oxField) {
00071 $sInitialValue = $oObject->$sField->getRawValue();
00072 } else {
00073 $sInitialValue = $oObject->$sField->value;
00074 }
00075 $oObject->$sField = new oxField(str_replace( array( '[{$shop->currenthomedir}]', '[{$oViewConf->getCurrentHomeDir()}]' ), $myConfig->getCurrentShopURL(), $sInitialValue ), oxField::T_RAW);
00076 $sEditObjectValue = $oObject->$sField->value;
00077 }
00078
00079
00080 if (!$sEditorFile || !file_exists($sEditorFile)) {
00081 if (strpos($iWidth, '%') === false) {
00082 $iWidth .= 'px';
00083 }
00084 if (strpos($iHeight, '%') === false) {
00085 $iHeight .= 'px';
00086 }
00087 return "<textarea id='editor_{$sField}' style='width:{$iWidth}; height:{$iHeight};'>$sEditObjectValue</textarea>";
00088 }
00089
00090 include_once ($sEditorFile);
00091
00092
00093 $this->_oEditor = new wysiwygPro();
00094
00095
00096 $sEditorUrl = $myConfig->getConfigParam( 'sShopURL' ).$myConfig->getConfigParam( 'sAdminDir' )."/{$sEditorPath}/";
00097 if ( $sAdminSSLURL = $myConfig->getConfigParam( 'sAdminSSLURL' ) ) {
00098 $sEditorUrl = "{$sAdminSSLURL}/{$sEditorPath}/";
00099 }
00100
00101 $this->_oEditor->editorURL = $sEditorUrl;
00102 $this->_oEditor->urlFormat = 'preserve';
00103
00104
00105 $this->_oEditor->documentDir = $this->_oEditor->imageDir = $myConfig->getPictureDir( false ).'wysiwigpro/';
00106 $this->_oEditor->documentURL = $this->_oEditor->imageURL = $myConfig->getPictureUrl( null, false ).'wysiwigpro/';
00107
00108
00109 $this->_oEditor->upload = true;
00110
00111
00112 $this->_oEditor->emptyValue = "";
00113
00114
00115 $this->_oEditor->deleteFiles = true;
00116 $this->_oEditor->deleteFolders = true;
00117
00118
00119 $this->_oEditor->allowedImageExtensions = '.jpg, .jpeg, .gif, .png';
00120
00121
00122 $this->_oEditor->allowedDocExtensions = '.html, .htm, .pdf, .doc, .rtf, .txt, .xl, .xls, .ppt, .pps, .zip, .tar, .swf, .wmv, .rm, .mov, .jpg, .jpeg, .gif, .png';
00123
00124
00125 $this->_oEditor->name = $sField;
00126
00127
00128 $oLang = oxLang::getInstance();
00129 $this->_oEditor->lang = $oLang->translateString( 'editor_language', $oLang->getTplLanguage() );
00130
00131
00132 if ( $sEditObjectValue ) {
00133 $this->_oEditor->value = $sEditObjectValue;
00134 }
00135
00136
00137 $this->setAdminMode( false );
00138 $sCSSPath = $myConfig->getResourcePath("styles/{$sStylesheet}", false );
00139 $sCSSUrl = $myConfig->getResourceUrl("styles/{$sStylesheet}", false );
00140
00141 $aCSSPaths = array();
00142
00143
00144 $aCSSPaths[] = $myConfig->getResourcePath("oxid.css", false );
00145
00146 $this->setAdminMode( true );
00147
00148 if (is_file($sCSSPath)) {
00149
00150 $aCSSPaths[] = $sCSSUrl;
00151
00152 if (is_readable($sCSSPath)) {
00153 $aCSS = @file( $sCSSPath);
00154 if ( isset( $aCSS) && $aCSS) {
00155 $aClasses = array();
00156 $oStr = getStr();
00157 foreach ( $aCSS as $key => $sLine ) {
00158 $sLine = trim($sLine);
00159
00160 if ( $sLine[0] == '.' && !strstr( $sLine, 'default' ) ) {
00161
00162 $sTag = $oStr->substr( $sLine, 1);
00163 $iEnd = $oStr->strpos( $sTag, ' ' );
00164 if ( !isset( $iEnd ) || !$iEnd ) {
00165 $iEnd = $oStr->strpos( $sTag, '\n' );
00166 }
00167
00168 if ( $sTag = $oStr->substr( $sTag, 0, $iEnd ) ) {
00169 $aClasses["span class='{$sTag}'"] = $sTag;
00170 }
00171 }
00172 }
00173 $this->_oEditor->stylesMenu = $aClasses;
00174 }
00175 }
00176 }
00177
00178 foreach ( $aCSSPaths as $sCssPath ) {
00179 $this->_oEditor->addStylesheet( $sCssPath );
00180 }
00181
00182
00183
00184 $this->_oEditor->loadPlugin( 'templateFilter' );
00185 $this->_oEditor->plugins['templateFilter']->protect( '[{', '}]' );
00186 if ( $myConfig->getConfigParam( 'bl_perfParseLongDescinSmarty' ) ) {
00187 $this->_oEditor->plugins['templateFilter']->assign( '[{$oViewConf->getCurrentHomeDir()}]', $myConfig->getShopURL() );
00188 $this->_oEditor->plugins['templateFilter']->assign( '[{$oViewConf->getCurrentHomeDir()}]', $myConfig->getSSLShopURL() );
00189 }
00190
00191
00192 return $this->_oEditor->fetch( $iWidth, $iHeight );
00193 }
00194
00200 public function resetNrOfCatArticles()
00201 {
00202
00203 $this->resetContentCache();
00204 }
00205
00211 public function resetNrOfVendorArticles()
00212 {
00213
00214 $this->resetContentCache();
00215 }
00216
00222 public function resetNrOfManufacturerArticles()
00223 {
00224
00225 $this->resetContentCache();
00226 }
00227
00240 protected function _getCategoryTree( $sTplVarName, $sSelectedCatId, $sEditCatId = '', $blForceNonCache = false, $iTreeShopId = null )
00241 {
00242
00243 if ( !isset( $this->oCatTree ) || $blForceNonCache ) {
00244 $this->oCatTree = oxNew( 'oxCategoryList' );
00245 $this->oCatTree->setShopID( $iTreeShopId );
00246 $this->oCatTree->buildList( $this->getConfig()->getConfigParam( 'bl_perfLoadCatTree' ) );
00247 }
00248
00249
00250 $oCatTree = $this->oCatTree;
00251
00252 if ( $sEditCatId && isset( $oCatTree[$sEditCatId] ) ) {
00253 unset( $oCatTree[$sEditCatId] );
00254 }
00255
00256
00257 $oRoot = oxNew( 'oxcategory' );
00258 $oRoot->oxcategories__oxtitle = new oxField('--');
00259
00260 $oCatTree->assign( array_merge( array( '' => $oRoot ), $oCatTree->getArray() ) );
00261
00262
00263 if ( $sSelectedCatId ) {
00264
00265 foreach ($oCatTree as $oCategory) {
00266 if ($oCategory->getId() == $sSelectedCatId ) {
00267 $oCategory->selected = 1;
00268 break;
00269 }
00270 }
00271 } else {
00272 $oCatTree->rewind();
00273 if ( $oCat = $oCatTree->current() ) {
00274 $oCat->selected = 1;
00275 $sSelectedCatId = $oCat->getId();
00276 }
00277 }
00278
00279
00280 $this->_aViewData[$sTplVarName] = $oCatTree;
00281
00282 return $sSelectedCatId;
00283 }
00284
00290 public function changeFolder()
00291 {
00292 $sFolder = oxConfig::getParameter( 'setfolder' );
00293 $sFolderClass = oxConfig::getParameter( 'folderclass' );
00294
00295 if ( $sFolderClass == 'oxcontent' && $sFolder == 'CMSFOLDER_NONE' ) {
00296 $sFolder = '';
00297 }
00298
00299 $oObject = oxNew( $sFolderClass );
00300 if ( $oObject->load( oxConfig::getParameter( 'oxid' ) ) ) {
00301 $oObject->{$oObject->getCoreTableName() . '__oxfolder'} = new oxField($sFolder);
00302 $oObject->save();
00303 }
00304 }
00305
00313 protected function _setupNavigation( $sNode )
00314 {
00315
00316 if ( $sNode ) {
00317
00318 $myAdminNavig = $this->getNavigation();
00319
00320
00321 $this->_aViewData['default_edit'] = $myAdminNavig->getActiveTab( $sNode, $this->_iDefEdit );
00322
00323
00324 $this->_aViewData['bottom_buttons'] = $myAdminNavig->getBtn( $sNode );
00325 }
00326 }
00327
00335 protected function _resetCounts( $aIds )
00336 {
00337 $oUtils = oxUtilsCount::getInstance();
00338 foreach ( $aIds as $sType => $aResetInfo ) {
00339 foreach ( $aResetInfo as $sResetId => $iPos ) {
00340 switch ( $sType ) {
00341 case 'vendor':
00342 $this->resetCounter( "vendorArticle", $sResetId );
00343 break;
00344 case 'manufacturer':
00345 $this->resetCounter( "manufacturerArticle", $sResetId );
00346 break;
00347 }
00348 }
00349 }
00350 }
00351 }