Skip to content
This repository was archived by the owner on Dec 25, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 0 additions & 82 deletions backstage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,87 +1146,6 @@ def post(self):
else:
self.redirect('/')

class BackstageTopicHandler(webapp.RequestHandler):
def get(self):
template_values = {}
site = GetSite()
member = CheckAuth(self)
l10n = GetMessages(self, member, site)
template_values['l10n'] = l10n
if member:
if member.num == 1:
template_values['page_title'] = site.title + u' › ' + l10n.backstage + u' › ' + l10n.topic_settings
template_values['site'] = site
template_values['site_use_topic_types'] = site.use_topic_types
if site.topic_types is None:
template_values['site_topic_types'] = ''
else:
template_values['site_topic_types'] = site.topic_types
if site.use_topic_types is not True:
s = '<select name="use_topic_types"><option value="1">Enabled</option><option value="0" selected="selected">Disabled</option></select>'
else:
s = '<select name="use_topic_types"><option value="1" selected="selected">Enabled</option><option value="0">Disabled</option></select>'
template_values['s'] = s
template_values['member'] = member
template_values['system_version'] = SYSTEM_VERSION
path = os.path.join(os.path.dirname(__file__), 'tpl', 'desktop', 'backstage_topic.html')
output = template.render(path, template_values)
self.response.out.write(output)
else:
self.redirect('/')

def post(self):
template_values = {}
site = GetSite()
member = CheckAuth(self)
l10n = GetMessages(self, member, site)
template_values['l10n'] = l10n
if member:
if member.num == 1:
template_values['page_title'] = site.title + u' › ' + l10n.backstage + u' › ' + l10n.topic_settings
template_values['site'] = site
template_values['site_use_topic_types'] = site.use_topic_types
if site.topic_types is None:
template_values['site_topic_types'] = ''
else:
template_values['site_topic_types'] = site.topic_types
if site.use_topic_types is not True:
s = '<select name="use_topic_types"><option value="1">Enabled</option><option value="0" selected="selected">Disabled</option></select>'
else:
s = '<select name="use_topic_types"><option value="1" selected="selected">Enabled</option><option value="0">Disabled</option></select>'
template_values['s'] = s
template_values['member'] = member
template_values['system_version'] = SYSTEM_VERSION
errors = 0
# Verification: use_topic_types
site_use_topic_types = self.request.get('use_topic_types').strip()
if site_use_topic_types is None:
s = '<select name="use_topic_types"><option value="1">Enabled</option><option value="0" selected="selected">Disabled</option></select>'
else:
if site_use_topic_types == '1':
s = '<select name="use_topic_types"><option value="1" selected="selected">Enabled</option><option value="0">Disabled</option></select>'
else:
s = '<select name="use_topic_types"><option value="1">Enabled</option><option value="0" selected="selected">Disabled</option></select>'
template_values['s'] = s
# Verification: topic_types
site_topic_types = self.request.get('topic_types').strip()
if errors == 0:
if site_use_topic_types == '1':
site.use_topic_types = True
else:
site.use_topic_types = False
site.topic_types = site_topic_types
site.put()
memcache.delete('site')
self.redirect('/backstage')
else:
path = os.path.join(os.path.dirname(__file__), 'tpl', 'desktop', 'backstage_topic.html')
output = template.render(path, template_values)
self.response.out.write(output)
else:
self.redirect('/')


