Renamed module name to google_search (custom_search)

Clean code.
Updated google custom search to handle quota limit and no query submit.
Updated encoding issues for input searches: like "void safe" and "void + safe".
This commit is contained in:
jvelilla
2015-10-14 11:51:59 -03:00
parent 454d92f85b
commit 9263f31521
18 changed files with 435 additions and 256 deletions

View File

@@ -26,7 +26,7 @@
<library name="cms_openid_module" location="..\..\modules\openid\openid-safe.ecf" readonly="false"/>
<library name="cms_admin_module" location="..\..\modules\admin\admin-safe.ecf" readonly="false"/>
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes-safe.ecf" readonly="false"/>
<library name="module_google_custom_search" location="..\..\modules\custom_search\custom_search.ecf" readonly="false" use_application_options="true"/>
<library name="module_google_custom_search" location="..\..\modules\google_search\google_search.ecf" readonly="false" use_application_options="true"/>
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf" readonly="false"/>
<!--

View File

@@ -0,0 +1,6 @@
{
"gcse": {
"cx":"015017565055626880074:9gdgp1fvt-g",
"secret_key":"AIzaSyBKAXNofo-RqZb6kUmpbiCwPEy7n7-E51k"
}
}

View File

@@ -4,7 +4,7 @@
</header>
<!-- list of results -->
<ol>
<ol start="{$result.current_page.start_index/}">
<!-- Item result -->
{foreach from="$result.items" item="item"}
@@ -18,7 +18,7 @@
</h3>
</header>
<blockquote cite="{$item.link/}">
<p>{htmlentities}{$item.snippet/}{/htmlentities}</p>
<p>{$item.html_snippet/}</p>
<footer>
<p><abbr title="Uniform Resource Locator">Source</abbr> <a href="{$item.link/}">{$item.display_link/}</a></p>
</footer>
@@ -37,4 +37,4 @@
<li><a href="{$site_url/}gcse/?q={$result.next_page.search_terms/}&amp;start={$result.next_page.start_index/}&amp;num={$result.next_page.count/}">Next</a></li>
{/if}
</ul>
</section>
</section>

View File

@@ -0,0 +1,8 @@
$(document).ready(function() {
$('#gcse_search_form').submit(function() {
window.open('', 'formpopup', 'width=600,height=600,resizeable,scrollbars');
this.target = 'formpopup';
});
});

View File

@@ -5,9 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- EWF CMS -->
<link rel="stylesheet" href="{$site_url/}theme/css/style.css">
<!-- jQuery dep -->
<script src="{$site_url/}theme/js/jquery-1.10.2.min.js"></script>
<script src="{$site_url/}theme/js/popup_search.js"></script>
{if isset="$head"}{$head/}{/if}
{if isset="$styles"}{$styles/}{/if}
@@ -21,7 +22,10 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<title>{$head_title/}</title>
</head>
<body>
<!-- Page Top -->
{if isset="$region_top"}
@@ -40,7 +44,7 @@
<! -- Page search -->
<div class="row">
<div class="col-md-2 col-md-offset-9">
<form action="{$site_url/}gcse" class="search-form">
<form action="{$site_url/}gcse" class="search-form" id="gcse_search_form">
<div class="form-group has-feedback">
<input type="search" class="form-control" name="q" id="gcse_search" placeholder="search">
<span class="glyphicon glyphicon-search form-control-feedback"></span>