Commit ddbdfe71 authored by Frank Bergmann's avatar Frank Bergmann

- added OpenACS 5.6 code

parent 1e4b5633
<?xml version="1.0" encoding="utf-8"?>
<message_catalog package_key="search" locale="cs_CZ" charset="utf-8">
<msg key="Advanced_Search">Pokročilé hledání</msg>
<msg key="anytime">kdykoli</msg>
<msg key="Date_Range">Datové rozmezí</msg>
<msg key="details">podrobnosti</msg>
<msg key="Feeling_Lucky">Zkusím štěstí</msg>
<msg key="lt_bstopwordsb_is_a_very">&quot;&lt;b&gt;%stopwords%&lt;/b&gt;&quot; je velmi běžné slovo a nebylo zahrnuto do vašeho hledání</msg>
<msg key="lt_FtsEngineDriver_not_a">FtsEngineDriver není dostupný!</msg>
<msg key="lt_Make_sure_all_words_a">Ověřte korektní zápis všech slov</msg>
<msg key="lt_No_pages_were_found_c">Nebyly nalezené žádné stránky obsahující &quot;</msg>
<msg key="lt_The_following_words_a">Následující slova jsou velmi běžná a nebyla zahrnuta do vašeho hledání</msg>
<msg key="lt_Try_different_keyword">Zkuste jiná klíčová slova.</msg>
<msg key="lt_Try_more_general_keyw">Zkuste obecnější klíčová slova.</msg>
<msg key="lt_Try_your_query_on_stw">Zkuste hledat na: %stw;noquote%</msg>
<msg key="lt_You_must_specify_some">Musíte zadat klíčová slova</msg>
<msg key="Next">Další</msg>
<msg key="past_3_months">poslední 3 měsíce</msg>
<msg key="past_6_months">posledních 6 měsíců</msg>
<msg key="past_year">poslední rok</msg>
<msg key="Previous">Předchozí</msg>
<msg key="Result_page">Strana s výsledky:</msg>
<msg key="results">výsledky</msg>
<msg key="Search">Hledat</msg>
<msg key="Searched_for_query">Hledaný výraz: %query%</msg>
<msg key="Suggestions">Návrhy:</msg>
<msg key="Try_fewer_keywords">Zkuste méně klíčových slov.</msg>
<msg key="Untitled">Nepojmenováno</msg>
</message_catalog>
<?xml version="1.0" encoding="utf-8"?>
<message_catalog package_key="search" locale="el_GR" charset="utf-8">
<msg key="________Search_took">. Η αναζήτηση διήρκησε</msg>
<msg key="Advanced_Search">Προχωρημένη αναζήτηση</msg>
<msg key="advanced_search">&quot;προχωρημένη αναζήτηση&quot;</msg>
<msg key="anytime">οποτεδήποτε</msg>
<msg key="Date_Range">Χρονική περίοδος</msg>
<msg key="details">Λεπτομέρειες</msg>
<msg key="Feeling_Lucky">Νιώθω τυχερός</msg>
<msg key="lt_bstopwordsb_is_a_very">Η &quot;&lt;b&gt;%stopwords%&lt;/b&gt;&quot; είναι μια πολύ κοινή λέξη και δεν συμπεριελήφθη στην αναζήτηση.</msg>
<msg key="lt_FtsEngineDriver_not_a">Ο FtsEngineDriver δεν είναι διαθέσιμος! </msg>
<msg key="lt_Make_sure_all_words_a">Σιγουρευθείτε ότι όλες οι λέξεις έχουν γραφεί κανονικά.</msg>
<msg key="lt_No_pages_were_found_c">Δεν βρέθηκαν σελίδες που να περιέχουν &quot; </msg>
<msg key="lt_The_following_words_a">Οι ακόλουθες λέξεις είναι πολύ κοινές και δεν έχουν συμπεριληφθεί στην αναζήτηση σας:</msg>
<msg key="lt_Tip_In_most_browsers_">Συμβουλή: Στις περισσότερες εφαρμογές πλοήγησης μπορείτε να πατήσετε το enter αντί να κάνετε κλικ στο κουμπί αναζήτησης. </msg>
<msg key="lt_Try_different_keyword">Προσπαθήστε με διάφορες λέξεις κλειδιά.</msg>
<msg key="lt_Try_more_general_keyw">Προσπαθήστε με πιο γενικές λέξεις κλειδιά.</msg>
<msg key="lt_Try_your_query_on_stw">Προσπαθήστε την αναζήτηση σας στο: %stw;noquote%
</msg>
<msg key="lt_You_must_specify_some">Πρέπει να ορίσετε κάποιες λέξεις κλειδιά</msg>
<msg key="nbspDisplay">&amp;nbsp;Display</msg>
<msg key="Next">Επόμενο</msg>
<msg key="of_about">από </msg>
<msg key="past_3_months">τους τελευταίους 3 μήνες</msg>
<msg key="past_6_months">τους τελευταίους 6 μήνες</msg>
<msg key="past_year">τον τελευταίο χρόνο </msg>
<msg key="Previous">Προηγούμενο</msg>
<msg key="Result_page">Σελίδα αποτελεσμάτων:</msg>
<msg key="Results">Αποτελέσματα</msg>
<msg key="results">αποτελέσματα</msg>
<msg key="Search">Αναζήτηση</msg>
<msg key="Searched_for_query">Αναζήτηση αποτελεσμάτων για &lt;strong&gt;%query%&lt;/strong&gt;</msg>
<msg key="seconds">δευτερόλεπτα.</msg>
<msg key="selected">επιλεγμένο</msg>
<msg key="Suggestions">Προτάσεις:</msg>
<msg key="The">Το &quot;&lt;b&gt;AND&lt;/b&gt;&quot; δεν χρειάζεται - όλοι οι όροι έχουν ληφθεί υπόψη κατά την αναζήτηση.</msg>
<msg key="Try_fewer_keywords">Προσπαθήστε με λιγότερες λέξεις κλειδιά.</msg>
<msg key="Untitled">Χωρίς τίτλο</msg>
</message_catalog>
<?xml version="1.0" encoding="ISO-8859-1"?>
<message_catalog package_key="search" locale="nl_ZA" charset="ISO-8859-1">
<msg key="Advanced_Search">Gevorderde soektog</msg>
<msg key="and_not_needed">&quot;&lt;b&gt;AND&lt;/b&gt;&quot;-operator is onnodig -- ons gebruik standaard alle soekterme.</msg>
<msg key="anytime">eender wanneer</msg>
<msg key="Date_Range">Datumbereik</msg>
<msg key="details">details</msg>
<msg key="Display">Toon</msg>
<msg key="Feeling_Lucky">Doen 'n gok</msg>
<msg key="lt_bstopwordsb_is_a_very">&quot;&lt;b&gt;%stopwords%&lt;/b&gt;&quot; is 'n nogal baie voorkomend woord en is nie in die soekopdrag meegeneem nie.</msg>
<msg key="lt_FtsEngineDriver_not_a">FtsEngineDriver nie beskikbaar nie</msg>
<msg key="lt_Make_sure_all_words_a">Let op dat alle woorde korrek gespel is.</msg>
<msg key="lt_No_pages_were_found_c">Geen bladsye gevind nie met &quot;</msg>
<msg key="lt_The_following_words_a">Die volgende woorde kom nogal baie voor en is nie in die soekopdrag meegeneem nie:</msg>
<msg key="lt_Try_different_keyword">Probeer andere kernwoorde.</msg>
<msg key="lt_Try_more_general_keyw">Probeer meer algemene kernwoorden.</msg>
<msg key="lt_Try_your_query_on_stw">Probeer jou soekvraag op: %stw;noquote%</msg>
<msg key="lt_You_must_specify_some">Jy moet 'n aantal kernwoorde opgeef</msg>
<msg key="Next">Volgende</msg>
<msg key="no_driver_contact_webmaster">Soek is momenteel nie gekonfigureer nie. Alleen die webbaas kan dit inskakel.</msg>
<msg key="past_3_months">afgelope 3 maande</msg>
<msg key="past_6_months">afgelope 6 maande</msg>
<msg key="past_year">afgelope jaar</msg>
<msg key="Previous">Vorige</msg>
<msg key="Result_page">Resultaatbladsy:</msg>
<msg key="results">resultate</msg>
<msg key="Results_count">Resultate &lt;b&gt;%low% - %high%&lt;/b&gt; uit ongeveer &lt;b&gt;%count%&lt;/b&gt;. Soektog het %elapsed% seconde geverg.</msg>
<msg key="Search">Soek</msg>
<msg key="Searched_for_query">Gesoek na: %query%</msg>
<msg key="Suggestions">Suggesties:</msg>
<msg key="Tip_In_most_browsers_return">Tip: In die meeste blaaiers kan u gewoon op &quot;return&quot; druk in plaas van op die soekknop.</msg>
<msg key="Try_fewer_keywords">Probeer minder kernwoorde.</msg>
<msg key="Untitled">Naamloos</msg>
</message_catalog>
<?xml version="1.0" encoding="utf-8"?>
<message_catalog package_key="search" locale="pl_PL" charset="utf-8">
<msg key="lt_Try_different_keyword">Spróbuj z innymi słowami kluczowymi.</msg>
<msg key="lt_Try_more_general_keyw">Spróbuj bardziej ogólnych słów kluczowych.</msg>
<msg key="lt_You_must_specify_some">Musisz podać jakieś słowa kluczowe.</msg>
<msg key="Next">Następne</msg>
<msg key="past_3_months">zeszłe 3 miesiące</msg>
<msg key="past_6_months">zeszłych 6 miesięcy</msg>
<msg key="past_year">zeszły rok</msg>
<msg key="Previous">Poprzednie</msg>
<msg key="Result_page">Strona Wyników:</msg>
<msg key="results">wyniki</msg>
<msg key="Search">Szukaj</msg>
<msg key="Searched_for_query">Szukano frazy: &lt;b&gt;%query%&lt;/b&gt;</msg>
<msg key="Suggestions">Sugestie:</msg>
<msg key="Try_fewer_keywords">Spróbuj wpisać mniej słów.</msg>
<msg key="Untitled">Bez Tytułu</msg>
</message_catalog>
<if @results_paginator:rowcount@ gt 0>
<div id="results-pages" class="@paginator_class@">
<ul class="compact list-paginator">
<if @url_previous_group@ nil>
<li>&lt;&lt;</li>
</if>
<else>
<li><a href="@url_previous_group@">&lt;&lt;</a></li>
</else>
<if @url_previous@ nil>
<li>&lt;</li>
</if>
<else>
<li><a href="@url_previous@">&lt;</a></li>
</else>
<multiple name="results_paginator">
<if @results_paginator.current_p@>
<li class="current">@results_paginator.item@</li>
</if>
<else>
<li><a href="@results_paginator.link@">@results_paginator.item@</a></li>
</else>
</multiple>
<if @url_next@ nil>
<li>&gt;</li>
</if>
<else>
<li><a href="@url_next@">&gt;</a></li>
</else>
<if @url_next_group@ nil>
<li>&gt;&gt;</li>
</if>
<else>
<li><a href="@url_next_group@">&gt;&gt;</a></li>
</else>
</ul>
</div>
</if>
set package_id [ad_conn package_id]
set limit [parameter::get -package_id $package_id -parameter LimitDefault]
set pages_per_group [parameter::get -package_id $package_id -parameter PagesPerGroup]
set current_result_page [expr {$low / $limit}]
set from_result_page [expr {($current_result_page / $pages_per_group) * $pages_per_group}]
set last_result_page [expr {($count + $limit - 1)/ $limit - 1}]
set to_result_page [expr {($last_result_page < $pages_per_group + $from_result_page - 1 ? $last_result_page : $pages_per_group + $from_result_page - 1)} ]
set current_page_group [expr { int($current_result_page / $pages_per_group) }]
set last_page_group [expr { int($last_result_page / $pages_per_group) }]
set first_page_in_group [expr { $current_page_group * $pages_per_group }]
set last_page_in_group [expr { ($current_page_group + 1) * $pages_per_group - 1 }]
if { $current_page_group >= 1 } {
set offset [expr {($current_page_group - 1) * $pages_per_group * $limit}]
set url_previous_group [export_vars -base search {{q $urlencoded_query} search_package_id offset num}]
} else {
set url_previous_group ""
}
if { $current_page_group < $last_page_group } {
set offset [expr {($current_page_group + 1) * $pages_per_group * $limit}]
set url_next_group [export_vars -base search {{q $urlencoded_query} search_package_id offset num}]
} else {
set url_next_group ""
}
if { $current_result_page > 0 } {
set offset [expr ($current_result_page - 1) * $limit]
set url_previous [export_vars -base search {{q $urlencoded_query} search_package_id offset num}]
} else {
set url_previous ""
}
if { $current_result_page < $last_result_page } {
set offset [expr {$current_result_page * $limit + $limit}]
set url_next [export_vars -base search {{q $urlencoded_query} search_package_id offset num}]
} else {
set url_next ""
}
template::multirow create results_paginator item link current_p
for { set __i $from_result_page } { $__i <= $to_result_page} { incr __i } {
set link "search?q=${urlencoded_query}&search_package_id=$search_package_id"
append link "&offset=[expr {$__i * $limit}]"
append link "&num=$num"
template::multirow append results_paginator [expr {$__i + 1}] $link [expr {$__i == $current_result_page}]
}
<form method=GET action="@search_url@" class="inline-form">
<div>
<input type="text" name="q" size="16" maxlength="256">
<input type=submit value="#acs-kernel.common_search#" name=t>
<br>
<a href="@advanced_search_url@">#search.Advanced_Search#</a>
</div>
</form>
set base_url [site_node::get_package_url -package_key search]
set search_url "${base_url}search"
set advanced_search_url "${base_url}advanced-search"
--
-- Copyright (C) 2005 MIT
--
-- This file is part of dotLRN.
--
-- dotLRN is free software; you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software
-- Foundation; either version 2 of the License, or (at your option) any later
-- version.
--
-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details.
--
--
-- Populate .LRN's intermedia index
--
-- @author <a href="mailto:openacs@dirkgomez.de">Dirk Gomez</a>
-- @version $Id$
-- @creation-date 13-May-2005
--
truncate table search_observer_queue;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects where object_type in ('cal_item') ;
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects, cr_items where object_id=live_revision and object_type in ('file_storage_object') ;
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects where object_type in ('static_portal_content');
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects where object_type in ('forums_message') ;
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects where object_type in ('forums_forum') ;
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects, cr_items, cr_news where news_id=live_revision and object_id=live_revision and object_type in ('news');
-- and archive_date is null;
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects where object_type in ('faq') ;
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects where object_type in ('survey');
commit;
insert into search_observer_queue (object_id, event) select object_id, 'INSERT' from acs_objects,cr_items where object_type in ('phb_person') and object_id=live_revision ;
commit;
--alter index swi_index rebuild parameters ('sync') ;
create table syndication (
object_id integer
constraint syndication_object_id_fk
references acs_objects (object_id) on delete cascade
constraint syndication_pk
primary key,
last_updated date default sysdate
constraint syndication_last_updated_nn not null,
rss_xml_frag blob,
body blob,
url blob
);
comment on table syndication is 'stores xml fragments for consolidating into rss feeds. Also stores an html version of the content item
and it''s url from the link field of the rss';
drop table syndication;
-- Create the syndication table
@@ ../syndication-create.sql
create table syndication (
object_id integer
constraint syndication_object_id_fk
references acs_objects (object_id) on delete cascade
constraint syndication_object_id_pk
primary key,
last_updated timestamptz
constraint syndication_last_updated_nn
not null
default now(),
rss_xml_frag text,
body text,
url text
);
comment on table syndication is 'stores xml fragments for consolidating into rss feeds. Also stores an html version of the content item
and it''s url from the link field of the rss';
-- define args so we can package_exec_plsql
-- JCD
select define_function_args('search_observer__enqueue','object_id,event');
select define_function_args('search_observer__dequeue','object_id,event_date,event');
-- Create the syndication table
\i ../syndication-create.sql
namespace eval search {}
namespace eval search::install {}
ad_proc search::install::after_instantiate {
-package_id:required
} {
Package after instantiation callback proc.
Schedule the indexer so the admin doesn't have to restart their server to get search
up and running after mounting it.
} {
# DRB: Unless it is being instantiated from initial install as specified by an install.xml
# file, in which case the init file hasn't been sourced, and the user has to restart their
# server anyway ...
if { [info procs search::init::schedule_indexer] ne "" } {
search::init::schedule_indexer
}
}
#
ad_library {
Handle extra arguments not defined in service contract.
Preliminary support for package_ids and object_type as an example
@author Dave Bauer (dave@thedesignexperience.org)
@creation-date 2009-03-13
@cvs-id $Id$
}
ad_proc -callback search::extra_arg -impl object_type {
-value
-object_table_alias
} {
Implement per object type search
} {
if {$object_table_alias eq "" || ![info exists object_table_alias] || $value eq ""} {
return [list]
}
return [list from_clause {} where_clause "$object_table_alias.object_type = '[db_quote $value]'"]
}
ad_proc -callback search::extra_arg -impl package_ids {
-value
-object_table_alias
} {
Implement per package_id search
} {
if {$object_table_alias eq "" || ![info exists object_table_alias] || $value eq ""} {
return [list]
}
return [list from_clause {} where_clause "$object_table_alias.package_id in ([template::util::tcl_to_sql_list $value])"]
}
\ No newline at end of file
ad_library {
Binaries conversion procedures for the search package.
Thanks to Carsten Clasohm for suggesting the converter programs.
@author Dirk Gomez <openacs@dirkgomez.de>
@creation-date 2005-06-25
@cvs-id $Id$
}
namespace eval search {}
namespace eval search::convert {}
ad_proc -public search::convert::binary_to_text {
{-filename:required}
{-mime_type:required}
} {
Converts the binary file to text and returns this as a string.
(Carsten Clasohm provided the converters.)
@author Dirk Gomez <openacs@dirkgomez.de>
@creation-date 2005-06-25
} {
set tmp_filename [ns_tmpnam]
set result ""
switch $mime_type {
{application/msword} -
{application/vnd.ms-word} {
set convert_command {catdoc $filename >$tmp_filename}
}
{application/msexcel} -
{application/vnd.ms-excel} {
set convert_command {xls2csv $filename >$tmp_filename}
}
{application/mspowerpoint} -
{application/vnd.ms-powerpoint} {
set convert_command {ppthtml $filename >$tmp_filename}
}
{application/pdf} {
set convert_command {pdftotext $filename $tmp_filename}
}
{application/vnd.oasis.opendocument.text} -
{application/vnd.oasis.opendocument.text-template} -
{application/vnd.oasis.opendocument.text-web} -
{application/vnd.oasis.opendocument.text-master} -
{application/vnd.oasis.opendocument.presentation} -
{application/vnd.oasis.opendocument.presentation-template} -
{application/vnd.oasis.opendocument.spreadsheet} -
{application/vnd.oasis.opendocument.spreadsheet-template} {
set convert_command {unzip -p $filename content.xml >$tmp_filename}
}
{text/html} {
return [catch {[ns_striphtml $filename]} error]
}
default {
# If there's nothing implemented for a particular mime type
# we'll just index filename and pathname
return ""
}
}
if {[catch {eval exec $convert_command} err]} {
catch {file delete $tmp_filename}
ns_log Error "SEARCH: conversion failed - $convert_command: $err"
file delete $tmp_filename
return
}
set fd [open $tmp_filename "r"]
set result [read $fd]
close $fd
file delete $tmp_filename
return $result
}
ad_library {
Syndication callback and support routines.
@author Jeff Davis (davis@xarg.net)
@cvs-id $Id$
}
ad_proc -public -callback search::action -impl syndicate {} {
create or replace the record in the syndication table for
the given object_id
See photo-album-search-procs for an example of what
you need to do in the FtsContentProvider datasource
proc to make something syndicable.
JCD: to fix: should not just glue together XML this way, also assumes rss 2.0, no provision for
alternate formats, assumes content:encoded will be defined in the wrapper.
} {
if {![parameter::get -boolean -package_id [apm_package_id_from_key search] -parameter Syndicate -default 0]} {
return
}
if {$action eq "DELETE"} {
db_dml nuke {delete from syndication where object_id = :object_id}
} else {
upvar $datasource d
if {![info exists d(syndication)]} {
return
}
array set syn {
category {}
author {}
guid {}
}
array set syn $d(syndication)
set object_id $d(object_id)
set url $syn(link)
set body $d(content)
set published [lc_time_fmt $syn(pubDate) "%a, %d %b %Y %H:%M:%S GMT"]
set xmlMap [list & "&amp;" < "&lt;" > "&gt;" \" "&quot;" ' "&apos;"]
set rss_xml_frag " <item>
<title>[string map $xmlMap $d(title)]</title>
<link>[string map $xmlMap $url]</link>
<guid isPermaLink=\"true\">[string map $xmlMap $syn(guid)]</guid>
<description>[string map $xmlMap $syn(description)]</description>
<author>[string map $xmlMap $syn(author)]</author>
<content:encoded><!\[CDATA\[$body]]></content:encoded>
<category>[string map $xmlMap $syn(category)]</category>
<pubDate>$published</pubDate>
</item>"
db_dml nuke {delete from syndication where object_id = :object_id}
db_dml insert {insert into syndication(object_id, rss_xml_frag, body, url) values (:object_id, :rss_xml_frag, :body, :url)}
}
}
#search-info
{
margin-bottom:0px;
border-top:1px solid #cfcfcf;
background:#dddddd;
padding:3px 0;
width:100%;
}
#search-info p
{
font-size:100%;
color: #000000;
}
#search-info p.subtitle
{
margin-left:3px;
position:absolute;
left:10px;
padding-left:5px;
margin-top:-1px;
}
#search-info p.times
{
text-align:right;
margin:0;
padding-right:5px;
margin-left:13em;
white-space:nowrap;
}
#search-results li
{
margin-bottom:15px;
display:block;
}
#search-results li:before
{
content: counter(item) ". ";
counter-increment: item;
}
#search-results a.result-title
{
font-size:110%;
}
#search-results .result-text
{
padding-left: 14px;
}
#search-results .result-url
{
padding-left: 14px;
color: #008000;
}
#results-pages
{
text-align:center;
margin-bottom:5px;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment