Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added User Config Options
  • Loading branch information
Jon Whitcraft committed Jul 22, 2011
1 parent 4d31710 commit 7d5fd31
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 0 deletions.
52 changes: 52 additions & 0 deletions SugarModules/modules/githb_commits/UserConfig.php
@@ -0,0 +1,52 @@
<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
*The contents of this file are subject to the SugarCRM Professional End User License Agreement
*("License") which can be viewed at http://www.sugarcrm.com/EULA.
*By installing or using this file, You have unconditionally agreed to the terms and conditions of the License, and You may
*not use this file except in compliance with the License. Under the terms of the license, You
*shall not, among other things: 1) sublicense, resell, rent, lease, redistribute, assign or
*otherwise transfer Your rights to the Software, and 2) use the Software for timesharing or
*service bureau purposes such as hosting the Software for commercial gain and/or for the benefit
*of a third party. Use of the Software may be subject to applicable fees and any use of the
*Software without first paying applicable fees is strictly prohibited. You do not have the
*right to remove SugarCRM copyrights from the source code or user interface.
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for requirements.
*Your Warranty, Limitations of liability and Indemnity are expressly stated in the License. Please refer
*to the License for the specific language governing these rights and limitations under the License.
*Portions created by SugarCRM are Copyright (C) 2004 SugarCRM, Inc.; All Rights Reserved.
********************************************************************************/
/*********************************************************************************
* $Id: ConfigureTabs.php 51995 2009-10-28 21:55:55Z clee $
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/

if (!is_admin($current_user)) {
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
}
global $sugar_config;

$title = get_module_title("", translate('LBL_GITHUB_CONNECTOR') . ":", true);
$sugar_smarty = new Sugar_Smarty();

if (isset($_REQUEST['save_config']) && $_REQUEST['save_config'] != '0') {
$cfg = new Configurator();
$cfg->config['github_username'] = $_REQUEST['username'];
$cfg->config['github_secret'] = $_REQUEST['secret'];
$cfg->config['github_repos'] = $_REQUEST['unique_key'];
$cfg->handleOverride();
}

$sugar_smarty->assign('APP', $GLOBALS['app_strings']);
$sugar_smarty->assign('MOD', $GLOBALS['mod_strings']);
$sugar_smarty->assign('GITHUB_USERNAME', $sugar_config['github_username']);
$sugar_smarty->assign('GITHUB_USERSECRET', $sugar_config['github_secret']);
$sugar_smarty->assign('GITHUB_REPOS', $sugar_config['github_repos']);

echo $sugar_smarty->fetch('modules/githb_commits/UserConfig.tpl');
101 changes: 101 additions & 0 deletions SugarModules/modules/githb_commits/UserConfig.tpl
@@ -0,0 +1,101 @@
{*
/**
* LICENSE: The contents of this file are subject to the SugarCRM Professional
* End User License Agreement ("License") which can be viewed at
* http://www.sugarcrm.com/EULA. By installing or using this file, You have
* unconditionally agreed to the terms and conditions of the License, and You
* may not use this file except in compliance with the License. Under the
* terms of the license, You shall not, among other things: 1) sublicense,
* resell, rent, lease, redistribute, assign or otherwise transfer Your
* rights to the Software, and 2) use the Software for timesharing or service
* bureau purposes such as hosting the Software for commercial gain and/or for
* the benefit of a third party. Use of the Software may be subject to
* applicable fees and any use of the Software without first paying applicable
* fees is strictly prohibited. You do not have the right to remove SugarCRM
* copyrights from the source code or user interface.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* Your Warranty, Limitations of liability and Indemnity are expressly stated
* in the License. Please refer to the License for the specific language
* governing these rights and limitations under the License. Portions created
* by SugarCRM are Copyright (C) 2006 SugarCRM, Inc.; All Rights Reserved.
*/
// $Id: PasswordManager.tpl 37436 2009-06-01 01:14:03Z Faissah $
*}
<form name="ConnectorConfig" id="EditView" method="POST" action="index.php">
<input type='hidden' name='action' value='UserConfig'/>
<input type='hidden' name='module' value='githb_commits'/>
<input type='hidden' id='save_config' name='save_config' value='0'/>
<table border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input title="{$MOD.LBL_GITHUB_CONNECTOR}" class="button"
onclick="document.getElementById('save_config').value='1'" type="submit" name="button"
value="{$MOD.LBL_GITHUB_CONNECTOR}">
<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button"
onclick="document.location.href='index.php?module=Administration&action=index'" type="button"
name="cancel" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</td>
</tr>
</table>
<div id="EditView_tabs">
<div>
<div id="DEFAULT">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table id="userConfig" name="userConfig" width="100%" border="0" cellspacing="1"
cellpadding="0" class="edit view">
<tr>
<th align="left" scope="row" colspan="2">
<h4>
{$MOD.LBL_GITHUB_CONNECTOR}
</h4>
</th>
</tr>
<tr>
<td scope="row" width='25%'>
{$MOD.LBL_GITHUB_USERNAME}:
</td>
<td>
<input type='text' size='42' name='username' value='{$GITHUB_USERNAME}'>
</td>
</tr>
<tr>
<td scope="row" width='25%'>
{$MOD.LBL_GITHUB_USERSECRET}:
</td>
<td>
<input type='text' size='42' name='secret' value='{$GITHUB_USERSECRET}'>
</td>
</tr>
<tr>
<td scope="row" width='25%'>
{$MOD.LBL_GITHUB_REPOS}:
</td>
<td>
{$MOD.LBL_GITHUB_REPOSHELP}<br />
<textarea name='unique_key'>{$GITHUB_REPOS}</textarea>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="buttons">
<input title="{$MOD.LBL_GITHUB_CONNECTOR}" class="button"
onclick="document.getElementById('save_config').value='1'" type="submit" name="button"
value="{$MOD.LBL_GITHUB_CONNECTOR}">
<input title="{$APP.LBL_CANCEL_BUTTON_LABEL}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button"
onclick="document.location.href='index.php?module=Administration&action=index'" type="button"
name="cancel" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
</div>

0 comments on commit 7d5fd31

Please sign in to comment.