<?php
/*======================================================================================
Module: Articles
======================================================================================*/

// Check authorisation
if (!isset($gCms)) exit;
if ( !$this->CheckPermission('Articles: modify settings') ) exit;

// Set Tab name
$tabto = 'prefs';

// Assign Smarty vars
$smarty->assign('formstart',$this->CreateFormStart($id,'admin_prefs',$returnid,'post','multipart/form-data',true,array()));
$smarty->assign('formend',$this->CreateFormEnd());
$smarty->assign('submit',$this->CreateInputSubmit($id,'submit',$this->Lang('submit')));
$smarty->assign('tabto',$this->CreateInputHidden($id,'tabto',$tabto));

// Default return ID
$smarty->assign('prompt_returnid',$this->Lang('default_page'));
$smarty->assign('input_returnid',$contentops->CreateHierarchyDropdown('',$this->GetPreference('returnid'),$id.'returnid',0,1,0,1)); // current, parent, parent_id, allowcurrent, use_perms, ignore_current, allow_all

// Name for mode categories
$smarty->assign('prompt_mode_categories',$this->Lang('mode_categories'));
$smarty->assign('input_mode_categories',$this->CreateInputText($id,'mode_categories',$this->GetPreference('mode_categories'),20,100));

// Name for mode articles
$smarty->assign('prompt_mode_articles',$this->Lang('mode_articles'));
$smarty->assign('input_mode_articles',$this->CreateInputText($id,'mode_articles',$this->GetPreference('mode_articles'),20,100));

// Name for mode article
$smarty->assign('prompt_mode_article',$this->Lang('mode_article'));
$smarty->assign('input_mode_article',$this->CreateInputText($id,'mode_article',$this->GetPreference('mode_article'),20,100));

// Name for mode cart
$smarty->assign('prompt_mode_cart',$this->Lang('mode_cart'));
$smarty->assign('input_mode_cart',$this->CreateInputText($id,'mode_cart',$this->GetPreference('mode_cart'),20,100));

// Name for mode cartsnippet
$smarty->assign('prompt_mode_cartsnippet',$this->Lang('mode_cartsnippet'));
$smarty->assign('input_mode_cartsnippet',$this->CreateInputText($id,'mode_cartsnippet',$this->GetPreference('mode_cartsnippet'),20,100));

// Name for mode form
$smarty->assign('prompt_mode_form',$this->Lang('mode_form'));
$smarty->assign('input_mode_form',$this->CreateInputText($id,'mode_form',$this->GetPreference('mode_form'),20,100));

// Name for mode summary
$smarty->assign('prompt_mode_summary',$this->Lang('mode_summary'));
$smarty->assign('input_mode_summary',$this->CreateInputText($id,'mode_summary',$this->GetPreference('mode_summary'),20,100));

// Name for mode ack
$smarty->assign('prompt_mode_ack',$this->Lang('mode_ack'));
$smarty->assign('input_mode_ack',$this->CreateInputText($id,'mode_ack',$this->GetPreference('mode_ack'),20,100));

// Long Description
$smarty->assign('prompt_longdesc_use',$this->Lang('use_longdesc'));
$smarty->assign('input_longdesc_use',$this->CreateInputCheckbox($id,'longdesc_use','1',$this->GetPreference('longdesc_use'),'0'));

// Image
$smarty->assign('prompt_image_use',$this->Lang('use_image'));
$smarty->assign('input_image_use',$this->CreateInputCheckbox($id,'image_use','1',$this->GetPreference('image_use'),'0'));

// Order
$smarty->assign('prompt_order_use',$this->Lang('use_order'));
$smarty->assign('input_order_use',$this->CreateInputCheckbox($id,'order_use','1',$this->GetPreference('order_use'),'0'));

// URL
$smarty->assign('prompt_url_use',$this->Lang('use_url'));
$smarty->assign('input_url_use',$this->CreateInputCheckbox($id,'url_use','1',$this->GetPreference('url_use'),'0'));

// Detail page
$smarty->assign('prompt_detailpage_use',$this->Lang('use_detailpage'));
$smarty->assign('input_detailpage_use',$this->CreateInputCheckbox($id,'detailpage_use','1',$this->GetPreference('detailpage_use'),'0'));

// Dates
$smarty->assign('prompt_dates_use',$this->Lang('use_dates'));
$smarty->assign('input_dates_use',$this->CreateInputCheckbox($id,'dates_use','1',$this->GetPreference('dates_use'),'0'));

// Use Availibility
$smarty->assign('prompt_availibility_use',$this->Lang('use_availibility'));
$smarty->assign('input_availibility_use',$this->CreateInputCheckbox($id,'availibility_use','1',$this->GetPreference('availibility_use'),'0'));

// Counting down Availibility
$smarty->assign('prompt_availibility_count',$this->Lang('count_availibility'));
$smarty->assign('input_availibility_count',$this->CreateInputCheckbox($id,'availibility_count','1',$this->GetPreference('availibility_count'),'0'));

