From cd017282e4e9e3756496d5b10dddd379279c0aed Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Thu, 10 Jan 2013 22:34:23 -0700 Subject: [PATCH 1/2] use Python 2.4 compatible script; update Smarty templates --- mods/friendica-to-smarty-tpl.py | 16 ++++++++++------ view/theme/dispy/smarty3/conversation.tpl | 2 +- .../dispy/smarty3/threaded_conversation.tpl | 2 +- view/theme/dispy/smarty3/wall_thread.tpl | 2 +- view/theme/frost-mobile/smarty3/conversation.tpl | 2 +- view/theme/frost-mobile/smarty3/register.tpl | 4 ++-- .../smarty3/threaded_conversation.tpl | 2 +- view/theme/frost-mobile/smarty3/wall_thread.tpl | 2 +- view/theme/frost/smarty3/acl_selector.tpl | 1 - view/theme/frost/smarty3/register.tpl | 4 ++-- .../frost/smarty3/threaded_conversation.tpl | 2 +- view/theme/frost/smarty3/wall_thread.tpl | 2 +- view/theme/quattro/smarty3/conversation.tpl | 2 +- .../quattro/smarty3/threaded_conversation.tpl | 2 +- view/theme/quattro/smarty3/wall_thread.tpl | 2 +- view/theme/smoothly/smarty3/wall_thread.tpl | 2 +- view/theme/testbubble/smarty3/wall_thread.tpl | 2 +- .../theme/vier/smarty3/threaded_conversation.tpl | 2 +- view/theme/vier/smarty3/wall_thread.tpl | 2 +- 19 files changed, 29 insertions(+), 26 deletions(-) diff --git a/mods/friendica-to-smarty-tpl.py b/mods/friendica-to-smarty-tpl.py index 6037d04ea..ff1a102a4 100755 --- a/mods/friendica-to-smarty-tpl.py +++ b/mods/friendica-to-smarty-tpl.py @@ -77,7 +77,7 @@ def fix_element(element): if parts[first+1][0] == '$': # This takes care of elements where the filename is a variable, e.g. {{ inc $file }} - element += 'file:' + ldelim + parts[first+1].rstrip('}') + rdelim + element += ldelim + parts[first+1].rstrip('}') + rdelim else: # This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }} element += parts[first+1].rstrip('}') @@ -189,10 +189,14 @@ for a_file in files: filename = os.path.join(path,a_file) ext = a_file.split('.')[-1] if os.path.isfile(filename) and ext == 'tpl': - with open(filename, 'r') as f: - newfilename = os.path.join(outpath,a_file) - with open(newfilename, 'w') as outf: - print "Converting " + filename + " to " + newfilename - convert(f, outf, php_tpl) + f = open(filename, 'r') + newfilename = os.path.join(outpath,a_file) + outf = open(newfilename, 'w') + + print "Converting " + filename + " to " + newfilename + convert(f, outf, php_tpl) + + outf.close() + f.close() diff --git a/view/theme/dispy/smarty3/conversation.tpl b/view/theme/dispy/smarty3/conversation.tpl index 302f7172b..6461955e7 100644 --- a/view/theme/dispy/smarty3/conversation.tpl +++ b/view/theme/dispy/smarty3/conversation.tpl @@ -11,7 +11,7 @@ {{/if}} {{if $item.comment_lastcollapsed}}{{/if}} - {{include file="file:{{$item.template}}"}} + {{include file="{{$item.template}}"}} {{/foreach}} diff --git a/view/theme/dispy/smarty3/threaded_conversation.tpl b/view/theme/dispy/smarty3/threaded_conversation.tpl index 367698bee..fdca3e557 100644 --- a/view/theme/dispy/smarty3/threaded_conversation.tpl +++ b/view/theme/dispy/smarty3/threaded_conversation.tpl @@ -1,7 +1,7 @@ {{$live_update}} {{foreach $threads as $thread}} -{{include file="file:{{$thread.template}}" item=$thread}} +{{include file="{{$thread.template}}" item=$thread}} {{/foreach}}
diff --git a/view/theme/dispy/smarty3/wall_thread.tpl b/view/theme/dispy/smarty3/wall_thread.tpl index b0de88e34..a0b818d07 100644 --- a/view/theme/dispy/smarty3/wall_thread.tpl +++ b/view/theme/dispy/smarty3/wall_thread.tpl @@ -132,7 +132,7 @@ class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onc
{{foreach $item.children as $child}} - {{include file="file:{{$child.template}}" item=$child}} + {{include file="{{$child.template}}" item=$child}} {{/foreach}} diff --git a/view/theme/frost-mobile/smarty3/conversation.tpl b/view/theme/frost-mobile/smarty3/conversation.tpl index aa6bee0ea..844d94891 100644 --- a/view/theme/frost-mobile/smarty3/conversation.tpl +++ b/view/theme/frost-mobile/smarty3/conversation.tpl @@ -11,7 +11,7 @@ {{/if}} {{if $item.comment_lastcollapsed}}{{/if}} - {{include file="file:{{$item.template}}"}} + {{include file="{{$item.template}}"}} {{/foreach}} diff --git a/view/theme/frost-mobile/smarty3/register.tpl b/view/theme/frost-mobile/smarty3/register.tpl index bc0ce4cc9..a224721dd 100644 --- a/view/theme/frost-mobile/smarty3/register.tpl +++ b/view/theme/frost-mobile/smarty3/register.tpl @@ -11,9 +11,9 @@

