public
Description: Blog Modules for CMS Made Simple 2.0
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsms-blog.git
Make sure we only index if the post is published

git-svn-id: http://svn.cmsmadesimple.org/svn/blog/trunk@19 
b11ec80d-081b-0410-a2d1-923984365dec
wishy (author)
Tue Apr 08 07:38:46 -0700 2008
commit  152d572f05e09fde11a744326fe200ced0fe35a7
tree    97757d18effd003c36428e9c00af1e6e7a98efcd
parent  3aef452680351b0d4f2343fd4fbd0aa68bbf9255
...
161
162
163
164
 
 
 
 
165
166
167
168
169
 
170
171
172
...
195
196
197
 
 
 
 
 
198
199
200
...
161
162
163
 
164
165
166
167
168
169
170
171
 
172
173
174
175
...
198
199
200
201
202
203
204
205
206
207
208
0
@@ -161,12 +161,15 @@ class BlogPost extends CmsModuleOrm
0
   
0
   function after_save()
0
   {
0
- $this->index();
0
+ if ($this->status == 'publish')
0
+ $this->index();
0
+ else
0
+ $this->remove_index(); //In case the status was changed from publish to sommething else
0
   }
0
   
0
   function after_delete()
0
   {
0
- CmsSearch::get_instance()->remove_content('Blog', 'BlogPost', $this->id);
0
+ $this->remove_index();
0
   }
0
   
0
   function create_xmlrpc_array()
0
@@ -195,6 +198,11 @@ class BlogPost extends CmsModuleOrm
0
   {
0
     CmsSearch::get_instance()->add_content('Blog', 'BlogPost', $this->id, $this->get_url(), $this->title, $this->content, 'en_US', $this->get_summary_for_frontend());
0
   }
0
+
0
+ public function remove_index()
0
+ {
0
+ CmsSearch::get_instance()->remove_content('Blog', 'BlogPost', $this->id);
0
+ }
0
 }
0
 
0
 # vim:ts=4 sw=4 noet

Comments

    No one has commented yet.