From ddbb6d71ab5c58322e4cde55b56ca50206e35298 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Wed, 27 Mar 2013 16:51:09 -0700 Subject: [PATCH] Remove obsolete house ad system. This has been replaced by reddit-plugin-adzerk and Adzerk.net. --- r2/r2/config/routing.py | 8 -- r2/r2/controllers/__init__.py | 1 - r2/r2/controllers/ads.py | 57 ----------- r2/r2/controllers/api.py | 85 ---------------- r2/r2/controllers/front.py | 2 - r2/r2/controllers/mediaembed.py | 27 ++---- r2/r2/lib/pages/admin_pages.py | 1 - r2/r2/lib/pages/pages.py | 140 +------------------------- r2/r2/lib/validator/validator.py | 18 ---- r2/r2/models/__init__.py | 1 - r2/r2/models/ad.py | 151 ----------------------------- r2/r2/templates/adminadassign.html | 70 ------------- r2/r2/templates/adminads.html | 121 ----------------------- r2/r2/templates/adminadsrs.html | 71 -------------- r2/r2/templates/dart_ad.html | 98 ------------------- r2/r2/templates/housead.html | 58 ----------- r2/r2/templates/redditads.html | 130 ------------------------- 17 files changed, 9 insertions(+), 1030 deletions(-) delete mode 100644 r2/r2/controllers/ads.py delete mode 100644 r2/r2/models/ad.py delete mode 100644 r2/r2/templates/adminadassign.html delete mode 100644 r2/r2/templates/adminads.html delete mode 100644 r2/r2/templates/adminadsrs.html delete mode 100644 r2/r2/templates/dart_ad.html delete mode 100644 r2/r2/templates/housead.html delete mode 100644 r2/r2/templates/redditads.html diff --git a/r2/r2/config/routing.py b/r2/r2/config/routing.py index 4262848ef..fb1cda1fd 100644 --- a/r2/r2/config/routing.py +++ b/r2/r2/config/routing.py @@ -110,11 +110,6 @@ def make_map(): mc('/feedback', controller='feedback', action='feedback') mc('/ad_inq', controller='feedback', action='ad_inq') - # Used for editing ads - mc('/admin/ads', controller='ads') - mc('/admin/ads/:adcn/:action', controller='ads', - requirements=dict(action="assign|srs")) - mc('/admin/awards', controller='awards') mc('/admin/awards/:awardcn/:action', controller='awards', requirements=dict(action="give|winners")) @@ -334,9 +329,6 @@ def make_map(): # Used for showing ads mc("/ads/", controller="ad", action="ad") - mc("/ads/r/:reddit_name/:keyword", controller="ad", action="ad", - keyword=None) - mc("/ads/:codename", controller="ad", action="ad_by_codename") mc("/try", controller="forms", action="try_compact") diff --git a/r2/r2/controllers/__init__.py b/r2/r2/controllers/__init__.py index a7c0805e1..1cfde2b87 100644 --- a/r2/r2/controllers/__init__.py +++ b/r2/r2/controllers/__init__.py @@ -65,7 +65,6 @@ def load_controllers(): from post import PostController from toolbar import ToolbarController from awards import AwardsController - from ads import AdsController from errorlog import ErrorlogController from promotecontroller import PromoteController from mediaembed import MediaembedController diff --git a/r2/r2/controllers/ads.py b/r2/r2/controllers/ads.py deleted file mode 100644 index 87edc2d04..000000000 --- a/r2/r2/controllers/ads.py +++ /dev/null @@ -1,57 +0,0 @@ -# The contents of this file are subject to the Common Public Attribution -# License Version 1.0. (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -# License Version 1.1, but Sections 14 and 15 have been added to cover use of -# software over a computer network and provide for limited attribution for the -# Original Developer. In addition, Exhibit A has been modified to be consistent -# with Exhibit B. -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -# the specific language governing rights and limitations under the License. -# -# The Original Code is reddit. -# -# The Original Developer is the Initial Developer. The Initial Developer of -# the Original Code is reddit Inc. -# -# All portions of the code written by reddit are Copyright (c) 2006-2013 reddit -# Inc. All Rights Reserved. -############################################################################### - -from pylons import request, g -from reddit_base import RedditController -from r2.lib.pages import AdminPage, AdminAds, AdminAdAssign, AdminAdSRs -from r2.lib.validator import * - -class AdsController(RedditController): - - @validate(VSponsorAdmin()) - def GET_index(self): - res = AdminPage(content = AdminAds(), - show_sidebar = False, - title = 'ads').render() - return res - - @validate(VSponsorAdmin(), - ad = VAdByCodename('adcn')) - def GET_assign(self, ad): - if ad is None: - abort(404, 'page not found') - - res = AdminPage(content = AdminAdAssign(ad), - show_sidebar = False, - title='assign an ad to a community').render() - return res - - @validate(VSponsorAdmin(), - ad = VAdByCodename('adcn')) - def GET_srs(self, ad): - if ad is None: - abort(404, 'page not found') - - res = AdminPage(content = AdminAdSRs(ad), - show_sidebar = False, - title='ad srs').render() - return res diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 1985a8fd8..f012838db 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -2492,91 +2492,6 @@ class ApiController(RedditController, OAuth2ResourceController): form.set_html(".status", _('saved')) - @validatedForm(VSponsor(), - ad = VByName("fullname"), - colliding_ad=VAdByCodename(("codename", "fullname")), - codename = VLength("codename", max_length = 100), - imgurl = VLength("imgurl", max_length = 1000), - raw_html = VLength("raw_html", max_length = 10000), - linkurl = VLength("linkurl", max_length = 1000)) - def POST_editad(self, form, jquery, ad, colliding_ad, codename, - imgurl, raw_html, linkurl): - if form.has_errors(("codename", "imgurl", "linkurl"), - errors.NO_TEXT): - pass - - if form.has_errors(("codename"), errors.INVALID_OPTION): - form.set_html(".status", "some other ad has that codename") - pass - - if form.has_error(): - return - - if ad is None: - Ad._new(codename, - imgurl=imgurl, - raw_html=raw_html, - linkurl=linkurl) - form.set_html(".status", "saved. reload to see it.") - return - - ad.codename = codename - ad.imgurl = imgurl - ad.raw_html = raw_html - ad.linkurl = linkurl - ad._commit() - form.set_html(".status", _('saved')) - - @validatedForm(VSponsor(), - ad = VByName("fullname"), - sr = VSubmitSR("community"), - weight = VInt("weight", - coerce=False, min=0, max=100000), - ) - def POST_assignad(self, form, jquery, ad, sr, weight): - if form.has_errors("ad", errors.NO_TEXT): - pass - - if form.has_errors("community", errors.SUBREDDIT_REQUIRED, - errors.SUBREDDIT_NOEXIST, errors.SUBREDDIT_NOTALLOWED): - pass - - if form.has_errors("fullname", errors.NO_TEXT): - pass - - if form.has_errors("weight", errors.BAD_NUMBER): - pass - - if form.has_error(): - return - - if ad.codename == "DART" and sr.name == g.default_sr and weight != 100: - log_text("Bad default DART weight", - "The default DART weight can only be 100, not %s." - % weight, - "error") - abort(403, 'forbidden') - - existing = AdSR.by_ad_and_sr(ad, sr) - - if weight is not None: - if existing: - existing.weight = weight - existing._commit() - else: - AdSR._new(ad, sr, weight) - - form.set_html(".status", _('saved')) - - else: - if existing: - existing._delete() - AdSR.by_ad(ad, _update=True) - AdSR.by_sr(sr, _update=True) - - form.set_html(".status", _('deleted')) - - @validatedForm(VAdmin(), award=VByName("fullname"), colliding_award=VAwardByCodename(("codename", "fullname")), diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 9e78061e7..656409a79 100755 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -658,8 +658,6 @@ class FrontController(RedditController, OAuth2ResourceController): elif is_moderator_with_perms('flair') and location == 'flair': c.allow_styles = True pane = FlairPane(num, after, reverse, name, user) - elif c.user_is_sponsor and location == 'ads': - pane = RedditAds() elif (location == "about") and is_api(): return self.redirect(add_sr('about.json'), code=301) else: diff --git a/r2/r2/controllers/mediaembed.py b/r2/r2/controllers/mediaembed.py index 4e618dfcc..51316b80d 100644 --- a/r2/r2/controllers/mediaembed.py +++ b/r2/r2/controllers/mediaembed.py @@ -23,14 +23,12 @@ from reddit_base import MinimalController from r2.lib.scraper import get_media_embed -from r2.lib.pages import MediaEmbedBody, render_ad, render_ad_by_codename +from r2.lib.pages import MediaEmbedBody from r2.lib.validator import * from pylons import request from pylons.controllers.util import abort -from r2.lib.cache import make_key -import random class MediaembedController(MinimalController): @validate(link = VLink('link')) @@ -54,23 +52,10 @@ class MediaembedController(MinimalController): return MediaEmbedBody(body = content).render() + class AdController(MinimalController): - def request_key(self): - return make_key('request', - c.lang, - c.content_langs, - request.host, - c.cname, - request.fullpath, - random.choice(xrange(100))) - - def GET_ad(self, reddit_name = None, keyword=None): - c.render_style = "html" - return render_ad(reddit_name=reddit_name, keyword=keyword) - - def GET_ad_by_codename(self, codename = None): - if not codename: - abort(404) - c.render_style = "html" - return render_ad_by_codename(codename) + def try_pagecache(self): + pass + def GET_ad(self): + return "This is a placeholder ad." diff --git a/r2/r2/lib/pages/admin_pages.py b/r2/r2/lib/pages/admin_pages.py index 6b01c7e95..836a84300 100644 --- a/r2/r2/lib/pages/admin_pages.py +++ b/r2/r2/lib/pages/admin_pages.py @@ -34,7 +34,6 @@ from r2.lib.menus import ( def admin_menu(**kwargs): buttons = [ OffsiteButton("traffic", "/traffic"), - NavButton(menu.ads, "ads"), NavButton(menu.awards, "awards"), NavButton(menu.errors, "error log"), ] diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 8ef22e507..a24082eba 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -22,7 +22,7 @@ from r2.lib.wrapped import Wrapped, Templated, CachedTemplate from r2.models import Account, FakeAccount, DefaultSR, make_feedurl -from r2.models import FakeSubreddit, Subreddit, Ad, AdSR, SubSR, AllMinus, AllSR +from r2.models import FakeSubreddit, Subreddit, SubSR, AllMinus, AllSR from r2.models import Friends, All, Sub, NotFound, DomainSR, Random, Mod, RandomNSFW, RandomSubscription, MultiReddit, ModSR, Frontpage from r2.models import Link, Printable, Trophy, bidding, PromoCampaign, PromotionWeights, Comment from r2.models import Flair, FlairTemplate, FlairTemplateBySubredditIndex @@ -2400,41 +2400,6 @@ class AdminErrorLog(Templated): Templated.__init__(self) -class AdminAds(Templated): - """The admin page for editing ads""" - def __init__(self): - from r2.models import Ad - Templated.__init__(self) - self.ads = Ad._all_ads() - -class AdminAdAssign(Templated): - """The interface for assigning an ad to a community""" - def __init__(self, ad): - self.weight = 100 - Templated.__init__(self, ad = ad) - -class AdminAdSRs(Templated): - """View the communities an ad is running on""" - def __init__(self, ad): - self.adsrs = AdSR.by_ad(ad) - - # Create a dictionary of - # SR => total weight of all its ads - # for all SRs that this ad is running on - self.sr_totals = {} - for adsr in self.adsrs: - sr = adsr._thing2 - - if sr.name not in self.sr_totals: - # We haven't added up this SR yet. - self.sr_totals[sr.name] = 0 - # Get all its ads and total them up. - sr_adsrs = AdSR.by_sr_merged(sr) - for adsr2 in sr_adsrs: - self.sr_totals[sr.name] += adsr2.weight - - Templated.__init__(self, ad = ad) - class AdminAwards(Templated): """The admin page for editing awards""" def __init__(self): @@ -2464,15 +2429,11 @@ class AdminAwardWinners(Templated): trophies = Trophy.by_award(award) Templated.__init__(self, award = award, trophies = trophies) + class Ads(Templated): def __init__(self): Templated.__init__(self) - path = "" - if c.custom_dart_keyword: - path = "r/%s/%s" % (c.site.name, c.custom_dart_keyword) - elif not c.default_sr: - path = "r/%s/" % c.site.name - self.ad_url = g.ad_domain + "/ads/" + path + self.ad_url = g.ad_domain + "/ads/" self.frame_id = "ad-frame" @@ -3487,27 +3448,6 @@ class MediaEmbedBody(CachedTemplate): res = CachedTemplate.render(self, *a, **kw) return responsive(res, True) -class RedditAds(Templated): - def __init__(self, **kw): - self.sr_name = c.site.name - self.adsrs = AdSR.by_sr_merged(c.site) - self.total = 0 - - self.adsrs.sort(key=lambda a: a._thing1.codename) - - seen = {} - for adsr in self.adsrs: - seen[adsr._thing1.codename] = True - self.total += adsr.weight - - self.other_ads = [] - all_ads = Ad._all_ads() - all_ads.sort(key=lambda a: a.codename) - for ad in all_ads: - if ad.codename not in seen: - self.other_ads.append(ad) - - Templated.__init__(self, **kw) class PaymentForm(Templated): def __init__(self, link, campaign, **kw): @@ -3786,80 +3726,6 @@ class RawString(Templated): def render(self, *a, **kw): return unsafe(self.s) -class Dart_Ad(CachedTemplate): - def __init__(self, dartsite, tag, custom_keyword=None): - tag = tag or "homepage" - keyword = custom_keyword or tag - tracker_url = tracking.get_impression_pixel_url("dart_" + tag) - Templated.__init__(self, tag = tag, dartsite = dartsite, - tracker_url = tracker_url, keyword=keyword) - - def render(self, *a, **kw): - res = CachedTemplate.render(self, *a, **kw) - return responsive(res, False) - -class HouseAd(CachedTemplate): - def __init__(self, rendering, linkurl, submit_link): - Templated.__init__(self, rendering=rendering, - linkurl = linkurl, - submit_link = submit_link) - - def render(self, *a, **kw): - res = CachedTemplate.render(self, *a, **kw) - return responsive(res, False) - - -def render_ad_by_codename(codename): - if codename == "DART": - return Dart_Ad("reddit.dart", g.default_sr).render() - - try: - ad = Ad._by_codename(codename) - except NotFound: - abort(404) - attrs = ad.important_attrs() - return HouseAd(**attrs).render() - - -def render_ad(reddit_name=None, keyword=None): - if not reddit_name: - reddit_name = g.default_sr - if g.live_config["frontpage_dart"]: - return Dart_Ad("reddit.dart", reddit_name, keyword).render() - - try: - sr = Subreddit._by_name(reddit_name, stale=True) - except NotFound: - return Dart_Ad("reddit.dart", g.default_sr, keyword).render() - - if sr.over_18: - dartsite = "reddit.dart.nsfw" - else: - dartsite = "reddit.dart" - - if keyword: - return Dart_Ad(dartsite, reddit_name, keyword).render() - - ads = {} - - for adsr in AdSR.by_sr_merged(sr): - ad = adsr._thing1 - ads[ad.codename] = (ad, adsr.weight) - - try: - codename = weighted_lottery({k: v[1] for k, v in ads.iteritems()}) - except ValueError, ex: - log_text( - "no winner", - "No winner found for /r/%s, error=%s" % (reddit_name, ex.message), - "error") - codename = "DART" - - if codename == "DART": - return Dart_Ad(dartsite, reddit_name).render() - else: - attrs = ads[codename][0].important_attrs() - return HouseAd(**attrs).render() class TryCompact(Reddit): def __init__(self, dest, **kw): diff --git a/r2/r2/lib/validator/validator.py b/r2/r2/lib/validator/validator.py index 1da154aef..4baa6d243 100644 --- a/r2/r2/lib/validator/validator.py +++ b/r2/r2/lib/validator/validator.py @@ -402,24 +402,6 @@ class VCommentByID(VThing): def __init__(self, param, redirect = True, *a, **kw): VThing.__init__(self, param, Comment, redirect=redirect, *a, **kw) -class VAd(VThing): - def __init__(self, param, redirect = True, *a, **kw): - VThing.__init__(self, param, Ad, redirect=redirect, *a, **kw) - -class VAdByCodename(Validator): - def run(self, codename, required_fullname=None): - if not codename: - return self.set_error(errors.NO_TEXT) - - try: - a = Ad._by_codename(codename) - except NotFound: - a = None - - if a and required_fullname and a._fullname != required_fullname: - return self.set_error(errors.INVALID_OPTION) - else: - return a class VAward(VThing): def __init__(self, param, redirect = True, *a, **kw): diff --git a/r2/r2/models/__init__.py b/r2/r2/models/__init__.py index 6bca5c491..d205f87b5 100644 --- a/r2/r2/models/__init__.py +++ b/r2/r2/models/__init__.py @@ -29,7 +29,6 @@ from report import * from subreddit import * from flair import * from award import * -from ad import * from bidding import * from mail_queue import Email, has_opted_out, opt_count from gold import * diff --git a/r2/r2/models/ad.py b/r2/r2/models/ad.py deleted file mode 100644 index 7f8e7133a..000000000 --- a/r2/r2/models/ad.py +++ /dev/null @@ -1,151 +0,0 @@ -# The contents of this file are subject to the Common Public Attribution -# License Version 1.0. (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -# License Version 1.1, but Sections 14 and 15 have been added to cover use of -# software over a computer network and provide for limited attribution for the -# Original Developer. In addition, Exhibit A has been modified to be consistent -# with Exhibit B. -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -# the specific language governing rights and limitations under the License. -# -# The Original Code is reddit. -# -# The Original Developer is the Initial Developer. The Initial Developer of -# the Original Code is reddit Inc. -# -# All portions of the code written by reddit are Copyright (c) 2006-2013 reddit -# Inc. All Rights Reserved. -############################################################################### - -from r2.lib.db.thing import Thing, Relation, NotFound -from r2.lib.db.operators import asc, desc, lower -from r2.lib.filters import _force_unicode -from r2.lib.memoize import memoize -from r2.models import Subreddit -from pylons import c, g, request - -class Ad (Thing): - _defaults = dict( - codename = None, - imgurl = None, - linkurl = None, - raw_html = None, - ) - - @classmethod - @memoize('ad.all_ads') - def _all_ads_cache(cls): - return [ a._id for a in Ad._query(sort=desc('_date'), limit=1000) ] - - @classmethod - def _all_ads(cls, _update=False): - all = cls._all_ads_cache(_update=_update) - # Can't just return Ad._byID() results because - # the ordering will be lost - d = Ad._byID(all, data=True) - return [ d[id] for id in all ] - - @classmethod - def _new(cls, codename, imgurl, raw_html, linkurl): - a = Ad(codename=codename, imgurl=imgurl, raw_html=raw_html, - linkurl=linkurl) - a._commit() - Ad._all_ads_cache(_update=True) - - @classmethod - def _by_codename(cls, codename): - q = cls._query(lower(Ad.c.codename) == codename.lower()) - q._limit = 1 - ad = list(q) - - if ad: - return cls._byID(ad[0]._id, True) - else: - raise NotFound, 'Ad %s' % codename - - def url(self): - return "%s/ads/%s" % (g.ad_domain, self.codename) - - def submit_link(self): - from r2.lib.template_helpers import get_domain - from mako.filters import url_escape - - d = get_domain(subreddit=False) - u = _force_unicode(self.url()) - - return "http://%s/r/ads/submit?url=%s" % (d, url_escape(u)) - - def rendering(self): - if self.raw_html: - return self.raw_html - else: - return "" % self.imgurl - - def important_attrs(self): - return dict(rendering=self.rendering(), linkurl=self.linkurl, - submit_link=self.submit_link()) - -class AdSR(Relation(Ad, Subreddit)): - @classmethod - def _new(cls, ad, sr, weight=100): - t = AdSR(ad, sr, "adsr") - t.weight = weight - t._commit() - - AdSR.by_ad(ad, _update=True) - AdSR.by_sr(sr, _update=True) - - @classmethod - @memoize('adsr.by_ad') - def by_ad_cache(cls, ad_id): - q = AdSR._query(AdSR.c._thing1_id == ad_id, - sort = desc('_date')) - q._limit = 500 - return [ t._id for t in q ] - - @classmethod - def by_ad(cls, ad, _update=False): - rel_ids = cls.by_ad_cache(ad._id, _update=_update) - adsrs = AdSR._byID_rel(rel_ids, data=True, eager_load=True, - thing_data=True, return_dict = False) - return adsrs - - @classmethod - @memoize('adsr.by_sr') - def by_sr_cache(cls, sr_id): - q = AdSR._query(AdSR.c._thing2_id == sr_id, - sort = desc('_date')) - q._limit = 500 - return [ t._id for t in q ] - - @classmethod - def by_sr(cls, sr, _update=False): - rel_ids = cls.by_sr_cache(sr._id, _update=_update) - adsrs = AdSR._byID_rel(rel_ids, data=True, eager_load=True, - thing_data=True, return_dict = False) - return adsrs - - @classmethod - def by_sr_merged(cls, sr, _update=False): - if sr.name == g.default_sr: - return cls.by_sr(sr) - - my_adsrs = cls.by_sr(sr) - global_adsrs = cls.by_sr(Subreddit._by_name(g.default_sr, stale=True)) - - seen = {} - for adsr in my_adsrs: - seen[adsr._thing1.codename] = True - for adsr in global_adsrs: - if adsr._thing1.codename not in seen: - my_adsrs.append(adsr) - - return my_adsrs - - @classmethod - def by_ad_and_sr(cls, ad, sr): - q = cls._fast_query(ad, sr, "adsr") - return q.values()[0] diff --git a/r2/r2/templates/adminadassign.html b/r2/r2/templates/adminadassign.html deleted file mode 100644 index ecbe17a98..000000000 --- a/r2/r2/templates/adminadassign.html +++ /dev/null @@ -1,70 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be -## consistent with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is reddit Inc. -## -## All portions of the code written by reddit are Copyright (c) 2006-2013 -## reddit Inc. All Rights Reserved. -############################################################################### - -<%namespace file="utils.html" import="error_field"/> - -
- - - - - - - - - - - - - - - - -
- - - -

