Esempio n. 1
0
 /**
  * @see SugarController::loadBean()
  */
 public function loadBean()
 {
     global $mod_strings;
     if (!isset($_REQUEST['import_module'])) {
         return;
         // there is no module to load
     }
     $this->importModule = $_REQUEST['import_module'];
     $this->bean = BeanFactory::getBean($this->importModule);
     if ($this->bean) {
         if (!$this->bean->importable) {
             $this->bean = false;
         } elseif ($_REQUEST['import_module'] == 'Users' && !is_admin($GLOBALS['current_user'])) {
             $this->bean = false;
         } elseif ($this->bean->bean_implements('ACL')) {
             if (!ACLController::checkAccess($this->bean->module_dir, 'import', true)) {
                 ACLController::displayNoAccess();
                 sugar_die('');
             }
         }
     }
     if (!$this->bean && $this->importModule != "Administration") {
         $_REQUEST['message'] = $mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'];
         $this->view = 'error';
         if (!isset($_REQUEST['import_map_id']) && !isset($_REQUEST['delete_map_id'])) {
             $this->_processed = true;
         }
     } else {
         $GLOBALS['FOCUS'] = $this->bean;
     }
 }
Esempio n. 2
0
 function display()
 {
     ob_start();
     if (isset($GLOBALS['cal_strings'])) {
         return parent::display() . "Only one Calendar dashlet is allowed.";
     }
     require_once 'modules/Calendar/Calendar.php';
     require_once 'modules/Calendar/CalendarDisplay.php';
     require_once "modules/Calendar/CalendarGrid.php";
     global $cal_strings, $current_language;
     $cal_strings = return_module_language($current_language, 'Calendar');
     if (!ACLController::checkAccess('Calendar', 'list', true)) {
         ACLController::displayNoAccess(true);
     }
     $cal = new Calendar($this->view);
     $cal->dashlet = true;
     $cal->add_activities($GLOBALS['current_user']);
     $cal->load_activities();
     $display = new CalendarDisplay($cal, $this->id);
     $display->display_calendar_header(false);
     $display->display();
     $str = ob_get_contents();
     ob_end_clean();
     return parent::display() . $str;
 }
Esempio n. 3
0
 function display()
 {
     global $current_user, $app_strings, $mod_strings;
     $admin = is_admin($current_user) || is_admin_for_module($current_user, 'Reports');
     foreach ($this->data['data'] as $i => $rowData) {
         if (isset($this->data['data'][$i]['IS_PUBLISHED'])) {
             $this->data['data'][$i]['IS_PUBLISHED'] = "<input type='checkbox' ";
             if ($rowData['IS_PUBLISHED'] == 'yes') {
                 $this->data['data'][$i]['IS_PUBLISHED'] .= ' checked ';
             }
             if ($admin) {
                 $this->data['data'][$i]['IS_PUBLISHED'] .= " onclick='location.href=\"index.php?module=Reports&action=index&publish=no&publish_report_id={$rowData['ID']}\";'>";
             } else {
                 $this->data['data'][$i]['IS_PUBLISHED'] .= ' disabled=true>';
             }
         }
         if (isset($this->data['data'][$i]['IS_SCHEDULED'])) {
             $this->data['data'][$i]['IS_SCHEDULED'] = "<a href='#' onclick=\"schedulePOPUP('{$rowData['ID']}'); return false\" class='listViewTdToolsS1'>{$rowData['IS_SCHEDULED_IMG']} {$rowData['IS_SCHEDULED']}</a>";
         }
         if (!isset($this->data['data'][$i]['IS_EDIT'])) {
             if ($this->data['data'][$i]['ASSIGNED_USER_ID'] != $current_user->id || !ACLController::checkAccess('Reports', 'edit', $this->data['data'][$i]['ASSIGNED_USER_ID'])) {
                 $this->data['data'][$i]['IS_EDIT'] = "&nbsp;";
             } else {
                 $this->data['data'][$i]['IS_EDIT'] = "<a title=\"{$app_strings['LBL_EDIT_BUTTON']}\" href=\"index.php?action=ReportsWizard&module=Reports&page=report&record={$rowData['ID']}\">" . SugarThemeRegistry::current()->getImage("edit_inline", '', null, null, ".gif", $mod_strings['LBL_EDIT']) . "</a>";
             }
         }
     }
     $this->ss->assign('act', 'ReportsWizard');
     return parent::display();
 }
 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 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;
 }
