##------------------------------------------------------------------------------
## check/mynotes.ext
## DE: Erweiterte Prüfung für My Notes (Abhängigkeiten, etc.)
## EN: Additional checks for My Notes (dependencies e.g.)
##------------------------------------------------------------------------------
##
## Creation:       20.11.2008  Florian Schlögl <Florian_Schloegl.Wolfsteam@web.de>
## Last modified:  18.02.2009  Florian Schlögl <Florian_Schloegl.Wolfsteam@web.de>
## Version:        0.1.1
##
##------------------------------------------------------------------------------
if (OPT_MYNOTES)
then
    #--------------------
    # DE: Paket-Identifer für andere Pakete bereitstellen
    # EN: paket identifier for other pakets
    #--------------------
    provides mynotes version 0.1.1
    
    #--------------------
    # DE; Abhängigkeit zu einem bestimmten Paket definieren
    # EN: dependencies on onther pakets
    #--------------------
    depends on fli4l version 3.0.[0-3]
    depends on httpd version 3.0
    
    #--------------------
    # DE: passende Sprachdatei mitkopieren
    # EN: copy language file
    #--------------------
    # DE: Sprache ermitteln
    # EN: get language
    if defined (HTTPD_GUI_LANG)
    then
        if (HTTPD_GUI_LANG == "auto")
        then
            set gui_lang=LOCALE
        else
            set gui_lang=HTTPD_GUI_LANG
        fi
    else
        set gui_lang=LOCALE
    fi
    
    # DE Sprachdatei heraussuchen und mitkopieren
    # EN: search and copy language file
    split (gui_lang, lang_tmp_%, ' ', NUMERIC)
    foreach lang in lang_tmp_%
    do
        stat("opt/files/srv/www/lang/mynotes.$lang", langfile)
        if (langfile_res == "OK")
        then
            # DE: gefundene Sprachdatei mitkopieren
            # EN: copy language file
            add_to_opt "files/srv/www/lang/mynotes.$lang" "mode=444 flags=sh"
        else
            # DE: keine passende Sprachdatei gefunden -> Englisch verwenden
            # EN: language file not found -> use default english
            warning "MYNOTES: could not find 'files/srv/www/lang/mynotes.$lang', perhaps this file isn't translated yet. Falling back to English."
            stat("files/srv/www/lang/mynotes.en", langfile)
            if (langfile_res == "OK")
            then
                add_to_opt "files/srv/www/lang/mynotes.en" "mode=444 flags=sh"
            else
                # DE: keine passende Sprachdatei gefunden -> Deutsch verwenden
                # EN: language file not found -> use default german
                warning "MYNOTES: could not find 'files/srv/www/lang/mynotes.en', perhaps this file isn't translated yet. Falling back to German."
                stat("files/srv/www/lang/mynotes.de", langfile)
                if (langfile_res == "OK")
                then
                    add_to_opt "files/srv/www/lang/mynotes.de" "mode=444 flags=sh"
                else
                    # DE: Deutsch-Sprachdatei existiert auch nicht!
                    # EN: german language file also does not exist
                    error "MYNOTES: No default translation found! Check that the paket was correctly installed."
                fi
            fi
        fi
    done
fi
#----------------------------------------------------------------------------
# mynotes.ext -- EOF ---
#----------------------------------------------------------------------------