Changeset 11849
- Timestamp:
- 08/30/07 11:32:18 (1 year ago)
- Files:
-
- trunk/midcom/net.nehmer.static/handler/create.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/net.nehmer.static/handler/create.php
r11276 r11849 150 150 $this->_article = new midcom_db_article(); 151 151 $this->_article->topic = $this->_content_topic->id; 152 152 153 153 if ( array_key_exists('name', $this->_defaults) 154 154 && $this->_defaults['name'] == 'index') … … 195 195 { 196 196 case 'save': 197 198 $tries = 0; 199 $maxtries = 999; 200 197 201 if ( $this->_config->get('simple_name_handling') 198 202 && $this->_article->name == '') … … 201 205 { 202 206 $urlgenerator = $_MIDCOM->serviceloader->load('midcom_core_service_urlgenerator'); 203 $this->_article->name = $urlgenerator->from_string($this->_article->title); 204 $this->_article->update(); 207 $article_tmp_name = $urlgenerator->from_string($this->_article->title); 205 208 } 206 209 else 207 210 { 208 $ this->_article->name = $this->_article->title;211 $article_tmp_name = $this->_article->title; 209 212 } 213 210 214 } 211 215 else 216 { 217 $article_tmp_name = $this->_article->title; 218 } 219 220 $this->_article->name = $article_tmp_name; 221 222 while( !$this->_article->update() 223 && $tries < $maxtries) 224 { 225 $this->_article->name = $article_tmp_name; 226 if ($tries > 0) 227 { 228 // Append an integer if articles with same name exist 229 $this->_article->name .= sprintf("-%03d", $tries); 230 } 231 $tries++; 232 } 233 212 234 // Index the article 213 235 $indexer =& $_MIDCOM->get_service('indexer');