// Show available articles
$smarty->assign('prompt_availibility_show',$this->Lang('show_availibility'));
$smarty->assign('input_availibility_show',$this->CreateInputCheckbox($id,'availibility_show','1',$this->GetPreference('availibility_show'),'0'));

// Delivery time
$smarty->assign('prompt_deliverytime_use',$this->Lang('use_deliverytime'));
$smarty->assign('input_deliverytime_use',$this->CreateInputCheckbox($id,'deliverytime_use','1',$this->GetPreference('deliverytime_use'),'0'));

// Shipping costs
$smarty->assign('prompt_shippingcosts_use',$this->Lang('use_shippingcosts'));
$smarty->assign('input_shippingcosts_use',$this->CreateInputCheckbox($id,'shippingcosts_use','1',$this->GetPreference('shippingcosts_use'),'0'));

// Price
$smarty->assign('prompt_price_use',$this->Lang('use_price'));
$smarty->assign('input_price_use',$this->CreateInputCheckbox($id,'price_use','1',$this->GetPreference('price_use'),'0'));

// VAT
$smarty->assign('prompt_vat_use',$this->Lang('use_vat'));
$smarty->assign('input_vat_use',$this->CreateInputCheckbox($id,'vat_use','1',$this->GetPreference('vat_use'),'0'));
$smarty->assign('prompt_vat_standard',$this->Lang('vat_standard'));
$smarty->assign('input_vat_standard',$this->CreateInputText($id,'vat_standard',$this->GetPreference('vat_standard'),5,10));

// Cart
$smarty->assign('prompt_cart_use',$this->Lang('use_cart'));
$smarty->assign('input_cart_use',$this->CreateInputCheckbox($id,'cart_use','1',$this->GetPreference('cart_use'),'0'));

// Currency
$smarty->assign('prompt_currency',$this->Lang('currency'));
$smarty->assign('input_currency',$this->CreateInputText($id,'currency',$this->GetPreference('currency'),5,100));

// Costs for Cash on Delivery
$smarty->assign('prompt_cash_on_delivery',$this->Lang('cash_on_delivery_costs'));
$smarty->assign('input_cash_on_delivery',$this->CreateInputText($id,'cash_on_delivery',$this->GetPreference('cash_on_delivery'),5,100));

// Costs for Cash on Delivery
$smarty->assign('prompt_countries',$this->Lang('countries'));
$smarty->assign('input_countries',$this->CreateTextArea(false, $id, $this->GetPreference('countries'), 'countries', 'pagesmalltextarea'));

// EMails
$smarty->assign('prompt_emails',$this->Lang('emails'));
$smarty->assign('input_emails',$this->CreateInputText($id,'emails',$this->GetPreference('emails'),20,250));
$smarty->assign('help_emails',$this->Lang('emails_help'));

// EMail subject for the owner
$smarty->assign('prompt_subject_owner',$this->Lang('subject_owner_prompt'));
$smarty->assign('input_subject_owner',$this->CreateInputText($id,'subject_owner',$this->GetPreference('subject_owner'),20,100));
$smarty->assign('help_subject_owner',$this->Lang('subject_owner_help'));

// EMail subject for the customer
$smarty->assign('prompt_subject_customer',$this->Lang('subject_customer_prompt'));
$smarty->assign('input_subject_customer',$this->CreateInputText($id,'subject_customer',$this->GetPreference('subject_customer'),20,100));
$smarty->assign('help_subject_customer',$this->Lang('subject_customer_help'));

// Date format
$smarty->assign('prompt_date_format',$this->Lang('date_format_prompt'));
$smarty->assign('input_date_format',$this->CreateInputText($id,'date_format',$this->GetPreference('date_format'),10,100));
$smarty->assign('help_date_format',$this->Lang('date_format_help'));

// SEO data
$smarty->assign('prompt_seo_use',$this->Lang('use_seo'));
$smarty->assign('input_seo_use',$this->CreateInputCheckbox($id,'seo_use','1',$this->GetPreference('seo_use'),'0'));

// Link to Gallery
$galleries = array('keine Gallery'=>'-- none --');
if ($gal=$this->GetModuleInstance('Gallery')) {$galleries[$gal->GetFriendlyName()]='Gallery';}
if ($gal=$this->GetModuleInstance('IPTCGallery')) {$galleries[$gal->GetFriendlyName()]='IPTCGallery';}
$smarty->assign('prompt_gallery_use',$this->Lang('use_gallery'));
//trigger_error("GetPreference('use_gallery') is ".$this->GetPreference('use_gallery'));
$smarty->assign('input_gallery_use',$this->CreateInputDropdown($id,'gallery_use',$galleries,'',$this->GetPreference('use_gallery','-- none --')));
$smarty->assign('debug_gallerysetting',$this->GetPreference('use_gallery'));


// Display Template
echo $this->ProcessTemplate('settings.tpl');

// EOF