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 6037d04ea2..ff1a102a44 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 302f7172b5..6461955e74 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 367698beeb..fdca3e5574 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 b0de88e34a..a0b818d070 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 aa6bee0ea5..844d948917 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 bc0ce4cc9c..a224721dd1 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 0c96b30e3e..d5bbf06a6b 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 e1a0aa868e..6359768837 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 f3b1abea7c..361bf8843a 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 72b628f39d..0f9765063e 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 680a201eef..c61de4f53a 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 a0c576b18b..4b28c218fe 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 f22b11a751..b812d533a3 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 a7516a8a31..158c30d6bd 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 68e6d5d102..f6068d330a 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 b0538b9791..2d329e712e 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 8a0150e5b0..82ceb23b98 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 a7516a8a31..158c30d6bd 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 386164f18c..e2d55113dc 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 ce5dc5a2f6..ae5294a9ae 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 768ca93878..4d9abe11df 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 0830063c61..f77cac8de2 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 c1fed91bab..3010f659f7 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}}