示例#1
0
 private function getMain($lib)
 {
     $format = "SELECT lib FROM `" . DB_PRE_CORE . "roles`  where types=%d and id = (select pid from " . DB_PRE_CORE . "roles where types=%d and lib='%s' limit 1) limit 1";
     $sql = sprintf($format, DB_TYPE_DIFFERENCE, DB_TYPE_DIFFERENCE, $lib);
     $m = parent::FetchOne($sql);
     return $m['lib'];
 }
function template_pagination(&$args)
{
    $smarty = new Sugar_Smarty();
    $reporter = $args['reporter'];
    global $mod_strings;
    // disable export if configured to
    global $current_user, $sugar_config, $app_strings;
    $smarty->assign('mod_strings', $mod_strings);
    $smarty->assign('app_strings', $app_strings);
    $is_owner = true;
    if (isset($args['reporter']->saved_report) && $args['reporter']->saved_report->assigned_user_id != $current_user->id) {
        $is_owner = false;
    }
    // if
    $isExportAccess = false;
    if (!ACLController::checkAccess('Reports', 'export', $is_owner) || $sugar_config['disable_export'] || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($reporter->module) && ACLAction::getUserAccessLevel($current_user->id, $reporter->module, 'access') == ACL_ALLOW_ENABLED && ACLAction::getUserAccessLevel($current_user->id, $reporter->module, 'admin') == ACL_ALLOW_ADMIN)) {
        // no op
    } else {
        $smarty->assign('exportImagePath', SugarThemeRegistry::current()->getImage('export', "  border='0' align='absmiddle'", null, null, '.gif', translate('LBL_EXPORT')));
        $isExportAccess = true;
    }
    // else
    $smarty->assign('isExportAccess', $isExportAccess);
    $smarty->assign('start_link_ImagePath', SugarThemeRegistry::current()->getImage("start_off", "  border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_START']));
    $smarty->assign('prev_link_ImagePath', SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_PREVIOUS']));
    $smarty->assign('end_link_ImagePath', SugarThemeRegistry::current()->getImage("end_off", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_END']));
    $smarty->assign('next_link_ImagePath', SugarThemeRegistry::current()->getImage("next_off", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_NEXT']));
    $smarty->assign('start_link_disabled', true);
    $smarty->assign('prev_link_disabled', true);
    $smarty->assign('end_link_disabled', true);
    $smarty->assign('next_link_disabled', true);
    $next = $reporter->row_end + $reporter->report_offset;
    if ($reporter->report_offset > 0) {
        $prev = $reporter->report_offset - $reporter->report_max;
        $smarty->assign('start_link_ImagePath', SugarThemeRegistry::current()->getImage("start", "  border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_START']));
        $smarty->assign('start_link_onclick', "onClick=javascript:set_offset(0);");
        $smarty->assign('start_link_disabled', false);
        $smarty->assign('prev_link_ImagePath', SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_PREVIOUS']));
        $smarty->assign('prev_link_onclick', "onClick=javascript:set_offset({$prev});");
        $smarty->assign('prev_link_disabled', false);
    }
    // if
    if ($next < $reporter->total_count) {
        $end = ceil($reporter->total_count / $reporter->report_max - 1) * $reporter->report_max;
        $smarty->assign('end_link_ImagePath', SugarThemeRegistry::current()->getImage("end", "  border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_END']));
        $smarty->assign('end_link_disabled', false);
        $smarty->assign('end_link_onclick', "onClick=javascript:set_offset({$end});");
        $smarty->assign('next_link_ImagePath', SugarThemeRegistry::current()->getImage("next", " border='0' align='absmiddle'", null, null, '.gif', $app_strings['LNK_LIST_NEXT']));
        $smarty->assign('next_link_disabled', false);
        $smarty->assign('next_link_onclick', "onClick=javascript:set_offset({$next});");
    }
    // if
    $start_range = $reporter->report_offset > 0 ? $reporter->row_start + $reporter->report_offset : ($reporter->total_count == 0 ? 0 : 1);
    $end_range = $reporter->row_end + $reporter->report_offset;
    $smarty->assign('start_range', $start_range);
    $smarty->assign('end_range', $end_range);
    $smarty->assign('total_count', $reporter->total_count);
    return $smarty->fetch("modules/Reports/templates/_template_pagination.tpl");
}
示例#3
0
 public function run()
 {
     if (!$this->toFlavor('pro')) {
         return;
     }
     // add User field in Role
     include_once "modules/ACLActions/ACLAction.php";
     ACLAction::addActions('Users', 'module');
 }
示例#4
0
 /**
  * Export API
  *
  * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array.
  * @param $args array The arguments array passed in from the API
  * @return String
  */
 public function export(ServiceBase $api, array $args)
 {
     $seed = BeanFactory::newBean($args['module']);
     if (!$seed->ACLAccess('export')) {
         throw new SugarApiExceptionNotAuthorized($GLOBALS['app_strings']['ERR_EXPORT_DISABLED']);
     }
     ob_start();
     global $sugar_config;
     global $current_user;
     global $app_list_strings;
     $theModule = clean_string($args['module']);
     if ($sugar_config['disable_export'] || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($theModule) && ACLAction::getUserAccessLevel($current_user->id, $theModule, 'access') == ACL_ALLOW_ENABLED && (ACLAction::getUserAccessLevel($current_user->id, $theModule, 'admin') == ACL_ALLOW_ADMIN || ACLAction::getUserAccessLevel($current_user->id, $theModule, 'admin') == ACL_ALLOW_ADMIN_DEV))) {
         throw new SugarApiExceptionNotAuthorized($GLOBALS['app_strings']['ERR_EXPORT_DISABLED']);
     }
     //check to see if this is a request for a sample or for a regular export
     if (!empty($args['sample'])) {
         //call special method that will create dummy data for bean as well as insert standard help message.
         $content = exportSampleFromApi($args);
     } else {
         $content = exportFromApi($args);
     }
     $filename = $args['module'];
     //use label if one is defined
     if (!empty($app_list_strings['moduleList'][$args['module']])) {
         $filename = $app_list_strings['moduleList'][$args['module']];
     }
     //strip away any blank spaces
     $filename = str_replace(' ', '', $filename);
     if (isset($args['members']) && $args['members'] == true) {
         $filename .= '_' . 'members';
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	BUILD THE EXPORT FILE
     ob_end_clean();
     return $this->doExport($api, $filename, $content);
 }
示例#5
0
 /**
  * Helper function that enumerates the list of modules and checks if they are an admin/dev.
  * The code was just too similar to copy and paste.
  *
  * @return array
  */
 protected function _getModulesForACL($type = 'dev')
 {
     $isDev = $type == 'dev';
     $isAdmin = $type == 'admin';
     global $beanList;
     $myModules = array();
     if (!is_array($beanList)) {
         return $myModules;
     }
     // These modules don't take kindly to the studio trying to play about with them.
     static $ignoredModuleList = array('iFrames', 'Feeds', 'Home', 'Dashboard', 'Calendar', 'Activities', 'Reports');
     $actions = ACLAction::getUserActions($this->id);
     foreach ($beanList as $module => $val) {
         // Remap the module name
         $module = $this->_fixupModuleForACL($module);
         if (in_array($module, $myModules)) {
             // Already have the module in the list
             continue;
         }
         if (in_array($module, $ignoredModuleList)) {
             // You can't develop on these modules.
             continue;
         }
         $key = 'module';
         if ($this->isAdmin() && isset($actions[$module][$key])) {
             $myModules[] = $module;
         }
     }
     return $myModules;
 }
 function process($lvsParams = array())
 {
     global $current_user;
     $currentSearchFields = array();
     $configureView = true;
     // configure view or regular view
     $query = false;
     $whereArray = array();
     $lvsParams['massupdate'] = false;
     // apply filters
     if (isset($this->filters) || $this->myItemsOnly) {
         $whereArray = $this->buildWhere();
     }
     $this->lvs->export = false;
     $this->lvs->multiSelect = false;
     $this->lvs->quickViewLinks = false;
     // columns
     foreach ($this->columns as $name => $val) {
         if (!empty($val['default']) && $val['default']) {
             $displayColumns[strtoupper($name)] = $val;
             $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':');
         }
     }
     $this->lvs->displayColumns = $displayColumns;
     $this->lvs->lvd->setVariableName($this->seedBean->object_name, array());
     $lvsParams['overrideOrder'] = true;
     $lvsParams['orderBy'] = 'date_entered';
     $lvsParams['sortOrder'] = 'DESC';
     $lvsParams['custom_from'] = '';
     // Get the real module list
     if (empty($this->selectedCategories)) {
         $mod_list = $this->categories;
     } else {
         $mod_list = array_flip($this->selectedCategories);
         //27949, here the key of $this->selectedCategories is not module name, the value is module name, so array_flip it.
     }
     $external_modules = array();
     $admin_modules = array();
     $owner_modules = array();
     $regular_modules = array();
     foreach ($mod_list as $module => $ignore) {
         // Handle the UserFeed differently
         if ($module == 'UserFeed') {
             $regular_modules[] = 'UserFeed';
             continue;
         }
         if (in_array($module, $this->externalAPIList)) {
             $external_modules[] = $module;
         }
         if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') <= ACL_ALLOW_NONE) {
             // Not enough access to view any records, don't add it to any lists
             continue;
         }
         if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') == ACL_ALLOW_OWNER) {
             $owner_modules[] = $module;
         } else {
             $regular_modules[] = $module;
         }
     }
     if (!empty($this->displayTpl)) {
         //MFH BUG #14296
         $where = '';
         if (!empty($whereArray)) {
             $where = '(' . implode(') AND (', $whereArray) . ')';
         }
         $additional_where = '';
         $module_limiter = " sugarfeed.related_module in ('" . implode("','", $regular_modules) . "')";
         if (is_admin($GLOBALS['current_user'])) {
             $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules);
             $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')";
         } else {
             if (count($owner_modules) > 0) {
                 $module_limiter = " ((sugarfeed.related_module IN ('" . implode("','", $regular_modules) . "') " . ") ";
                 if (count($owner_modules) > 0) {
                     $module_limiter .= "OR (sugarfeed.related_module IN('" . implode("','", $owner_modules) . "') AND sugarfeed.assigned_user_id = '" . $current_user->id . "' " . ") ";
                 }
                 $module_limiter .= ")";
             }
         }
         if (!empty($where)) {
             $where .= ' AND ';
         }
         $where .= $module_limiter;
         $this->lvs->setup($this->seedBean, $this->displayTpl, $where, $lvsParams, 0, $this->displayRows, array('name', 'description', 'date_entered', 'created_by', 'related_module', 'link_url', 'link_type'));
         foreach ($this->lvs->data['data'] as $row => $data) {
             $this->lvs->data['data'][$row]['NAME'] = str_replace("{this.CREATED_BY}", get_assigned_user_name($this->lvs->data['data'][$row]['CREATED_BY']), $data['NAME']);
             //Translate the SugarFeeds labels if necessary.
             preg_match('/\\{([^\\^ }]+)\\.([^\\}]+)\\}/', $this->lvs->data['data'][$row]['NAME'], $modStringMatches);
             if (count($modStringMatches) == 3 && $modStringMatches[1] == 'SugarFeed' && !empty($data['RELATED_MODULE'])) {
                 $modKey = $modStringMatches[2];
                 $modString = translate($modKey, $modStringMatches[1]);
                 if (strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']])) {
                     continue;
                 }
                 $modStringSingular = $GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']];
                 $modString = string_format($modString, array($modStringSingular));
                 $this->lvs->data['data'][$row]['NAME'] = preg_replace('/' . $modStringMatches[0] . '/', strtolower($modString), $this->lvs->data['data'][$row]['NAME']);
             }
         }
         // assign a baseURL w/ the action set as DisplayDashlet
         foreach ($this->lvs->data['pageData']['urls'] as $type => $url) {
             // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
             if ($type == 'orderBy') {
                 $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url);
             } else {
                 $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url) . '&sugar_body_only=1&id=' . $this->id;
             }
         }
         $this->lvs->ss->assign('dashletId', $this->id);
     }
     $td = $GLOBALS['timedate'];
     $needResort = false;
     $resortQueue = array();
     $feedErrors = array();
     $fetchRecordCount = $this->displayRows + $this->lvs->data['pageData']['offsets']['current'];
     foreach ($external_modules as $apiName) {
         $api = ExternalAPIFactory::loadAPI($apiName);
         if ($api !== FALSE) {
             // FIXME: Actually calculate the oldest sugar feed we can see, once we get an API that supports this sort of filter.
             $reply = $api->getLatestUpdates(0, $fetchRecordCount);
             if ($reply['success'] && count($reply['messages']) > 0) {
                 array_splice($resortQueue, count($resortQueue), 0, $reply['messages']);
             } else {
                 if (!$reply['success']) {
                     $feedErrors[] = $reply['errorMessage'];
                 }
             }
         }
     }
     if (count($feedErrors) > 0) {
         $this->lvs->ss->assign('feedErrors', $feedErrors);
     }
     // If we need to resort, get to work!
     foreach ($this->lvs->data['data'] as $normalMessage) {
         list($user_date, $user_time) = explode(' ', $normalMessage['DATE_ENTERED']);
         list($db_date, $db_time) = $td->to_db_date_time($user_date, $user_time);
         $unix_timestamp = strtotime($db_date . ' ' . $db_time);
         $normalMessage['sort_key'] = $unix_timestamp;
         $normalMessage['NAME'] = '</b>' . $normalMessage['NAME'];
         $resortQueue[] = $normalMessage;
     }
     usort($resortQueue, create_function('$a,$b', 'return $a["sort_key"]<$b["sort_key"];'));
     // Trim it down to the necessary number of records
     $numRecords = count($resortQueue);
     $numRecords = $numRecords - $this->lvs->data['pageData']['offsets']['current'];
     $numRecords = min($this->displayRows, $numRecords);
     $this->lvs->data['data'] = $resortQueue;
 }
示例#7
0
 /**
  * static getRoleActions($role_id)
  *
  * gets the actions of a given role
  *
  * @param GUID $role_id
  *
  * @return array of actions
  */
 function getRoleActions($role_id, $type = 'module')
 {
     global $beanList;
     //if we don't have it loaded then lets check against the db
     $additional_where = '';
     $db = DBManagerFactory::getInstance();
     $query = "SELECT acl_actions.*";
     //only if we have a role id do we need to join the table otherwise lets use the ones defined in acl_actions as the defaults
     if (!empty($role_id)) {
         $query .= " ,acl_roles_actions.access_override ";
     }
     $query .= " FROM acl_actions ";
     if (!empty($role_id)) {
         $query .= " LEFT JOIN acl_roles_actions ON acl_roles_actions.role_id = '{$role_id}' AND  acl_roles_actions.action_id = acl_actions.id AND acl_roles_actions.deleted = 0";
     }
     $query .= " WHERE acl_actions.deleted=0 ORDER BY acl_actions.category, acl_actions.name";
     $result = $db->query($query);
     $role_actions = [];
     while ($row = $db->fetchByAssoc($result)) {
         $action = new ACLAction();
         $action->populateFromRow($row);
         if (!empty($row['access_override'])) {
             $action->aclaccess = $row['access_override'];
         } else {
             $action->aclaccess = ACL_ALLOW_DEFAULT;
         }
         //#27877 . If  there is no this module in beanlist , we will not show them in UI, no matter this module was deleted or not in ACL_ACTIONS table.
         if (empty($beanList[$action->category])) {
             continue;
         }
         //end
         if (!isset($role_actions[$action->category])) {
             $role_actions[$action->category] = [];
         }
         $role_actions[$action->category][$action->acltype][$action->name] = $action->toArray();
     }
     // Sort by translated categories
     uksort($role_actions, "ACLRole::langCompare");
     return $role_actions;
 }
 function get_user_module_list($user)
 {
     $GLOBALS['log']->info('Begin: SoapHelperWebServices->get_user_module_list');
     global $app_list_strings, $current_language;
     $app_list_strings = return_app_list_strings_language($current_language);
     $modules = query_module_access_list($user);
     ACLController::filterModuleList($modules, false);
     global $modInvisList, $modInvisListActivities;
     foreach ($modInvisList as $invis) {
         $modules[$invis] = 'read_only';
     }
     if (isset($modules['Calendar']) || $modules['Activities']) {
         foreach ($modInvisListActivities as $invis) {
             $modules[$invis] = $invis;
         }
     }
     $actions = ACLAction::getUserActions($user->id, true);
     foreach ($actions as $key => $value) {
         if (isset($value['module']) && $value['module']['access']['aclaccess'] < ACL_ALLOW_ENABLED) {
             if ($value['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                 unset($modules[$key]);
             } else {
                 $modules[$key] = 'read_only';
             }
             // else
         } else {
             $modules[$key] = '';
         }
         // else
     }
     // foreach
     $GLOBALS['log']->info('End: SoapHelperWebServices->get_user_module_list');
     return $modules;
 }
function get_user_module_list($user)
{
    global $app_list_strings, $current_language, $beanList, $beanFiles;
    $app_list_strings = return_app_list_strings_language($current_language);
    $modules = query_module_access_list($user);
    ACLController::filterModuleList($modules, false);
    global $modInvisList;
    foreach ($modInvisList as $invis) {
        $modules[$invis] = 'read_only';
    }
    $actions = ACLAction::getUserActions($user->id, true);
    foreach ($actions as $key => $value) {
        if (isset($value['module']) && $value['module']['access']['aclaccess'] < ACL_ALLOW_ENABLED) {
            if ($value['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                unset($modules[$key]);
            } else {
                $modules[$key] = 'read_only';
            }
            // else
        } else {
            $modules[$key] = '';
        }
        // else
    }
    // foreach
    //Remove all modules that don't have a beanFiles entry associated with it
    foreach ($modules as $module_name => $module) {
        if (isset($beanList[$module_name])) {
            $class_name = $beanList[$module_name];
            if (empty($beanFiles[$class_name])) {
                unset($modules[$module_name]);
            }
        } else {
            unset($modules[$module_name]);
        }
    }
    return $modules;
}
示例#10
0
 function disabledModuleList($moduleList, $by_value = true, $view = 'list')
 {
     global $aclModuleList, $current_user;
     if (is_admin($GLOBALS['current_user'])) {
         return array();
     }
     $actions = ACLAction::getUserActions($current_user->id, false);
     $disabled = array();
     $compList = array();
     if ($by_value) {
         foreach ($moduleList as $key => $value) {
             $compList[$value] = $key;
         }
     } else {
         $compList =& $moduleList;
     }
     if (isset($moduleList['ProductTemplates'])) {
         $moduleList['Products'] = 'Products';
     }
     foreach ($actions as $action_name => $action) {
         if (!empty($action['module'])) {
             $aclModuleList[$action_name] = $action_name;
             if (isset($compList[$action_name])) {
                 if ($action['module']['access']['aclaccess'] < ACL_ALLOW_ENABLED || $action['module'][$view]['aclaccess'] < 0) {
                     if ($by_value) {
                         $disabled[$compList[$action_name]] = $compList[$action_name];
                     } else {
                         $disabled[$action_name] = $action_name;
                     }
                 }
             }
         }
     }
     if (isset($compList['Calendar']) && !(ACL_ALLOW_ENABLED == $actions['Calls']['module']['access']['aclaccess'] || ACL_ALLOW_ENABLED == $actions['Meetings']['module']['access']['aclaccess'] || ACL_ALLOW_ENABLED == $actions['Tasks']['module']['access']['aclaccess'])) {
         if ($by_value) {
             $disabled[$compList['Calendar']] = $compList['Calendar'];
         } else {
             $disabled['Calendar'] = 'Calendar';
         }
         if (isset($compList['Activities']) && !(ACL_ALLOW_ENABLED == $actions['Notes']['module']['access']['aclaccess'] || ACL_ALLOW_ENABLED == $actions['Notes']['module']['access']['aclaccess'])) {
             if ($by_value) {
                 $disabled[$compList['Activities']] = $compList['Activities'];
             } else {
                 $disabled['Activities'] = 'Activities';
             }
         }
     }
     if (isset($disabled['Products'])) {
         $disabled['ProductTemplates'] = 'ProductTemplates';
     }
     return $disabled;
 }
 /** create the appropriate database tables for this bean */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->dbManager->createTable($this);
             if ($this->bean_implements('ACL')) {
                 ACLAction::addActions($this->module_dir);
             }
         } else {
             echo "Table Already Exists : {$this->table_name}<br>";
         }
     }
 }
示例#12
0
 /**
  * Get user access for the list of actions
  * @param string $module
  * @param array $access_list List of actions
  * @returns array - List of access levels. Access levels not returned are assumed to be "all allowed".
  */
 public function getUserAccess($module, $access_list, $context)
 {
     $user = $this->getCurrentUser($context);
     if (empty($user) || empty($user->id) || is_admin($user)) {
         // no user or admin - do nothing
         return $access_list;
     }
     $is_owner = !(isset($context['owner_override']) && $context['owner_override'] == false);
     if (isset(self::$non_module_acls[$module])) {
         $level = self::$non_module_acls[$module];
     } else {
         $level = 'module';
     }
     $actions = ACLAction::getUserActions($user->id, false, $module, $level);
     if (empty($actions)) {
         return $access_list;
     }
     // default implementation, specific ACLs can override
     $access = $access_list;
     // check 'access' first - if it's false all others will be false
     if (isset($access_list['access'])) {
         if (!ACLAction::userHasAccess($user->id, $module, 'access', $level, true)) {
             foreach ($access_list as $action => $value) {
                 $access[$action] = false;
             }
             return $access;
         }
         // no need to check it second time
         unset($access_list['access']);
     }
     foreach ($access_list as $action => $value) {
         // may have the bean, so we need to use checkAccess
         if (!$this->checkAccess($module, $action, $context) || isset($actions[$action]['aclaccess']) && !ACLAction::hasAccess($is_owner, $actions[$action]['aclaccess'])) {
             $access[$action] = false;
         }
     }
     return $access;
 }
 /**
  * create_tables
  * Override this method to insert ACLActions for the tracker beans
  *
  */
 function create_tables()
 {
     $path = 'modules/Trackers/config.php';
     if (defined('TEMPLATE_URL')) {
         $path = SugarTemplateUtilities::getFilePath($path);
     }
     require $path;
     foreach ($tracker_config as $key => $configEntry) {
         if (isset($configEntry['bean']) && $configEntry['bean'] != 'Tracker') {
             $bean = new $configEntry['bean']();
             if ($bean->bean_implements('ACL')) {
                 ACLAction::addActions($bean->module_dir, $configEntry['bean']);
             }
         }
     }
     parent::create_tables();
 }
示例#14
0
function get_workflow_admin_modules_for_user($user)
{
    /* Workflow modules blacklist */
    $workflowNotSupportedModules = array('iFrames', 'Feeds', 'Home', 'Dashboard', 'Calendar', 'Activities', 'Reports', 'pmse_Business_Rules', 'pmse_Project', 'pmse_Emails_Templates', 'pmse_Inbox');
    if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
        return $_SESSION['get_workflow_admin_modules_for_user'];
    }
    global $moduleList;
    $workflow_mod_list = array();
    foreach ($moduleList as $module) {
        $workflow_mod_list[$module] = $module;
    }
    // This list is taken from teh previous version of workflow_utils.php
    $workflow_mod_list['Tasks'] = "Tasks";
    $workflow_mod_list['Calls'] = "Calls";
    $workflow_mod_list['Meetings'] = "Meetings";
    $workflow_mod_list['Notes'] = "Notes";
    $workflow_mod_list['ProjectTask'] = "Project Tasks";
    $workflow_mod_list['Leads'] = "Leads";
    $workflow_mod_list['Opportunities'] = "Opportunities";
    // End of list
    $workflow_admin_modules = array();
    if (empty($user)) {
        return $workflow_admin_modules;
    }
    $actions = ACLAction::getUserActions($user->id);
    foreach ($workflow_mod_list as $key => $val) {
        if (!in_array($val, $workflow_admin_modules) && !in_array($val, $workflowNotSupportedModules) && $user->isDeveloperForModule($key)) {
            $workflow_admin_modules[$key] = $val;
        }
    }
    $_SESSION['get_workflow_admin_modules_for_user'] = $workflow_admin_modules;
    return $workflow_admin_modules;
}
 /**
  * Metadata fixes for the RLI Module
  *
  * - Removes the file that shows the RLI Module
  * - Removes the Studio File
  * - Hides the RLI module from the menu bar
  * - Removes the ACL Actions
  */
 protected function fixRevenueLineItemModule()
 {
     // hide the RLI module from the quick create, this needs to be done first, so it's properly removed
     $this->toggleRevenueLineItemQuickCreate(false);
     // cleanup on the current request
     $GLOBALS['modInvisList'][] = 'RevenueLineItems';
     if (isset($GLOBALS['moduleList']) && is_array($GLOBALS['moduleList'])) {
         foreach ($GLOBALS['moduleList'] as $key => $mod) {
             if ($mod === 'RevenueLineItems') {
                 unset($GLOBALS['moduleList'][$key]);
             }
         }
     }
     if (SugarAutoLoader::fileExists($this->appExtFolder . '/Include/' . $this->rliModuleExtFile)) {
         SugarAutoLoader::unlink($this->appExtFolder . '/Include/' . $this->rliModuleExtFile);
     }
     if (SugarAutoLoader::fileExists($this->rliStudioFile)) {
         SugarAutoLoader::unlink($this->rliStudioFile);
     }
     if (SugarAutoLoader::fileExists($this->rliModuleExtFolder . '/Vardefs/' . $this->rliModuleExtVardefFile)) {
         SugarAutoLoader::unlink($this->rliModuleExtFolder . '/Vardefs/' . $this->rliModuleExtVardefFile);
     }
     // hide the RLI module in workflows
     $affected_modules = $this->toggleRevenueLineItemsLinkInWorkFlows(false);
     // hide the mega menu tab
     $this->setRevenueLineItemModuleTab(false);
     // handle the parent type field
     $this->setRevenueLineItemInParentRelateDropDown(false);
     // disable the ACLs on RevenueLineItems
     ACLAction::removeActions('RevenueLineItems');
     // add the RLI module
     $affected_modules[] = 'RevenueLineItems';
     return $affected_modules;
 }
示例#16
0
 function action_DeployPackage()
 {
     global $current_user;
     if (defined('TEMPLATE_URL')) {
         sugar_cache_reset();
         SugarTemplateUtilities::disableCache();
     }
     //increment etag for menu so the new module shows up when the AJAX UI reloads
     $current_user->incrementETag("mainMenuETag");
     $mb = new ModuleBuilder();
     $load = $_REQUEST['package'];
     $message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED'];
     if (!empty($load)) {
         $zip = $mb->getPackage($load);
         require_once 'ModuleInstall/PackageManager/PackageManager.php';
         $pm = new PackageManager();
         $info = $mb->packages[$load]->build(false);
         $uploadDir = $pm->upload_dir . '/upgrades/module/';
         mkdir_recursive($uploadDir);
         rename($info['zip'], $uploadDir . $info['name'] . '.zip');
         copy($info['manifest'], $uploadDir . $info['name'] . '-manifest.php');
         $_REQUEST['install_file'] = $uploadDir . $info['name'] . '.zip';
         $GLOBALS['mi_remove_tables'] = false;
         $pm->performUninstall($load);
         //#23177 , js cache clear
         clearAllJsAndJsLangFilesWithoutOutput();
         //#30747, clear the cache in memory
         $cache_key = 'app_list_strings.' . $GLOBALS['current_language'];
         sugar_cache_clear($cache_key);
         sugar_cache_reset();
         //clear end
         $pm->performInstall($_REQUEST['install_file'], true);
         //clear the unified_search_module.php file
         require_once 'modules/Home/UnifiedSearchAdvanced.php';
         UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile();
         //bug 44269 - start
         //clear workflow admin modules cache
         if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
             unset($_SESSION['get_workflow_admin_modules_for_user']);
         }
         //clear "is_admin_for_module" cache
         $sessionVar = 'MLA_' . $current_user->user_name;
         foreach ($mb->packages as $package) {
             foreach ($package->modules as $module) {
                 $_SESSION[$sessionVar][$package->name . '_' . $module->name] = true;
             }
         }
         //recreate acl cache
         $actions = ACLAction::getUserActions($current_user->id, true);
         //bug 44269 - end
     }
     echo 'complete';
 }
示例#17
0
 /**
  * @return void
  * @param unknown $data
  * @param unknown $xTemplateSection
  * @param unknown $html_varName
  * @desc INTERNAL FUNCTION process the List Navigation
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  * All Rights Reserved.
  * Contributor(s): ______________________________________..
  */
 function processListNavigation($xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean = null, $subpanel_def = null, $col_count = 20)
 {
     global $export_module;
     global $sugar_config;
     global $current_user;
     global $currentModule;
     global $app_strings;
     $start_record = $current_offset + 1;
     if (!is_numeric($col_count)) {
         $col_count = 20;
     }
     if ($row_count == 0) {
         $start_record = 0;
     }
     $end_record = $start_record + $this->records_per_page;
     // back up the the last page.
     if ($end_record > $row_count + 1) {
         $end_record = $row_count + 1;
     }
     // Determine the start location of the last page
     if ($row_count == 0) {
         $number_pages = 0;
     } else {
         $number_pages = floor(($row_count - 1) / $this->records_per_page);
     }
     $last_offset = $number_pages * $this->records_per_page;
     if (empty($this->query_limit) || $this->query_limit > $this->records_per_page) {
         $this->base_URL = $this->getBaseURL($html_varName);
         $dynamic_url = '';
         if ($this->is_dynamic) {
             $dynamic_url .= '&' . $this->getSessionVariableName($html_varName, 'ORDER_BY') . '=' . $this->getSessionVariable($html_varName, 'ORDER_BY') . '&sort_order=' . $this->sort_order . '&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->subpanel_module;
         }
         $current_URL = htmlentities($this->base_URL . $current_offset . $dynamic_url);
         $start_URL = htmlentities($this->base_URL . "0" . $dynamic_url);
         $previous_URL = htmlentities($this->base_URL . $previous_offset . $dynamic_url);
         $next_URL = htmlentities($this->base_URL . $next_offset . $dynamic_url);
         $end_URL = htmlentities($this->base_URL . 'end' . $dynamic_url);
         if (!empty($this->start_link_wrapper)) {
             $current_URL = $this->start_link_wrapper . $current_URL . $this->end_link_wrapper;
             $start_URL = $this->start_link_wrapper . $start_URL . $this->end_link_wrapper;
             $previous_URL = $this->start_link_wrapper . $previous_URL . $this->end_link_wrapper;
             $next_URL = $this->start_link_wrapper . $next_URL . $this->end_link_wrapper;
             $end_URL = $this->start_link_wrapper . $end_URL . $this->end_link_wrapper;
         }
         $moduleString = "{$currentModule}_{$html_varName}_offset";
         $moduleStringOrder = "{$currentModule}_{$html_varName}_ORDER_BY";
         if ($this->shouldProcess && !$this->multi_select_popup) {
             // check the checkboxes onload
             echo "<script>YAHOO.util.Event.addListener(window, \"load\", sListView.check_boxes);</script>\n";
             $massUpdateRun = isset($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true';
             $uids = empty($_REQUEST['uid']) || $massUpdateRun ? '' : $_REQUEST['uid'];
             $select_entire_list = $massUpdateRun ? 0 : (isset($_POST['select_entire_list']) ? $_POST['select_entire_list'] : (isset($_REQUEST['select_entire_list']) ? $_REQUEST['select_entire_list'] : 0));
             echo "<textarea style='display: none' name='uid'>{$uids}</textarea>\n" . "<input type='hidden' name='select_entire_list' value='{$select_entire_list}'>\n" . "<input type='hidden' name='{$moduleString}' value='0'>\n" . "<input type='hidden' name='{$moduleStringOrder}' value='0'>\n";
         }
         $GLOBALS['log']->debug("Offsets: (start, previous, next, last)(0, {$previous_offset}, {$next_offset}, {$last_offset})");
         if (0 == $current_offset) {
             $start_link = "<button type='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("start_off", "aborder='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
             $previous_link = "<button type='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
         } else {
             if ($this->multi_select_popup) {
                 // nav links for multiselect popup, submit form to save checks.
                 $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='javascript:save_checks(0, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
                 $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='javascript:save_checks({$previous_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
             } elseif ($this->shouldProcess) {
                 $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='location.href=\"{$start_URL}\"; sListView.save_checks(0, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
                 $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='location.href=\"{$previous_URL}\"; sListView.save_checks({$previous_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
             } else {
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $start_URL)) {
                     $onClick = "\"{$start_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$start_URL}\";'";
                 }
                 $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $previous_URL)) {
                     $onClick = "\"{$previous_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$previous_URL}\";'";
                 }
                 $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
             }
         }
         if ($last_offset <= $current_offset) {
             $end_link = "<button type='button' name='listViewEndButton' title='{$this->local_app_strings['LNK_LIST_END']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("end_off", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
             $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("next_off", "aborder='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
         } else {
             if ($this->multi_select_popup) {
                 // nav links for multiselect popup, submit form to save checks.
                 $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='javascript:save_checks({$last_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
                 if (!empty($sugar_config['disable_count_query'])) {
                     $end_link = '';
                 }
                 $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' onClick='javascript:save_checks({$next_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
             } elseif ($this->shouldProcess) {
                 $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='location.href=\"{$end_URL}\"; sListView.save_checks(\"end\", \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
                 $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick='location.href=\"{$next_URL}\"; sListView.save_checks({$next_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
             } else {
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $next_URL)) {
                     $onClick = "\"{$next_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$next_URL}\";'";
                 }
                 $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $end_URL)) {
                     $onClick = "\"{$end_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$end_URL}\";'";
                 }
                 $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
             }
         }
         $GLOBALS['log']->info("Offset (next, current, prev)({$next_offset}, {$current_offset}, {$previous_offset})");
         $GLOBALS['log']->info("Start/end records ({$start_record}, {$end_record})");
         $end_record = $end_record - 1;
         $script_href = "<a style=\\'width: 150px\\' name=\"thispage\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'if (document.MassUpdate.select_entire_list.value==1){document.MassUpdate.select_entire_list.value=0;sListView.check_all(document.MassUpdate, \"mass[]\", true, {$this->records_per_page})}else {sListView.check_all(document.MassUpdate, \"mass[]\", true)};\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']}&nbsp;&#x28;{$this->records_per_page}&#x29;&#x200E;</a>" . "<a style=\\'width: 150px\\' name=\"selectall\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$row_count});\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}&nbsp;&#x28;{$row_count}&#x29;&#x200E;</a>" . "<a style=\\'width: 150px\\' name=\"deselect\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'sListView.clear_all(document.MassUpdate, \"mass[]\", false);\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_NONE']}</a>";
         $close_inline_img = SugarThemeRegistry::current()->getImage('close_inline', 'border=0', null, null, ".gif", $app_strings['LBL_CLOSEINLINE']);
         echo "<script>\n                function select_dialog() {\n                \tvar \$dialog = \$('<div></div>')\n\t\t\t\t\t.html('<a style=\\'width: 150px\\' name=\"thispage\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'if (document.MassUpdate.select_entire_list.value==1){document.MassUpdate.select_entire_list.value=0;sListView.check_all(document.MassUpdate, \"mass[]\", true, {$this->records_per_page})}else {sListView.check_all(document.MassUpdate, \"mass[]\", true)};\\' href=\\'javascript:void(0)\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']}&nbsp;&#x28;{$this->records_per_page}&#x29;&#x200E;</a>" . "<a style=\\'width: 150px\\' name=\"selectall\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$row_count});\\' href=\\'javascript:void(0)\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}&nbsp;&#x28;{$row_count}&#x29;&#x200E;</a>" . "<a style=\\'width: 150px\\' name=\"deselect\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'sListView.clear_all(document.MassUpdate, \"mass[]\", false);\\' href=\\'javascript:void(0)\\'>{$this->local_app_strings['LBL_LISTVIEW_NONE']}</a>')\n\t\t\t\t\t.dialog({\n\t\t\t\t\t\tautoOpen: false,\n\t\t\t\t\t\twidth: 150\n\t\t\t\t\t});\n\t\t\t\t\t\$dialog.dialog('open');\n\n                }\n                </script>";
         if ($this->show_select_menu) {
             $total_label = "";
             $total = $row_count;
             $pageTotal = $row_count > 0 ? $end_record - $start_record + 1 : 0;
             if (!empty($GLOBALS['sugar_config']['disable_count_query']) && $GLOBALS['sugar_config']['disable_count_query'] === true && $total > $pageTotal) {
                 $this->show_plus = true;
                 $total = $pageTotal;
                 $total_label = $total . '+';
             } else {
                 $this->show_plus = false;
                 $total_label = $total;
             }
             echo "<input type='hidden' name='show_plus' value='{$this->show_plus}'>\n";
             //Bug#52931: Replace with actionMenu
             //$select_link = "<a id='select_link' onclick='return select_dialog();' href=\"javascript:void(0)\">".$this->local_app_strings['LBL_LINK_SELECT']."&nbsp;".SugarThemeRegistry::current()->getImage('MoreDetail', 'border=0', 11, 7, '.png', $app_strings['LBL_MOREDETAIL'])."</a>";
             $menuItems = array("<input title=\"" . $app_strings['LBL_SELECT_ALL_TITLE'] . "\" type='checkbox' class='checkbox massall' name='massall' id='massall' value='' onclick='sListView.check_all(document.MassUpdate, \"mass[]\", this.checked);' /><a href='javascript: void(0);'></a>", "<a  name='thispage' id='button_select_this_page' class='menuItem' onmouseover='hiliteItem(this,\"yes\");' onmouseout='unhiliteItem(this);' onclick='if (document.MassUpdate.select_entire_list.value==1){document.MassUpdate.select_entire_list.value=0;sListView.check_all(document.MassUpdate, \"mass[]\", true, {$pageTotal})}else {sListView.check_all(document.MassUpdate, \"mass[]\", true)};' href='#'>{$app_strings['LBL_LISTVIEW_OPTION_CURRENT']}&nbsp;&#x28;{$pageTotal}&#x29;&#x200E;</a>", "<a  name='selectall' id='button_select_all' class='menuItem' onmouseover='hiliteItem(this,\"yes\");' onmouseout='unhiliteItem(this);' onclick='sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$total});' href='#'>{$app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}&nbsp;&#x28;{$total_label}&#x29;&#x200E;</a>", "<a name='deselect' id='button_deselect' class='menuItem' onmouseover='hiliteItem(this,\"yes\");' onmouseout='unhiliteItem(this);' onclick='sListView.clear_all(document.MassUpdate, \"mass[]\", false);' href='#'>{$app_strings['LBL_LISTVIEW_NONE']}</a>");
             require_once 'include/Smarty/plugins/function.sugar_action_menu.php';
             $select_link = smarty_function_sugar_action_menu(array('class' => 'clickMenu selectmenu', 'id' => 'selectLink', 'buttons' => $menuItems), $this->xTemplate);
         } else {
             $select_link = "&nbsp;";
         }
         $export_link = '<input class="button" type="button" value="' . $this->local_app_strings['LBL_EXPORT'] . '" ' . 'onclick="return sListView.send_form(true, \'' . $_REQUEST['module'] . '\', \'index.php?entryPoint=export\',\'' . $this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'] . '\')">';
         if ($this->show_delete_button) {
             $delete_link = '<input class="button" type="button" id="delete_button" name="Delete" value="' . $this->local_app_strings['LBL_DELETE_BUTTON_LABEL'] . '" onclick="return sListView.send_mass_update(\'selected\',\'' . $this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'] . '\', 1)">';
         } else {
             $delete_link = '&nbsp;';
         }
         $admin = new Administration();
         $admin->retrieveSettings('system');
         $user_merge = $current_user->getPreference('mailmerge_on');
         if ($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']) {
             echo "<script>\n                function mailmerge_dialog(el) {\n                   \tvar \$dialog = \$('<div></div>')\n\t\t\t\t\t.html('<a style=\\'width: 150px\\' class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'return sListView.send_form(true, \"MailMerge\", \"index.php\", \"{$this->local_app_strings['LBL_LISTVIEW_NO_SELECTED']}\")\\' href=\\'javascript:void(0)\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_SELECTED']}</a>" . "<a style=\\'width: 150px\\' class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' href=\\'index.php?action=index&module=MailMerge\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']}</a>" . "<a style=\\'width: 150px\\' class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' href=\\'index.php?action=index&module=MailMerge&entire=true\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}</a>')\n\t\t\t\t\t.dialog({\n\t\t\t\t\t\tautoOpen: false,\n\t\t\t\t\t\ttitle: '" . $this->local_app_strings['LBL_MAILMERGE'] . "',\n\t\t\t\t\t\twidth: 150,\n\t\t\t\t\t\tposition: {\n\t\t\t\t\t\t    my: myPos,\n\t\t\t\t\t\t    at: atPos,\n\t\t\t\t\t\t    of: \$(el)\n\t\t\t\t\t \t}\n\t\t\t\t\t});\n\n                }\n            </script>";
             $merge_link = "&nbsp;|&nbsp;<a id='mailmerge_link' onclick='return mailmerge_dialog(this)'; href=\"javascript:void(0)\">" . $this->local_app_strings['LBL_MAILMERGE'] . "</a>";
         } else {
             $merge_link = "&nbsp;";
         }
         $selected_objects_span = "&nbsp;|&nbsp;{$this->local_app_strings['LBL_LISTVIEW_SELECTED_OBJECTS']}<input  style='border: 0px; background: transparent; font-size: inherit; color: inherit' type='text' readonly name='selectCount[]' value='" . (isset($_POST['mass']) ? count($_POST['mass']) : 0) . "' />";
         if ($_REQUEST['module'] == 'Home' || $this->local_current_module == 'Import' || $this->show_export_button == false || !empty($sugar_config['disable_export']) || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($_REQUEST['module']) && ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'access') == ACL_ALLOW_ENABLED && (ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN || ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN_DEV))) {
             if ($_REQUEST['module'] != 'InboundEmail' && $_REQUEST['module'] != 'EmailMan' && $_REQUEST['module'] != 'iFrames') {
                 $selected_objects_span = '';
             }
             $export_link = "&nbsp;";
             $merge_link = "&nbsp;";
         } elseif ($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") {
             $merge_link = "&nbsp;";
         }
         if ($this->show_paging == true) {
             if (!empty($sugar_config['disable_count_query'])) {
                 if ($row_count > $end_record) {
                     $row_count .= '+';
                 }
             }
             $html_text = '';
             $html_text .= "<tr class='pagination' role='presentation'>\n";
             $html_text .= "<td COLSPAN=\"{$col_count}\" align=\"right\">\n";
             //$html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  >$export_link$merge_link$selected_objects_span</td>\n";
             //$html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  >";
             if ($subpanel_def != null) {
                 include_once 'include/SubPanel/SubPanelTiles.php';
                 $subpanelTiles = new SubPanelTiles($sugarbean);
                 $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  >";
                 //attempt to get the query to recreate this subpanel
                 if (!empty($this->response)) {
                     $response =& $this->response;
                 } else {
                     $response = SugarBean::get_union_related_list($sugarbean, $this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, -1, $this->query_limit, $subpanel_def);
                     $this->response = $response;
                 }
                 //if query is present, then pass it in as parameter
                 if (isset($response['query']) && !empty($response['query'])) {
                     $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']);
                 } else {
                     $html_text .= $subpanelTiles->get_buttons($subpanel_def);
                 }
             } else {
                 $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  nowrap>{$select_link}&nbsp;{$export_link}&nbsp;{$delete_link}&nbsp;{$selected_objects_span}";
             }
             $html_text .= "</td>\n<td nowrap align=\"right\">" . $start_link . "&nbsp;&nbsp;" . $previous_link . "&nbsp;&nbsp;<span class='pageNumbers'>(" . $start_record . " - " . $end_record . " " . $this->local_app_strings['LBL_LIST_OF'] . " " . $row_count . ")</span>&nbsp;&nbsp;" . $next_link . "&nbsp;&nbsp;" . $end_link . "</td></tr></table>\n";
             $html_text .= "</td>\n";
             $html_text .= "</tr>\n";
             $this->xTemplate->assign("PAGINATION", $html_text);
         }
         //C.L. - Fix for 23461
         if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') {
             $_SESSION['export_where'] = $this->query_where;
         }
         $this->xTemplate->parse($xtemplateSection . ".list_nav_row");
     }
 }