class BackstageRemoveMemcacheHandler(webapp.RequestHandler):
def post(self):
member = CheckAuth(self)
Expand All @@ -1252,7 +1171,6 @@ def main():
('/backstage/deactivate/user/(.*)', BackstageDeactivateUserHandler),
('/backstage/move/topic/(.*)', BackstageMoveTopicHandler),
('/backstage/site', BackstageSiteHandler),
('/backstage/topic', BackstageTopicHandler),
('/backstage/remove/mc', BackstageRemoveMemcacheHandler)
],
debug=True)
Expand Down
4 changes: 2 additions & 2 deletions member.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get(self):
member = CheckAuth(self)
l10n = GetMessages(self, member, site)
template_values['l10n'] = l10n
template_values['page_title'] = site.title + u' › ' + l10n.settings.decode('utf-8')
template_values['page_title'] = site.title + u' › ' + l10n.settings
if (member):
template_values['member'] = member
template_values['member_username'] = member.username
Expand Down Expand Up @@ -202,7 +202,7 @@ def post(self):
member = CheckAuth(self)
l10n = GetMessages(self, member, site)
template_values['l10n'] = l10n
template_values['page_title'] = site.title + u' › ' + l10n.settings.decode('utf-8')
template_values['page_title'] = site.title + u' › ' + l10n.settings
if (member):
template_values['member'] = member
template_values['member_username'] = member.username
Expand Down
60 changes: 8 additions & 52 deletions topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,17 @@ def get(self, node_name):
member = CheckAuth(self)
l10n = GetMessages(self, member, site)
template_values['l10n'] = l10n
template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic.decode('utf-8')
template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic
if (member):
template_values['member'] = member
node = GetKindByName('Node', node_name)
template_values['node'] = node
section = GetKindByNum('Section', node.section_num)
section = False
if node:
q2 = db.GqlQuery("SELECT * FROM Section WHERE num = :1", node.section_num)
if (q2.count() == 1):
section = q2[0]
template_values['section'] = section
if site.use_topic_types:
types = site.topic_types.split("\n")
options = '<option value="0">&nbsp;&nbsp;&nbsp;&nbsp;</option>'
i = 0
for a_type in types:
i = i + 1
detail = a_type.split(':')
options = options + '<option value="' + str(i) + '">' + detail[0] + '</option>'
tt = '<div class="sep5"></div><table cellpadding="5" cellspacing="0" border="0" width="100%"><tr><td width="60" align="right">Topic Type</td><td width="auto" align="left"><select name="type">' + options + '</select></td></tr></table>'
template_values['tt'] = tt
else:
template_values['tt'] = ''
if browser['ios']:
if node:
path = os.path.join(os.path.dirname(__file__), 'tpl', 'mobile', 'new_topic.html')
Expand All @@ -101,7 +93,7 @@ def post(self, node_name):
member = CheckAuth(self)
l10n = GetMessages(self, member, site)
template_values['l10n'] = l10n
template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic.decode('utf-8')
template_values['page_title'] = site.title + u' › ' + l10n.create_new_topic
if (member):
template_values['member'] = member
q = db.GqlQuery("SELECT * FROM Node WHERE name = :1", node_name)
Expand Down Expand Up @@ -150,38 +142,6 @@ def post(self, node_name):
template_values['topic_content'] = topic_content
template_values['topic_content_error'] = topic_content_error
template_values['topic_content_error_message'] = topic_content_error_messages[topic_content_error]
# Verification: type
if site.use_topic_types:
types = site.topic_types.split("\n")
if len(types) > 0:
topic_type = self.request.get('type').strip()
try:
topic_type = int(topic_type)
if topic_type < 0:
topic_type = 0
if topic_type > len(types):
topic_type = 0
if topic_type > 0:
detail = types[topic_type - 1].split(':')
topic_type_label = detail[0]
topic_type_color = detail[1]
except:
topic_type = 0
else:
topic_type = 0
options = '<option value="0">&nbsp;&nbsp;&nbsp;&nbsp;</option>'
i = 0
for a_type in types:
i = i + 1
detail = a_type.split(':')
if topic_type == i:
options = options + '<option value="' + str(i) + '" selected="selected">' + detail[0] + '</option>'
else:
options = options + '<option value="' + str(i) + '">' + detail[0] + '</option>'
tt = '<div class="sep5"></div><table cellpadding="5" cellspacing="0" border="0" width="100%"><tr><td width="60" align="right">Topic Type</td><td width="auto" align="left"><select name="type">' + options + '</select></td></tr></table>'
template_values['tt'] = tt
else:
template_values['tt'] = ''
template_values['errors'] = errors
if (errors == 0):
topic = Topic(parent=node)
Expand Down Expand Up @@ -225,11 +185,7 @@ def post(self, node_name):
if (re.findall('Android', ua)):
topic.source = 'Android'
if (re.findall('Mozilla\/5.0 \(PLAYSTATION 3;', ua)):
topic.source = 'PS3'
if site.use_topic_types:
if topic_type > 0:
topic.type = topic_type_label
topic.type_color = topic_type_color
topic.source = 'PS3'
node.topics = node.topics + 1
node.put()
topic.put()
Expand Down
29 changes: 2 additions & 27 deletions tpl/desktop/advertisers.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,10 @@ <h1 style="padding-top: 0px;">Advertisers of V2EX</h1>
<div class="sep20"></div>
<span class="bigger fade">感谢你们对这里的支持,让 V2EX 能够持续存在并发展。</span>
</div>
<div class="cell">
<strong>Promoted by <a href="http://jiepang.com/?utm_source=v2ex&utm_medium=banner&utm_campaign=V2EX" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'jiepang.com');">街旁</a></strong>
<div clas="sep5"></div>
<strong class="green">Reserved from 10/8 to 10/15, 2010 - Running</strong>
<div class="sep10"></div>
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
<td width="33%" valign="top">
<a href="http://we.jiepang.com/careers/?utm_source=v2ex&utm_medium=banner&utm_campaign=V2EX" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'we.jiepang.com');"><img src="http://web.me.com/v2ex.livid/badges/jiepang.png" border="0" width="120" height="90" alt="iMoney HD" /></a>
<div class="sep5"></div>
<span style="font-size: 11px; color: #666;">
<strong style="color: #000;"><a href="http://we.jiepang.com/careers/?utm_source=v2ex&utm_medium=banner&utm_campaign=V2EX" class="black" onClick="recordOutboundLink(this, 'Outbound Links', 'we.jiepang.com');">街旁寻 iOS 开发者</a></strong><div class="sep3"></div><span style="font-size: 12px;">街旁是一支短小精悍的团队,期待你的加入 :)</span>
</span>
</td>
<td width="34%" valign="top">