${thing.ad.codename}

-
-
- community - -
- ${error_field("SUBREDDIT_REQUIRED", "community", "span")} - ${error_field("SUBREDDIT_NOEXIST", "community", "span")} -
- weight - -
- ${error_field("BAD_NUMBER", "weight", "span")} -
- - - - - -

- back to ads -

-
- diff --git a/r2/r2/templates/adminads.html b/r2/r2/templates/adminads.html deleted file mode 100644 index ec9637a3b..000000000 --- a/r2/r2/templates/adminads.html +++ /dev/null @@ -1,121 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be -## consistent with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is reddit Inc. -## -## All portions of the code written by reddit are Copyright (c) 2006-2013 -## reddit Inc. All Rights Reserved. -############################################################################### - -<%namespace file="utils.html" import="error_field"/> - -<%def name="adbuttons(codename, submit_link)"> - - - -<%def name="adedit(fullname, codename='', imgurl='', raw_html='', linkurl='')"> - - - - - - - - - - - - %for ad in thing.ads: - - - - %if ad.codename == "DART": - - - %else: - - - %endif - - %endfor - -
fncnimglinks & buttons
${ad._fullname}${ad.codename} - ${unsafe(ad.rendering())} - - ${adbuttons(ad.codename, ad.submit_link())} - - - ${unsafe(ad.rendering())} - - - img: ${ad.imgurl}
- link: ${ad.linkurl}
- raw html: ${ad.raw_html}
-
- ${adbuttons(ad.codename, ad.submit_link())} - ${adedit(ad._fullname, ad.codename, ad.imgurl, ad.raw_html, ad.linkurl)} -
- - -${adedit("NEW")} diff --git a/r2/r2/templates/adminadsrs.html b/r2/r2/templates/adminadsrs.html deleted file mode 100644 index a0ba680ea..000000000 --- a/r2/r2/templates/adminadsrs.html +++ /dev/null @@ -1,71 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be -## consistent with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is reddit Inc. -## -## All portions of the code written by reddit are Copyright (c) 2006-2013 -## reddit Inc. All Rights Reserved. -############################################################################### - -<%namespace file="utils.html" import="percentage"/> - -<%def name="adsrline(adsr)"> - - - - ${adsr._thing2.name} - - - - ${adsr.weight} - - - ${percentage(adsr.weight, thing.sr_totals[adsr._thing2.name])} - - - - -
- - - -
- - -

