PKv[8aapdata/svn-commit.tmp --This line, and those below, will be ignored-- M templates/admin/google_search_widget.html PKnZ8% pdata/example.html
Google
Google
--------------------------
Google
------------------------ PT -----------------------------
Google
---------------------------------------------------------------- PKY8{17zzpdata/.project TPGoogleAdsenseForSearch org.python.pydev.PyDevBuilder org.python.pydev.pythonNature PKFY8Y2a!!pdata/.pydevproject python 2.5 /TPGoogleAdsenseForSearch /home/vampas/projects/pocoo/werkzeug-main /home/vampas/projects/pocoo/textpress-main PKs[8ć~~pdata/__init__.py# -*- coding: utf-8 -*- # vim: sw=4 ts=4 fenc=utf-8 # ============================================================================= # $Id: __init__.py 96 2008-02-27 14:29:06Z s0undt3ch $ # ============================================================================= # $URL: http://devnull.ufsoft.org/svn/GoogleAdsenseForSearchWidget/trunk/__init__.py $ # $LastChangedDate: 2008-02-27 14:29:06 +0000 (Wed, 27 Feb 2008) $ # $Rev: 96 $ # $LastChangedBy: s0undt3ch $ # ============================================================================= # Copyright (C) 2007 Ufsoft.org - Pedro Algarvio # # Please view LICENSE for additional licensing information. # ============================================================================= # https://www.google.com/support/googleanalytics/bin/answer.py?answer=55585&topic=10981 from os.path import join, dirname from textpress.widgets import Widget from textpress.api import * #SHARED_FILES = join(dirname(__file__), 'shared') TEMPLATES = join(dirname(__file__), 'templates') class GoogleAdsenseForSearchWidget(Widget): __metaclass__ = cache.make_metaclass(vary=('user',)) NAME = 'get_google_search_box' TEMPLATE = 'google_search_widget.html' def __init__(self, show_title=False, sbi='Enter your search terms', ss0_label='Search the Web', ss1_label='Search', sbb_label='Submit search form', submit_button_value='Search', client='', forid='', channel='', safe_contents=True, background='white', cof='', hl='', site_domain='', google_search_domain='www.google.com', google_gif='Logo_25wht.gif', font_colour='#000000', bg_colour='#ffffff', input_field_size='31'): self.show_title = show_title self.sbi = sbi self.ss0_label = ss0_label self.ss1_label = ss1_label self.sbb_label = sbb_label self.submit_button_value = submit_button_value self.client = client self.forid = forid self.channel = channel self.safe_contents = safe_contents self.background = background self.cof = cof self.hl = hl self.site_domain = site_domain self.google_search_domain = google_search_domain self.google_gif = google_gif self.font_colour = font_colour self.bg_colour = bg_colour self.input_field_size = input_field_size # self.TEMPLATE = "google_search_widget_%s.html" % background @staticmethod def get_display_name(): return _('Google Adsense For Search') @staticmethod def configure_widget(initial_args, request): args = form = initial_args.copy() errors = [] if 'site_domain' not in initial_args: args['site_domain'] = request.environ.get('HTTP_HOST') if request.method == 'POST': args['sbi'] = request.form.get('sbi') if not args['sbi']: errors.append(_("SBI must be set.")) args['ss0_label'] = request.form.get('ss0_label') if not args['ss0_label']: errors.append(_("SS0 Label must be set.")) args['ss1_label'] = request.form.get('ss1_label') if not args['ss1_label']: errors.append(_("SS1 Label must be set.")) args['sbb_label'] = request.form.get('sbb_label') if not args['sbb_label']: errors.append(_("SSB Label must be set.")) args['submit_button_value'] = request.form.get('submit_button_value') if not args['submit_button_value']: errors.append(_("Submit Button Value must be set.")) args['client'] = request.form.get('client') if not args['client']: errors.append(_("Client ID must be set.")) args['forid'] = request.form.get('forid') if not args['forid']: errors.append(_("Forid must be set.")) args['channel'] = request.form.get('channel') args['safe_contents'] = request.form.get('safe_contents') == 'yes' args['background'] = background = request.form.get('background') if background == 'white': args['font_colour'] = '#000000' args['bg_colour'] = '#ffffff' args['google_gif'] = 'Logo_25wht.gif' elif background == 'black': args['font_colour'] = '#ffffff' args['bg_colour'] = '#000000' args['google_gif'] = 'Logo_25blk.gif' elif background == 'grey': args['font_colour'] = '#000000' args['bg_colour'] = '#cccccc' args['google_gif'] = 'Logo_25gry.gif' else: errors.append(_("Background must be one of 'white', 'black', " "'grey'.")) args['input_field_size'] = request.form.get('input_field_size', '31') args['cof'] = request.form.get('cof') if not args['cof']: errors.append(_("COF must be set.")) args['hl'] = request.form.get('hl') if not args['hl']: errors.append(_("HL must be set.")) args['site_domain'] = request.form.get('site_domain') if not args['site_domain']: errors.append(_("Site Domain must be set.")) args['google_search_domain'] = google_search_domain = \ request.form.get('google_search_domain') if not google_search_domain: errors.append(_("Google Search Domain must be set.")) else: request.app.cfg[ 'google_adsense_for_search/google_search_domain' ] = google_search_domain if errors: args = None return args, render_template('admin/google_search_widget.html', errors=errors, form=form, site_domain=request.environ['HTTP_HOST']) def do_search_results(req): options = {} options['google_search_domain'] = \ req.app.cfg['google_adsense_for_search/google_search_domain'].\ encode('utf-8') return render_response('google_search_results.html', **options) def setup(app, plugin): app.add_config_var('google_adsense_for_search/google_search_domain', unicode, u'www.google.com') #app.add_shared_exports('google_adsense_for_search', SHARED_FILES) app.add_template_searchpath(TEMPLATES) app.add_widget(GoogleAdsenseForSearchWidget) app.add_url_rule('/search', view=do_search_results, endpoint='google_search/results') PK License: BSD Version: 0.1 Description: Enables search on your TextPress Blog using Google Adsense For Search.
\
Contribute Back
\ If you think this plugin is usefull and would like\ to contribute back, feel free to click on the donate button.\ This is optional.\ \
\ \ \ \ \


\
\

PK5v[84r>*pdata/templates/google_search_results.html{% extends "layout.html" %} {% block title %}{% trans "Google Search Results" %}{% endblock %} {% block contents %}
{% endblock %} PK Z8^y?)pdata/templates/google_search_widget.html{% extends 'widgets/base.html' %} {% block title %}{% endblock %} {% block body %}
Google
{% if widget.channel -%} {%- endif %} {% if widget.safe_contents -%} {%- endif %}
{% endblock %} PKv[8E!!/pdata/templates/admin/google_search_widget.html{% for error in errors %}
{{ error }}
{% endfor %}
You must set all of these settings!
Failing to do so, will throw an error, with the exception for Safe Contents and Channel.
Most of the values you need to put here will be copy/paste'ed from the code that Google AdSense For Search gives you, pay attention to that.
Failing to do so, might compromise your commitment with Google AdSense and the policy that google obliges you to follow.
In order to get the right code to copy/paste in this plugin, make sure you specify that you want to "Open results within my own site".
This IS Important!!! Not doing this will probably make the results IFRAME not show up.
I here by state that I won't be held responsible for breaking your Google AdSense policy because you're using a plugin I coded. Yet, all attempts were made to make sure the resulting code is exactly like the one Google gives us.
Use At Your Own Risk!
{% trans "Client ID" %}
{{ h.input_field('client', form.client, size=40) }}
This will be your client ID.
From the following example code:
{% filter escape -%}
        
      {%- endfilter %}
Your cliend id would be pub-0000000000000000.
{% trans "Channel" %}
{{ h.input_field('channel', form.channel) }}
This is not a mandatory field.
If you have chosen a channel when getting your code from google, you should have something like:
{% filter escape -%}
        
      {%- endfilter %}
The value you'd put on the box would be 0000000000.
{% trans "Safe Contents" %}
{{ h.checkbox('safe_contents', form.safe_contents) }}
SafeSearch (English only)
With SafeSearch, sites and web pages containing adult-themed and explicit sexual content are excluded from web search results.
{% trans "Background Color" %}
Google Adsense For Search provides three flavours for your search box.
Choose one of:
  • White
  • Black
  • Grey
Input Search Field Size
{{ h.input_field('input_field_size', form.input_field_size, size=5) }}
This is the size(number of chars) for the search string input field. Google's default is 31.
{% trans "Forid" %}
{{ h.input_field('forid', form.forid, size=5) }}
Don't know what this is, but, considering the following example:
{% filter escape -%}
        
      {%- endfilter %}
You would put 1 in the box.
{% trans "COF" %}
{{ h.input_field('cof', form.cof, size=100) }}
This is the colours scheme you choose for the IFRAME showing the results.
Considering the following example:
{% filter escape -%}
        
      {%- endfilter %}
You would put GALT:#FF0000;GL:1;DIV:#880309;VLC:900000; in the box.
The value shown in the example has been shortened for readability.
Extremely Important: make sure you don't forget to specify that you want to "Open results within my own site" like said above.
SBI
{{ h.input_field('sbi', form.sbi, size=40) }}
This is the message shown to users using a non graphical browser(I think).
Considering the following example:
{% filter escape -%}
        
      {%- endfilter %}
You would put Enter your search tems in the box.
SBB Label
{{ h.input_field('sbb_label', form.sbb_label, size=40) }}
This is the label for the submit button.
Considering the following example:
{% filter escape -%}
    
    {%- endfilter %}
You would put Submit search form in the box
Submit Button Value
{{ h.input_field('submit_button_value', form.submit_button_value, size=40) }}
This is the string for the submit button.
Consider the following example:
{% filter escape -%}
      
      {%- endfilter %}
You'd put Search in the box.
SS0 Label
{{ h.input_field('ss0_label', form.ss0_label, size=40) }}
This is the title attribute of the label html tag for the ss0 input field.
Considering the following example:
{% filter escape -%}
      

      {%- endfilter %}
You would put Search the Web in the box
SS1 Label
{{ h.input_field('ss1_label', form.ss1_label, size=40) }}
This is the title attribute of the label html tag for the ss1 input field.
Considering the following example:
{% filter escape -%}
      

      {%- endfilter %}
In this specific case you would only add Search because the domain will be the one you're running this TextPress instance and will be added by the plugin.
{% trans "HL" %}
{{ h.input_field('hl', form.hl, size=4) }}
This is the language chosen on the Google Adsense For Search.
Considering the following example:
{% filter escape -%}
      
      {%- endfilter %}
You would put en in the box.
Blog Domain
{{ h.input_field('site_domain', form.site_domain or site_domain) }}
This is the domain of your TextPress install.
Normaly you won't have to change this value as it will be entered automaticaly by the plugin from the domain you're running this TextPress instance.
Google Search Domain
{{ h.input_field('google_search_domain', form.google_search_domain) }}
This is the Google domain used to submit your users search query. You will get this value from the second box Google gives you to copy/paste the code.
Considering the following example:
{% filter escape -%}
      
{%- endfilter %}
You would put www.google.com in the box.
PK[8ڥTEXTPRESS_PLUGINTPGoogleAdsenseForSearchPK[8܃TEXTPRESS_PACKAGE1PKv[8aapdata/svn-commit.tmpPKnZ8% pdata/example.htmlPKY8{17zz!pdata/.projectPKFY8Y2a!!f#pdata/.pydevprojectPKs[8ć~~%pdata/__init__.pyPK*Npdata/templates/google_search_results.htmlPK Z8^y?)nQpdata/templates/google_search_widget.htmlPKv[8E!!/Ypdata/templates/admin/google_search_widget.htmlPK[8ڥq{TEXTPRESS_PLUGINPK[8܃{TEXTPRESS_PACKAGEPK {