</td>
<td width="33%" valign="top">

</td>
</tr>
</table>
</div>
<div class="cell">
<strong>Promoted by <a href="http://iweek.ly/?utm_source=v2ex&utm_medium=banner&utm_campaign=V2EX" target="_blank" onClick="recordOutboundLink(this, 'Outbound Links', 'iweek.ly');">iWeek.ly</a></strong>
<div clas="sep5"></div>
<strong class="fade">Reserved from 8/8 to 10/8, 2010</strong>
<strong class="green">Reserved from 8/8 to 10/8, 2010 - Live Ads</strong>
<div class="sep10"></div>
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
Expand Down Expand Up @@ -122,9 +99,7 @@ <h1 style="padding-top: 0px;">Advertisers of V2EX</h1>
</tr>
</table>
</div>
<div class="inner" align="center"><div class="sep5"></div>
<a href="mailto:hello@v2ex.com?subject=广告投放咨询" class="super normal button">我要投放</a>
<div class="sep5"></div>
<div class="inner">
</div>
</div>
</div>
Expand Down
68 changes: 0 additions & 68 deletions tpl/desktop/backstage_topic.html

This file was deleted.

6 changes: 6 additions & 0 deletions tpl/desktop/common/bottom.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<div class="sep5"></div>
<small>VERSION: {{ system_version }}<br />♥ Do have a faith in what you're doing.</small>
</div>
<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script>
<script type="text/javascript">
try {
reinvigorate.track("m705q-1p0cs1776p");
} catch(err) {}
</script>
{% if site.analytics %}
<script type="text/javascript">
var _gaq = _gaq || [];
Expand Down
2 changes: 1 addition & 1 deletion tpl/desktop/common/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="alternate" type="application/atom+xml" href="/index.xml" />
<meta name="google-site-verification" content="LM_cJR94XJIqcYJeOCscGVMWdaRUvmyz6cVOqkFplaU" />
{% if canonical %}<link rel="canonical" href="{{ canonical }}" />{% endif %}
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
{% if site.analytics %}
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
Expand Down
2 changes: 1 addition & 1 deletion tpl/desktop/common/topics.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% for topic in topics %}
<tr>
<td align="right" width="50" class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %} lend">{% ifequal topic.replies 0 %}<span class="snow">{{ topic.replies }}</span>{% else %}<strong><span class="green">{{ topic.replies }}</span></strong>{% endifequal %}</td>
<td align="left" width="auto" class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">{% if site.use_topic_types %}{% if topic.type %}<span style="display: inline-block; background-color: {{ topic.type_color }}; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; color: #fff; padding: 0px 8px 0px 8px; font-size: 13px;">{{ topic.type }}</span> &nbsp;{% endif %}{% endif %}<a href="/t/{{ topic.num }}">{{ topic.title|escape }}</a></td>
<td align="left" width="auto" class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}"><a href="/t/{{ topic.num }}">{{ topic.title|escape }}</a></td>
<td align="left" width="80" class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">{% if topic.member %}<a href="/member/{{ topic.member.username }}" class="dark">{{ topic.member.username }}</a>{% else %}<a href="/member/{{ topic.created_by }}" class="dark">{{ topic.created_by }}</a>{% endif %}</td>
<td align="left" width="110" class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %} rend"><small class="fade">{{ topic.last_touched|timezone:8|date:"Y-n-j G:i:s"}}</small></td>
</tr>
Expand Down
Loading