コード例 #1
0
ファイル: Patch.php プロジェクト: burbuja/indefero
 function postSave($create = false)
 {
     if ($create) {
         IDF_Timeline::insert($this, $this->get_review()->get_project(), $this->get_review()->get_submitter());
         IDF_Search::index($this->get_review());
     }
 }
コード例 #2
0
ファイル: Wiki.php プロジェクト: burbuja/indefero
 public function search($request, $match)
 {
     $prj = $request->project;
     if (!isset($request->REQUEST['q']) or trim($request->REQUEST['q']) == '') {
         $url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::index', array($prj->shortname));
         return new Pluf_HTTP_Response_Redirect($url);
     }
     $q = $request->REQUEST['q'];
     $title = sprintf(__('Documentation Search - %s'), $q);
     $pages = new Pluf_Search_ResultSet(IDF_Search::mySearch($q, $prj, 'IDF_WikiPage'));
     if (count($pages) > 100) {
         $pages->results = array_slice($pages->results, 0, 100);
     }
     $pag = new Pluf_Paginator();
     $pag->items = $pages;
     $pag->class = 'recent-issues';
     $pag->item_extra_props = array('project_m' => $prj, 'shortname' => $prj->shortname, 'current_user' => $request->user);
     $pag->summary = __('This table shows the pages found.');
     $pag->action = array('IDF_Views_Wiki::search', array($prj->shortname), array('q' => $q));
     $pag->edit_action = array('IDF_Views_Wiki::view', 'shortname', 'title');
     $pag->extra_classes = array('right', '', 'a-c');
     $list_display = array('title' => __('Page Title'), array('summary', 'IDF_Views_Wiki_SummaryAndLabels', __('Summary')), array('modif_dtime', 'Pluf_Paginator_DateYMD', __('Updated')));
     $pag->configure($list_display);
     $pag->items_per_page = 100;
     $pag->no_results_text = __('No pages were found.');
     $pag->setFromRequest($request);
     $params = array('page_title' => $title, 'pages' => $pag, 'q' => $q);
     return Pluf_Shortcuts_RenderToResponse('idf/wiki/search.html', $params, $request);
 }
コード例 #3
0
ファイル: WikiRevision.php プロジェクト: Br3nda/indefero
 function postSave($create = false)
 {
     if ($create) {
         // Check if more than one revision for this page. We do
         // not want to insert the first revision in the timeline
         // as the page itself is inserted.  We do not insert on
         // update as update is performed to change the is_head
         // flag.
         $sql = new Pluf_SQL('wikipage=%s', array($this->wikipage));
         $rev = Pluf::factory('IDF_WikiRevision')->getList(array('filter' => $sql->gen()));
         if ($rev->count() > 1) {
             IDF_Timeline::insert($this, $this->get_wikipage()->get_project(), $this->get_submitter());
             foreach ($rev as $r) {
                 if ($r->id != $this->id and $r->is_head) {
                     $r->is_head = false;
                     $r->update();
                 }
             }
         }
         $page = $this->get_wikipage();
         $page->update();
         // Will update the modification timestamp.
         IDF_Search::index($page);
     }
 }
コード例 #4
0
ファイル: 2Search.php プロジェクト: burbuja/indefero
/**
 * Add the download of files.
 */
function IDF_Migrations_2Search_up($params = null)
{
    $models = array('IDF_Search_Occ');
    $db = Pluf::db();
    $schema = new Pluf_DB_Schema($db);
    foreach ($models as $model) {
        $schema->model = new $model();
        $schema->createTables();
    }
    foreach (Pluf::factory('IDF_Issue')->getList() as $i) {
        IDF_Search::index($i);
    }
}
コード例 #5
0
ファイル: IssueComment.php プロジェクト: Br3nda/indefero
 function postSave($create = false)
 {
     if ($create) {
         // Check if more than one comment for this issue. We do
         // not want to insert the first comment in the timeline as
         // the issue itself is inserted.
         $sql = new Pluf_SQL('issue=%s', array($this->issue));
         $co = Pluf::factory('IDF_IssueComment')->getList(array('filter' => $sql->gen()));
         if ($co->count() > 1) {
             IDF_Timeline::insert($this, $this->get_issue()->get_project(), $this->get_submitter());
         }
     }
     IDF_Search::index($this->get_issue());
 }
コード例 #6
0
ファイル: Commit.php プロジェクト: Br3nda/indefero
 function preDelete()
 {
     IDF_Timeline::remove($this);
     IDF_Search::remove($this);
 }
コード例 #7
0
ファイル: Issue.php プロジェクト: Br3nda/indefero
 public function search($request, $match)
 {
     $prj = $request->project;
     if (!isset($request->REQUEST['q']) or trim($request->REQUEST['q']) == '') {
         $url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index', array($prj->shortname));
         return new Pluf_HTTP_Response_Redirect($url);
     }
     $q = $request->REQUEST['q'];
     $title = sprintf(__('Search Issues - %s'), $q);
     $issues = new Pluf_Search_ResultSet(IDF_Search::mySearch($q, $prj, 'IDF_Issue'));
     if (count($issues) > 100) {
         // no more than 100 results as we do not care
         $issues->results = array_slice($issues->results, 0, 100);
     }
     $pag = new Pluf_Paginator();
     $pag->items = $issues;
     $pag->class = 'recent-issues';
     $pag->item_extra_props = array('project_m' => $prj, 'shortname' => $prj->shortname, 'current_user' => $request->user);
     $pag->summary = __('This table shows the found issues.');
     $pag->action = array('IDF_Views_Issue::search', array($prj->shortname), array('q' => $q));
     $pag->extra_classes = array('a-c', '', 'a-c', '');
     $list_display = array('id' => __('Id'), array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')), array('status', 'IDF_Views_Issue_ShowStatus', __('Status')), array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')));
     $pag->configure($list_display);
     $pag->items_per_page = 100;
     $pag->no_results_text = __('No issues were found.');
     $pag->setFromRequest($request);
     $params = array('page_title' => $title, 'issues' => $pag, 'q' => $q);
     return Pluf_Shortcuts_RenderToResponse('idf/issues/search.html', $params, $request);
 }
コード例 #8
0
ファイル: Review.php プロジェクト: burbuja/indefero
 function postSave($create = false)
 {
     // At creation, we index after saving the associated patch.
     if (!$create) {
         IDF_Search::index($this);
     }
 }
コード例 #9
0
ファイル: Commit.php プロジェクト: burbuja/indefero
 function preDelete()
 {
     IDF_Timeline::remove($this);
     IDF_Search::remove($this);
     IDF_Gconf::dropForModel($this);
 }