{{$realpeople}}


-{{if $oidlabel }} +{{if $oidlabel}}
- +
{{/if}} diff --git a/view/theme/frost-mobile/smarty3/threaded_conversation.tpl b/view/theme/frost-mobile/smarty3/threaded_conversation.tpl index 0c96b30e3..d5bbf06a6 100644 --- a/view/theme/frost-mobile/smarty3/threaded_conversation.tpl +++ b/view/theme/frost-mobile/smarty3/threaded_conversation.tpl @@ -1,7 +1,7 @@ {{$live_update}} {{foreach $threads as $thread}} -{{include file="file:{{$thread.template}}" item=$thread}} +{{include file="{{$thread.template}}" item=$thread}} {{/foreach}}
diff --git a/view/theme/frost-mobile/smarty3/wall_thread.tpl b/view/theme/frost-mobile/smarty3/wall_thread.tpl index e1a0aa868..635976883 100644 --- a/view/theme/frost-mobile/smarty3/wall_thread.tpl +++ b/view/theme/frost-mobile/smarty3/wall_thread.tpl @@ -113,7 +113,7 @@ {{foreach $item.children as $child}} - {{include file="file:{{$child.template}}" item=$child}} + {{include file="{{$child.template}}" item=$child}} {{/foreach}} {{if $item.flatten}} diff --git a/view/theme/frost/smarty3/acl_selector.tpl b/view/theme/frost/smarty3/acl_selector.tpl index f3b1abea7..361bf8843 100644 --- a/view/theme/frost/smarty3/acl_selector.tpl +++ b/view/theme/frost/smarty3/acl_selector.tpl @@ -9,7 +9,6 @@ diff --git a/view/theme/frost/smarty3/register.tpl b/view/theme/frost/smarty3/register.tpl index 72b628f39..0f9765063 100644 --- a/view/theme/frost/smarty3/register.tpl +++ b/view/theme/frost/smarty3/register.tpl @@ -11,9 +11,9 @@

{{$realpeople}}