示例#18
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->db->createTable($this);
             if ($this->bean_implements('ACL')) {
                 $aclList = SugarACL::loadACLs($this->getACLCategory());
                 foreach ($aclList as $acl) {
                     if ($acl instanceof SugarACLStatic) {
                         $createACL = true;
                     }
                 }
             }
             if (!empty($createACL)) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             display_notice("Table already exists : {$this->table_name}<br>");
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }
示例#19
0
 /**
  * @return void
  * @param unknown $data
  * @param unknown $xTemplateSection
  * @param unknown $html_varName
  * @desc INTERNAL FUNCTION process the List Navigation
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  * All Rights Reserved.
  * Contributor(s): ______________________________________..
  */
 function processListNavigation($xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean = null, $subpanel_def = null, $col_count = 20)
 {
     global $export_module;
     global $sugar_config;
     global $current_user;
     global $currentModule;
     $start_record = $current_offset + 1;
     if (!is_numeric($col_count)) {
         $col_count = 20;
     }
     if ($row_count == 0) {
         $start_record = 0;
     }
     $end_record = $start_record + $this->records_per_page;
     // back up the the last page.
     if ($end_record > $row_count + 1) {
         $end_record = $row_count + 1;
     }
     // Deterime the start location of the last page
     if ($row_count == 0) {
         $number_pages = 0;
     } else {
         $number_pages = floor(($row_count - 1) / $this->records_per_page);
     }
     $last_offset = $number_pages * $this->records_per_page;
     if (empty($this->query_limit) || $this->query_limit > $this->records_per_page) {
         $this->base_URL = $this->getBaseURL($html_varName);
         $dynamic_url = '';
         if ($this->is_dynamic) {
             $dynamic_url .= '&' . $this->getSessionVariableName($html_varName, 'ORDER_BY') . '=' . $this->getSessionVariable($html_varName, 'ORDER_BY') . '&sort_order=' . $this->sort_order . '&to_pdf=true&action=SubPanelViewer&subpanel=' . $this->subpanel_module;
         }
         $current_URL = $this->base_URL . $current_offset . $dynamic_url;
         $start_URL = $this->base_URL . "0" . $dynamic_url;
         $previous_URL = $this->base_URL . $previous_offset . $dynamic_url;
         $next_URL = $this->base_URL . $next_offset . $dynamic_url;
         $end_URL = $this->base_URL . 'end' . $dynamic_url;
         if (!empty($this->start_link_wrapper)) {
             $current_URL = $this->start_link_wrapper . $current_URL . $this->end_link_wrapper;
             $start_URL = $this->start_link_wrapper . $start_URL . $this->end_link_wrapper;
             $previous_URL = $this->start_link_wrapper . $previous_URL . $this->end_link_wrapper;
             $next_URL = $this->start_link_wrapper . $next_URL . $this->end_link_wrapper;
             $end_URL = $this->start_link_wrapper . $end_URL . $this->end_link_wrapper;
         }
         $moduleString = "{$currentModule}_{$html_varName}_offset";
         $moduleStringOrder = "{$currentModule}_{$html_varName}_ORDER_BY";
         if ($this->shouldProcess && !$this->multi_select_popup) {
             // check the checkboxes onload
             echo "<script>YAHOO.util.Event.addListener(window, \"load\", sListView.check_boxes);</script>\n";
             $massUpdateRun = isset($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true';
             $uids = empty($_REQUEST['uid']) || $massUpdateRun ? '' : $_REQUEST['uid'];
             $select_entire_list = isset($_REQUEST['select_entire_list']) && !$massUpdateRun ? $_REQUEST['select_entire_list'] : 0;
             echo "<textarea style='display: none' name='uid'>{$uids}</textarea>\n" . "<input type='hidden' name='select_entire_list' value='{$select_entire_list}'>\n" . "<input type='hidden' name='{$moduleString}' value='0'>\n" . "<input type='hidden' name='{$moduleStringOrder}' value='0'>\n";
         }
         $GLOBALS['log']->debug("Offsets: (start, previous, next, last)(0, {$previous_offset}, {$next_offset}, {$last_offset})");
         if (0 == $current_offset) {
             $start_link = "<button type='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("start_off", "alt='" . $this->local_app_strings['LNK_LIST_START'] . "'  border='0' align='absmiddle'") . "</button>";
             $previous_link = "<button type='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("previous_off", "alt='" . $this->local_app_strings['LNK_LIST_PREVIOUS'] . "'  border='0' align='absmiddle'") . "</button>";
         } else {
             if ($this->multi_select_popup) {
                 // nav links for multiselect popup, submit form to save checks.
                 $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='javascript:save_checks(0, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("start", "alt='" . $this->local_app_strings['LNK_LIST_START'] . "'  border='0' align='absmiddle'") . "</button>";
                 $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='javascript:save_checks({$previous_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("previous", "alt='" . $this->local_app_strings['LNK_LIST_PREVIOUS'] . "'  border='0' align='absmiddle'") . "</button>";
             } elseif ($this->shouldProcess) {
                 $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='location.href=\"{$start_URL}\"; sListView.save_checks(0, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("start", "alt='" . $this->local_app_strings['LNK_LIST_START'] . "'  border='0' align='absmiddle'") . "</button>";
                 $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='location.href=\"{$previous_URL}\"; sListView.save_checks({$previous_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("previous", "alt='" . $this->local_app_strings['LNK_LIST_PREVIOUS'] . "'  border='0' align='absmiddle'") . "</button>";
             } else {
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $start_URL)) {
                     $onClick = "\"{$start_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$start_URL}\";'";
                 }
                 $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("start", "alt='" . $this->local_app_strings['LNK_LIST_START'] . "'  border='0' align='absmiddle'") . "</button>";
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $previous_URL)) {
                     $onClick = "\"{$previous_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$previous_URL}\";'";
                 }
                 $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("previous", "alt='" . $this->local_app_strings['LNK_LIST_PREVIOUS'] . "'  border='0' align='absmiddle'") . "</button>";
             }
         }
         if ($last_offset <= $current_offset) {
             $end_link = "<button type='button' name='listViewEndButton' title='{$this->local_app_strings['LNK_LIST_END']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("end_off", "alt='" . $this->local_app_strings['LNK_LIST_END'] . "'  border='0' align='absmiddle'") . "</button>";
             $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("next_off", "alt='" . $this->local_app_strings['LNK_LIST_NEXT'] . "'  border='0' align='absmiddle'") . "</button>";
         } else {
             if ($this->multi_select_popup) {
                 // nav links for multiselect popup, submit form to save checks.
                 $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='javascript:save_checks({$last_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("end", "alt='" . $this->local_app_strings['LNK_LIST_END'] . "'  border='0' align='absmiddle'") . "</button>";
                 if (!empty($sugar_config['disable_count_query'])) {
                     $end_link = '';
                 }
                 $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' onClick='javascript:save_checks({$next_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("next", "alt='" . $this->local_app_strings['LNK_LIST_NEXT'] . "'  border='0' align='absmiddle'") . "</button>";
             } elseif ($this->shouldProcess) {
                 $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='location.href=\"{$end_URL}\"; sListView.save_checks(\"end\", \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("end", "alt='" . $this->local_app_strings['LNK_LIST_END'] . "'  border='0' align='absmiddle'") . "</button>";
                 $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick='location.href=\"{$next_URL}\"; sListView.save_checks({$next_offset}, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("next", "alt='" . $this->local_app_strings['LNK_LIST_NEXT'] . "'  border='0' align='absmiddle'") . "</button>";
             } else {
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $next_URL)) {
                     $onClick = "\"{$next_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$next_URL}\";'";
                 }
                 $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("next", "alt='" . $this->local_app_strings['LNK_LIST_NEXT'] . "'  border='0' align='absmiddle'") . "</button>";
                 $onClick = '';
                 if (0 != preg_match('/javascript.*/', $end_URL)) {
                     $onClick = "\"{$end_URL};\"";
                 } else {
                     $onClick = "'location.href=\"{$end_URL}\";'";
                 }
                 $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("end", "alt='" . $this->local_app_strings['LNK_LIST_END'] . "'  border='0' align='absmiddle'") . "</button>";
             }
         }
         $GLOBALS['log']->info("Offset (next, current, prev)({$next_offset}, {$current_offset}, {$previous_offset})");
         $GLOBALS['log']->info("Start/end records ({$start_record}, {$end_record})");
         $end_record = $end_record - 1;
         echo "<script>\n                function select_overlib() {\n                    return overlib('<a style=\\'width: 150px\\' name=\"thispage\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'if (document.MassUpdate.select_entire_list.value==1){document.MassUpdate.select_entire_list.value=0;sListView.check_all(document.MassUpdate, \"mass[]\", true, {$this->records_per_page})}else {sListView.check_all(document.MassUpdate, \"mass[]\", true)};\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']}&nbsp;&#x28;{$this->records_per_page}&#x29;&#x200E;</a>" . "<a style=\\'width: 150px\\' name=\"selectall\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'sListView.check_entire_list(document.MassUpdate, \"mass[]\",true,{$row_count});\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}&nbsp;&#x28;{$row_count}&#x29;&#x200E;</a>" . "<a style=\\'width: 150px\\' name=\"deselect\" class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'sListView.clear_all(document.MassUpdate, \"mass[]\", false);\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_NONE']}</a>" . "', CENTER, '" . "', STICKY, MOUSEOFF, 3000, CLOSETEXT, '<img border=0 src=" . SugarThemeRegistry::current()->getImageURL('close_inline.gif') . ">', WIDTH, 150, CLOSETITLE, '" . $this->local_app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE'] . "', CLOSECLICK, FGCLASS, 'olOptionsFgClass', " . "CGCLASS, 'olOptionsCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olOptionsCapFontClass', CLOSEFONTCLASS, 'olOptionsCloseFontClass');\n                }\n                </script>";
         if ($this->show_select_menu) {
             $select_link = "<a id='select_link' onclick='return select_overlib();' href=\"#\">" . $this->local_app_strings['LBL_LINK_SELECT'] . "&nbsp;<img src='" . SugarThemeRegistry::current()->getImageURL('MoreDetail.png') . "' width='11' height='7' border='0''>" . "</a>";
         } else {
             $select_link = "&nbsp;";
         }
         // put overlib strings into functions to avoid backslash plague!
         /*echo "<script>
                       function export_overlib() {
                           return overlib('<a style=\'width: 150px\' class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'return sListView.send_form(true, \"{$_REQUEST['module']}\", \"export.php\", \"{$this->local_app_strings['LBL_LISTVIEW_NO_SELECTED']}\")\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_SELECTED']}</a>"
                       . "<a style=\'width: 150px\' class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' onclick=\'return sListView.send_form(false, \"{$_REQUEST['module']}\", \"export.php\", \"{$this->local_app_strings['LBL_LISTVIEW_NO_SELECTED']}\")\' href=\'#\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']}</a>"
                       . "<a style=\'width: 150px\' class=\'menuItem\' onmouseover=\'hiliteItem(this,\"yes\");\' onmouseout=\'unhiliteItem(this);\' href=\'export.php?module={$_REQUEST['module']}\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}</a>"
                       . "', CAPTION, '" . $this->local_app_strings['LBL_EXPORT']
                       . "', STICKY, MOUSEOFF, 3000, CLOSETEXT, '<img border=0 style=\'margin-left:2px; margin-right: 2px;\' src=" . $this->local_image_path
                       . "close.gif>', WIDTH, 150, CLOSETITLE, '" . $this->local_app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE'] . "', CLOSECLICK, FGCLASS, 'olOptionsFgClass', "
                       . "CGCLASS, 'olOptionsCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olOptionsCapFontClass', CLOSEFONTCLASS, 'olOptionsCloseFontClass');
                       }
                       </script>";
           */
         //$export_link = "<a id='export_link' onclick='return export_overlib();' href=\"#\">".SugarThemeRegistry::current()->getImage("export","alt='".$this->local_app_strings['LBL_EXPORT']."'  border='0' align='absmiddle'")."&nbsp;".$this->local_app_strings['LBL_EXPORT']."</a>";
         $export_link = '<input class="button" type="button" value="' . $this->local_app_strings['LBL_EXPORT'] . '" ' . 'onclick="return sListView.send_form(true, \'' . $_REQUEST['module'] . '\', \'index.php?entryPoint=export\',\'' . $this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'] . '\')">';
         if ($this->show_delete_button) {
             $delete_link = '<input class="button" type="button" name="Delete" value="' . $this->local_app_strings['LBL_DELETE_BUTTON_LABEL'] . '" onclick="return sListView.send_mass_update(\'selected\',\'' . $this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'] . '\', 1)">';
         } else {
             $delete_link = '&nbsp;';
         }
         $admin = new Administration();
         $admin->retrieveSettings('system');
         $user_merge = $current_user->getPreference('mailmerge_on');
         if ($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']) {
             echo "<script>\n                function mailmerge_overlib() {\n                    return overlib('<a style=\\'width: 150px\\' class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' onclick=\\'return sListView.send_form(true, \"MailMerge\", \"index.php\", \"{$this->local_app_strings['LBL_LISTVIEW_NO_SELECTED']}\")\\' href=\\'#\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_SELECTED']}</a>" . "<a style=\\'width: 150px\\' class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' href=\\'index.php?action=index&module=MailMerge\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_CURRENT']}</a>" . "<a style=\\'width: 150px\\' class=\\'menuItem\\' onmouseover=\\'hiliteItem(this,\"yes\");\\' onmouseout=\\'unhiliteItem(this);\\' href=\\'index.php?action=index&module=MailMerge&entire=true\\'>{$this->local_app_strings['LBL_LISTVIEW_OPTION_ENTIRE']}</a>" . "', CAPTION, '" . $this->local_app_strings['LBL_MAILMERGE'] . "', STICKY, MOUSEOFF, 3000, CLOSETEXT, '<img border=0 style=\\'margin-left:2px; margin-right: 2px;\\' src=" . $this->local_image_path . "close.gif>', WIDTH, 150, CLOSETITLE, '" . $this->local_app_strings['LBL_ADDITIONAL_DETAILS_CLOSE_TITLE'] . "', CLOSECLICK, FGCLASS, 'olOptionsFgClass', " . "CGCLASS, 'olOptionsCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olOptionsCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass');\n                }\n            </script>";
             $merge_link = "&nbsp;|&nbsp;<a id='mailmerge_link' onclick='return mailmerge_overlib()'; href=\"#\">" . $this->local_app_strings['LBL_MAILMERGE'] . "</a>";
         } else {
             $merge_link = "&nbsp;";
         }
         $selected_objects_span = "&nbsp;|&nbsp;{$this->local_app_strings['LBL_LISTVIEW_SELECTED_OBJECTS']}<input  style='border: 0px; background: transparent; font-size: inherit; color: inherit' type='text' readonly name='selectCount[]' value='" . (!empty($select_entire_list) ? $row_count : 0) . "' />";
         if ($_REQUEST['module'] == 'Home' || $this->local_current_module == 'Import' || $this->show_export_button == false || !empty($sugar_config['disable_export']) || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($_REQUEST['module']) && ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'access') == ACL_ALLOW_ENABLED && (ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN || ACLAction::getUserAccessLevel($current_user->id, $_REQUEST['module'], 'admin') == ACL_ALLOW_ADMIN_DEV))) {
             if ($_REQUEST['module'] != 'InboundEmail' && $_REQUEST['module'] != 'EmailMan' && $_REQUEST['module'] != 'iFrames') {
                 $selected_objects_span = '';
             }
             $export_link = "&nbsp;";
             $merge_link = "&nbsp;";
         } elseif ($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") {
             $merge_link = "&nbsp;";
         }
         if ($this->show_paging == true) {
             if (!empty($sugar_config['disable_count_query'])) {
                 if ($row_count > $end_record) {
                     $row_count .= '+';
                 }
             }
             $html_text = '';
             $html_text .= "<tr class='pagination'>\n";
             $html_text .= "<td COLSPAN=\"{$col_count}\" align=\"right\">\n";
             //$html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  >$export_link$merge_link$selected_objects_span</td>\n";
             //$html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  >";
             if ($subpanel_def != null) {
                 include_once 'include/SubPanel/SubPanelTiles.php';
                 $subpanelTiles = new SubPanelTiles($sugarbean);
                 $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  >";
                 //attempt to get the query to recreate this subpanel
                 if (!empty($this->response)) {
                     $response =& $this->response;
                 } else {
                     $response = SugarBean::get_union_related_list($sugarbean, $this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, -1, $this->query_limit, $subpanel_def);
                     $this->response = $response;
                 }
                 //if query is present, then pass it in as parameter
                 if (isset($response['query']) && !empty($response['query'])) {
                     $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']);
                 } else {
                     $html_text .= $subpanelTiles->get_buttons($subpanel_def);
                 }
             } else {
                 $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  nowrap>{$select_link}&nbsp;{$export_link}&nbsp;{$delete_link}&nbsp;{$selected_objects_span}";
             }
             $html_text .= "</td>\n<td nowrap align=\"right\">" . $start_link . "&nbsp;&nbsp;" . $previous_link . "&nbsp;&nbsp;<span class='pageNumbers'>(" . $start_record . " - " . $end_record . " " . $this->local_app_strings['LBL_LIST_OF'] . " " . $row_count . ")</span>&nbsp;&nbsp;" . $next_link . "&nbsp;&nbsp;" . $end_link . "</td></tr></table>\n";
             $html_text .= "</td>\n";
             $html_text .= "</tr>\n";
             $this->xTemplate->assign("PAGINATION", $html_text);
         }
         //C.L. - Fix for 23461
         if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'Popup') {
             $_SESSION['export_where'] = $this->query_where;
         }
         $this->xTemplate->parse($xtemplateSection . ".list_nav_row");
     }
 }
