Commit e02f268a authored by Ali Hallaji's avatar Ali Hallaji

Add RTL feature to ERP5 | Add Farsi lang to ERP5

parent 52e8b364
def LanguageHandler(self, username, lang):
if not getattr(self, 'lang_slot', None):
self.lang_slot = {}
# name of all rtl languages
rtl_lang = ['fa']
if lang in rtl_lang:
self.lang_slot[username] = 'rtl'
else:
self.lang_slot[username] = 'ltr'
# This script returns an iterable of the paths to standard CSS objects.
# If you want to customize your own site, please override this script
# in your own skin folder. Note that the returned items must be
# relative URLs instead of absolute URLs, i.e. they must be traversable
# from the portal object. This is required for further processing of CSS
# data, e.g. compression.
#
# BBB: For the history, erp5.css is included by css_list_template.
# So this script has nothing to do in reality.
result = context.switch_style(context.Base_getUserCaption())
css_list = ('{}erp5_knowledge_box.css'.format(result),)
return css_list
#gadget_area_wrapper {
margin-top: 0.5em;
}
#page_wrapper {
text-align: right;
margin: 0em;
padding: 0em;
padding-top: 0em;
background-color: inherit;
min-height: 500px;
width: 100%;
float:left;
margin-top: 0.5em;
}
#loading-wrapper{
position:absolute;
width:250px;
top:80px;
left:50%;
margin-left:-150px;
text-align:center;
padding:7px 0 0 0;
background-color: #FFF;
z-index:1000;
}
#loading-wrapper p{
font-weight: bold;
font-size: 90%;
}
.invisible-gadget{
display:none;
}
/* 3 columng gadget layout */
div.portal-column {
float: left;
width:32.9%;
margin-right:3px;
min-height: 200px;
}
/* Boxes */
div.block {
margin:1px 1px 3px;
padding: 0px;
width: 100%;
}
div.pad-actions{
float:left;
}
h3.handle {
margin: 0;
padding: 0 0 0 9px;
font-size: 14px;
color: #fff;
border-radius: 10px 10px 0 0;
-moz-border-radius: 10px 10px 0 0;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
border: 1px solid #3D6474;
}
h3.handle span.handle {
display: block;
min-height:20px;
padding: 4px 4px 0 0;
}
div.block h3 span.gadget_title{
min-width: 100px;
}
/* Minimize, Edit, Remove images */
span.clickable_image{
cursor: pointer;
margin-top: 5px;
display: block;
float: left;
}
#tabs li span.rename_tab_dialog_image{
background: url("icon_edit.gif") no-repeat;
padding-right: 6px;
}
#tabs li span.remove_tab_dialog_image{
background: url("icon_remove.gif") no-repeat;
padding-right: 6px;
}
a.clickable-block{
display: block;
float: right;
width: 15px;
height: 15px;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
padding: 0em;
margin: 0;
}
a.block-remove {
background-image: url(icon_remove.gif);
}
a.block-minimize {
background-image: url(icon_minimize.gif);
}
a.block-edit-form {
background-image: url(icon_edit.gif);
}
.block-hover {
border: 2px dashed #f00;
}
span.handle,
h3.handle {
cursor: move;
}
/* In edit form disable border */
div.edit-form fieldset{
border: 0px solid black;
}
div.edit-form button{
margin-top: 0.5em;
}
div.edit-form {
padding-top: 0.5em;
padding-left: 1em;
padding-bottom: 0.5em;
border: solid black;
border-width: 0 1px 1px 1px;
background-color: #BDD0F0;
overflow: auto;
width:auto;
}
/* Tabs for Knowledge Pads */
#pad-navigation-wrapper{
margin-top:10px;
border-bottom:1px solid #3D6474;
height:25px;
width:100%;
}
#tabs {
padding-left: 0em;
float: right;
width:78%;
}
#tabs ul {
margin : 0em;
padding: 0em;
width: 100%;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
}
li.tab {
display: block;
font-size: 12px;
float: right;
height: 24px;
padding-right: 5px;
background-color: #BDD0F0;
cursor: pointer;
border: 1px solid #3D6474;
margin-right: 1px;
}
#tabs li span{
padding: 0px 10px;
display: block;
float: left;
height: 19px;
padding-top: 5px;
}
/* Selected tabs should be 1px higher in order to hide border at bottom */
li.tab_selected {
font-weight: bold;
background-color: #DAE6F6;
border-bottom: 1px solid #DAE6F6;
}
/* without this declaration IE will hide draggable elements!*/
.content .field{
position: static;
clear:both;
}
/* Dialogs */
div.toggable_dialog{
display: none;
left: 400px;
position: absolute;
top: 75px;
z-index: 10000;
border: 5px solid #BDD0F0;
background-color: #97B0D1;
padding: 0em 1em 0.5em 1em;
}
#add-gadgets{
cursor: pointer;
}
#add_new_tab_dialog_link{
cursor: pointer;
font-weight: bold;
background: transparent;
display: block;
float: right;
font-weight: bold;
height: 19px;
padding-top: 5px;
padding-left: 5px;
margin-left: 5px;
border-style: none;
}
#create_own_pad_dialog_link{
cursor: pointer;
background: url("images/configure.png") no-repeat !important;
display: block;
float: left;
height: 22px!important;
width:22px!important;
padding-top: 5px;
padding-left: 5px;
margin-left: 5px;
border-style: none;
}
#tabs_switcher{
cursor: pointer;
font-weight: bold;
background: transparent;
padding-top: 5px;
border-style: none;
margin: 0em;
width: 10%;
float:left
}
#add_new_gadget_link{
font-weight: bold;
height: 20px;
text-align:right;
padding-top:5px;
float:right;
width:12%;
}
/* Draggable Area */
div.draggable_wrapper{
background-color: #FFFFFF;
}
div.wait_block {
text-align: center;
padding: 2em;
}
div.box_inner_content {
background-color:#FFFFFF;
padding: 0.1em;
clear:left;
overflow: visible;
}
div.box_inner_content ol{
margin-top: 0em;
}
/* seperate gadget tables from rest of ERP5*/
div.block div.content{
padding: 0px;
}
div.block table,
div.block table tr,
div.block table tr td{
border: none;
}
/* lisbox style should be square for gadgets */
div.block ul{
list-style-type: square;
}
/*
Gadget listbox CSS
*/
div.block table.listbox .right{
float:right;
}
div.block table.listbox .left{
float:left;
}
div.block .listbox-head{
margin-left:0;
}
div.block div.listbox-head-spacer{
display:none;
}
div.block div.listbox-head-content {
/* background: none;*/
background-color: #E3EAFA;
border: none;
margin-left:0;
padding-left: 10px;
border-top-left-radius: 0;
-moz-border-top-left-radius: 0;
-webkit-border-top-left-radius: 0;
}
div.block table.listbox tr{
margin-top:2px;
}
div.block table.listbox tr.DataB {
background-color:#FFF;
}
div.block div.input{
margin-left:0em;
}
#add-stick-gadget-tool-section{
margin-bottom: 1.5em;
}
/* labels in forms inserted into a gadget should be visible
indedepndantly from fact that master form may use hiddenLabel */
div.block div.hidden_label label,
div.block div.hiddenLabel label{
display: none;
}
/*
Gadgets CSS - use to define gadget specific CSS.
*/
div.block .right{
float:right;
margin-left:5px;
}
div.block div.box_inner_content div.worklist_list ul {
list-style-image:url(bullet.png);
margin:0;
padding-bottom:0.5em;
padding-left:2em;
padding-top:0.5em;
}
div.block div.worklist_list ul li{
overflow: visible;
margin-bottom:5px;
background-color:white;
}
div.block div.worklist_list a{
color:black;
text-decoration:none;
cursor:pointer;
}
div.block div.worklist_list ul li a:hover{
text-decoration:none;
}
/* Some gadgets share same Document_getSummaryAsHTML or RssFeed_getSummaryAsHTML */
div.document-gadget-quick-preview div.teaser{
cursor: pointer;
margin-bottom: 3px;
}
div.document-gadget-quick-preview div.teaser img{
vertical-align:top;
max-width: 150px;
}
div.document-gadget-quick-preview span.document-title,
div.document-gadget-quick-preview span.modification-date{
font-size:1em;
color: #000;
}
/* Some items can be marked as read and we need a way to visualize it */
div.document-gadget-quick-preview div.read span.document-title,
div.document-gadget-quick-preview div.read span.modification-date{
color: #969696;
}
div.document-gadget-quick-preview a.document-link{
color:#000;
font-weight:bold;
}
/* Rss Feed reader gadget needs no listbox headers or
show number of records or show 'No results' as listbox title is used for this */
div.gadget-rss-reader table.listbox thead,
div.gadget-rss-reader div.listbox-number-of-records,
div.gadget-rss-reader table.listbox td.listbox-table-no-result-row,
div.gadget-rss-reader div.listbox-title{
display: none;
}
div.gadget-rss-reader-message{
font-weight:bold;
}
div.gadget-rss-reader .listbox-head-content{
height:auto;
}
div.gadget-rss-reader .listbox-body,
div.gadget-rss-reader .listbox-head{
margin-left:4px;
width:auto;
}
div.gadget-rss-reader div.read{
background-color:#ececec;
}
div.gadget-rss-reader span.modification-date{
color: #969696;
}
div.gadget-rss-reader a.document-link {
color:#000;
}
div.gadget-rss-reader a.listbox_title {
text-decoration: underline;
font-weight:bold;
}
div.rss-description{
margin-top:4px;
}
div.teaser .thumbnail-image{
margin-top:0px;
margin-right:4px;
margin-bottom:4px;
float:left;
}
div.teaser .icon {
vertical-align:middle;
}
/* RSS logo */
div.gadget-rss-reader-logo img{
float:right;
margin:4px;
width:auto;
}
div.gadget-rss-reader div.listbox-head-content {
background-color: transparent;
padding-left:0px;
}
div.gadget-rss-reader .body {
float:left;
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>rtl_erp5_knowledge_box.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RTL ERP5 knowledge box</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
import re
try:
website = context.getWebSiteValue()
except AttributeError:
website = None
if website is not None and website.isStaticLanguageSelection():
# Web Mode
root_website = website.getOriginalDocument()
default_language = root_website.getDefaultAvailableLanguage()
root_website_url = root_website.absolute_url()
website_url_pattern = r'^%s(?:%s)*(/|$)' % (
re.escape(root_website_url),
'|'.join('/' + re.escape(x) for x in root_website.getAvailableLanguageList()))
referer_url = context.REQUEST.HTTP_REFERER
if referer_url:
if select_language == default_language:
redirect_url = re.sub(website_url_pattern, root_website_url + r'\1', referer_url)
else:
redirect_url = re.sub(website_url_pattern, root_website_url + '/' + select_language + r'\1',
referer_url)
else:
if select_language == default_language:
redirect_url = root_website_url
else:
redirect_url = root_website_url + '/' + select_language
return context.REQUEST.RESPONSE.redirect(redirect_url)
else:
# ERP5 Mode
# XXX Localizer-dependent
portal = context.getPortalObject()
if select_language is None:
select_language = context.REQUEST.form["Base_doLanguage"]
if not select_language:
select_language = portal.Localizer.get_selected_language()
#context.test(select_language)
context.langauge_handler(context.Base_getUserCaption(), select_language)
portal.Localizer.changeLanguage(select_language)
<tal:block tal:replace="nothing"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block metal:define-macro="header_definitions">
<tal:block tal:define="
global portal here/portal_url/getPortalObject;
global portal_path portal_path | portal/absolute_url;
local_parameter_list local_parameter_list | python: {};
action_context python: portal.restrictedTraverse(request.get('object_path', '?'), here);
global actions python: here.Base_filterDuplicateActions(portal.portal_actions.listFilteredActionsFor(action_context));
global url here/absolute_url;
global current_form_id python: local_parameter_list.get('dialog_id', local_parameter_list.get('form_id', 'view'));
dummy python: request.set('current_form_id', current_form_id);
global current_url python: '%s/%s' % (url, current_form_id);
global current_action python: portal.ERP5Site_getCurrentAction(current_url, actions);
cancel_url request/cancel_url | current_url;
dummy python: local_parameter_list.update({'cancel_url': cancel_url});
dummy python: request.RESPONSE.setHeader('Content-Type', 'text/html;; charset=utf-8');
dummy python: request.set('here', here);
global css_list css_list | python:[];
dummy python:css_list.extend(['%s/%s' % (portal_path, x) for x in portal.ERP5Site_getCssRelativeUrlList()]);
css_list_template css_list_template | python:['%s/%serp5.css' % (portal_path, here.switch_style(here.Base_getUserCaption())),
'%s/%serp5_listbox.css' % (portal_path, here.switch_style(here.Base_getUserCaption())),];
dummy python:css_list.extend(css_list_template);
global js_list js_list | python:['%s/erp5_xhtml_appearance.js' % portal_path];
global js_list python: ['%s/%s' % (portal_path, x) for x in portal.ERP5Site_getJavaScriptRelativeUrlList()] + js_list;
global http_parameter_list python: portal.ERP5Site_filterParameterList(request.form);
dummy python: http_parameter_list.update(local_parameter_list);
global http_parameters python: portal.ERP5Site_renderHTTPParameterList(http_parameter_list);
global form nocall:form | nothing;
portal_preferences python: portal.portal_preferences;
global preferred_html_style_developper_mode portal_preferences/getPreferredHtmlStyleDevelopperMode;
global preferred_html_style_translator_mode portal_preferences/getPreferredHtmlStyleTranslatorMode;
global preferred_html_style_contextual_help portal_preferences/getPreferredHtmlStyleContextualHelp;
global preferred_html_style_acknowledgeable_message portal_preferences/getPreferredHtmlStyleAcknowledgeableMessage;
global developper_shortcut_render python: (preferred_html_style_developper_mode or preferred_html_style_translator_mode) and portal.developper_shortcut_render;
global selected_language portal/Localizer/get_selected_language;
" />
</tal:block>
<tal:block metal:define-macro="header_boilerplate">
<base tal:attributes="href string:${url}/" />
<meta name="description" tal:attributes="content description | title | string:ERP5 Free Open Source ERP and CRM" />
<meta name="keywords" tal:attributes="content python:', '.join(subject_list)" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title
tal:define="
title title | string:ERP5;
header_title header_title | nothing;
"
tal:content="python: header_title or '%s | %s' % (title, here.getPortalObject().title_or_id())"
></title>
<link rel="icon" tal:attributes="href python: portal_path + '/favicon.ico'" type="image/x-icon" />
<link rel="shortcut icon" tal:attributes="href python: portal_path + '/favicon.ico'" type="image/x-icon" />
</tal:block>
<tal:block metal:define-macro="render_css_js">
<link
tal:repeat="css python: css_list"
tal:attributes="href python: css"
type="text/css"
rel="stylesheet"
/>
<tal:block
tal:condition="python: form is not None"
tal:repeat="field python: [field for group in form.get_groups(include_empty=0) for field in form.get_fields_in_group(group)]"
>
<style
tal:define="css python: field.render_css(REQUEST=request)"
tal:condition="python: css"
tal:content="python: css"
type="text/css"></style>
<tal:block tal:define="dummy python: js_list.extend(field.get_javascript_list(REQUEST=request))" />
</tal:block>
<tal:block
tal:define="known python: set()"
tal:repeat="js python: js_list"
><tal:block
tal:condition="python: js not in known"
><script
tal:define="dummy python: known.add(js)"
tal:attributes="src js"
type="text/javascript"
></script></tal:block></tal:block>
</tal:block>
<tal:block metal:define-macro="http_definitions">
<tal:block tal:replace="structure python: modules['ZTUtils'].make_hidden_input(**http_parameter_list)" />
</tal:block>
</tal:block>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>LanguageHandler</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>language_handler</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>langauge_handler</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Language Handler</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>rtl_erp5.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RTL Style</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>rtl_erp5_listbox.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RTL ERP5 ListBox</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if username in context.lang_slot:
if context.lang_slot[username] == 'rtl':
return (context.lang_slot[username] + '_')
return ''
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>username</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>switch_style</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Switch style language</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_l10n_fa
\ No newline at end of file
language_handler
\ No newline at end of file
erp5_knowledge_pad
erp5_xhtml_style
\ No newline at end of file
erp5_rtl_support
\ No newline at end of file
1
\ No newline at end of file
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