diff -rN old-ghestalt/app/accounts.py new-ghestalt/app/accounts.py
8a9
> from ghestalt.i18n.utils import i18n_site_base
12a14
> from django.utils import translation
15,20c17,26
< email = forms.EmailField()
< password = forms.CharField(widget=forms.PasswordInput)
< password2 = forms.CharField(widget=forms.PasswordInput)
< first_name = forms.CharField(max_length=30)
< last_name = forms.CharField(max_length=30)
< user_name = forms.CharField(max_length=30)
---
> email = forms.EmailField(label=_('E-mail address'))
> password = forms.CharField(label=_('Password'),widget=forms.PasswordInput)
> password2 = forms.CharField(label=_('Password (again)'),widget=forms.PasswordInput)
> first_name = forms.CharField(label=_('First name'),max_length=30)
> last_name = forms.CharField(label=_('Last name'),max_length=30)
> user_name = forms.CharField(label=_('Account username'),max_length=30)
> location = forms.CharField(label=_('Location'),max_length=30, required=False)
> otro_lang = forms.ChoiceField(label=_('Language'),choices=settings.LANGUAGES, required=False)
> otro_first_name = forms.CharField(label=_('First name in language'),max_length=30, required=False)
> otro_last_name = forms.CharField(label=_('Last name in language'),max_length=30, required=False)
24a31,56
> def clean_location(self):
> raw = self.clean_data.get('location')
> if raw=='':
> return raw
> raw2 = map(unicode.upper,map(unicode.strip,raw.split(',')))
> if len(raw2) != 2:
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> if raw2[0][-1] in 'NS':
> if raw2[0][0]=='-':
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> if raw2[0][-1]=='S':
> raw2[0] = '-'+raw2[0][:-1]
> if raw2[0][-1]=='N':
> raw2[0] = raw2[0][:-1]
> if raw2[1][-1] in 'EW':
> if raw2[1][0]=='-':
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> if raw2[1][-1]=='W':
> raw2[1] = '-'+raw2[1][:-1]
> if raw2[1][-1]=='E':
> raw2[1] = raw2[1][:-1]
> try:
> long,lat = (float(raw2[0]),float(raw2[1]))
> except ValueError:
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> return '%f,%f' % (long,lat)
42a75,78
> location = form.clean_data.get('location')
> otro_lang = form.clean_data.get('otro_lang')
> otro_first_name = form.clean_data.get('otro_first_name')
> otro_last_name = form.clean_data.get('otro_last_name')
47c83
< userprofile = UserProfile(first_name=first_name, last_name=last_name, email=email, role="User", user=u)
---
> userprofile = UserProfile(first_name=first_name, last_name=last_name, email=email, role="User", user=u, location=location,otro_lang=otro_lang, otro_last_name=otro_last_name, otro_first_name=otro_first_name)
55,56c91,93
< subject = "Welcome to %s" % (settings.SITE_NAME)
< c['login_url'] = "%s%s/accounts/login" % (settings.SITE_DOMAIN, settings.SITE_BASE)
---
> subject = _("Welcome to %s" % (settings.SITE_NAME))
> site_base = i18n_site_base(request)
> c['login_url'] = "%s%s/accounts/login" % (settings.SITE_DOMAIN, site_base)
61,66c98,110
< try:
< send_mail(subject, t.render(c), site_email,
< [email], fail_silently=False)
< except:
< return bad_or_missing(request,'Problems sending mail.')
< return http.HttpResponseRedirect('%s/accounts/thankyou' % (settings.SITE_BASE))
---
> if userprofile.otro_lang != settings.LANGUAGE_CODE[:2]:
> request.session['otro_lang'] = userprofile.otro_lang
> try:
> if request.session['other_lang']: pass
> except KeyError:
> request.session['other_lang'] = userprofile.otro_lang
> if settings.ENABLE_MAIL:
> try:
> send_mail(subject, t.render(c), site_email,
> [email], fail_silently=False)
> except:
> return bad_or_missing(request,'Problems sending mail.')
> return http.HttpResponseRedirect('%s/accounts/thankyou' % (site_base))
70a115,192
> ##
> class EditAccountForm(forms.Form):
> first_name = forms.CharField(label=_('First name'),max_length=30)
> last_name = forms.CharField(label=_('Last name'),max_length=30)
> location = forms.CharField(label=_('Location'),max_length=30,required=False)
> otro_lang = forms.ChoiceField(label=_('Language'),choices=settings.LANGUAGES,required=False)
> otro_first_name = forms.CharField(label=_('First name in language'),max_length=30,required=False)
> otro_last_name = forms.CharField(label=_('Last name in language'),max_length=30,required=False)
> def clean_location(self):
> raw = self.clean_data.get('location')
> if raw=='':
> return raw
> raw2 = map(unicode.upper,map(unicode.strip,raw.split(',')))
> if len(raw2) != 2:
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> if raw2[0][-1] in 'NS':
> if raw2[0][0]=='-':
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> if raw2[0][-1]=='S':
> raw2[0] = '-'+raw2[0][:-1]
> if raw2[0][-1]=='N':
> raw2[0] = raw2[0][:-1]
> if raw2[1][-1] in 'EW':
> if raw2[1][0]=='-':
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> if raw2[1][-1]=='W':
> raw2[1] = '-'+raw2[1][:-1]
> if raw2[1][-1]=='E':
> raw2[1] = raw2[1][:-1]
> try:
> long,lat = (float(raw2[0]),float(raw2[1]))
> except ValueError:
> raise forms.ValidationError(_(u'Cannot parse location. Format is lat,long.'))
> return '%f,%f' % (long,lat)
> def clean(self):
> return self.clean_data
>
> def edit(request):
> if request.POST:
> form = EditAccountForm(request.POST)
> if form.is_valid():
> first_name = form.clean_data.get('first_name')
> last_name = form.clean_data.get('last_name')
> otro_lang = form.clean_data.get('otro_lang')
> otro_first_name = form.clean_data.get('otro_first_name')
> otro_last_name = form.clean_data.get('otro_last_name')
> location = form.clean_data.get('location')
> u = User.objects.get(id=request.user.id)
> userprofile = UserProfile.objects.get(user=u.id)
> u.first_name = first_name
> u.last_name = last_name
> u.save()
> userprofile.first_name=first_name
> userprofile.last_name=last_name
> userprofile.role="User"
> userprofile.user=u
> userprofile.location=location
> userprofile.otro_lang=otro_lang
> userprofile.otro_last_name=otro_last_name
> userprofile.otro_first_name=otro_first_name
> userprofile.save()
> if userprofile.otro_lang != settings.LANGUAGE_CODE[:2]:
> request.session['otro_lang'] = userprofile.otro_lang
> try:
> if request.session['other_lang']: pass
> except KeyError:
> request.session['other_lang'] = userprofile.otro_lang
> site_base = i18n_site_base(request)
> return http.HttpResponseRedirect('%s/accounts/thankyou' % (site_base))
> else:
> userprofile = UserProfile.objects.get(user=request.user.id)
> user = User.objects.get(id=request.user.id)
> d = userprofile.__dict__
> d.update(user.__dict__)
> form = EditAccountForm(d)
> return render_to_response('account_edit_form.html', {'form': form},
> RequestContext(request))
> edit = login_required(edit)
84c206,207
< return http.HttpResponseRedirect('%s/' % (settings.SITE_BASE))
---
> site_base = i18n_site_base(request)
> return http.HttpResponseRedirect('%s/' % (site_base))
diff -rN old-ghestalt/app/contact.py new-ghestalt/app/contact.py
11,12c11,12
< ("General Question", "General question"),
< ("Improvement Suggestion", "Improvement suggestion"),
---
> ("General Question", _("General question")),
> ("Improvement Suggestion", _("Improvement suggestion")),
16,20c16,20
< name = forms.CharField(max_length=20)
< email = forms.EmailField()
< subject = forms.CharField(max_length=30)
< inquiry = forms.ChoiceField(choices=email_choices)
< contents = forms.CharField(widget=forms.Textarea(attrs={'rows': 14, 'cols': 60}))
---
> name = forms.CharField(label=_('Name'),max_length=20)
> email = forms.EmailField(label=_('E-mail address'))
> subject = forms.CharField(label=_('Subject'),max_length=30)
> inquiry = forms.ChoiceField(label=_('Inquiry'),choices=email_choices)
> contents = forms.CharField(label=_('Contents'),widget=forms.Textarea(attrs={'rows': 14, 'cols': 60}))
36,40c36,41
< try:
< send_mail(subject, t.render(c), site_email,
< [site_email], fail_silently=False)
< except:
< return bad_or_missing(request,'Problems sending mail.')
---
> if settings.ENABLE_MAIL:
> try:
> send_mail(subject, t.render(c), site_email,
> [site_email], fail_silently=False)
> except:
> return bad_or_missing(request,'Problems sending mail.')
diff -rN old-ghestalt/app/context_processors.py new-ghestalt/app/context_processors.py
7a8,9
> from django.utils import translation
> from ghestalt.i18n.utils import *
11,12c13,29
< site_name = settings.SITE_NAME
< return {'site_base': settings.SITE_BASE,
---
> site_name = _(settings.SITE_NAME)
> site_base = i18n_site_base(request)
> try:
> other_lang = str(request.session['other_lang'])
> except KeyError:
> other_lang = None
> gui_lang = request.LANGUAGE_CODE[:2]
> try:
> otro_lang = str(request.session['otro_lang'])
> except KeyError:
> otro_lang = None
> if i18n_lang_suffix(request.path)[1:] in settings.LANGUAGES_BIDI:
> content_bidi = True
> else:
> content_bidi = False
> return {'site_base': site_base,
> 'site_root': settings.SITE_BASE,
14c31,37
< 'media_url': settings.MEDIA_URL}
---
> 'media_url': settings.MEDIA_URL,
> 'url_path': request.path,
> 'other_lang': other_lang,
> 'gui_lang': gui_lang,
> 'base_lang': settings.LANGUAGE_CODE[:2],
> 'otro_lang': otro_lang,
> }
diff -rN old-ghestalt/app/models.py new-ghestalt/app/models.py
0a1
> from django.conf import settings
2a4
> from django.utils.translation import gettext_lazy as _
24c26,33
<
---
> otro_lang = models.CharField(_('Language'),maxlength=10,choices=settings.LANGUAGES,default=settings.LANGUAGE_CODE[:2], blank=True)
> # when viewing content in otro_lang your name will appear as otro_name
> otro_first_name = models.CharField(maxlength=30, blank=True)
> otro_last_name = models.CharField(maxlength=30, blank=True)
> def _get_otro_full_name(self):
> "Returns the person's otro language name."
> return '%s %s' % (self.otro_first_name, self.otro_last_name)
> otro_full_name = property(_get_otro_full_name)
diff -rN old-ghestalt/app/templates/account.html new-ghestalt/app/templates/account.html
0a1
> {% load ghmarkup %}
10c11,14
<
Welcome, {{ user_data.full_name }}.
---
> Welcome, {{ user_data.full_name }}.
> Your recorded long/lat is {{ user_data.location }}.
> Otro language: {{ user_data.otro_lang|prettylang }}.
> Otro name: {{ user_data.otro_last_name }}, {{ user_data.otro_first_name }}.
12a17
> Edit user details
diff -rN old-ghestalt/app/templates/base.html new-ghestalt/app/templates/base.html
0a1
> {% load ghmarkup %}
12a14
>
42c44
< Login
---
> Login
47c49,65
<
---
> Viewing site in {{ gui_lang|prettylang }}
> {% ifnotequal base_lang gui_lang %}
> Change to {{ base_lang|prettylang }}
> {% endifnotequal %}
> {% if other_lang %}{% ifnotequal other_lang gui_lang %}
> Change to {{ other_lang|prettylang }}
> {% endifnotequal %}{% endif %}
> {% if otro_lang %}
> {% ifnotequal otro_lang gui_lang %}
> {% ifnotequal otro_lang other_lang %}
> Change to {{ otro_lang|prettylang }}
> {% endifnotequal %}
> {% endifnotequal %}
> {% endif %}
> Other Languages
>
>
diff -rN old-ghestalt/app/templates/edit.html new-ghestalt/app/templates/edit.html
12c12,13
< {% if preview %}{{ preview|ghmarkup }}{% endif %}
---
> {% if source %}Translation source
{{ source|ghmarkup:what }}{% endif %}
> {% if preview %}{{ preview|ghmarkup:what }}{% endif %}
15,16c16,17
<
<
---
>
>
diff -rN old-ghestalt/app/templates/history.html new-ghestalt/app/templates/history.html
12,13c12,13
< {{ entry.id }} {{ entry.mtime }} {{ entry.what|ghlink }}
< ... {% filter ghlink %}user/{{ entry.muser }}{% endfilter %}
---
> {{ entry.id }} {{ entry.mtime }} {{ entry.what|ghlink }}
> ... {{ entry.muser|userlink:"/user/history" }}
diff -rN old-ghestalt/app/templates/intro.html new-ghestalt/app/templates/intro.html
1a2
> {% load ghmarkup %}
10c11
< Welcome to Ghestalt{% if user.username %}, {{ user.username }}{% endif %}.
---
> Welcome to Ghestalt{% if user.username %}, {{ user.username|userlink:"/intro" }}{% endif %}.
13c14
< You can Login, or go straight to the Wiki.
---
>
You can Login, or go straight to the Wiki.
16c17
<
Go straight to the Wiki.
---
>
Go straight to the Wiki.
diff -rN old-ghestalt/app/templates/missing.html new-ghestalt/app/templates/missing.html
15c15
< Add page
---
> Add page
diff -rN old-ghestalt/app/templates/recent.html new-ghestalt/app/templates/recent.html
12,13c12,14
<
{{ entry.id }} {{ entry.mtime }} {{entry.what|ghlink}}
< ... {% filter ghlink %}user/{{ entry.muser }}{% endfilter %}
---
> {% ifchanged entry.mtime.date %}{{ entry.mtime.date }}{% endifchanged %}
> - {{ entry.id }} {{ entry.mtime|date:"P" }} {{entry.what|ghlink}}
> ... {{ entry.muser|userlink:"/user/recent" }}
diff -rN old-ghestalt/app/templates/site_404.html new-ghestalt/app/templates/site_404.html
11a12
> {%if params%} {{ params.message }}
{%endif%}
diff -rN old-ghestalt/app/templates/theorem.html new-ghestalt/app/templates/theorem.html
7c7,12
< {{ norm.ldata|ghmarkup:"mm/set/" }}
---
> {% if origwhat %}
> Translated version missing. Click Translate on page bottom to add it yourself.
>
> {% endif %}
>
> {% ghmarkuptag %}{{ norm.ldata }}{% endghmarkuptag %}
15c20
< Last edited: {{ norm.mtime }} by {% filter ghlink %}user/{% if norm.muser %}{{ norm.muser }}{% else %}{{ thm.muser }} {% endif %}{% endfilter %}
---
> Last edited: {{ norm.mtime }} by {% if norm.muser %}{{ norm.muser|userlink:"/wiki/theorempage" }}{% else %}{{ thm.muser|userlink:"/wiki/theorempage" }} {% endif %}
17c22
<
---
> Translate
>
diff -rN old-ghestalt/app/templates/wiki.html new-ghestalt/app/templates/wiki.html
3a4,10
> {% block translation %}
> Available translations
> {% for lang in all_langs %}
> {{ lang|prettylang }}
> {% endfor %}
>
> {% endblock %}
5c12,17
< {{ title }}
---
> {% if not no_title %}{{ title }}
{% else %}
> [{{ title }}]
{% endif %}
> {% if origwhat %}
> Translated version missing. Click Translate on page bottom to add it yourself.
>
> {% endif %}
7c19,21
< {{ log.ldata|ghmarkup }}
---
>
> {% ghmarkuptag %}{{ log.ldata }}{% endghmarkuptag %}
>
9c23
< Last edited: {{ log.mtime }} by {% filter ghlink %}user/{{ log.muser }}{% endfilter %}
---
> Last edited: {{ log.mtime|date:"d/M/Y P" }} by {{ log.muser|userlink:"/wiki/wikipage" }}
11,15c25,32
<
---
>
> Edit
> History
> {{ log.what|talklink:url_path }}
> {% if trans_target %}
> Translate
> {% endif %}
>
diff -rN old-ghestalt/app/templates/wikibase.html new-ghestalt/app/templates/wikibase.html
1a2
> {% load ghmarkup %}
9c10
< Wiki Homepage
---
> Wiki Home
11a13,18
>
> New Page
> Unlinked Pages
>
> {% block translation %}
> {% endblock %}
diff -rN old-ghestalt/app/templatetags/ghmarkup.py new-ghestalt/app/templatetags/ghmarkup.py
6a7
> from ghestalt.i18n.utils import *
35c36,37
< def userlink(uname, body = None):
---
> def userlink(uname, body = None, i18n_base = '', lang_suffix=''):
> uname = i18n_baselang(uname)
44,45c46,52
<
< realname = profile.first_name+" "+profile.last_name
---
> realname = ''
> if profile.otro_lang != settings.LANGUAGE_CODE[:2] and lang_suffix[1:]==profile.otro_lang:
> realname = (profile.otro_first_name+" "+profile.otro_last_name).decode('utf-8')
> realname = ''.join(map(lambda x: '%d;' % (ord(x)),realname))
> if realname=='':
> realname = (profile.first_name+" "+profile.last_name).decode('utf-8')
> realname = ''.join(map(lambda x: '%d;' % (ord(x)),realname))
48c55
< return '' + htmlquote(body) + ''
---
> return '' + body + ''
50c57,58
< def wikilink(str, exists = None, ispreblock = False, ctx = None):
---
> def wikilink(str, path='', exists = None, ispreblock = False, ctx = None, lang_suffix = '', i18n_base=''):
> (i18n_base, ctx, lang_suffix) = parse_url_path(path)
67c75
< return userlink(link[5:], body)
---
> return userlink(link[5:], body, i18n_base=i18n_base, lang_suffix=lang_suffix)
72c80
< if ctx and link.find('/') < 0: link = ctx + link
---
> if ctx and link.find('/') < 0: link = ctx + '/' + link
79c87,88
< url = wikiurl(link)
---
> url = wikiurl(link, lang_suffix=lang_suffix, i18n_base=i18n_base)
> langtext = ''
80a90,95
> m = re.search('_[a-z][a-z]$', linktext)
> if m:
> langcode = linktext[m.start()+1:]
> if LOCALIZED_LANGAUGE_NAMES.has_key(langcode):
> linktext = linktext[:m.start()]
> langtext = ' ('+LOCALIZED_LANGAUGE_NAMES[langcode]+')'
87c102
< return '' + htmlquote(body) + ''
---
> return '' + htmlquote(body) + langtext+''
89,90c104,105
< def wikiurl(page):
< return settings.SITE_BASE + '/' + wikiwhat(page)
---
> def wikiurl(page, lang_suffix='', i18n_base=''):
> return i18n_base + '/' + wikiwhat(page) + lang_suffix
132c147,162
< def process_ghmarkup(str, ctx):
---
> def parse_url_path(path):
> if path.startswith('/intl/'):
> i18n_base = '/'.join(path.split('/',3)[:3])
> path = ''.join(path.split('/',3)[3:])
> else:
> i18n_base = ''
> if path.find('/')>0:
> ctx = path.rsplit('/',1)[0]
> if ctx=='wiki':
> ctx=''
> else:
> ctx = ''
> lang_suffix = i18n_lang_suffix(path)
> return (i18n_base, ctx, lang_suffix)
>
> def process_ghmarkup(str, path):
155c185
< return wikilink(str, ispreblock = False, ctx = ctx)
---
> return wikilink(str, path, ispreblock = False)
263,264c293,294
< def ghmarkup(value, ctx = None):
< return process_ghmarkup(value, ctx)
---
> def ghmarkup(value, path = ''):
> return process_ghmarkup(value, path)
266c296,297
< def talklink(value):
---
> def talklink(value,path=''):
> (i18n_base, ctx, lang_suffix) = parse_url_path(path)
269c300,318
< return wikilink(value[:-5] + '|Main page')
---
> return wikilink(value[:-5] + '|'+_('Main page'),path)
> else:
> return wikilink(value + '/talk|'+_('Discuss'),path)
>
> def translatelink(value, what = None):
> if value != what:
> return 'edit/'+urlquote(what)
> return 'edit/'+urlquote(value)
>
> def prettylang(value):
> if not value:
> value = settings.LANGUAGE_CODE[:2]
> if len(value)>3:
> if value[-3]=='_':
> value = value[-2:]
> else:
> value = settings.LANGUAGE_CODE[:2]
> if LOCALIZED_LANGAUGE_NAMES.has_key(value):
> return LOCALIZED_LANGAUGE_NAMES[value]
271c320,339
< return wikilink(value + '/talk|Discuss')
---
> if settings.LANGUAGES_DICT.has_key(value):
> return settings.LANGUAGES_DICT[value]
> else:
> return "Uknown language: "+value
>
> def userlink_filter(uname, path):
> (i18n_base, ctx, lang_suffix) = parse_url_path(path)
> return userlink(uname, i18n_base=i18n_base,lang_suffix=lang_suffix)
>
> class GhmarkupNode(template.Node):
> def __init__(self, nodelist):
> self.nodelist = nodelist
> def render(self, context):
> output = self.nodelist.render(context)
> return ghmarkup(output, context['url_path']).encode('utf-8')
>
> def ghmarkup_tag(parser, token):
> nodelist = parser.parse(('endghmarkuptag',))
> parser.delete_first_token()
> return GhmarkupNode(nodelist)
275a344,347
> register.filter('translatelink', translatelink)
> register.filter('prettylang', prettylang)
> register.filter('userlink', userlink_filter)
> register.tag('ghmarkuptag',ghmarkup_tag)
diff -rN old-ghestalt/app/views.py new-ghestalt/app/views.py
9a10
> from ghestalt.i18n.utils import *
13c14
< titleprefs = {'wiki': 'Wiki: ', 'bib': 'Bibliography: ', 'user': 'User: '}
---
> titleprefs = {'wiki': _('Wiki: '), 'bib': _('Bibliography: '), 'user': _('User: ')}
21c22
< suffix = ' discussion'
---
> suffix = _(' discussion')
22a24
> ltitle[-1] = i18n_baselang(ltitle[-1])
25c27,30
< def wiki_showpage(request, page):
---
> def wiki_homepage(request):
> return HttpResponseRedirect(i18n_site_base(request)+'/wiki/HomePage'+i18n_wiki_suffix(request))
>
> def wiki_showpage(request, page, origwhat=None):
29a35,38
> if i18n_baselang(what) != what:
> return wiki_showpage(request,i18n_baselang(page),origwhat=what)
> if origwhat:
> what = origwhat
32c41,60
< return render_to_response('wiki.html',{'title':wikititle(what), 'log':log},
---
> if i18n_lang_suffix(what)[1:] in settings.LANGUAGES_BIDI:
> content_bidi = True
> else:
> content_bidi = False
> all_langs = map(lambda x: x['what'],Log.objects.filter(what__startswith=i18n_baselang(what)).values('what').distinct())
> all_langs = filter(lambda x: x.rsplit('_',1)[0]==i18n_baselang(what),all_langs)
> all_langs.sort()
> trans_target = None
> trans_source = what
> if i18n_baselang(what) not in all_langs:
> trans_target = i18n_baselang(what)
> try:
> if i18n_baselang(what)+'_'+request.session['otro_lang'] not in all_langs:
> trans_target = i18n_baselang(what)+'_'+request.session['otro_lang']
> except KeyError:
> pass
> if origwhat:
> trans_target = origwhat
> what = origwhat
> return render_to_response('wiki.html',{'title':wikititle(page), 'log':log, 'origwhat':origwhat, 'what':what, 'all_langs':all_langs, 'trans_target':trans_target, 'trans_source':trans_source, 'no_title':log.ldata.startswith('=='),'CONTENT_BIDI': content_bidi},
40c68
< return render_to_response('wiki.html',{'title':wikititle(log.what), 'log':log},
---
> return render_to_response('wiki.html',{'title':wikititle(log.what), 'log':log, 'what':log.what},
58a87,108
> class NewPageForm(Form):
> page_name = CharField(label=_('Page name'),max_length=30,required=False)
> language = ChoiceField(label=_('Language'),choices=settings.LANGUAGES)
> def clean(self):
> return self.clean_data
>
> def wiki_new(request):
> if request.POST:
> form = NewPageForm(request.POST)
> if form.is_valid():
> page_name = form.clean_data.get('page_name')
> language = form.clean_data.get('language')
> if language!=settings.LANGUAGE_CODE[:2]:
> suffix = '_'+language
> else:
> suffix = ''
> return HttpResponseRedirect(i18n_site_base(request)+'/edit/wiki/'+page_name+suffix)
> else:
> form = NewPageForm({'language':request.LANGUAGE_CODE[:2]})
> return render_to_response('newpage.html',{'form':form},
> RequestContext(request))
>
60c110
< ldata = CharField(widget=Textarea(attrs={'rows': 24, 'cols': 80}), label="Text")
---
> ldata = CharField(widget=Textarea(attrs={'rows': 24, 'cols': 80}), label=_("Text"))
73,74c123,128
< if request.POST['submit']=='Preview':
< return render_to_response('edit.html',{'form': form, 'title':wikititle(what), 'mtime':'now', 'muser':'me', 'preview': form.clean_data.get('ldata')},
---
> if '_preview' in request.POST:
> if i18n_lang_suffix(what)[1:] in settings.LANGUAGES_BIDI:
> content_bidi = True
> else:
> content_bidi = False
> return render_to_response('edit.html',{'form': form, 'title':wikititle(what), 'mtime':'now', 'muser':'me', 'preview': form.clean_data.get('ldata'), 'what':what,'CONTENT_BIDI': content_bidi },
78c132
< return HttpResponseRedirect('/' + what)
---
> return HttpResponseRedirect(i18n_site_base(request)+'/' + what)
79a134,139
> if request.GET.has_key('source'):
> source = request.GET['source']
> add_prefixes = True
> else:
> source = what
> add_prefixes = False
81,82c141,146
< log = Log.objects.filter(what=what).latest()
< form = LogForm({'ldata':log.ldata})
---
> log = Log.objects.filter(what=source).latest()
> trans_message = '\n^^^^^ '+_('Replace caret marked lines with translation')+'\n^ '
> if add_prefixes:
> form = LogForm({'ldata':trans_message+log.ldata.replace('\n','\n^ ')+trans_message+'\n'})
> else:
> form = LogForm({'ldata':log.ldata})
85c149
< return render_to_response('edit.html',{'form': form, 'title':wikititle(what), 'mtime':'now', 'muser':'me'},
---
> return render_to_response('edit.html',{'form': form, 'title':wikititle(what), 'mtime':'now', 'muser':'me', 'what':what},
90c154
< def show_theorem(request, theorem):
---
> def show_theorem(request, theorem, origwhat=None):
105a170,171
> if i18n_baselang(what) != what:
> return show_theorem(request,i18n_baselang(theorem),origwhat=what)
107a174,177
> if origwhat:
> what = origwhat
> render_dict['what'] = what
> render_dict['origwhat'] = origwhat
diff -rN old-ghestalt/local_settings-postgres.py new-ghestalt/local_settings-postgres.py
8a9,10
> ENABLE_MAIL = False
>
10c12
< SITE_BASE = ''
---
> SITE_BASE = 'http://localhost:8080'
diff -rN old-ghestalt/local_settings-sqlite.py new-ghestalt/local_settings-sqlite.py
8a9,10
> ENABLE_MAIL = False
>
10c12
< SITE_BASE = ''
---
> SITE_BASE = 'http://localhost:8080'
diff -rN old-ghestalt/local_settings.py new-ghestalt/local_settings.py
9,10c9,10
< SITE_BASE = ''
< SITE_EMAIL = ''
---
> SITE_BASE = 'http://localhost:8080'
> SITE_EMAIL = '@'.join(['raph.levien', 'gmail.com'])
diff -rN old-ghestalt/settings.py new-ghestalt/settings.py
3a4
> gettext = lambda x: x # dummy gettext enables marking translation strings
9c10
< SITE_NAME = 'Ghestalt'
---
> SITE_NAME = gettext('Ghestalt')
60,61c61,64
< 'django.template.loaders.filesystem.load_template_source',
< 'django.template.loaders.app_directories.load_template_source',
---
> # 'django.template.loaders.filesystem.load_template_source',
> # 'django.template.loaders.app_directories.load_template_source',
> 'ghestalt.template.loaders.i18n_filesystem.load_template_source',
> 'ghestalt.template.loaders.i18n_app_directories.load_template_source',
67a71
> 'ghestalt.middleware.localeurl.LocaleURLMiddleware',
93c97,121
< 'django.core.context_processors.auth',)
---
> 'django.core.context_processors.auth',
> # 'django.core.context_processors.debug',
> )
>
> #INTERNAL_IPS = ('127.0.0.1',
> # 'localhost',)
>
> LANGUAGES = [
> ('en',gettext('English')),
> ('he',gettext('Hebrew')),
> ('po',gettext('Polish')),
> ('es',gettext('Spanish')),
> ]
>
> LANGUAGES_DICT = dict(LANGUAGES)
>
> LOCATIONS = [
> ('unset',''),
> ('il','Israel'),
> ('us','USA'),
> ]
>
> FIXTURE_DIRS = (
> '/home/dan/django/ghestalt',
> )
diff -rN old-ghestalt/static/css/style.css new-ghestalt/static/css/style.css
104,116c104,116
< .productImage {
< border:solid 1px silver;
< padding:5px;
< float: left;
< margin-top: 10px;
< margin-left: 10px;
< margin-right: 10px;
< margin-bottom:2px;
< }
<
< .productImage p {
< text-align: center;
< font-size: 10pt;
---
> .productImage {
> border:solid 1px silver;
> padding:5px;
> float: left;
> margin-top: 10px;
> margin-left: 10px;
> margin-right: 10px;
> margin-bottom:2px;
> }
>
> .productImage p {
> text-align: center;
> font-size: 10pt;
216a217
> DIV.new {text-decoration: none; color: red}
diff -rN old-ghestalt/urls.py new-ghestalt/urls.py
2a3
> from ghestalt.i18n.utils import *
4a6,10
> (r'^intl/\w\w(?P/intl/.*)$', 'django.views.generic.simple.direct_to_template',
> {'template':'site_404.html','message':'Page seems unavailable. Please check URL browser is pointing at.'}),
> (r'^intl/\w\w/', include('ghestalt.urls')),
> (r'^i18ninfo/', 'ghestalt.i18n.views.i18ninfo'),
> (r'^intl', 'ghestalt.i18n.views.i18n_chooselang'),
6a13
> (r'^$','ghestalt.i18n.views.redirectroot'),
9a17
> (r'^wiki/$', 'wiki_homepage'),
10a19
> (r'^wiki/NewPage$', 'wiki_new'),
27a37,38
> (r'^accounts/profile/$', 'accounts.info'),
> (r'^accounts/edit/$', 'accounts.edit'),