示例#20
0
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
global $current_user, $beanList, $beanFiles, $mod_strings;
$installed_classes = array();
$ACLbeanList = $beanList;
if (is_admin($current_user)) {
    foreach ($ACLbeanList as $module => $class) {
        if (empty($installed_classes[$class]) && isset($beanFiles[$class]) && file_exists($beanFiles[$class])) {
            if ($class == 'Tracker') {
            } else {
                require_once $beanFiles[$class];
                $mod = new $class();
                if ($mod->bean_implements('ACL') && empty($mod->acl_display_only)) {
                    // BUG 10339: do not display messages for upgrade wizard
                    if (!isset($_REQUEST['upgradeWizard'])) {
                        echo translate('LBL_ADDING', 'ACL', '') . $mod->module_dir . '<br>';
                    }
                    if (!empty($mod->acltype)) {
                        ACLAction::addActions($mod->module_dir, $mod->acltype);
                    } else {
                        ACLAction::addActions($mod->module_dir);
                    }
                    $installed_classes[$class] = true;
                }
            }
        }
    }
}
示例#21
0
    function mass_assign($event, $arguments)
    {
        $action = $_REQUEST['action'];
        $module = $_REQUEST['module'];
        $no_mass_assign_list = array("Emails" => "Emails", "ACLRoles" => "ACLRoles");
        //,"Users"=>"Users");
        //check if security suite enabled
        $action = strtolower($action);
        if (isset($module) && ($action == "list" || $action == "index" || $action == "listview") && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != true) && !array_key_exists($module, $no_mass_assign_list)) {
            global $current_user;
            if (is_admin($current_user) || ACLAction::getUserAccessLevel($current_user->id, "SecurityGroups", 'access') == ACL_ALLOW_ENABLED) {
                require_once 'modules/SecurityGroups/SecurityGroup.php';
                $groupFocus = new SecurityGroup();
                $security_modules = $groupFocus->getSecurityModules();
                //if(in_array($module,$security_modules)) {
                if (in_array($module, array_keys($security_modules))) {
                    global $app_strings;
                    global $current_language;
                    $current_module_strings = return_module_language($current_language, 'SecurityGroups');
                    $form_header = get_form_header($current_module_strings['LBL_MASS_ASSIGN'], '', false);
                    $groups = $groupFocus->get_list("name", "", 0, -99, -99);
                    $options = array("" => "");
                    foreach ($groups['list'] as $group) {
                        $options[$group->id] = $group->name;
                    }
                    $group_options = get_select_options_with_id($options, "");
                    $mass_assign = <<<EOQ

<script type="text/javascript" language="javascript">
function confirm_massassign(del,start_string, end_string) {
\tif (del == 1) {
\t\treturn confirm( start_string + sugarListView.get_num_selected()  + end_string);
\t}
\telse {
\t\treturn confirm( start_string + sugarListView.get_num_selected()  + end_string);
\t}
}

function send_massassign(mode, no_record_txt, start_string, end_string, del) {

\tif(!sugarListView.confirm_action(del, start_string, end_string))
\t\treturn false;

\tif(document.MassAssign_SecurityGroups.massassign_group.selectedIndex == 0) {
\t\talert("Please select a group and try again.");
\t\treturn false;\t
\t}
\t 
\tif (document.MassUpdate.select_entire_list &&
\t\tdocument.MassUpdate.select_entire_list.value == 1)
\t\tmode = 'entire';
\telse if (document.MassUpdate.massall.checked == true)
\t\tmode = 'page';
\telse
\t\tmode = 'selected';

\tvar ar = new Array();
\tif(del == 1) {
\t\tvar deleteInput = document.createElement('input');
\t\tdeleteInput.name = 'Delete';
\t\tdeleteInput.type = 'hidden';
\t\tdeleteInput.value = true;
\t\tdocument.MassAssign_SecurityGroups.appendChild(deleteInput);
\t}

\tswitch(mode) {
\t\tcase 'page':
\t\t\tdocument.MassAssign_SecurityGroups.uid.value = '';
\t\t\tfor(wp = 0; wp < document.MassUpdate.elements.length; wp++) {
\t\t\t\tif(typeof document.MassUpdate.elements[wp].name != 'undefined'
\t\t\t\t\t&& document.MassUpdate.elements[wp].name == 'mass[]' && document.MassUpdate.elements[wp].checked) {
\t\t\t\t\t\t\tar.push(document.MassUpdate.elements[wp].value);
\t\t\t\t}
\t\t\t}
\t\t\tdocument.MassAssign_SecurityGroups.uid.value = ar.join(',');
\t\t\tif(document.MassAssign_SecurityGroups.uid.value == '') {
\t\t\t\talert(no_record_txt);
\t\t\t\treturn false;
\t\t\t}
\t\t\tbreak;
\t\tcase 'selected':
\t\t\tfor(wp = 0; wp < document.MassUpdate.elements.length; wp++) {
\t\t\t\tif(typeof document.MassUpdate.elements[wp].name != 'undefined'
\t\t\t\t\t&& document.MassUpdate.elements[wp].name == 'mass[]'
\t\t\t\t\t\t&& document.MassUpdate.elements[wp].checked) {
\t\t\t\t\t\t\tar.push(document.MassUpdate.elements[wp].value);
\t\t\t\t}
\t\t\t}
\t\t\tif(document.MassAssign_SecurityGroups.uid.value != '') document.MassAssign_SecurityGroups.uid.value += ',';
\t\t\tdocument.MassAssign_SecurityGroups.uid.value += ar.join(',');
\t\t\tif(document.MassAssign_SecurityGroups.uid.value == '') {
\t\t\t\talert(no_record_txt);
\t\t\t\treturn false;
\t\t\t}
\t\t\tbreak;
\t\tcase 'entire':
\t\t\tvar entireInput = document.createElement('input');
\t\t\tentireInput.name = 'entire';
\t\t\tentireInput.type = 'hidden';
\t\t\tentireInput.value = 'index';
\t\t\tdocument.MassAssign_SecurityGroups.appendChild(entireInput);
\t\t\t//confirm(no_record_txt);
\t\t\tbreak;
\t}

\tdocument.MassAssign_SecurityGroups.submit();
\treturn false;
}

</script>

\t\t<form action='index.php' method='post' name='MassAssign_SecurityGroups'  id='MassAssign_SecurityGroups'>
\t\t\t<input type='hidden' name='action' value='MassAssign' />
\t\t\t<input type='hidden' name='module' value='SecurityGroups' />
\t\t\t<input type='hidden' name='return_action' value='{$action}' />
\t\t\t<input type='hidden' name='return_module' value='{$module}' />
\t\t\t<textarea style='display: none' name='uid'></textarea>


\t\t<div id='massassign_form'>{$form_header}
\t\t<table cellpadding='0' cellspacing='0' border='0' width='100%'>
\t\t<tr>
\t\t<td style='padding-bottom: 2px;' class='listViewButtons'>
\t\t<input type='submit' name='Assign' value='{$current_module_strings['LBL_ASSIGN']}' onclick="return send_massassign('selected', '{$app_strings['LBL_LISTVIEW_NO_SELECTED']}','{$current_module_strings['LBL_ASSIGN_CONFIRM']}','{$current_module_strings['LBL_CONFIRM_END']}',0);" class='button'>
\t\t<input type='submit' name='Remove' value='{$current_module_strings['LBL_REMOVE']}' onclick="return send_massassign('selected', '{$app_strings['LBL_LISTVIEW_NO_SELECTED']}','{$current_module_strings['LBL_REMOVE_CONFIRM']}','{$current_module_strings['LBL_CONFIRM_END']}',1);" class='button'>


\t\t</td></tr></table>
\t\t<table cellpadding='0' cellspacing='0' border='0' width='100%' class='tabForm' id='mass_update_table'>
\t\t<tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0'>
\t\t<tr>
\t\t<td>{$current_module_strings['LBL_GROUP']}</td>
\t\t<td><select name='massassign_group' id="massassign_group" tabindex='1'>{$group_options}</select></td>
\t\t</tr>
\t\t</table></td></tr></table></div>\t\t\t
\t\t</form>\t\t
EOQ;
                    echo $mass_assign;
                }
            }
        }
        //if after a save...
        if (!empty($_SESSION['securitysuite_error'])) {
            $lbl_securitysuite_error = $_SESSION['securitysuite_error'];
            unset($_SESSION['securitysuite_error']);
            echo <<<EOQ
<script>
\t\t\t\t

var oNewP = document.createElement("div");
oNewP.className = 'error';

var oText = document.createTextNode("{$lbl_securitysuite_error}");
oNewP.appendChild(oText);

var beforeMe = document.getElementsByTagName("div")[0];
document.body.insertBefore(oNewP, beforeMe);
</script>
EOQ;
        }
    }