${thing.ad.codename}

-
- - - - - - - - %for adsr in thing.adsrs: - ${adsrline(adsr)} - %endfor -
- community - - wt - - pct -
- -

- back to ads -

- diff --git a/r2/r2/templates/dart_ad.html b/r2/r2/templates/dart_ad.html deleted file mode 100644 index 52163c63a..000000000 --- a/r2/r2/templates/dart_ad.html +++ /dev/null @@ -1,98 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be -## consistent with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is reddit Inc. -## -## All portions of the code written by reddit are Copyright (c) 2006-2013 -## reddit Inc. All Rights Reserved. -############################################################################### - - - - - - - - - - - - - - diff --git a/r2/r2/templates/housead.html b/r2/r2/templates/housead.html deleted file mode 100644 index a0d4902f0..000000000 --- a/r2/r2/templates/housead.html +++ /dev/null @@ -1,58 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be -## consistent with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is reddit Inc. -## -## All portions of the code written by reddit are Copyright (c) 2006-2013 -## reddit Inc. All Rights Reserved. -############################################################################### - - - - - - - - - - - - diff --git a/r2/r2/templates/redditads.html b/r2/r2/templates/redditads.html deleted file mode 100644 index e4871563d..000000000 --- a/r2/r2/templates/redditads.html +++ /dev/null @@ -1,130 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be -## consistent with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is reddit Inc. -## -## All portions of the code written by reddit are Copyright (c) 2006-2013 -## reddit Inc. All Rights Reserved. -############################################################################### - -<%namespace file="utils.html" import="error_field"/> -<%namespace file="utils.html" import="percentage"/> - -<%def name="row(ad, weight, whence)"> - - - - - (place img here) - - - - -
- - ${ad.codename} - -
- -
- -
- - - - %if whence == "inherited": - weight: - -
- (inheriting ${weight} from /r/${g.default_sr}) -
- %else: - weight: -
-
- %if whence == "overridden": - -## pass - - %elif thing.sr_name == g.default_sr: - (hereby the sitewide default) - %else: - (overridden for /r/${thing.sr_name}) - %endif -
- %endif - ${error_field("BAD_NUMBER", "weight", "span")} -
- - %if whence != "unused": -
- percentage: - ${percentage(weight, thing.total)} -
- %endif - -
- -
- %if thing.sr_name == g.default_sr and ad.codename == 'DART': - - %else: - - - %endif -
- -
- - - - - - %if thing.adsrs: - - - - %endif - - %for adsr in thing.adsrs: - ${row(adsr._thing1, adsr.weight, - "overridden" if adsr._thing2.name == thing.sr_name else "inherited")} - %endfor - - %if thing.other_ads: - - - - %endif - - %for ad in thing.other_ads: - ${row(ad, "", "unused")} - %endfor -
- Ads in rotation on /r/${thing.sr_name}: -
- Ads not (yet) used on this subreddit: -
- -