-{{if $oidlabel }} +{{if $oidlabel}}
- +
{{/if}} diff --git a/view/theme/frost/smarty3/threaded_conversation.tpl b/view/theme/frost/smarty3/threaded_conversation.tpl index 680a201ee..c61de4f53 100644 --- a/view/theme/frost/smarty3/threaded_conversation.tpl +++ b/view/theme/frost/smarty3/threaded_conversation.tpl @@ -13,7 +13,7 @@ {{$live_update}} {{foreach $threads as $thread}} -{{include file="file:{{$thread.template}}" item=$thread}} +{{include file="{{$thread.template}}" item=$thread}} {{/foreach}}
diff --git a/view/theme/frost/smarty3/wall_thread.tpl b/view/theme/frost/smarty3/wall_thread.tpl index a0c576b18..4b28c218f 100644 --- a/view/theme/frost/smarty3/wall_thread.tpl +++ b/view/theme/frost/smarty3/wall_thread.tpl @@ -112,7 +112,7 @@ {{foreach $item.children as $child}} - {{include file="file:{{$child.template}}" item=$child}} + {{include file="{{$child.template}}" item=$child}} {{/foreach}} {{if $item.flatten}} diff --git a/view/theme/quattro/smarty3/conversation.tpl b/view/theme/quattro/smarty3/conversation.tpl index f22b11a75..b812d533a 100644 --- a/view/theme/quattro/smarty3/conversation.tpl +++ b/view/theme/quattro/smarty3/conversation.tpl @@ -17,7 +17,7 @@ {{if $item.type == tag}} {{include file="wall_item_tag.tpl"}} {{else}} - {{include file="file:{{$item.template}}"}} + {{include file="{{$item.template}}"}} {{/if}} {{/foreach}} diff --git a/view/theme/quattro/smarty3/threaded_conversation.tpl b/view/theme/quattro/smarty3/threaded_conversation.tpl index a7516a8a3..158c30d6b 100644 --- a/view/theme/quattro/smarty3/threaded_conversation.tpl +++ b/view/theme/quattro/smarty3/threaded_conversation.tpl @@ -8,7 +8,7 @@ {{if $thread.type == tag}} {{include file="wall_item_tag.tpl" item=$thread}} {{else}} - {{include file="file:{{$thread.template}}" item=$thread}} + {{include file="{{$thread.template}}" item=$thread}} {{/if}} diff --git a/view/theme/quattro/smarty3/wall_thread.tpl b/view/theme/quattro/smarty3/wall_thread.tpl index 68e6d5d10..f6068d330 100644 --- a/view/theme/quattro/smarty3/wall_thread.tpl +++ b/view/theme/quattro/smarty3/wall_thread.tpl @@ -149,7 +149,7 @@ {{if $child.type == tag}} {{include file="wall_item_tag.tpl" item=$child}} {{else}} - {{include file="file:{{$item.template}}" item=$child}} + {{include file="{{$item.template}}" item=$child}} {{/if}} {{/foreach}} diff --git a/view/theme/smoothly/smarty3/wall_thread.tpl b/view/theme/smoothly/smarty3/wall_thread.tpl index b0538b979..2d329e712 100644 --- a/view/theme/smoothly/smarty3/wall_thread.tpl +++ b/view/theme/smoothly/smarty3/wall_thread.tpl @@ -148,7 +148,7 @@
{{foreach $item.children as $child}} - {{include file="file:{{$child.template}}" item=$child}} + {{include file="{{$child.template}}" item=$child}} {{/foreach}} {{if $item.flatten}} diff --git a/view/theme/testbubble/smarty3/wall_thread.tpl b/view/theme/testbubble/smarty3/wall_thread.tpl index 8a0150e5b..82ceb23b9 100644 --- a/view/theme/testbubble/smarty3/wall_thread.tpl +++ b/view/theme/testbubble/smarty3/wall_thread.tpl @@ -95,7 +95,7 @@
{{foreach $item.children as $child}} - {{include file="file:{{$child.template}}" item=$child}} + {{include file="{{$child.template}}" item=$child}} {{/foreach}} {{if $item.flatten}} diff --git a/view/theme/vier/smarty3/threaded_conversation.tpl b/view/theme/vier/smarty3/threaded_conversation.tpl index a7516a8a3..158c30d6b 100644 --- a/view/theme/vier/smarty3/threaded_conversation.tpl +++ b/view/theme/vier/smarty3/threaded_conversation.tpl @@ -8,7 +8,7 @@ {{if $thread.type == tag}} {{include file="wall_item_tag.tpl" item=$thread}} {{else}} - {{include file="file:{{$thread.template}}" item=$thread}} + {{include file="{{$thread.template}}" item=$thread}} {{/if}} diff --git a/view/theme/vier/smarty3/wall_thread.tpl b/view/theme/vier/smarty3/wall_thread.tpl index 386164f18..e2d55113d 100644 --- a/view/theme/vier/smarty3/wall_thread.tpl +++ b/view/theme/vier/smarty3/wall_thread.tpl @@ -150,7 +150,7 @@ {{if $item.type == tag}} {{include file="wall_item_tag.tpl" item=$child}} {{else}} - {{include file="file:{{$item.template}}" item=$child}} + {{include file="{{$item.template}}" item=$child}} {{/if}} {{/foreach}} From 1cfc660e6df2d0e3c10a13c2a38d8df0a2af249e Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Thu, 10 Jan 2013 22:36:44 -0700 Subject: [PATCH 2/2] update a few more Smarty templates --- view/smarty3/conversation.tpl | 2 +- view/smarty3/register.tpl | 4 ++-- view/smarty3/threaded_conversation.tpl | 2 +- view/smarty3/wall_thread.tpl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/view/smarty3/conversation.tpl b/view/smarty3/conversation.tpl index ce5dc5a2f..ae5294a9a 100644 --- a/view/smarty3/conversation.tpl +++ b/view/smarty3/conversation.tpl @@ -11,7 +11,7 @@ {{/if}} {{if $item.comment_lastcollapsed}}{{/if}} - {{include file="file:{{$item.template}}"}} + {{include file="{{$item.template}}"}} {{/foreach}} diff --git a/view/smarty3/register.tpl b/view/smarty3/register.tpl index 768ca9387..4d9abe11d 100644 --- a/view/smarty3/register.tpl +++ b/view/smarty3/register.tpl @@ -11,9 +11,9 @@

{{$fillwith}}

{{$fillext}}

-{{if $oidlabel }} +{{if $oidlabel}}
- +
{{/if}} diff --git a/view/smarty3/threaded_conversation.tpl b/view/smarty3/threaded_conversation.tpl index 0830063c6..f77cac8de 100644 --- a/view/smarty3/threaded_conversation.tpl +++ b/view/smarty3/threaded_conversation.tpl @@ -1,7 +1,7 @@ {{$live_update}} {{foreach $threads as $thread}} -{{include file="file:{{$thread.template}}" item=$thread}} +{{include file="{{$thread.template}}" item=$thread}} {{/foreach}}
diff --git a/view/smarty3/wall_thread.tpl b/view/smarty3/wall_thread.tpl index c1fed91ba..3010f659f 100644 --- a/view/smarty3/wall_thread.tpl +++ b/view/smarty3/wall_thread.tpl @@ -108,7 +108,7 @@
{{foreach $item.children as $child}} - {{include file="file:{{$child.template}}" item=$child}} + {{include file="{{$child.template}}" item=$child}} {{/foreach}} {{if $item.flatten}}