function display($defines)
 {
     global $app_strings;
     global $currentModule;
     $title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
     $accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
     $value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
     $this->module = 'Emails';
     $to_addrs = '';
     $additionalFormFields = array();
     $additionalFormFields['type'] = 'out';
     // cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
     $additionalFormFields['parent_type'] = $defines['focus']->module_dir;
     $additionalFormFields['parent_id'] = $defines['focus']->id;
     $additionalFormFields['parent_name'] = $defines['focus']->name;
     if (isset($defines['focus']->email1)) {
         $to_addrs = $defines['focus']->email1;
     } elseif ($defines['focus']->object_name == 'Case') {
         require_once 'modules/Accounts/Account.php';
         $acct = new Account();
         $acct->retrieve($defines['focus']->account_id);
         $to_addrs = $acct->email1;
     }
     if (!empty($to_addrs)) {
         $additionalFormFields['to_email_addrs'] = $to_addrs;
     }
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input title='{$title}' class='button' type='button' name='button' value='  {$value}  '/>\n";
         return $button;
     }
     $button = $this->_get_form($defines, $additionalFormFields);
     $button .= "<input title='{$title}' accesskey='{$accesskey}' class='button' type='submit' name='button' value='  {$value}  '/>\n";
     $button .= "</form>";
     return $button;
 }
 function display($defines)
 {
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $temp = '';
         return $temp;
     }
     global $app_strings;
     global $mod_strings;
     global $currentModule;
     $title = $app_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'];
     $accesskey = $app_strings['LBL_TRACK_EMAIL_BUTTON_KEY'];
     $value = $app_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'];
     $this->module = 'Emails';
     $additionalFormFields = array();
     $additionalFormFields['type'] = 'archived';
     // cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
     $additionalFormFields['parent_type'] = $defines['focus']->module_dir;
     $additionalFormFields['parent_id'] = $defines['focus']->id;
     $additionalFormFields['parent_name'] = $defines['focus']->name;
     if (isset($defines['focus']->email1)) {
         $additionalFormFields['to_email_addrs'] = $defines['focus']->email1;
     }
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input title='{$title}' class='button' type='button' name='button' value='  {$value}  ' disabled/>\n";
         return $button;
     }
     $button = $this->_get_form($defines, $additionalFormFields);
     $button .= "<input title='{$title}' accesskey='{$accesskey}' class='button' type='submit' name='button' value='  {$value}  '/>\n";
     $button .= "</form>";
     return $button;
 }
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");
}
示例#4
0
 function checkDashletDisplay()
 {
     if (!in_array($this->type, $GLOBALS['moduleList']) && !in_array($this->type, $GLOBALS['modInvisList']) && (!in_array('Activities', $GLOBALS['moduleList']) || !in_array($this->type, $GLOBALS['modInvisListActivities']))) {
         $displayDashlet = false;
     } elseif (ACLController::moduleSupportsACL($this->type) && !ACLController::checkAccess($this->type, 'list', true)) {
         $displayDashlet = false;
     } else {
         $displayDashlet = true;
     }
     return $displayDashlet;
 }
示例#5
0
 /**
  * Extends SugarBean::listviewACLHelper
  *
  * @return array
  */
 public function listviewACLHelper()
 {
     $array_assign = parent::listviewACLHelper();
     $is_owner = false;
     if (!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)) {
         $array_assign['ACCOUNT'] = 'a';
     } else {
         $array_assign['ACCOUNT'] = 'span';
     }
     return $array_assign;
 }
    function getJavascript()
    {
        global $action;
        if (!ACLController::moduleSupportsACL($this->module)) {
            return '';
        }
        $script = "<SCRIPT>\n//BEGIN ACL JAVASCRIPT\n";
        if ($action == 'DetailView') {
            if (!ACLController::checkAccess($this->module, 'edit', $this->is_owner)) {
                $script .= <<<EOQ
\t\t\t\t\t\tif(typeof(document.DetailView) != 'undefined'){
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Edit']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Edit'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Duplicate']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Duplicate'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOQ;
            }
            if (!ACLController::checkAccess($this->module, 'delete', $this->is_owner)) {
                $script .= <<<EOQ
\t\t\t\t\t\tif(typeof(document.DetailView) != 'undefined'){
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Delete']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Delete'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOQ;
            }
        }
        if (file_exists('modules/' . $this->module . '/metadata/acldefs.php')) {
            include 'modules/' . $this->module . '/metadata/acldefs.php';
            foreach ($acldefs[$this->module]['forms'] as $form_name => $form) {
                foreach ($form as $field_name => $field) {
                    if ($field['app_action'] == $action) {
                        switch ($form_name) {
                            case 'by_id':
                                $script .= $this->getFieldByIdScript($field_name, $field);
                                break;
                            case 'by_name':
                                $script .= $this->getFieldByNameScript($field_name, $field);
                                break;
                            default:
                                $script .= $this->getFieldByFormScript($form_name, $field_name, $field);
                                break;
                        }
                    }
                }
            }
        }
        $script .= '</SCRIPT>';
        return $script;
    }
 function displayList(&$layout_def)
 {
     $module = '';
     $record = '';
     if (isset($layout_def['varname'])) {
         $key = strtoupper($layout_def['varname']);
     } else {
         $key = $this->_get_column_alias($layout_def);
         $key = strtoupper($key);
     }
     if (empty($layout_def['fields'][$key])) {
         return "";
     } else {
         $value = $layout_def['fields'][$key];
     }
     if (empty($layout_def['target_record_key'])) {
         $record = $layout_def['fields']['ID'];
     } else {
         $record_key = strtoupper($layout_def['target_record_key']);
         $record = $layout_def['fields'][$record_key];
     }
     if (!empty($layout_def['target_module_key'])) {
         if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
             $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])];
         }
     }
     if (empty($module)) {
         if (empty($layout_def['target_module'])) {
             $module = $layout_def['module'];
         } else {
             $module = $layout_def['target_module'];
         }
     }
     $action = 'DetailView';
     $value = $layout_def['fields'][$key];
     global $current_user;
     if (isset($layout_def['custom']) && $layout_def['custom'] == true && $key == "BEAN_NAME") {
         $productlog = new ProductLog();
         $productlog->retrieve($layout_def['fields']['ID']);
         $module = $productlog->bean_name;
         if ($productlog->bean_name == 'Quote') {
             $module = 'Quotes';
         }
         $record = $layout_def['fields']['BEAN_ID'];
         return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
     } elseif ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id)) {
         return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
     } else {
         return $value;
     }
 }
示例#8
0
 function checkDashletDisplay()
 {
     if (!in_array($this->type, $GLOBALS['moduleList']) && !in_array($this->type, $GLOBALS['modInvisList']) && !in_array('Activities', $GLOBALS['moduleList'])) {
         $displayDashlet = false;
     } elseif (ACLController::moduleSupportsACL($this->type)) {
         $bean = SugarModule::get($this->type)->loadBean();
         if (!ACLController::checkAccess($this->type, 'list', true, $bean->acltype)) {
             $displayDashlet = false;
         }
         $displayDashlet = true;
     } else {
         $displayDashlet = true;
     }
     return $displayDashlet;
 }
 function displayList(&$layout_def)
 {
     $module = 'Supplies';
     $record = '';
     if (isset($layout_def['varname'])) {
         $key = strtoupper($layout_def['varname']);
     } else {
         $key = $this->_get_column_alias($layout_def);
         $key = strtoupper($key);
     }
     if (empty($layout_def['fields'][$key])) {
         return "";
     } else {
         $value = $layout_def['fields'][$key];
     }
     if (empty($layout_def['target_record_key'])) {
         $record = $layout_def['fields']['SUPPLYID'];
     } else {
         $record_key = strtoupper($layout_def['target_record_key']);
         $record = $layout_def['fields'][$record_key];
     }
     /*if(!empty($layout_def['target_module_key'])) { 
     			if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
     				$module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])];
     			}	
     		}
     */
     /*if (empty($module)) {
     			if(empty($layout_def['target_module']))
     			{
     				$module = $layout_def['module'];
     			}
     		else
     			{
     				$module = $layout_def['target_module'];
     			}
     		}*/
     $action = 'DetailView';
     $value = $layout_def['fields'][$key];
     global $current_user;
     if ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id)) {
         return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
     } else {
         return $value;
     }
 }
 function display($defines)
 {
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true) || $defines['module'] == "Activities" & !ACLController::checkAccess("Emails", 'edit', true)) {
         $temp = '';
         return $temp;
     }
     /**
      * if module is hidden or subpanel for the module is hidden - doesn't show quick create button
      */
     if (SugarWidget::isModuleHidden('Emails')) {
         return '';
     }
     global $app_strings, $current_user, $sugar_config, $beanList, $beanFiles;
     $title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
     //$accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
     $value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
     $parent_type = $defines['focus']->module_dir;
     $parent_id = $defines['focus']->id;
     //martin Bug 19660
     $userPref = $current_user->getPreference('email_link_type');
     $defaultPref = $sugar_config['email_default_client'];
     if ($userPref != '') {
         $client = $userPref;
     } else {
         $client = $defaultPref;
     }
     if ($client != 'sugar') {
         $bean = $defines['focus'];
         // awu: Not all beans have emailAddress property, we must account for this
         if (isset($bean->emailAddress)) {
             $to_addrs = $bean->emailAddress->getPrimaryAddress($bean);
             $button = "<input class='button' type='button'  value='{$value}'  id='" . $this->getWidgetId() . "'  name='" . preg_replace('[ ]', '', $value) . "'   title='{$title}' onclick=\"location.href='mailto:{$to_addrs}';return false;\" />";
         } else {
             $button = "<input class='button' type='button'  value='{$value}'  id='" . $this->getWidgetId() . "'  name='" . preg_replace('[ ]', '', $value) . "'  title='{$title}' onclick=\"location.href='mailto:';return false;\" />";
         }
     } else {
         //Generate the compose package for the quick create options.
         $composeData = array("parent_id" => $parent_id, "parent_type" => $parent_type);
         require_once 'modules/Emails/EmailUI.php';
         $eUi = new EmailUI();
         $j_quickComposeOptions = $eUi->generateComposePackageForQuickCreate($composeData, http_build_query($composeData), false, $defines['focus']);
         $button = "<input title='{$title}'  id='" . $this->getWidgetId() . "'  onclick='SUGAR.quickCompose.init({$j_quickComposeOptions});' class='button' type='submit' name='" . preg_replace('[ ]', '', $value) . "_button' value='{$value}' />";
     }
     return $button;
 }
 function display($widget_data)
 {
     global $app_strings;
     global $currentModule;
     $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array());
     $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
     $title = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_TITLE'];
     //$accesskey = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_KEY'];
     $value = $app_strings['LBL_ACCUMULATED_HISTORY_BUTTON_LABEL'];
     $module_name = 'Activities';
     $id = $widget_data['focus']->id;
     $initial_filter = "&record={$id}&module_name={$currentModule}";
     if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'detail', true)) {
         $temp = '<input disabled type="button" name="summary_button" id="summary_button"' . ' class="button"' . ' title="' . $title . '"' . ' value="' . $value . '"';
         return $temp;
     }
     return '<input type="button" name="summary_button" id="summary_button"' . ' class="button"' . ' title="' . $title . '"' . ' value="' . $value . '"' . " onclick='open_popup(\"{$module_name}\",600,400,\"{$initial_filter}\",false,false,{$json_encoded_php_array});' />\n";
 }
 function display($defines)
 {
     global $app_strings;
     global $currentModule;
     $title = $app_strings['LBL_NEW_BUTTON_TITLE'];
     //$accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
     $value = $app_strings['LBL_NEW_BUTTON_LABEL'];
     $this->module = 'Contacts';
     /**
      * if module is hidden or subpanel for the module is hidden - doesn't show select button
      */
     if (SugarWidget::isModuleHidden($this->module)) {
         return '';
     }
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input title='{$title}'class='button' type='button' name='button' value='  {$value}  ' disabled/>\n";
         return $button;
     }
     $additionalFormFields = array();
     if (isset($defines['focus']->billing_address_street)) {
         $additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street;
     }
     if (isset($defines['focus']->billing_address_city)) {
         $additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city;
     }
     if (isset($defines['focus']->billing_address_state)) {
         $additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state;
     }
     if (isset($defines['focus']->billing_address_country)) {
         $additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country;
     }
     if (isset($defines['focus']->billing_address_postalcode)) {
         $additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode;
     }
     if (isset($defines['focus']->phone_office)) {
         $additionalFormFields['phone_work'] = $defines['focus']->phone_office;
     }
     $button = $this->_get_form($defines, $additionalFormFields);
     $button .= "<input title='{$title}' class='button' type='submit' name='{$this->getWidgetId()}' id='{$this->getWidgetId()}' value='  {$value}  '/>\n";
     $button .= "</form>";
     return $button;
 }
 function display($defines)
 {
     global $app_strings;
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true) || $defines['module'] == "History" & !ACLController::checkAccess("Emails", 'edit', true)) {
         $temp = '';
         return $temp;
     }
     // if module is hidden or subpanel for the module is hidden - doesn't show quick create button
     if (SugarWidget::isModuleHidden('Emails')) {
         return '';
     }
     $title = $app_strings['LBL_TRACK_EMAIL_BUTTON_TITLE'];
     $value = $app_strings['LBL_TRACK_EMAIL_BUTTON_LABEL'];
     $this->module = 'Emails';
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input id='" . preg_replace('[ ]', '', $value) . "_button'  title='{$title}' class='button' type='button' name='" . preg_replace('[ ]', '', strtolower($value)) . "_button' value='{$value}' disabled/>\n";
     } else {
         $button = "<input id='" . preg_replace('[ ]', '', $value) . "_button' title='{$title}' class='button' type='button' onClick=\"javascript:subp_archive_email();\" name='" . preg_replace('[ ]', '', strtolower($value)) . "_button' value='{$value}'/>\n";
     }
     return $button;
 }
 function display($defines)
 {
     global $app_strings;
     global $currentModule;
     $title = $app_strings['LBL_NEW_BUTTON_TITLE'];
     //$accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
     $value = $app_strings['LBL_NEW_BUTTON_LABEL'];
     $this->module = 'RealtyTemplates';
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input title='{$title}'class='button' type='button' name='button' value='  {$value}  ' disabled/>\n";
         return $button;
     }
     $additionalFormFields = array();
     //from Buildings
     if ($defines['focus']->object_name == 'Buildings') {
         if (isset($defines['focus']->id)) {
             $additionalFormFields['building_id'] = $defines['focus']->id;
         }
         if (isset($defines['focus']->number_of_floors)) {
             $additionalFormFields['number_of_floors'] = $defines['focus']->number_of_floors;
         }
         if (isset($defines['focus']->address_country)) {
             $additionalFormFields['address_country'] = $defines['focus']->address_country;
         }
         if (isset($defines['focus']->address_city)) {
             $additionalFormFields['address_city'] = $defines['focus']->address_city;
         }
         if (isset($defines['focus']->address_street)) {
             $additionalFormFields['address_street'] = $defines['focus']->address_street;
         }
         if (isset($defines['focus']->address_region)) {
             $additionalFormFields['address_region'] = $defines['focus']->address_region;
         }
     }
     $button = $this->_get_form($defines, $additionalFormFields);
     $button .= "<input title='{$title}' class='button' type='submit' name='{$this->getWidgetId()}_button' id='{$this->getWidgetId()}' value='  {$value}  '/>\n";
     $button .= "</form>";
     return $button;
 }
示例#15
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);
 }
示例#16
0
 function listviewACLHelper()
 {
     $array_assign = parent::listviewACLHelper();
     $is_owner = false;
     //MFH BUG 18281; JChi #15255
     $is_owner = !empty($this->assigned_user_id) && $this->assigned_user_id == $GLOBALS['current_user']->id;
     if (!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)) {
         $array_assign['ACCOUNT'] = 'a';
     } else {
         $array_assign['ACCOUNT'] = 'span';
     }
     return $array_assign;
 }
示例#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;
     $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");
     }
 }
 /** This default function is used to create the HTML for a simple button */
 function display($defines, $additionalFormFields = null, $nonbutton = false)
 {
     $temp = '';
     $inputID = $this->getWidgetId();
     if (!empty($this->acl) && ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], $this->acl, true)) {
         return $temp;
     }
     global $app_strings;
     if (isset($_REQUEST['layout_def_key']) && $_REQUEST['layout_def_key'] == 'UserEAPM') {
         // Subpanels generally don't go on the editview, so we have to handle this special
         $megaLink = $this->_get_form($defines, $additionalFormFields, true);
         $button = "<input title='{$this->title}' accesskey='{$this->access_key}' class='button' type='submit' name='{$inputID}' id='{$inputID}' value='{$this->form_value}' onclick='javascript:document.location=\"index.php?" . $megaLink . "\"; return false;'/>";
     } else {
         $button = $this->_get_form($defines, $additionalFormFields);
         $button .= "<input title='{$this->title}' accesskey='{$this->access_key}' class='button' type='submit' name='{$inputID}' id='{$inputID}' value='{$this->form_value}' />\n</form>";
     }
     if ($nonbutton) {
         $button = "<a onclick=''>{$this->form_value}";
     }
     return $button;
 }
 function displayList(&$layout_def)
 {
     global $app_strings;
     global $app_list_strings;
     global $current_user;
     if (isset($layout_def['varname'])) {
         $key = strtoupper($layout_def['varname']);
     } else {
         $key = $this->_get_column_alias($layout_def);
         $key = strtoupper($key);
     }
     //add module image
     //add module image
     if (!empty($layout_def['target_module_key'])) {
         if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
             $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])];
         }
     }
     if (empty($module)) {
         if (empty($layout_def['target_module'])) {
             $module = $layout_def['module'];
         } else {
             $module = $layout_def['target_module'];
         }
     }
     $action = 'DetailView';
     if (empty($layout_def['target_record_key'])) {
         $record = $layout_def['fields']['ID'];
     } else {
         $record_key = strtoupper($layout_def['target_record_key']);
         $record = $layout_def['fields'][$record_key];
     }
     $action_access = false;
     if (!empty($record) && ($layout_def[$action] && !$layout_def['owner_module'] || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) {
         $action_access = true;
     }
     $icon_img_html = SugarThemeRegistry::current()->getImage($module . '', 'border="0"', null, null, '.gif', $app_list_strings['moduleList'][$module]);
     if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) {
         $ret = "";
     } else {
         if ($action_access) {
             $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>";
         } else {
             $ret = $icon_img_html;
         }
     }
     if (!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])) {
         if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) {
             $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])];
         }
         $imagePath = '';
         if ($layout_def['image2'] == '__VARIABLE') {
             if (!empty($layout_def['fields'][$key . '_ICON'])) {
                 $imagePath = $layout_def['fields'][$key . '_ICON'];
             }
         } else {
             $imagePath = $layout_def['image2'];
         }
         if (!empty($imagePath)) {
             $icon_img_html = SugarThemeRegistry::current()->getImage($imagePath . '', 'border="0"', null, null, '.gif', $imagePath);
             $ret .= empty($link_url) ? '' : '&nbsp;<a href="' . $link_url . '" TARGET = "_blank">' . "{$icon_img_html}</a>";
         }
     }
     //if requested, add attachment icon.
     if (!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])) {
         if (is_array($layout_def['image2_url_field'])) {
             //Generate file url.
             if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])])) {
                 $key = $layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])];
                 $file = $layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])];
                 $filepath = "index.php?entryPoint=download&id=" . $key . "&type=" . $layout_def['module'];
             }
         } else {
             if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) {
                 $filepath = "index.php?entryPoint=download&id=" . $layout_def['fields']['ID'] . "&type=" . $layout_def['module'];
             }
         }
         $icon_img_html = SugarThemeRegistry::current()->getImage($layout_def['image2'] . '', 'border="0"', null, null, '.gif', $layout_def['image2']);
         if ($action_access && !empty($filepath)) {
             $ret .= '<a href="' . $filepath . '" >' . "{$icon_img_html}</a>";
         } elseif (!empty($filepath)) {
             $ret .= $icon_img_html;
         }
     } else {
         if (!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) {
             $ret .= $layout_def['fields']['ATTACHMENT_IMAGE'];
         }
     }
     return $ret;
 }
示例#20
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");
     }
 }
示例#21
0
 function getDashlets($category = '')
 {
     global $app_strings, $current_language, $mod_strings;
     require_once $GLOBALS['sugar_config']['cache_dir'] . 'dashlets/dashlets.php';
     $categories = array('module' => 'Module Views', 'portal' => 'Portal', 'charts' => 'Charts', 'tools' => 'Tools', 'misc' => 'Miscellaneous', 'web' => 'Web');
     $dashletStrings = array();
     $dashletsList = array();
     if (!empty($category)) {
         $dashletsList[$categories[$category]] = array();
     } else {
         $dashletsList['Module Views'] = array();
         $dashletsList['Charts'] = array();
         $dashletsList['Tools'] = array();
         $dashletsList['Web'] = array();
     }
     asort($dashletsFiles);
     foreach ($dashletsFiles as $className => $files) {
         if (!empty($files['meta']) && is_file($files['meta'])) {
             require_once $files['meta'];
             // get meta file
             $directory = substr($files['meta'], 0, strrpos($files['meta'], '/') + 1);
             if (is_file($directory . $files['class'] . '.' . $current_language . '.lang.php')) {
                 require_once $directory . $files['class'] . '.' . $current_language . '.lang.php';
             } elseif (is_file($directory . $files['class'] . '.en_us.lang.php')) {
                 require_once $directory . $files['class'] . '.en_us.lang.php';
             }
             // try to translate the string
             if (empty($dashletStrings[$files['class']][$dashletMeta[$files['class']]['title']])) {
                 $title = $dashletMeta[$files['class']]['title'];
             } else {
                 $title = $dashletStrings[$files['class']][$dashletMeta[$files['class']]['title']];
             }
             // try to translate the string
             if (empty($dashletStrings[$files['class']][$dashletMeta[$files['class']]['description']])) {
                 $description = $dashletMeta[$files['class']]['description'];
             } else {
                 $description = $dashletStrings[$files['class']][$dashletMeta[$files['class']]['description']];
             }
             // generate icon
             if (!empty($dashletMeta[$files['class']]['icon'])) {
                 // here we'll support image inheritance if the supplied image has a path in it
                 // i.e. $dashletMeta[$files['class']]['icon'] = 'themes/default/images/dog.gif'
                 // in this case, we'll strip off the path information to check for the image existing
                 // in the current theme.
                 $imageName = SugarThemeRegistry::current()->getImageURL(basename($dashletMeta[$files['class']]['icon']), false);
                 if (!empty($imageName)) {
                     if (sugar_is_file($imageName)) {
                         $icon = '<img src="' . $imageName . '" alt="" border="0" align="absmiddle" />';
                     } else {
                         $icon = '';
                     }
                 }
             } else {
                 if (empty($dashletMeta[$files['class']]['module'])) {
                     $icon = get_dashlets_dialog_icon('default');
                 } else {
                     if (!in_array($dashletMeta[$files['class']]['module'], $GLOBALS['moduleList']) && !in_array($dashletMeta[$files['class']]['module'], $GLOBALS['modInvisList']) && !in_array('Activities', $GLOBALS['moduleList'])) {
                         unset($dashletMeta[$files['class']]);
                         continue;
                     } else {
                         $icon = get_dashlets_dialog_icon($dashletMeta[$files['class']]['module']);
                     }
                 }
             }
             // determine whether to display
             if (!empty($dashletMeta[$files['class']]['hidden']) && $dashletMeta[$files['class']]['hidden'] === true) {
                 $displayDashlet = false;
             } elseif (!empty($dashletMeta[$files['class']]['module']) && (!in_array($dashletMeta[$files['class']]['module'], $GLOBALS['moduleList']) && !in_array($dashletMeta[$files['class']]['module'], $GLOBALS['modInvisList'])) && !in_array('Activities', $GLOBALS['moduleList'])) {
                 $displayDashlet = false;
             } else {
                 $displayDashlet = true;
                 //check ACL ACCESS
                 if (!empty($dashletMeta[$files['class']]['module']) && ACLController::moduleSupportsACL($dashletMeta[$files['class']]['module'])) {
                     $type = 'module';
                     if ($dashletMeta[$files['class']]['module'] == 'Trackers') {
                         $type = 'Tracker';
                     }
                     if (!ACLController::checkAccess($dashletMeta[$files['class']]['module'], 'view', true, $type)) {
                         $displayDashlet = false;
                     }
                     if (!ACLController::checkAccess($dashletMeta[$files['class']]['module'], 'list', true, $type)) {
                         $displayDashlet = false;
                     }
                 }
             }
             if ($dashletMeta[$files['class']]['category'] == 'Charts') {
                 $type = 'predefined_chart';
             } else {
                 $type = 'module';
             }
             if ($displayDashlet && isset($dashletMeta[$files['class']]['dynamic_hide']) && $dashletMeta[$files['class']]['dynamic_hide']) {
                 if (file_exists($files['file'])) {
                     require_once $files['file'];
                     if (class_exists($files['class'])) {
                         $dashletClassName = $files['class'];
                         $displayDashlet = call_user_func(array($files['class'], 'shouldDisplay'));
                     }
                 }
             }
             if ($displayDashlet) {
                 $cell = array('title' => $title, 'description' => $description, 'onclick' => 'return SUGAR.mySugar.addDashlet(\'' . $className . '\', \'' . $type . '\', \'' . (!empty($dashletMeta[$files['class']]['module']) ? $dashletMeta[$files['class']]['module'] : '') . '\');', 'icon' => $icon, 'id' => $files['class'] . '_select');
                 if (!empty($category) && $dashletMeta[$files['class']]['category'] == $categories[$category]) {
                     array_push($dashletsList[$categories[$category]], $cell);
                 } else {
                     if (empty($category)) {
                         array_push($dashletsList[$dashletMeta[$files['class']]['category']], $cell);
                     }
                 }
             }
         }
     }
     if (!empty($category)) {
         asort($dashletsList[$categories[$category]]);
     } else {
         foreach ($dashletsList as $key => $value) {
             asort($dashletsList[$key]);
         }
     }
     $this->dashlets = $dashletsList;
 }
 function displayList(&$layout_def)
 {
     global $focus;
     $module = '';
     $record = '';
     if (isset($layout_def['varname'])) {
         $key = strtoupper($layout_def['varname']);
     } else {
         $key = $this->_get_column_alias($layout_def);
         $key = strtoupper($key);
     }
     if (empty($layout_def['fields'][$key])) {
         return "";
     } else {
         $value = $layout_def['fields'][$key];
     }
     if (empty($layout_def['target_record_key'])) {
         $record = $layout_def['fields']['ID'];
     } else {
         $record_key = strtoupper($layout_def['target_record_key']);
         $record = $layout_def['fields'][$record_key];
     }
     if (!empty($layout_def['target_module_key'])) {
         if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
             $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])];
         }
     }
     if (empty($module)) {
         if (empty($layout_def['target_module'])) {
             $module = $layout_def['module'];
         } else {
             $module = $layout_def['target_module'];
         }
     }
     //links to email module now need additional information.
     //this is to resolve the information about the target of the emails. necessitated by feature that allow
     //only on email record for the whole campaign.
     $parent = '';
     if (!empty($layout_def['parent_info'])) {
         if (!empty($focus)) {
             $parent = "&parent_id=" . $focus->id;
             $parent .= "&parent_module=" . $focus->module_dir;
         }
     } else {
         if (!empty($layout_def['parent_id'])) {
             if (isset($layout_def['fields'][strtoupper($layout_def['parent_id'])])) {
                 $parent .= "&parent_id=" . $layout_def['fields'][strtoupper($layout_def['parent_id'])];
             }
         }
         if (!empty($layout_def['parent_module'])) {
             if (isset($layout_def['fields'][strtoupper($layout_def['parent_module'])])) {
                 $parent .= "&parent_module=" . $layout_def['fields'][strtoupper($layout_def['parent_module'])];
             }
         }
     }
     $action = 'DetailView';
     $value = $layout_def['fields'][$key];
     global $current_user;
     if (!empty($record) && ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) {
         $link = ajaxLink("index.php?module={$module}&action={$action}&record={$record}{$parent}");
         if ($module == 'EAPM') {
             $link = "index.php?module={$module}&action={$action}&record={$record}{$parent}";
         }
         return '<a href="' . $link . '" >' . "{$value}</a>";
     } else {
         return $value;
     }
 }
示例#23
0
 /**
  * This function returns an ordered list of all "tabs", actually subpanels, for this module
  * The source list is obtained from the subpanel layout contained in the layout_defs for this module,
  * found either in the modules metadata/subpaneldefs.php file, or in the modules custom/.../Ext/Layoutdefs/layoutdefs.ext.php file
  * and filtered through an ACL check.
  * Note that the keys for the resulting array of tabs are in practice the name of the underlying source relationship for the subpanel
  * So for example, the key for a custom module's subpanel with Accounts might be 'one_one_accounts', as generated by the Studio Relationship Editor
  * Although OOB module subpanels have keys such as 'accounts', which might on the face of it appear to be a reference to the related module, in fact 'accounts' is still the relationship name
  * @param boolean 	Optional - include the subpanel title label in the return array (false)
  * @return array	All tabs that pass an ACL check
  */
 function get_available_tabs($FromGetModuleSubpanels = false)
 {
     global $modListHeader;
     global $modules_exempt_from_availability_check;
     if (isset($this->_visible_tabs_array)) {
         return $this->_visible_tabs_array;
     }
     if (empty($modListHeader)) {
         $modListHeader = query_module_access_list($GLOBALS['current_user']);
     }
     $this->_visible_tabs_array = array();
     // bug 16820 - make sure this is an array for the later ksort
     if (isset($this->layout_defs['subpanel_setup'])) {
         //retrieve list of hidden subpanels
         $hidden_panels = $this->get_hidden_subpanels();
         //activities is a special use case in that if it is hidden,
         //then the history tab should be hidden too.
         if (!empty($hidden_panels) && is_array($hidden_panels) && in_array('activities', $hidden_panels)) {
             //add history to list hidden_panels
             $hidden_panels['history'] = 'history';
         }
         foreach ($this->layout_defs['subpanel_setup'] as $key => $values_array) {
             //exclude if this subpanel is hidden from admin screens
             $module = $key;
             if (isset($values_array['module'])) {
                 $module = strtolower($values_array['module']);
             }
             if ($hidden_panels && is_array($hidden_panels) && (in_array($module, $hidden_panels) || array_key_exists($module, $hidden_panels))) {
                 //this panel is hidden, skip it
                 continue;
             }
             // make sure the module attribute is set, else none of this works...
             if (!isset($values_array['module'])) {
                 $GLOBALS['log']->debug("SubPanelDefinitions->get_available_tabs(): no module defined in subpaneldefs for '{$key}' =>" . var_export($values_array, true) . " - ingoring subpanel defintion");
                 continue;
             }
             //check permissions.
             $exempt = array_key_exists($values_array['module'], $modules_exempt_from_availability_check);
             $ok = $exempt || (!ACLController::moduleSupportsACL($values_array['module']) || ACLController::checkAccess($values_array['module'], 'list', true));
             $GLOBALS['log']->debug("SubPanelDefinitions->get_available_tabs(): " . $key . "= " . ($exempt ? "exempt " : "not exempt " . ($ok ? " ACL OK" : "")));
             if ($ok) {
                 while (!empty($this->_visible_tabs_array[$values_array['order']])) {
                     $values_array['order']++;
                 }
                 $this->_visible_tabs_array[$values_array['order']] = $FromGetModuleSubpanels ? array($key => $values_array['title_key']) : $key;
             }
         }
     }
     ksort($this->_visible_tabs_array);
     return $this->_visible_tabs_array;
 }
示例#24
0
 function listviewACLHelper()
 {
     $array_assign = parent::listviewACLHelper();
     $is_owner = false;
     if (!empty($this->account_id)) {
         if (!empty($this->account_id_owner)) {
             global $current_user;
             $is_owner = $current_user->id == $this->account_id_owner;
         }
     }
     if (!ACLController::moduleSupportsACL('Accounts') || ACLController::checkAccess('Accounts', 'view', $is_owner)) {
         $array_assign['ACCOUNT'] = 'a';
     } else {
         $array_assign['ACCOUNT'] = 'span';
     }
     return $array_assign;
 }
示例#25
0
 function listviewACLHelper()
 {
     $array_assign = parent::listviewACLHelper();
     $is_owner = false;
     $in_group = false;
     //SECURITY GROUPS
     if (!empty($this->parent_name)) {
         if (!empty($this->parent_name_owner)) {
             global $current_user;
             $is_owner = $current_user->id == $this->parent_name_owner;
         } else {
             if (!empty($this->parent_type) && !empty($this->parent_id)) {
                 global $current_user;
                 $parent_bean = BeanFactory::getBean($this->parent_type, $this->parent_id);
                 if ($parent_bean !== false) {
                     $is_owner = $current_user->id == $parent_bean->assigned_user_id;
                 }
             }
         }
         require_once "modules/SecurityGroups/SecurityGroup.php";
         $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view');
         /* END - SECURITY GROUPS */
     }
     /* BEGIN - SECURITY GROUPS */
     /**
     if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)){
     */
     if (!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)) {
         /* END - SECURITY GROUPS */
         $array_assign['PARENT'] = 'a';
     } else {
         $array_assign['PARENT'] = 'span';
     }
     $is_owner = false;
     $in_group = false;
     //SECURITY GROUPS
     if (!empty($this->contact_name)) {
         if (!empty($this->contact_name_owner)) {
             global $current_user;
             $is_owner = $current_user->id == $this->contact_name_owner;
         } else {
             global $current_user;
             $parent_bean = BeanFactory::getBean('Contacts', $this->contact_id);
             if ($parent_bean !== false) {
                 $is_owner = $current_user->id == $parent_bean->assigned_user_id;
             }
         }
         require_once "modules/SecurityGroups/SecurityGroup.php";
         $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view');
         /* END - SECURITY GROUPS */
     }
     /* BEGIN - SECURITY GROUPS */
     /**
     if( ACLController::checkAccess('Contacts', 'view', $is_owner)){
     */
     if (ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) {
         /* END - SECURITY GROUPS */
         $array_assign['CONTACT'] = 'a';
     } else {
         $array_assign['CONTACT'] = 'span';
     }
     return $array_assign;
 }
示例#26
0
 function get_list_view_data()
 {
     $data = parent::get_list_view_data();
     $delete = '';
     if (ACLController::moduleSupportsACL($data['RELATED_MODULE']) && !ACLController::checkAccess($data['RELATED_MODULE'], 'view', $data['CREATED_BY'] == $GLOBALS['current_user']->id) && !ACLController::checkAccess($data['RELATED_MODULE'], 'list', $data['CREATED_BY'] == $GLOBALS['current_user']->id)) {
         $data['NAME'] = '';
         return $data;
     }
     if (is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id) {
         $delete = get_image($GLOBALS['image_path'] . '/delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'SugarFeed.deleteFeed("' . $data['ID'] . '", "{this.id}")\'');
     }
     $data['NAME'] .= $data['DESCRIPTION'];
     $data['NAME'] = '<div class="list view" style="padding:5px;border-right:none;border-left:none;border-top:none;">' . html_entity_decode($data['NAME']);
     if (!empty($data['LINK_URL'])) {
         $linkClass = SugarFeed::getLinkClass($data['LINK_TYPE']);
         if ($linkClass !== FALSE) {
             $data['NAME'] .= $linkClass->getDisplay($data);
         }
     }
     $data['NAME'] .= '<div class="byLineBox"><span class="byLineLeft">';
     $data['NAME'] .= '&nbsp;</span><div class="byLineRight"> ' . $this->getTimeLapse($data['DATE_ENTERED']) . ' &nbsp;' . $delete . '</div></div>';
     return $data;
 }
示例#27
0
 function listviewACLHelper()
 {
     $array_assign = parent::listviewACLHelper();
     $is_owner = false;
     if (!empty($this->parent_name)) {
         if (!empty($this->parent_name_owner)) {
             global $current_user;
             $is_owner = $current_user->id == $this->parent_name_owner;
         }
     }
     if (!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)) {
         $array_assign['PARENT'] = 'a';
     } else {
         $array_assign['PARENT'] = 'span';
     }
     $is_owner = false;
     if (!empty($this->contact_name)) {
         if (!empty($this->contact_name_owner)) {
             global $current_user;
             $is_owner = $current_user->id == $this->contact_name_owner;
         }
     }
     if (ACLController::checkAccess('Contacts', 'view', $is_owner)) {
         $array_assign['CONTACT'] = 'a';
     } else {
         $array_assign['CONTACT'] = 'span';
     }
     return $array_assign;
 }
 function display($defines)
 {
     global $app_strings;
     global $currentModule;
     $title = $app_strings['LBL_NEW_BUTTON_TITLE'];
     $accesskey = $app_strings['LBL_NEW_BUTTON_KEY'];
     $value = $app_strings['LBL_NEW_BUTTON_LABEL'];
     $this->module = 'Leads';
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input title='{$title}'class='button' type='button' name='button' value='  {$value}  ' disabled/>\n";
         return $button;
     }
     $additionalFormFields = array();
     //from accounts
     if ($defines['focus']->object_name == 'Account') {
         if (isset($defines['focus']->billing_address_street)) {
             $additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street;
         }
         if (isset($defines['focus']->billing_address_city)) {
             $additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city;
         }
         if (isset($defines['focus']->billing_address_state)) {
             $additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state;
         }
         if (isset($defines['focus']->billing_address_country)) {
             $additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country;
         }
         if (isset($defines['focus']->billing_address_postalcode)) {
             $additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode;
         }
         if (isset($defines['focus']->phone_office)) {
             $additionalFormFields['phone_work'] = $defines['focus']->phone_office;
         }
         if (isset($defines['focus']->id)) {
             $additionalFormFields['account_id'] = $defines['focus']->id;
         }
     }
     //from contacts
     if ($defines['focus']->object_name == 'Contact') {
         if (isset($defines['focus']->salutation)) {
             $additionalFormFields['salutation'] = $defines['focus']->salutation;
         }
         if (isset($defines['focus']->first_name)) {
             $additionalFormFields['first_name'] = $defines['focus']->first_name;
         }
         if (isset($defines['focus']->last_name)) {
             $additionalFormFields['last_name'] = $defines['focus']->last_name;
         }
         if (isset($defines['focus']->primary_address_street)) {
             $additionalFormFields['primary_address_street'] = $defines['focus']->primary_address_street;
         }
         if (isset($defines['focus']->primary_address_city)) {
             $additionalFormFields['primary_address_city'] = $defines['focus']->primary_address_city;
         }
         if (isset($defines['focus']->primary_address_state)) {
             $additionalFormFields['primary_address_state'] = $defines['focus']->primary_address_state;
         }
         if (isset($defines['focus']->primary_address_country)) {
             $additionalFormFields['primary_address_country'] = $defines['focus']->primary_address_country;
         }
         if (isset($defines['focus']->primary_address_postalcode)) {
             $additionalFormFields['primary_address_postalcode'] = $defines['focus']->primary_address_postalcode;
         }
         if (isset($defines['focus']->phone_work)) {
             $additionalFormFields['phone_work'] = $defines['focus']->phone_work;
         }
         if (isset($defines['focus']->id)) {
             $additionalFormFields['contact_id'] = $defines['focus']->id;
         }
     }
     //from opportunities
     if ($defines['focus']->object_name == 'Opportunity') {
         if (isset($defines['focus']->id)) {
             $additionalFormFields['opportunity_id'] = $defines['focus']->id;
         }
         if (isset($defines['focus']->account_name)) {
             $additionalFormFields['account_name'] = $defines['focus']->account_name;
         }
         if (isset($defines['focus']->account_id)) {
             $additionalFormFields['account_id'] = $defines['focus']->account_id;
         }
     }
     $button = $this->_get_form($defines, $additionalFormFields);
     $button .= "<input title='{$title}' accesskey='{$accesskey}' class='button' type='submit' name='{$this->getWidgetId()}_button' id='{$this->getWidgetId()}_create_button' value='  {$value}  '/>\n";
     $button .= "</form>";
     return $button;
 }
 function display(&$widget_data)
 {
     global $app_strings;
     $initial_filter = '';
     $this->title = $this->getTitle();
     $this->accesskey = $this->getAccesskey();
     $this->value = $this->getDisplayName();
     if (is_array($this->button_properties)) {
         if (isset($this->button_properties['title'])) {
             $this->title = $app_strings[$this->button_properties['title']];
         }
         if (isset($this->button_properties['accesskey'])) {
             $this->accesskey = $app_strings[$this->button_properties['accesskey']];
         }
         if (isset($this->button_properties['form_value'])) {
             $this->value = $app_strings[$this->button_properties['form_value']];
         }
         if (isset($this->button_properties['module'])) {
             $this->module_name = $this->button_properties['module'];
         }
     }
     $focus = $widget_data['focus'];
     if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) {
         $button = ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" . ' title="' . $this->title . '"' . ' value="' . $this->value . "\"\n" . ' disabled />';
         return $button;
     }
     //refresh the whole page after end of action?
     $refresh_page = 0;
     if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) {
         $refresh_page = 1;
     }
     $subpanel_definition = $widget_data['subpanel_definition'];
     $button_definition = $subpanel_definition->get_buttons();
     $subpanel_name = $subpanel_definition->get_name();
     if (empty($this->module_name)) {
         $this->module_name = $subpanel_definition->get_module_name();
     }
     $link_field_name = $subpanel_definition->get_data_source_name(true);
     $popup_mode = 'Single';
     if (isset($widget_data['mode'])) {
         $popup_mode = $widget_data['mode'];
     }
     if (isset($widget_data['initial_filter_fields'])) {
         if (is_array($widget_data['initial_filter_fields'])) {
             foreach ($widget_data['initial_filter_fields'] as $value => $alias) {
                 if (isset($focus->{$value}) and !empty($focus->{$value})) {
                     $initial_filter .= "&" . $alias . '=' . urlencode($focus->{$value});
                 }
             }
         }
     }
     $create = "true";
     if (isset($widget_data['create'])) {
         $create = $widget_data['create'];
     }
     $return_module = $_REQUEST['module'];
     $return_action = 'SubPanelViewer';
     $return_id = $_REQUEST['record'];
     //field_to_name_array
     $fton_array = array('id' => 'subpanel_id');
     if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) {
         $fton_array = array_merge($fton_array, $widget_data['field_to_name_array']);
     }
     $return_url = "index.php?module={$return_module}&action={$return_action}&subpanel={$subpanel_name}&record={$return_id}&sugar_body_only=1";
     $popup_request_data = array('call_back_function' => 'set_return_and_save_background', 'form_name' => 'DetailView', 'field_to_name_array' => $fton_array, 'passthru_data' => array('child_field' => $subpanel_name, 'return_url' => urlencode($return_url), 'link_field_name' => $link_field_name, 'module_name' => $subpanel_name, 'refresh_page' => $refresh_page));
     if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) {
         $popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']);
     }
     if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) {
         if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') {
             $initial_filter = "&module_name=" . urlencode($widget_data['module']);
         }
     }
     //acl_roles_users_selectuser_button
     $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data);
     return ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" . ' title="' . $this->title . '"' . ' value="' . $this->value . "\"\n" . " onclick='open_popup(\"{$this->module_name}\",600,400,\"{$initial_filter}\",true,true,{$json_encoded_php_array},\"{$popup_mode}\",{$create});' />\n";
 }
示例#30
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