示例#22
0
 public function testclearSessionCache()
 {
     $aclAction = new ACLAction();
     //execute the method and verify that it unsets the session cache
     $aclAction->clearSessionCache();
     $this->assertFalse(isset($_SESSION['ACL']));
 }
示例#23
0
} else {
    $categories = ACLRole::getRoleActions('');
}
$sugar_smarty->assign('ROLE', $role->toArray());
$tdwidth = 10;
if (isset($_REQUEST['return_module'])) {
    $return['module'] = $_REQUEST['return_module'];
    if (isset($_REQUEST['return_action'])) {
        $return['action'] = $_REQUEST['return_action'];
    }
    if (isset($_REQUEST['return_record'])) {
        $return['record'] = $_REQUEST['return_record'];
    }
}
$sugar_smarty->assign('RETURN', $return);
$names = ACLAction::setupCategoriesMatrix($categories);
if (!empty($names)) {
    $tdwidth = 100 / sizeof($names);
}
$sugar_smarty->assign('CATEGORIES', $categories);
$sugar_smarty->assign('CATEGORY_NAME', $_REQUEST['category_name']);
$sugar_smarty->assign('TDWIDTH', $tdwidth);
$sugar_smarty->assign('ACTION_NAMES', $names);
$actions = $categories[$_REQUEST['category_name']]['module'];
$sugar_smarty->assign('ACTIONS', $actions);
ob_clean();
if ($_REQUEST['category_name'] == 'All') {
    echo $sugar_smarty->fetch('modules/ACLRoles/EditAllBody.tpl');
} else {
    //WDong Bug 23195: Strings not localized in Role Management.
    echo getClassicModuleTitle($_REQUEST['category_name'], array($app_list_strings['moduleList'][$_REQUEST['category_name']]), false);
示例#24
0
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
//Bug 30094, If zlib is enabled, it can break the calls to header() due to output buffering. This will only work php5.2+
ini_set('zlib.output_compression', 'Off');
ob_start();
require_once 'include/export_utils.php';
global $sugar_config;
global $locale;
global $current_user;
global $app_list_strings;
$the_module = clean_string($_REQUEST['module']);
if ($sugar_config['disable_export'] || !empty($sugar_config['admin_export_only']) && !(is_admin($current_user) || ACLController::moduleSupportsACL($the_module) && ACLAction::getUserAccessLevel($current_user->id, $the_module, 'access') == ACL_ALLOW_ENABLED && (ACLAction::getUserAccessLevel($current_user->id, $the_module, 'admin') == ACL_ALLOW_ADMIN || ACLAction::getUserAccessLevel($current_user->id, $the_module, 'admin') == ACL_ALLOW_ADMIN_DEV))) {
    die($GLOBALS['app_strings']['ERR_EXPORT_DISABLED']);
}
//check to see if this is a request for a sample or for a regular export
if (!empty($_REQUEST['sample'])) {
    //call special method that will create dummy data for bean as well as insert standard help message.
    $content = exportSample(clean_string($_REQUEST['module']));
} else {
    if (!empty($_REQUEST['uid'])) {
        $content = export(clean_string($_REQUEST['module']), $_REQUEST['uid'], isset($_REQUEST['members']) ? $_REQUEST['members'] : false);
    } else {
        $content = export(clean_string($_REQUEST['module']));
    }
}
$filename = $_REQUEST['module'];
//use label if one is defined
示例#25
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->dbManager->createTable($this);
             if ($this->bean_implements('ACL')) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             echo "Table already exists : {$this->table_name}<br>";
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }
示例#26
0
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
global $current_user, $beanList, $beanFiles;
$actionarr = ACLAction::getDefaultActions();
if (is_admin($current_user)) {
    $foundOne = false;
    foreach ($actionarr as $actionobj) {
        if (!isset($beanList[$actionobj->category]) || !file_exists($beanFiles[$beanList[$actionobj->category]])) {
            if (!isset($_REQUEST['upgradeWizard'])) {
                echo 'Removing for ' . $actionobj->category . '<br>';
            }
            $foundOne = true;
            ACLAction::removeActions($actionobj->category);
        }
    }
    if (!$foundOne) {
        echo 'No ACL modules found that needed to be removed';
    }
}
示例#27
0
function get_workflow_admin_modules_for_user($user)
{
    if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
        return $_SESSION['get_workflow_admin_modules_for_user'];
    }
    global $moduleList;
    $workflow_mod_list = array();
    foreach ($moduleList as $module) {
        $workflow_mod_list[$module] = $module;
    }
    // This list is taken from teh previous version of workflow_utils.php
    $workflow_mod_list['Tasks'] = "Tasks";
    $workflow_mod_list['Calls'] = "Calls";
    $workflow_mod_list['Meetings'] = "Meetings";
    $workflow_mod_list['Notes'] = "Notes";
    $workflow_mod_list['ProjectTask'] = "Project Tasks";
    $workflow_mod_list['Leads'] = "Leads";
    $workflow_mod_list['Opportunities'] = "Opportunities";
    // End of list
    $workflow_admin_modules = array();
    if (empty($user)) {
        return $workflow_admin_modules;
    }
    $actions = ACLAction::getUserActions($user->id);
    //check for ForecastSchedule because it doesn't exist in $workflow_mod_list
    if (isset($actions['ForecastSchedule']['module']['admin']['aclaccess']) && ($actions['ForecastSchedule']['module']['admin']['aclaccess'] == ACL_ALLOW_DEV || $actions['ForecastSchedule']['module']['admin']['aclaccess'] == ACL_ALLOW_ADMIN_DEV)) {
        $workflow_admin_modules['Forecasts'] = 'Forecasts';
    }
    foreach ($workflow_mod_list as $key => $val) {
        if (!in_array($val, $workflow_admin_modules) && ($val != 'iFrames' && $val != 'Feeds' && $val != 'Home' && $val != 'Dashboard' && $val != 'Calendar' && $val != 'Activities' && $val != 'Reports') && $user->isDeveloperForModule($key)) {
            $workflow_admin_modules[$key] = $val;
        }
    }
    $_SESSION['get_workflow_admin_modules_for_user'] = $workflow_admin_modules;
    return $workflow_admin_modules;
}
示例#28
0
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
global $current_user, $beanList, $beanFiles, $mod_strings;
$installed_classes = array();
$ACLbeanList = $beanList;
if (is_admin($current_user)) {
    foreach ($ACLbeanList as $module => $class) {
        if (empty($installed_classes[$class]) && isset($beanFiles[$class]) && file_exists($beanFiles[$class])) {
            if ($class == 'Tracker') {
            } else {
                require_once $beanFiles[$class];
                $mod = new $class();
                $GLOBALS['log']->debug("DOING: {$class}");
                if ($mod->bean_implements('ACL') && empty($mod->acl_display_only)) {
                    // BUG 10339: do not display messages for upgrade wizard
                    if (!isset($_REQUEST['upgradeWizard'])) {
                        echo translate('LBL_ADDING', 'ACL', '') . $mod->module_dir . '<br>';
                    }
                    if (!empty($mod->acltype)) {
                        ACLAction::addActions($mod->getACLCategory(), $mod->acltype);
                    } else {
                        ACLAction::addActions($mod->getACLCategory());
                    }
                    $installed_classes[$class] = true;
                }
            }
        }
    }
}
示例#29
0
 /**
  *
  * static pass by ref setupCategoriesMatrix(&$categories)
  * takes in an array of categories and modifes them adding display information
  *
  * @param unknown_type $categories
  */
 public static function setupCategoriesMatrix(&$categories)
 {
     global $ACLActions, $current_user;
     $names = array();
     $disabled = array();
     foreach ($categories as $cat_name => $category) {
         foreach ($category as $type_name => $type) {
             foreach ($type as $act_name => $action) {
                 $names[$act_name] = translate($ACLActions[$type_name]['actions'][$act_name]['label'], 'ACLActions');
                 $categories[$cat_name][$type_name][$act_name]['accessColor'] = ACLAction::AccessColor($action['aclaccess']);
                 if ($type_name == 'module') {
                     if ($act_name != 'aclaccess' && $categories[$cat_name]['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                         $categories[$cat_name][$type_name][$act_name]['accessColor'] = 'darkgray';
                         $disabled[] = $cat_name;
                     }
                 }
                 $categories[$cat_name][$type_name][$act_name]['accessName'] = ACLAction::AccessName($action['aclaccess']);
                 $categories[$cat_name][$type_name][$act_name]['accessLabel'] = ACLAction::AccessLabel($action['aclaccess']);
                 if ($cat_name == 'Users' && $act_name == 'admin') {
                     $categories[$cat_name][$type_name][$act_name]['accessOptions'][ACL_ALLOW_DEFAULT] = ACLAction::AccessName(ACL_ALLOW_DEFAULT);
                     $categories[$cat_name][$type_name][$act_name]['accessOptions'][ACL_ALLOW_DEV] = ACLAction::AccessName(ACL_ALLOW_DEV);
                 } else {
                     $categories[$cat_name][$type_name][$act_name]['accessOptions'] = ACLAction::getAccessOptions($act_name, $type_name);
                 }
             }
         }
     }
     if (!is_admin($current_user)) {
         foreach ($disabled as $cat_name) {
             unset($categories[$cat_name]);
         }
     }
     return $names;
 }
示例#30
0
 /**
  * Helper function that enumerates the list of modules and checks if they are an admin/dev.
  * The code was just too similar to copy and paste.
  *
  * @return array
  */
 protected function _getModulesForACL($type = 'dev')
 {
     $isDev = $type == 'dev';
     $isAdmin = $type == 'admin';
     global $beanList;
     $myModules = array();
     if (!is_array($beanList)) {
         return $myModules;
     }
     // These modules don't take kindly to the studio trying to play about with them.
     static $ignoredModuleList = array('iFrames', 'Feeds', 'Home', 'Dashboard', 'Calendar', 'Activities', 'Reports', 'UpgradeHistory');
     $actions = ACLAction::getUserActions($this->id);
     foreach ($beanList as $module => $val) {
         // Remap the module name
         $module = $this->_fixupModuleForACL($module);
         if (in_array($module, $myModules)) {
             // Already have the module in the list
             continue;
         }
         if (in_array($module, $ignoredModuleList)) {
             // You can't develop on these modules.
             continue;
         }
         $key = 'module';
         // The tracker modules have special case ACL mappings
         // in $GLOBALS['ACLActions'] that we need to account for.
         // TODO: In the future these should be migrated to a custom ACL strategy for those modules.
         if (in_array($module, array('Tracker', 'TrackerPerfs', 'TrackerQueries', 'TrackerSessions'))) {
             $focus = BeanFactory::getBean($module);
             if ($focus instanceof SugarBean) {
                 $key = $focus->acltype;
             }
         }
         if ($this->isAdmin() && isset($actions[$module][$key]) || isset($actions[$module][$key]['admin']['aclaccess']) && ($isDev && $actions[$module][$key]['admin']['aclaccess'] == ACL_ALLOW_DEV || $isAdmin && $actions[$module][$key]['admin']['aclaccess'] == ACL_ALLOW_ADMIN || $actions[$module][$key]['admin']['aclaccess'] == ACL_ALLOW_ADMIN_DEV)) {
             $myModules[] = $module;
         }
     }
     return $myModules;
 }