Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

If a plugin is configured, hide settings area with a link to toggle v…

…isibility
  • Loading branch information...
commit 0e6d0338af3fa396ac724731bec90aadaa94c26f 1 parent 2672dc7
@ginatrapani ginatrapani authored
Showing with 87 additions and 46 deletions.
  1. +29 −0 webapp/_lib/view/_plugin.showhider.tpl
  2. +1 −1  webapp/_lib/view/session.register.tpl
  3. +2 −0  webapp/plugins/expandurls/controller/class.ExpandURLsPluginConfigurationController.php
  4. +2 −2 webapp/plugins/expandurls/view/expandurls.account.index.tpl
  5. +2 −0  webapp/plugins/facebook/controller/class.FacebookPluginConfigurationController.php
  6. +8 −5 webapp/plugins/facebook/view/facebook.account.index.tpl
  7. +3 −0  webapp/plugins/geoencoder/controller/class.GeoEncoderPluginConfigurationController.php
  8. +3 −2 webapp/plugins/geoencoder/view/geoencoder.account.index.tpl
  9. +2 −0  webapp/plugins/googleplus/controller/class.GooglePlusPluginConfigurationController.php
  10. +7 −8 webapp/plugins/googleplus/view/googleplus.account.index.tpl
  11. +3 −1 webapp/plugins/hellothinkup/controller/class.HelloThinkUpPluginConfigurationController.php
  12. +2 −3 webapp/plugins/hellothinkup/view/hellothinkup.account.index.tpl
  13. +3 −0  webapp/plugins/twitter/controller/class.TwitterPluginConfigurationController.php
  14. +8 −11 webapp/plugins/twitter/view/twitter.account.index.tpl
  15. +2 −0  webapp/plugins/twitterrealtime/controller/class.TwitterRealtimePluginConfigurationController.php
  16. +1 −0  webapp/plugins/twitterrealtime/tests/TestOfTwitterRealtimePluginConfigurationController.php
  17. +9 −13 webapp/plugins/twitterrealtime/view/twitterrealtime.account.index.tpl
