public
Description: Blog Modules for CMS Made Simple 2.0
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsms-blog.git
Search Repo:
Added searching of blog posts

git-svn-id: http://svn.cmsmadesimple.org/svn/blog/trunk@18 
b11ec80d-081b-0410-a2d1-923984365dec
wishy (author)
Tue Apr 08 07:25:24 -0700 2008
commit  3aef452680351b0d4f2343fd4fbd0aa68bbf9255
tree    60dc7a2e6eb8602e858eac4d4c856382affdd232
parent  45e6bc007ff3c2a1dd558118c8e484be1cf61dff
...
82
83
84
 
85
86
87
...
206
207
208
 
 
 
 
 
 
 
 
 
209
210
211
...
82
83
84
85
86
87
88
...
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
0
@@ -82,6 +82,7 @@ class Blog extends CmsModuleBase
0
     $this->add_xmlrpc_method('editPost', 'metaWeblog');
0
     
0
     $this->add_temp_event_handler('Core', 'HeaderTagRender', 'handle_header_callback');
0
+ $this->add_temp_event_handler('Core', 'SearchReindex', 'reindex');
0
   }
0
   
0
   public function handle_header_callback($modulename, $eventname, &$params)
0
@@ -206,6 +207,15 @@ class Blog extends CmsModuleBase
0
     return $result;
0
   }
0
   
0
+ public function reindex()
0
+ {
0
+ $posts = cms_orm('BlogPost')->find_all_by_status('publish');
0
+ foreach ($posts as $one_post)
0
+ {
0
+ $one_post->index();
0
+ }
0
+ }
0
+
0
   public function get_default_summary_template()
0
   {
0
     return '{foreach from=$posts item=entry}
...
159
160
161
 
 
 
 
 
 
 
 
 
 
162
163
164
...
180
181
182
 
 
 
 
 
183
184
185
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
190
191
192
193
194
195
196
197
198
199
200
0
@@ -159,6 +159,16 @@ class BlogPost extends CmsModuleOrm
0
     $this->post_day = $this->post_date->format('d');
0
   }
0
   
0
+ function after_save()
0
+ {
0
+ $this->index();
0
+ }
0
+
0
+ function after_delete()
0
+ {
0
+ CmsSearch::get_instance()->remove_content('Blog', 'BlogPost', $this->id);
0
+ }
0
+
0
   function create_xmlrpc_array()
0
   {
0
     $result = array();
0
@@ -180,6 +190,11 @@ class BlogPost extends CmsModuleOrm
0
     
0
     return $result;
0
   }
0
+
0
+ public function index()
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
 
0
 # vim:ts=4 sw=4 noet

Comments

    No one has commented yet.