コード例 #1
0
ファイル: controller.php プロジェクト: jglaine/sugar761-ent
 /**
  * This function allows a user with Forecasts admin rights to reset the Forecasts settings so that the Forecasts wizard
  * dialog will appear once again.
  *
  */
 public function action_resetSettings()
 {
     global $current_user;
     if ($current_user->isAdminForModule('Forecasts')) {
         $db = DBManagerFactory::getInstance();
         $db->query("UPDATE config SET value = '0' WHERE category = 'Forecasts' and name in ('is_setup', 'has_commits')");
         MetaDataManager::refreshModulesCache(array('Forecasts'));
         MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_CONFIG));
         echo '<script>' . navigateToSidecar(buildSidecarRoute("Forecasts")) . ';</script>';
         exit;
     }
     $this->view = 'noaccess';
 }
コード例 #2
0
 /**
  * Redirect to another URL.
  *
  * If the module is not in BWC it will try to map to sidecar url.
  * If it loads only temporarily, please check if the module is pointing to
  * a layout/view in BWC.
  *
  * This function writes session data, ends the session and exists the app.
  *
  * @param string $url The URL to redirect to.
  */
 public function redirect($url)
 {
     global $disable_redirects;
     //Dirty hack to enable the inclusion of BWC style scripts that wish to redirect without breaking REST requests.
     if ($disable_redirects) {
         return;
     }
     /*
      * Parse the module from the URL first using regular expression.
      * This is faster than parse_url + parse_str in first place and most of
      * our redirects won't go to sidecar (at least for now).
      */
     if (preg_match('/module=([^&]+)/', $url, $matches) && !isModuleBWC($matches[1])) {
         parse_str(parse_url($url, PHP_URL_QUERY), $params);
         $script = navigateToSidecar(buildSidecarRoute($params['module'], $params['record'], translateToSidecarAction($params['action'])));
         echo "<script>{$script}</script>";
         exit;
     }
     session_write_close();
     header('HTTP/1.1 301 Moved Permanently');
     header("Location: {$url}");
     exit;
 }
コード例 #3
0
 /**
  * Display "access denied" message
  * @api
  */
 public function displayNoAccess($redirect_home = false)
 {
     echo '<script>function set_focus(){}</script><p class="error">' . translate('LBL_NO_ACCESS', 'ACL') . '</p>';
     if ($redirect_home) {
         $script = navigateToSidecar(buildSidecarRoute('Home'));
         // FIXME this old ugly code should go away from here...
         echo translate('LBL_REDIRECT_TO_HOME', 'ACL') . ' <span id="seconds_left">3</span> ' . translate('LBL_SECONDS', 'ACL') . "<script>\n                function redirect_countdown(left){\n                    document.getElementById('seconds_left').innerHTML = left;\n                    if (left == 0) {\n                        {$script}\n                    } else {\n                      left--;\n                      setTimeout('redirect_countdown(' + left + ')', 1000);\n                    }\n                };\n                setTimeout('redirect_countdown(3)', 1000);\n                </script>";
     }
 }
コード例 #4
0
$this->ss->assign('disabled_subs', $orig_vals_array[1]);
$this->ss->assign('enabled_subs_string', $orig_vals_str[0]);
$this->ss->assign('disabled_subs_string', $orig_vals_str[1]);
// FIXME we are doing this way since this view is going to be removed later
// this should be with proper buttons from smarty tpls.
require_once 'include/formbase.php';
$url = buildRedirectURL();
$cancelButtonClick = "SUGAR.ajaxUI.loadContent('{$url}'); return false;";
/*
 * Parse the module from the URL first using regular expression.
 * This is faster than parse_url + parse_str in first place and most of
 * our redirects won't go to sidecar (at least for now).
 */
if (preg_match('/module=([^&]+)/', $url, $matches) && !isModuleBWC($matches[1])) {
    parse_str(parse_url($url, PHP_URL_QUERY), $params);
    $script = navigateToSidecar(buildSidecarRoute($params['module'], $params['record'], translateToSidecarAction($params['action'])));
    $cancelButtonClick = "{$script} return false;";
}
$buttons = array('<input id="save_button" title="' . $app_strings['LBL_SAVE_BUTTON_TITLE'] . '" accessKey="' . $app_strings['LBL_SAVE_BUTTON_KEY'] . '" class="button" onclick="save();this.form.action.value=\'Subscriptions\'; " type="submit" name="button" value="' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '">', '<input id="cancel_button" title="' . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . '" accessKey="' . $app_strings['LBL_CANCEL_BUTTON_KEY'] . '" class="button" onclick="' . $cancelButtonClick . '" type="submit" name="button" value="' . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . '">');
$this->ss->assign('BUTTONS', $buttons);
$this->ss->display('modules/Campaigns/Subscriptions.tpl');
/*
 *This function constructs Drag and Drop multiselect box of subscriptions for display in manage subscription form
*/
function constructDDSubscriptionList($focus, $classname = '')
{
    require_once "include/templates/TemplateDragDropChooser.php";
    global $mod_strings;
    $unsubs_arr = '';
    $subs_arr = '';
    // Lets start by creating the subscription and unsubscription arrays
コード例 #5
0
 /**
  * Builds an appropriate Sidecar or BWC href attribute for the additional
  * details buttons, using the link supplied from the additional details
  * module metadata.
  *
  * @private
  * @param string $link (optional) The link from additional details module
  *   metadata. The function returns an empty string if none is supplied.
  * @return string The href attribute used for the button.
  */
 private function buildButtonLink($link = '')
 {
     if (preg_match('/module=([^&]+)/', $link, $matches) && !isModuleBWC($matches[1])) {
         parse_str(parse_url($link, PHP_URL_QUERY), $params);
         $script = navigateToSidecar(buildSidecarRoute($params['module'], $params['record'], translateToSidecarAction($params['action'])));
         $link = "javascript:{$script};";
     }
     return $link;
 }