Esempio n. 6
0
/**
 * Create HTML form to enter a new record with the minimum necessary fields.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function get_new_record_form()
{
    if (!ACLController::checkAccess('Tasks', 'edit', true)) {
        return '';
    }
    require_once 'include/time.php';
    global $app_strings, $mod_strings, $app_list_strings;
    global $current_user;
    global $theme;
    // Unimplemented until jscalendar language files are fixed
    // global $current_language;
    // global $default_language;
    // global $cal_codes;
    $user_id = $current_user->id;
    $default_status = $mod_strings['LBL_DEFAULT_STATUS'];
    $default_priority = $mod_strings['LBL_DEFAULT_PRIORITY'];
    $default_parent_type = $app_list_strings['record_type_default_key'];
    // Unimplemented until jscalendar language files are fixed
    // $cal_lang = (empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language];
    $cal_lang = "en";
    $cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
    $ntc_time_format = '(' . getDisplayTimeFormat() . ')';
    $ampm = AMPMMenu('', '');
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $the_form .= <<<EOQ
\t\t<form name="TaskSave" onSubmit="return check_form('TaskSave')" method="POST" action="index.php">
\t\t\t<input type="hidden" name="module" value="Tasks">
\t\t\t<input type="hidden" name="record" value="">
\t\t\t<input type="hidden" name="status" value="{$default_status}">
\t\t\t<input type="hidden" name="assigned_user_id" value='{$user_id}'>
\t\t\t<input type="hidden" name="priority" value="{$default_priority}">
\t\t\t<input type="hidden" name="parent_type" value="{$default_parent_type}">
\t\t\t<input type="hidden" name="action" value="Save">
\t\t\t<input type="hidden" name="date_due_flag">
\t\t<p>{$mod_strings['LBL_NEW_FORM_SUBJECT']} <span class="required">{$app_strings['LBL_REQUIRED_SYMBOL']}</span><br>
\t\t<input name='name' type="text" value=""><br>
\t\t{$mod_strings['LBL_NEW_FORM_DUE_DATE']}&nbsp;<span class="dateFormat">{$app_strings['NTC_DATE_FORMAT']}</span><br>
\t\t<input name='date_due' maxlength="10" onblur="parseDate(this, '{$cal_dateformat}');" id='jscal_field' type="text" value=""> <img src="themes/{$theme}/images/jscalendar.gif" alt="{$app_strings['LBL_ENTER_DATE']}"  id="jscal_trigger" align="absmiddle"><br>
\t\t{$mod_strings['LBL_NEW_FORM_DUE_TIME']}&nbsp;<span class="dateFormat">{$ntc_time_format}</span><br>
\t\t<input name='time_due' maxlength='5' type="text">&nbsp;{$ampm}</p>
\t\t<p><input title="{$app_strings['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$app_strings['LBL_SAVE_BUTTON_KEY']}" class="button" type="submit" name="button" value="{$app_strings['LBL_SAVE_BUTTON_LABEL']}" ></p>
\t\t</form>
\t\t<script type="text/javascript">
\t\tCalendar.setup ({
\t\t\tinputField : "jscal_field", ifFormat : "{$cal_dateformat}", showsTime : false, button : "jscal_trigger", singleClick : true, step : 1
\t\t});
\t\t</script>
EOQ;
    require_once 'include/javascript/javascript.php';
    require_once 'modules/Tasks/Task.php';
    $javascript = new javascript();
    $javascript->setFormName('TaskSave');
    $javascript->setSugarBean(new Task());
    $javascript->addRequiredFields('');
    $javascript->addField('date_due', false, '');
    $javascript->addField('time_due', false, '');
    $the_form .= $javascript->getScript();
    $the_form .= get_left_form_footer();
    return $the_form;
}
    function getForm($prefix, $mod = '')
    {
        if (!ACLController::checkAccess('Notes', 'edit', true)) {
            return '';
        }
        if (!empty($mod)) {
            global $current_language;
            $mod_strings = return_module_language($current_language, $mod);
        } else {
            global $mod_strings;
        }
        global $app_strings;
        global $app_list_strings;
        $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
        $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
        $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
        $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
        $the_form .= <<<EOQ

\t\t\t<form name="{$prefix}NoteSave" onSubmit="return check_form('{$prefix}NoteSave')" method="POST" action="index.php">
\t\t\t\t<input type="hidden" name="{$prefix}module" value="Notes">
\t\t\t\t<input type="hidden" name="{$prefix}action" value="Save">
EOQ;
        $the_form .= $this->getFormBody($prefix, $mod, "{$prefix}NoteSave", "20");
        $the_form .= <<<EOQ
\t\t\t<p><input title="{$lbl_save_button_title}" accessKey="{$lbl_save_button_key}" class="button" type="submit" name="button" value="  {$lbl_save_button_label}  " ></p>
\t\t\t</form>

EOQ;
        $the_form .= get_left_form_footer();
        $the_form .= get_validate_record_js();
        return $the_form;
    }
Esempio n. 8
0
 /**
  * display
  * Override the display method to support customization for the buttons that display
  * a popup and allow you to copy the account's address into the selected contacts.
  * The custom_code_billing and custom_code_shipping Smarty variables are found in
  * include/SugarFields/Fields/Address/DetailView.tpl (default).  If it's a English U.S.
  * locale then it'll use file include/SugarFields/Fields/Address/en_us.DetailView.tpl.
  */
 function display()
 {
     if (empty($this->bean->id)) {
         global $app_strings;
         sugar_die($app_strings['ERROR_NO_RECORD']);
     }
     require_once 'modules/AOS_PDF_Templates/formLetter.php';
     formLetter::DVPopupHtml('Accounts');
     $this->dv->process();
     global $mod_strings;
     if (ACLController::checkAccess('Contacts', 'edit', true)) {
         $push_billing = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] . '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' . $this->bean->name . '&html=change_address' . '&primary_address_street=' . str_replace(array("\rn", "\r", "\n"), array('', '', '<br>'), urlencode($this->bean->billing_address_street)) . '&primary_address_city=' . $this->bean->billing_address_city . '&primary_address_state=' . $this->bean->billing_address_state . '&primary_address_postalcode=' . $this->bean->billing_address_postalcode . '&primary_address_country=' . $this->bean->billing_address_country . '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE'] . '">';
         $push_shipping = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] . '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' . $this->bean->name . '&html=change_address' . '&primary_address_street=' . str_replace(array("\rn", "\r", "\n"), array('', '', '<br>'), urlencode($this->bean->shipping_address_street)) . '&primary_address_city=' . $this->bean->shipping_address_city . '&primary_address_state=' . $this->bean->shipping_address_state . '&primary_address_postalcode=' . $this->bean->shipping_address_postalcode . '&primary_address_country=' . $this->bean->shipping_address_country . '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE'] . '">';
     } else {
         $push_billing = '';
         $push_shipping = '';
     }
     $this->ss->assign("custom_code_billing", $push_billing);
     $this->ss->assign("custom_code_shipping", $push_shipping);
     if (empty($this->bean->id)) {
         global $app_strings;
         sugar_die($app_strings['ERROR_NO_RECORD']);
     }
     echo $this->dv->display();
 }
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");
}
Esempio n. 10
0
 public function preDisplay()
 {
     parent::preDisplay();
     if (ACLController::checkAccess('KBDocuments', 'edit', true)) {
         array_push($this->dv->defs['templateMeta']['form']['buttons'], array('customCode' => '<input title="{$MOD.LBL_CREATE_KB_DOCUMENT}" accessKey="M" class="button" onclick="this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\';" type="submit" name="button" value="{$MOD.LBL_CREATE_KB_DOCUMENT}">', 'sugar_html' => array('type' => 'submit', 'value' => '{$MOD.LBL_CREATE_KB_DOCUMENT}', 'htmlOptions' => array('title' => '{$MOD.LBL_CREATE_KB_DOCUMENT}', 'accessKey' => 'M', 'class' => 'button', 'onclick' => 'this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\';', 'name' => 'button'))));
     }
     $this->dv->th->deleteTemplate($this->dv->module, $this->dv->view);
 }
Esempio n. 11
0
/**
 * Create HTML form to enter a new record with the minimum necessary fields.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function get_new_record_form()
{
    if (!ACLController::checkAccess('Bugs', 'edit', true)) {
        return '';
    }
    global $mod_strings;
    global $app_strings;
    global $app_list_strings;
    global $mod_strings;
    global $theme;
    global $current_user;
    $seedRelease = new Release();
    $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
    $lbl_default_status = $app_list_strings['bug_status_default_key'];
    $lbl_subject = $mod_strings['LBL_SUBJECT'];
    $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
    $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
    $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
    $user_id = $current_user->id;
    $priority_options = get_select_options_with_id($app_list_strings['bug_priority_dom'], $app_list_strings['bug_priority_default_key']);
    $release_options = get_select_options_with_id($seedRelease->get_releases(TRUE, "Active"), "");
    $type_options = get_select_options_with_id($app_list_strings['bug_type_dom'], $app_list_strings['bug_type_default_key']);
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $the_form .= <<<EOQ

\t\t<form name="BugSave" onSubmit="return check_form('BugSave')" method="POST" action="index.php">
\t\t\t<input type="hidden" name="module" value="Bugs">
\t\t\t<input type="hidden" name="record" value="">

\t\t\t<input type="hidden" name="status" value="{$lbl_default_status}">
\t\t\t<input type="hidden" name="assigned_user_id" value='{$user_id}'>
\t\t\t<input type="hidden" name="action" value="Save">




\t\t{$lbl_subject}&nbsp;<span class="required">{$lbl_required_symbol}</span><br>
\t\t<p><input name='name' type="text" size='20' maxlength="255"value=""><br>
 \t\t{$mod_strings['LBL_TYPE']}&nbsp;<br>
\t\t<select name='type' >{$type_options}</select><br>
\t\t{$mod_strings['LBL_RELEASE']}&nbsp;<br>
\t\t<select name='found_in_release' >{$release_options}</select><br>
\t\t{$mod_strings['LBL_PRIORITY']}&nbsp;<br>
\t\t<select name='priority' >{$priority_options}</select>
</p><p>\t\t<input title="{$lbl_save_button_title}" accessKey="{$lbl_save_button_key}" class="button" type="submit" name="button" value="  {$lbl_save_button_label}  " ></p>

\t\t</form>
EOQ;
    require_once 'include/javascript/javascript.php';
    require_once 'modules/Bugs/Bug.php';
    $javascript = new javascript();
    $javascript->setFormName('BugSave');
    $javascript->setSugarBean(new Bug());
    $javascript->addRequiredFields('');
    $the_form .= $javascript->getScript();
    $the_form .= get_left_form_footer();
    return $the_form;
}
 public function checkAccess($thisReport)
 {
     global $current_user;
     require_once 'modules/ACL/ACLController.php';
     if (ACLController::checkAccess('KReports', 'export', false)) {
         return true;
     } else {
         return false;
     }
 }
 function buildExportLink($id = 'export_link')
 {
     $script = "";
     if (ACLController::checkAccess($this->seed->module_dir, 'export', true)) {
         if ($this->export) {
             $script = parent::buildExportLink($id);
         }
     }
     return $script . formLetter::LVSmarty();
 }
Esempio n. 14
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;
 }
Esempio n. 15
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;
 }
Esempio n. 16
0
 function buildExportLink($id = 'export_link')
 {
     global $app_strings;
     global $sugar_config;
     $script = "";
     if (ACLController::checkAccess($this->seed->module_dir, 'export', true)) {
         if ($this->export) {
             $script = parent::buildExportLink($id);
         }
     }
     $script .= "<a href='javascript:void(0)' id='map_listview_top' " . " onclick=\"return sListView.send_form(true, 'jjwg_Maps', " . "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', " . "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_MAP']}</a>";
     return formLetter::LVSmarty() . $script;
 }
Esempio n. 17
0
 /**
  * adds a menu item to the current contextMenu
  * 
  * @param string $text text of the item
  * @param string $action function or pointer to the javascript function to call
  * @param array $params other parameters includes:
  *      url - The URL for the MenuItem's anchor's "href" attribute.
  *      target - The value to be used for the MenuItem's anchor's "target" attribute.
  *      helptext - Additional instructional text to accompany the text for a MenuItem. Example: If the text is 
  *                 "Copy" you might want to add the help text "Ctrl + C" to inform the user there is a keyboard
  *                 shortcut for the item.
  *      emphasis - If set to true the text for the MenuItem will be rendered with emphasis (using <em>).
  *      strongemphasis - If set to true the text for the MenuItem will be rendered with strong emphasis (using <strong>).
  *      disabled - If set to true the MenuItem will be dimmed and will not respond to user input or fire events.
  *      selected - If set to true the MenuItem will be highlighted.
  *      submenu - Appends / removes a menu (and it's associated DOM elements) to / from the MenuItem.
  *      checked - If set to true the MenuItem will be rendered with a checkmark.
  */
 function addMenuItem($text, $action, $module = null, $aclAction = null, $params = null)
 {
     // check ACLs if module and aclAction set otherwise no ACL check
     if (!empty($module) && !empty($aclAction) && ACLController::checkAccess($module, $aclAction) || (empty($module) || empty($aclAction))) {
         $item = array('text' => translate($text), 'action' => $action);
         foreach (array('url', 'target', 'helptext', 'emphasis', 'strongemphasis', 'disabled', 'selected', 'submenu', 'checked') as $param) {
             if (!empty($params[$param])) {
                 $item[$param] = $params[$param];
             }
         }
         array_push($this->menuItems, $item);
     }
 }
 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;
     }
 }
Esempio n. 19
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 getDropDownDiv($tpl = 'modules/Home/UnifiedSearchAdvanced.tpl')
 {
     global $app_list_strings;
     if (!file_exists('cache/modules/unified_search_modules.php')) {
         $this->buildCache();
     }
     include 'cache/modules/unified_search_modules.php';
     global $mod_strings, $modListHeader, $app_list_strings, $current_user, $app_strings, $image_path, $beanList;
     $users_modules = $current_user->getPreference('globalSearch', 'search');
     if (!isset($users_modules)) {
         // preferences are empty, select all
         $users_modules = array();
         foreach ($unified_search_modules as $module => $data) {
             $users_modules[$module] = $beanList[$module];
         }
         $current_user->setPreference('globalSearch', $users_modules, 0, 'search');
     }
     $sugar_smarty = new Sugar_Smarty();
     $modules_to_search = array();
     foreach ($unified_search_modules as $module => $data) {
         if (array_key_exists($module, $modListHeader)) {
             if (ACLController::checkAccess($module, 'list')) {
                 $modules_to_search[$module] = array('translated' => $app_list_strings['moduleList'][$module]);
                 if (array_key_exists($module, $users_modules)) {
                     $modules_to_search[$module]['checked'] = true;
                 } else {
                     $modules_to_search[$module]['checked'] = false;
                 }
             }
         }
     }
     if (!empty($_REQUEST['query_string'])) {
         $sugar_smarty->assign('query_string', $_REQUEST['query_string']);
     } else {
         $sugar_smarty->assign('query_string', '');
     }
     $sugar_smarty->assign('IMAGE_PATH', $image_path);
     if (file_exists($image_path . 'searchButton.gif')) {
         $sugar_smarty->assign('USE_SEARCH_GIF', 1);
         $sugar_smarty->assign('LBL_SEARCH_BUTTON_LABEL', $app_strings['LBL_SEARCH_BUTTON_LABEL']);
     } else {
         $sugar_smarty->assign('USE_SEARCH_GIF', 0);
         $sugar_smarty->assign('LBL_SEARCH_BUTTON_LABEL', $app_strings['LBL_GO_BUTTON_LABEL']);
     }
     $sugar_smarty->assign('MODULES_TO_SEARCH', $modules_to_search);
     $sugar_smarty->debugging = true;
     return $sugar_smarty->fetch($tpl);
 }
 function display(&$widget_data)
 {
     /*
      * i.dymovsky
      * Because when user role can't edit Accounts, it also can't edit Membership Organizations. Select button leads to change MO list
      * See bug 25633
      * Bug25633 code change start
      */
     if (!ACLController::checkAccess($widget_data["module"], "edit", true)) {
         return;
     }
     /*
      * Bug25633 code change end
      */
     return parent::display($widget_data);
 }
 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;
 }
Esempio n. 26
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $beanFiles;
     require_once $beanFiles['Project'];
     $focus = BeanFactory::getBean('Project', $_REQUEST['record']);
     global $app_list_strings, $current_user, $mod_strings;
     $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
     if ($current_user->id == $focus->assigned_user_id || $current_user->is_admin) {
         $this->ss->assign('OWNER_ONLY', true);
     } else {
         $this->ss->assign('OWNER_ONLY', false);
     }
     if (ACLController::checkAccess('ProjectTask', 'edit', true)) {
         $this->ss->assign('EDIT_RIGHTS_ONLY', true);
     } else {
         $this->ss->assign('EDIT_RIGHTS_ONLY', false);
     }
     $this->ss->assign('SAVE_AS', $mod_strings['LBL_SAVE_AS_TEMPLATE']);
     $this->ss->assign("IS_TEMPLATE", 0);
     parent::display();
 }
 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;
 }
Esempio n. 28
0
/**
 * Returns the bean object of the given module
 *
 * @param  string $module
 * @return object
 */
function loadImportBean($module)
{
    $focus = loadBean($module);
    if ($focus) {
        if (!$focus->importable) {
            return false;
        }
        if ($module == 'Users' && !is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) {
            return false;
        }
        if ($focus->bean_implements('ACL')) {
            if (!ACLController::checkAccess($focus->module_dir, 'import', true)) {
                ACLController::displayNoAccess();
                sugar_die('');
            }
        }
    } else {
        return false;
    }
    return $focus;
}
Esempio n. 29
0
function get_new_record_form()
{
    if (!ACLController::checkAccess('ProjectTask', 'edit', true)) {
        return '';
    }
    global $app_strings;
    global $mod_strings;
    global $currentModule;
    global $current_user;
    global $sugar_version, $sugar_config;
    $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
    $form = new XTemplate('modules/ProjectTask/Forms.html');
    $module_select = empty($_REQUEST['module_select']) ? '' : $_REQUEST['module_select'];
    $form->assign('mod', $mod_strings);
    $form->assign('app', $app_strings);
    $form->assign('module', $currentModule);
    $options = get_select_options_with_id(get_user_array(), $current_user->id);
    $form->assign('ASSIGNED_USER_OPTIONS', $options);
    ///////////////////////////////////////
    ///
    /// SETUP ACCOUNT POPUP
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => "quick_save", 'field_to_name_array' => array('id' => 'parent_id', 'name' => 'project_name'));
    $json = getJSONobj();
    $encoded_popup_request_data = $json->encode($popup_request_data);
    //
    ///////////////////////////////////////
    $form->assign('encoded_popup_request_data', $encoded_popup_request_data);
    $form->parse('main');
    $the_form .= $form->text('main');
    require_once 'modules/ProjectTask/ProjectTask.php';
    $focus = new ProjectTask();
    require_once 'include/javascript/javascript.php';
    $javascript = new javascript();
    $javascript->setFormName('quick_save');
    $javascript->setSugarBean($focus);
    $javascript->addRequiredFields('');
    $jscript = $javascript->getScript();
    $the_form .= $jscript . get_left_form_footer();
    return $the_form;
}
 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;
 }