View
29 webapp/_lib/view/_plugin.showhider.tpl
@@ -0,0 +1,29 @@
+<script type="text/javascript">
+{literal}
+var settings_visible = {/literal}{if $is_configured}true{else}false{/if}{literal};
+function show_settings() {
+ if (settings_visible) {
+ $(".plugin-settings").hide();
+ $('#settings-flip-prompt').html('Show');
+ settings_visible = false;
+ $("#settings-icon").attr("src", site_root + "assets/img/slickgrid/actions.gif");
+ } else {
+ $(".plugin-settings").show();
+ $('#settings-flip-prompt').html('Hide');
+ settings_visible = true;
+ $("#settings-icon").attr("src", site_root + "assets/img/slickgrid/actions_reverse.jpg");
+ }
+}
+ $(document).ready(function() {
+ show_settings();
+ });
+{/literal}
+</script>
+
+<p>
+ <a href="#" onclick="show_settings(); return false"><img id="settings-icon" src="{$site_root_path}assets/img/slickgrid/actions.gif" /> <span id="settings-flip-prompt">Show</span> Settings</a>
+<br><br>
+</p>
+
+<div class="plugin-settings">
+<h2 class="subhead">Settings</h2>
View
2  webapp/_lib/view/session.register.tpl
@@ -56,7 +56,7 @@
<input name="pass1" type="password" id="pass1">
<small>
<br>
- At least 8 characters and a mix of numbers and letters.
+ At least 8 characters and with both numbers and letters.
</small>
</div>
</div>
View
2  webapp/plugins/expandurls/controller/class.ExpandURLsPluginConfigurationController.php
@@ -47,7 +47,9 @@ public function authControl() {
'label'=>'Bit.ly Username'));
$this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name'=>'bitly_api_key', 'size'=>40,
+
'label'=>'Bit.ly API key (<a href="http://bitly.com/a/your_api_key">Get it here</a>)'));
+ $this->addToView('is_configured', true);
return $this->generateView();
}
View
4 webapp/plugins/expandurls/view/expandurls.account.index.tpl
@@ -6,11 +6,11 @@
<div id="contact-admin-div" style="display: none; margin-top: 20px;">
{include file="_plugin.admin-request.tpl"}
</div>
-
+<br><br>
{if $options_markup}
-<div {if $user_is_admin}style="border: solid gray 1px;padding:10px;margin:20px"{/if}>
{if $user_is_admin}
+{include file="_plugin.showhider.tpl"}
<h2 class="subhead">Settings</h2>
{include file="_usermessage.tpl" field="setup"}
{/if}
View
2  webapp/plugins/facebook/controller/class.FacebookPluginConfigurationController.php
@@ -74,8 +74,10 @@ public function authControl() {
$facebook_plugin = new FacebookPlugin();
if ($facebook_plugin->isConfigured()) {
$this->setUpFacebookInteractions($facebook_plugin->getOptionsHash());
+ $this->addToView('is_configured', true);
} else {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
+ $this->addToView('is_configured', false);
}
return $this->generateView();
}
View
13 webapp/plugins/facebook/view/facebook.account.index.tpl
@@ -112,11 +112,10 @@ addPage" id="{$i->network_username}" value="add page" /></span>
{include file="_plugin.admin-request.tpl"}
</div>
-{if $options_markup}
-<div {if $user_is_admin}style="border: solid gray 1px;padding:10px;margin:20px"{/if}>
{if $user_is_admin}
-<h2 class="subhead">Settings</h2>
+{include file="_plugin.showhider.tpl"}
{include file="_usermessage.tpl" field="setup"}
+
<p style="padding:5px">To set up the Facebook plugin:</p>
<ol style="margin-left:40px">
<li><a href="https://developers.facebook.com/apps" target="_blank">Click the "Create New App" button on Facebook.</a></li>
@@ -160,10 +159,15 @@ addPage" id="{$i->network_username}" value="add page" /></span>
</li>
<li>Enter the Facebook-provided App ID and App Secret here.</li></ol>
{/if}
+
+
+{if $options_markup}
<p>
{$options_markup}
</p>
-</div>
+{/if}
+
+{if $user_is_admin}</div>{/if}
{literal}
<script type="text/javascript">
@@ -176,5 +180,4 @@ if( required_values_set ) {
}
{/literal}
</script>
-{/if}
View
3  webapp/plugins/geoencoder/controller/class.GeoEncoderPluginConfigurationController.php
@@ -53,6 +53,9 @@ public function authControl() {
$plugin = new GeoEncoderPlugin();
if (!$plugin->isConfigured()) {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
+ $this->addToView('is_configured', false);
+ } else {
+ $this->addToView('is_configured', true);
}
return $this->generateView();
View
5 webapp/plugins/geoencoder/view/geoencoder.account.index.tpl
@@ -13,8 +13,9 @@ The GeoEncoder plugin plots a post's responses on a Google Map and can lists the
</div>
{if $options_markup}
-<div {if $user_is_admin}style="border: solid gray 1px;padding:10px;margin:20px"{/if}>
-{if $user_is_admin}<h2 class="subhead">Settings</h2>
+{if $user_is_admin}
+{include file="_plugin.showhider.tpl"}
+<h2 class="subhead">Settings</h2>
{include file="_usermessage.tpl" field="setup"}
<p style="padding:5px">To set up the GeoEncoder plugin:</p>
<ol style="margin-left:40px"><li><a href="http://code.google.com/apis/maps/signup.html" target="_blank">Sign up for a Google Maps API key</a>.</li>
View
2  webapp/plugins/googleplus/controller/class.GooglePlusPluginConfigurationController.php
@@ -72,8 +72,10 @@ public function authControl() {
$plugin = new GooglePlusPlugin();
if ($plugin->isConfigured()) {
$this->setUpGPlusInteractions($options);
+ $this->addToView('is_configured', true);
} else {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
+ $this->addToView('is_configured', false);
}
return $this->generateView();
View
15 webapp/plugins/googleplus/view/googleplus.account.index.tpl
@@ -43,10 +43,8 @@
</div>
-{if $options_markup}
-<div {if $user_is_admin}style="border: solid gray 1px;padding:10px;margin:20px"{/if}>
{if $user_is_admin}
-<h2 class="subhead">Settings</h2>
+{include file="_plugin.showhider.tpl"}
{include file="_usermessage.tpl" field="setup"}
<p style="padding:5px">To set up the Google+ plugin:</p>
<ol style="margin-left:40px">
@@ -87,11 +85,15 @@
</li>
<li>Enter the Google-provided Client ID and Client Secret here.</li></ol>
{/if}
+
+{if $options_markup}
<p>
{$options_markup}
</p>
-</div>
-</div>
+{/if}
+
+{if $user_is_admin}</div>{/if}
+
{literal}
<script type="text/javascript">
if( required_values_set ) {
@@ -103,6 +105,3 @@ if( required_values_set ) {
}
{/literal}
</script>
-{/if}
-
-<br/>
View
4 webapp/plugins/hellothinkup/controller/class.HelloThinkUpPluginConfigurationController.php
@@ -89,7 +89,9 @@ public function authControl() {
$adv2 = array('name' => 'AdvancedInfo2', 'label' => '2nd advanced field', 'advanced' => true);
$this->addPluginOption(self::FORM_TEXT_ELEMENT, $adv2);
- return $this->generateView();
+ $plugin = new HelloThinkUpPlugin();
+ $this->addToView('is_configured', $plugin->isConfigured());
+ return $this->generateView();
}
}
View
5 webapp/plugins/hellothinkup/view/hellothinkup.account.index.tpl
@@ -2,11 +2,10 @@
<h2 class="subhead">Hello ThinkUp Plugin {insert name="help_link" id='hellothinkup'}</h2>
<p>{$message}</p>
-
+<br><br>
{if $options_markup}
-
{if $user_is_admin}
-<div style="border: solid gray 1px;padding:10px;margin:20px">
+{include file="_plugin.showhider.tpl"}
<h2 class="subhead">Plugin Settings Proof-of-Concept</h2>
{include file="_usermessage.tpl" field="setup"}
View
3  webapp/plugins/twitter/controller/class.TwitterPluginConfigurationController.php
@@ -117,15 +117,18 @@ public function authControl() {
$this->addToView('owner_instances', $owner_instances);
$this->addToView('oauthorize_link', $oauthorize_link);
+ $this->addToView('is_configured', true);
} else {
//set error message here
$this->addErrorMessage(
"Unable to obtain OAuth tokens from Twitter. Please double-check the consumer key and secret ".
"are correct.", "setup");
$oauthorize_link = '';
+ $this->addToView('is_configured', false);
}
} else {
$this->addInfoMessage('Please complete plugin setup to start using it.', 'setup');
+ $this->addToView('is_configured', false);
}
// add plugin options from
$this->addOptionForm();
View
19 webapp/plugins/twitter/view/twitter.account.index.tpl
@@ -12,7 +12,6 @@
<br /><br />
</div>
{/if}
-
{if count($owner_instances) > 0 }
<br>
<h2 class="subhead">Twitter Accounts</h2>
@@ -48,12 +47,10 @@
<!--<p>Alternately, add a public Twitter username for ThinkUp capture data about:</p>
<form method="get" action="index.php"><input type="hidden" name="p" value="twitter"><input name="twitter_username" /> <input type="submit" value="Add this Public User to ThinkUp"></form>-->
-
-{if $options_markup}
-<div {if $user_is_admin}style="border: solid gray 1px;padding:10px;margin:20px"{/if}>
{if $user_is_admin}
-<h2 class="subhead">Settings</h2>
+{include file="_plugin.showhider.tpl"}
{include file="_usermessage.tpl" field="setup"}
+
<p style="padding:5px">To set up the Twitter plugin:</p>
<ol style="margin-left:40px"><li><a href="https://dev.twitter.com/apps/new" target="_blank">Create a new application on Twitter for ThinkUp</a>.</li>
<li>
@@ -127,13 +124,16 @@
<li>Set the application Default Access type to "Read-only".</li>
<li>Enter the Twitter-provided consumer key and secret here.</li></ol>
{/if}
-<p>
+{if $options_markup}
+<p>
{$options_markup}
</p>
-</div>
-{literal}
+{/if}
+{if $user_is_admin}</div>{/if}
+
+{literal}
<script type="text/javascript">
if( required_values_set ) {
$('#add-account-div').show();
@@ -144,6 +144,3 @@ if( required_values_set ) {
}
{/literal}
</script>
-
-{/if}
-
View
2  webapp/plugins/twitterrealtime/controller/class.TwitterRealtimePluginConfigurationController.php
@@ -152,6 +152,8 @@ public function authControl() {
// add plugin options from
$this->addOptionForm();
+ $plugin = new TwitterRealtimePlugin();
+ $this->addToView('is_configured', $plugin->isConfigured());
return $this->generateView();
}
View
1  webapp/plugins/twitterrealtime/tests/TestOfTwitterRealtimePluginConfigurationController.php
@@ -58,6 +58,7 @@ public function testConfigOptionsNotAdmin() {
$owner = $owner_dao->getByEmail(Session::getLoggedInUser());
$controller = new TwitterRealtimePluginConfigurationController($owner, 'twitterrealtime');
$output = $controller->go();
+ $this->debug($output);
$this->assertPattern('/var is_admin = false/', $output); // not a js admin
$controller = new TwitterRealtimePluginConfigurationController($owner, 'twitterrealtime');
$output = $controller->go();
View
22 webapp/plugins/twitterrealtime/view/twitterrealtime.account.index.tpl
@@ -27,27 +27,25 @@
{include file="_plugin.admin-request.tpl"}
</div>
-<!--<p>Alternately, add a public Twitter username for ThinkUp capture data about:</p>
-<form method="get" action="index.php"><input type="hidden" name="p" value="twitter"><input name="twitter_username" /> <input type="submit" value="Add this Public User to ThinkUp"></form>-->
-
+{if $user_is_admin}
+{include file="_plugin.showhider.tpl"}
<p>
-<b>Note:</b> You can use redis for the realtime data queue. You will need php 5.3 or greater, and a redis server
+<b>Note:</b> You can use redis for the realtime data queue. You will need PHP 5.3 or greater, and a redis server
running on the local host. If those two requirements are met you will see an option to enable the redis queue.
</p>
-{if $options_markup}
-<div {if $user_is_admin}style="border: solid gray 1px;padding:10px;margin:20px"{/if}>
-<!-- Configure the TwitterRealtime Plugin -->
-{if $user_is_admin}
<p>{$auth_from_twitter}</p>
{/if}
-<p>
+{if $options_markup}
+<p>
{$options_markup}
</p>
-</div>
-{literal}
+{/if}
+
+{if $user_is_admin}</div>{/if}
+{literal}
<script type="text/javascript">
if( required_values_set ) {
$('#add-account-div').show();
@@ -59,5 +57,3 @@ if( required_values_set ) {
{/literal}
</script>
-{/if}
-
Please sign in to comment.
Something went wrong with that request. Please try again.