function display()
 {
     global $beanList, $beanFiles;
     if ($this->action == 'AjaxFormSave') {
         echo "<a href='index.php?action=DetailView&module=" . $this->module . "&record=" . $this->bean->id . "'>" . $this->bean->id . "</a>";
     } else {
         if (!empty($_REQUEST['modules'])) {
             $js_array = 'Array(';
             $count = count($_REQUEST['modules']);
             $index = 1;
             foreach ($_REQUEST['modules'] as $module) {
                 $js_array .= "'form_" . $module . "'";
                 if ($index < $count) {
                     $js_array .= ',';
                 }
                 $index++;
             }
             $js_array .= ');';
             echo "<script language='javascript'>var ajaxFormArray = new " . $js_array . "</script>";
             if ($count > 1) {
                 echo '<input type="button" class="button" value="Save All" id=\'ajaxsaveall\' onclick="return saveForms(\'Saving...\', \'Save Complete\');"/>';
             }
             foreach ($_REQUEST['modules'] as $module) {
                 $bean = $beanList[$module];
                 require_once $beanFiles[$bean];
                 $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $module);
                 $ev = new EditView($module);
                 $ev->process();
                 echo "<div id='multiedit_form_" . $module . "'>";
                 echo $ev->display(true, true);
                 echo "</div>";
             }
         }
     }
 }
Exemple #2
0
 function process()
 {
     global $current_user, $timedate;
     parent::process();
     $this->ss->assign('ASSIGNED_USER_ID', $current_user->id);
     $this->ss->assign('TEAM_ID', $current_user->default_team);
     $this->ss->assign('REQUEST', array_merge($_GET, $_POST));
     $this->ss->assign('CALENDAR_LANG', "en");
     $date_format = $timedate->get_cal_date_format();
     $this->ss->assign('USER_DATEFORMAT', '(' . $timedate->get_user_date_format() . ')');
     $this->ss->assign('CALENDAR_DATEFORMAT', $date_format);
     $time_format = $timedate->get_user_time_format();
     $time_separator = ":";
     if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
         $time_separator = $match[1];
     }
     $t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
     if (!isset($match[2]) || $match[2] == '') {
         $this->ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
     } else {
         $pm = $match[2] == "pm" ? "%P" : "%p";
         $this->ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
     }
     $this->ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
 }
 /**
  * If this is an existing attribute, do not allow changing of the attributeName
  */
 protected function resolveElementInformationDuringFormLayoutRender(&$elementInformation)
 {
     parent::resolveElementInformationDuringFormLayoutRender($elementInformation);
     if (!empty($this->model->attributeName) && $elementInformation['attributeName'] != 'null' && $elementInformation['attributeName'] != null && $this->model->canUpdateAttributeProperty($elementInformation['attributeName']) == false) {
         $elementInformation['disabled'] = true;
     }
 }
 protected function renderAfterFormLayout($form)
 {
     parent::renderAfterFormLayout($form);
     $formId = static::getFormId();
     // Begin Not Coding Standard
     Yii::app()->clientScript->registerScript('emailModalSubmitOnEnter', "\$('input').keypress(function(event) {\n                                                    if (event.which == 13) {\n                                                       \$('#{$formId}').find('.form-toolbar').find('a:first').click();\n                                                    }\n                                                });");
     // End Not Coding Standard
 }
Exemple #5
0
 protected function renderRightSideFormLayoutForEdit($form)
 {
     assert('$form instanceof ZurmoActiveForm');
     $content = parent::renderRightSideFormLayoutForEdit($form);
     $content .= "<h3>" . Zurmo::t('Core', 'Quick Tip') . '</h3>';
     $content .= ZurmoHtml::tag('p', array(), Zurmo::t('UsersModule', 'Users cannot be deleted. You can however change their status to inactive.'));
     return $content;
 }
Exemple #6
0
    public function render($isLoggedIn, LoginView $v, DateTimeView $dtv, RegistrationView $r, EditView $ev, ViewEntryView $vev)
    {
        ?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>The Initiative for Procrastination</title>
    <link rel="stylesheet" type="text/css" href="css/stylesheet.css"/>
  </head>
  <body>
    <h1 id="headline">The Initiative for Procrastination</h1>
    <?php 
        if ($isLoggedIn) {
            echo "<h2>Logged in</h2>";
            if ($ev->clickedNewEntry()) {
                echo $ev->getStartLink();
            } elseif ($v->userWantsToView()) {
                echo $vev->getStartLink();
            } else {
                echo $ev->getEntryLink();
            }
        } else {
            echo "<h2>Not logged in</h2>";
            if ($r->clickedRegister()) {
                echo $r->getLoginLink();
            } elseif (!$isLoggedIn) {
                echo $r->getRegLink();
            }
        }
        ?>
    <div class="container" >
      <?php 
        if ($r->clickedRegister() && $r->regSuccess() === false) {
            echo $r->response();
        } elseif ($ev->clickedNewEntry() && $ev->saveSuccess() === false && $isLoggedIn) {
            echo $ev->response();
        } elseif ($v->userWantsToView() && $v->clickedMenuItem() === true) {
            echo $vev->response();
        } else {
            if ($isLoggedIn) {
                echo $v->response();
                echo $v->getMenu();
                echo $v->getLogoutButton();
            }
            echo $v->response();
        }
        $dtv->show();
        ?>
    </div>

    <div>
      <em>This site uses cookies to improve user experience. By continuing to browse the site you are agreeing to our use of cookies.</em>
    </div>
   </body>
</html>
<?php 
    }
 function process()
 {
     global $current_user, $timedate;
     parent::process();
     $this->ss->assign('ASSIGNED_USER_ID', $current_user->id);
     $this->ss->assign('REQUEST', array_merge($_GET, $_POST));
     $this->ss->assign('CALENDAR_LANG', "en");
     $this->ss->assign('USER_DATEFORMAT', '(' . $timedate->get_user_date_format() . ')');
     $this->ss->assign('CALENDAR_DATEFORMAT', $timedate->get_cal_date_format());
 }
 /**
  * Create new currency
  * Create fake Opportunity with created currency
  * Try to get select for currency field and assert that new currency is selected
  * 
  * @return void
  * @group 48570
  */
 public function testCurrencySelect()
 {
     $currency = new Currency();
     $currency->iso4217 = 'EUR';
     $currency->name = 'Euro';
     $currency->symbol = 'E';
     $currency->conversion_rate = 1.5;
     $currency->status = 'Active';
     $currency->save();
     $focus = new Opportunity();
     $focus->id = __CLASS__;
     $focus->currency_id = $currency->id;
     $focus->team_id = '1';
     $editView = new EditView();
     $editView->showVCRControl = false;
     $editView->view = 'EditView';
     $editView->setup('Opportunities', $focus);
     $editView->process();
     $currency->mark_deleted($currency->id);
     $this->assertRegExp('/<option value="' . $focus->currency_id . '" selected>/sim', $editView->fieldDefs['currency_id']['value'], 'No selected option here');
 }
 protected function renderRightSideFormLayoutForEdit($form)
 {
     assert('$form instanceof ZurmoActiveForm');
     $content = parent::renderRightSideFormLayoutForEdit($form);
     $content .= "<h3>" . Zurmo::t('ZurmoModule', 'Rights and Permissions') . '</h3><div id="owner-box">';
     $element = new UserElement($this->getModel(), 'owner', $form);
     $element->editableTemplate = '{label}{content}{error}';
     $content .= $element->render() . '</div>';
     $element = new DerivedExplicitReadWriteModelPermissionsElement($this->getModel(), 'null', $form);
     $element->editableTemplate = '{label}{content}{error}';
     $content .= $element->render();
     return $content;
 }
 protected function renderAfterFormLayout($form)
 {
     parent::renderAfterFormLayout($form);
     $automaticMappingDisabled = OpportunitiesModule::isAutomaticProbabilityMappingDisabled();
     if ($automaticMappingDisabled === false) {
         $this->registerStageToProbabilityMappingScript($form);
     }
 }
Exemple #11
0
 /**
  * Renders the QuickCreate form from Smarty and returns HTML
  * @param array $vars request variable global
  * @param object $email Fetched email object
  * @param bool $addToAddressBook
  * @return array
  */
 function getQuickCreateForm($vars, $email, $addToAddressBookButton = false)
 {
     require_once "include/EditView/EditView2.php";
     global $app_strings;
     global $mod_strings;
     global $current_user;
     global $beanList;
     global $beanFiles;
     global $current_language;
     //Setup the current module languge
     $mod_strings = return_module_language($current_language, $_REQUEST['qc_module']);
     $bean = $beanList[$_REQUEST['qc_module']];
     $class = $beanFiles[$bean];
     require_once $class;
     $focus = new $bean();
     $people = array('Contact', 'Lead');
     $emailAddress = array();
     // people
     if (in_array($bean, $people)) {
         // lead specific
         $focus->lead_source = 'Email';
         $focus->lead_source_description = trim($email->name);
         $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr;
         if (isset($_REQUEST['sugarEmail']) && !empty($_REQUEST['sugarEmail'])) {
             if ($email->status == "sent") {
                 $from = isset($email->to_addrs_names) && !empty($email->to_addrs_names) ? $email->to_addrs_names : $email->to_addrs;
             } else {
                 $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr_name;
             }
         }
         $name = explode(" ", trim($from));
         $address = trim(array_pop($name));
         $address = str_replace(array("<", ">", "&lt;", "&gt;"), "", $address);
         $emailAddress[] = array('email_address' => $address, 'primary_address' => 1, 'invalid_email' => 0, 'opt_out' => 0, 'reply_to_address' => 1);
         $focus->email1 = $address;
         if (!empty($name)) {
             $focus->last_name = trim(array_pop($name));
             foreach ($name as $first) {
                 if (!empty($focus->first_name)) {
                     $focus->first_name .= " ";
                 }
                 $focus->first_name .= trim($first);
             }
         }
     } else {
         // bugs, cases, tasks
         $focus->name = trim($email->name);
     }
     $focus->description = trim(strip_tags($email->description));
     $focus->assigned_user_id = $current_user->id;
     $EditView = new EditView();
     $EditView->ss = new Sugar_Smarty();
     //MFH BUG#20283 - checks for custom quickcreate fields
     $EditView->setup($_REQUEST['qc_module'], $focus, 'custom/modules/' . $focus->module_dir . '/metadata/editviewdefs.php', 'include/EditView/EditView.tpl');
     $EditView->process();
     $EditView->render();
     $EditView->defs['templateMeta']['form']['buttons'] = array('email2save' => array('id' => 'e2AjaxSave', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(false);" />'), 'email2saveandreply' => array('id' => 'e2SaveAndReply', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_SAVE_AND_REPLY'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(\'reply\');" />'), 'email2cancel' => array('id' => 'e2cancel', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_CANCEL'] . '   " onclick="SUGAR.email2.detailView.quickCreateDialog.hide();" />'));
     if ($addToAddressBookButton) {
         $EditView->defs['templateMeta']['form']['buttons']['email2saveAddToAddressBook'] = array('id' => 'e2addToAddressBook', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_ADDRESS_BOOK_SAVE_AND_ADD'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(true);" />');
     }
     //Get the module language for javascript
     if (!is_file(sugar_cached('jsLanguage/') . $_REQUEST['qc_module'] . '/' . $GLOBALS['current_language'] . '.js')) {
         require_once 'include/language/jsLanguage.php';
         jsLanguage::createModuleStringsCache($_REQUEST['qc_module'], $GLOBALS['current_language']);
     }
     $jsLanguage = getVersionedScript("cache/jsLanguage/{$_REQUEST['qc_module']}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']);
     $EditView->view = 'EmailQCView';
     $EditView->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
     $EditView->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
     $meta = array();
     $meta['html'] = $jsLanguage . $EditView->display(false, true);
     $meta['html'] = str_replace("src='" . getVersionedPath('include/SugarEmailAddress/SugarEmailAddress.js') . "'", '', $meta['html']);
     $meta['emailAddress'] = $emailAddress;
     $mod_strings = return_module_language($current_language, 'Emails');
     return $meta;
 }
Exemple #12
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     if (!empty($_REQUEST['handle']) && $_REQUEST['handle'] == 'save') {
         return $this->handleSave();
     }
     global $beanList;
     // get the EditView defs to check if opportunity_name exists, for a check below for populating data
     $opportunityNameInLayout = false;
     $editviewFile = 'modules/Leads/metadata/editviewdefs.php';
     $this->medataDataFile = $editviewFile;
     if (file_exists("custom/{$editviewFile}")) {
         $this->medataDataFile = "custom/{$editviewFile}";
     }
     include $this->medataDataFile;
     foreach ($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section) {
         foreach ($section as $row_array) {
             foreach ($row_array as $cell) {
                 if (isset($cell['name']) && $cell['name'] == 'opportunity_name') {
                     $opportunityNameInLayout = true;
                 }
             }
         }
     }
     $this->medataDataFile = $this->fileName;
     if (file_exists("custom/{$this->fileName}")) {
         $this->medataDataFile = "custom/{$this->fileName}";
     }
     $this->loadDefs();
     $this->getRecord();
     $this->checkForDuplicates($this->focus);
     $smarty = new Sugar_Smarty();
     $ev = new EditView();
     $ev->ss = $smarty;
     $ev->view = "ConvertLead";
     echo $this->getModuleTitle();
     require_once "include/QuickSearchDefaults.php";
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     /*
      * Setup filter for Account/Contact popup picker
      */
     $filter = '';
     // Check if Lead has an account set
     if (!empty($this->focus->account_name)) {
         $filter .= '&name_advanced=' . urlencode($this->focus->account_name);
     }
     // Check if Lead First name is available
     if (!empty($this->focus->first_name)) {
         $filter .= '&first_name_advanced=' . urlencode($this->focus->first_name);
     }
     // Lead Last Name is always available
     $filter .= '&last_name_advanced=' . urlencode($this->focus->last_name);
     $smarty->assign('initialFilter', $filter);
     $smarty->assign('displayParams', array('initial_filter' => '{$initialFilter}'));
     $relatedFields = $this->contact->get_related_fields();
     $selectFields = array();
     foreach ($this->defs as $moduleName => $mDefs) {
         if (!empty($mDefs[$ev->view]['select']) && !empty($relatedFields[$mDefs[$ev->view]['select']])) {
             $selectFields[$moduleName] = $mDefs[$ev->view]['select'];
             continue;
         }
         foreach ($relatedFields as $fDef) {
             if (!empty($fDef['link']) && !empty($fDef['module']) && $fDef['module'] == $moduleName) {
                 $selectFields[$moduleName] = $fDef['name'];
                 break;
             }
         }
     }
     $smarty->assign('selectFields', $selectFields);
     $smarty->assign("contact_def", $this->contact->field_defs);
     $smarty->assign("form_name", "ConvertLead");
     $smarty->assign("form_id", "ConvertLead");
     $smarty->assign("module", "Leads");
     $smarty->assign("view", "convertlead");
     $smarty->assign("bean", $this->focus);
     $smarty->assign("record_id", $this->focus->id);
     global $mod_strings;
     $smarty->assign('MOD', $mod_strings);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     global $sugar_config, $app_list_strings, $app_strings;
     $smarty->assign('lead_conv_activity_opt', $sugar_config['lead_conv_activity_opt']);
     //Switch up list depending on copy or move
     if ($sugar_config['lead_conv_activity_opt'] == 'move') {
         $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('None' => $app_strings['LBL_NONE'], 'Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
     } else {
         if ($sugar_config['lead_conv_activity_opt'] == 'copy') {
             $smarty->assign('convertModuleListOptions', get_select_options_with_id(array('Contacts' => $app_list_strings["moduleListSingular"]['Contacts']), ''));
         }
     }
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         // skip if we aren't allowed to save this bean
         if (!$focus->ACLAccess('save')) {
             continue;
         }
         $focus->fill_in_additional_detail_fields();
         foreach ($focus->field_defs as $field => $def) {
             if (isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData']) {
                 if ($module == "Accounts" && $field == 'name') {
                     $focus->name = $this->focus->account_name;
                 } else {
                     if ($module == "Opportunities" && $field == 'amount') {
                         $focus->amount = unformat_number($this->focus->opportunity_amount);
                     } else {
                         if ($module == "Opportunities" && $field == 'name') {
                             if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)) {
                                 $focus->name = $this->focus->opportunity_name;
                             }
                         } else {
                             if ($field == "id") {
                                 //If it is not a contact, don't copy the ID from the lead
                                 if ($module == "Contacts") {
                                     $focus->{$field} = $this->focus->{$field};
                                 }
                             } else {
                                 if (is_a($focus, "Company") && $field == 'phone_office') {
                                     //Special case where company and person have the same field with a different name
                                     $focus->phone_office = $this->focus->phone_work;
                                 } else {
                                     if (strpos($field, "billing_address") !== false && $focus->field_defs[$field]["type"] == "varchar") {
                                         $tmp_field = str_replace("billing_", "primary_", $field);
                                         $focus->field_defs[$field]["type"] = "text";
                                         if (isset($this->focus->{$tmp_field})) {
                                             $focus->{$field} = $this->focus->{$tmp_field};
                                         }
                                     } else {
                                         if (strpos($field, "shipping_address") !== false && $focus->field_defs[$field]["type"] == "varchar") {
                                             $tmp_field = str_replace("shipping_", "primary_", $field);
                                             if (isset($this->focus->{$tmp_field})) {
                                                 $focus->{$field} = $this->focus->{$tmp_field};
                                             }
                                             $focus->field_defs[$field]["type"] = "text";
                                         } else {
                                             if (isset($this->focus->{$field})) {
                                                 $focus->{$field} = $this->focus->{$field};
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //Copy over email data
         $ev->setup($module, $focus, $this->medataDataFile, "modules/Leads/tpls/ConvertLead.tpl", false);
         $ev->process();
         echo $ev->display(false);
         echo $this->getValidationJS($module, $focus, $vdef[$ev->view]);
     }
     echo "</div>";
     echo $qsd->getQSScriptsJSONAlreadyDefined();
     // need to re-assign bean as it gets overridden by $ev->display
     $smarty->assign("bean", $this->focus);
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
 }
Exemple #13
0
 function display()
 {
     $this->ev->process();
     echo $this->ev->display($this->showTitle);
 }
Exemple #14
0
 public function __construct()
 {
     self::$sessionSaveLocation = Settings::MESSAGE_SESSION_NAME . Settings::APP_SESSION_NAME;
     self::$userSaveLocation = Settings::USER_SESSION_NAME . Settings::APP_SESSION_NAME;
 }
<?php

require_once '../../views/_secureHead.php';
require_once '../../models/_edit.php';
if (isset($sessionManager) && $sessionManager->getUserType() == 'ADMIN') {
    require_once 'usertypes.php';
    $id = request_isset('id');
    $userManager = new UserManager();
    $record = $userManager->getRecord($id);
    $page_title = 'Edit | Manage users';
    // build edit view
    $editView = new EditView('Edit', 'update_by_id', $id);
    $editView->addOptionBox('user_type', 'User type', $usertype_options, $record['user_type']);
    $editView->addRow('username', 'Username', $record['username']);
    $editView->addRow('salt', 'Salt (base64 encoded)', $record['salt'], 'disabled="disabled"');
    $editView->addRow('hash_algorithm', 'Hash algorithm', $record['hash_algorithm'], 'disabled="disabled"');
    $editView->addRow('hash', 'Hash', $record['password'], 'disabled="disabled"');
    $editView->addRow('new_password', 'New password', '');
    $views_to_load = array();
    $views_to_load[] = '../../views/_edit.php';
    include '../../views/_generic.php';
}
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     $view = !empty($_REQUEST['target_view']) ? $_REQUEST['target_view'] : 'QuickCreate';
     $module = $_REQUEST['module'];
     // locate the best viewdefs to use: 1. custom/module/quickcreatedefs.php 2. module/quickcreatedefs.php 3. custom/module/editviewdefs.php 4. module/editviewdefs.php
     $base = 'modules/' . $module . '/metadata/';
     $source = 'custom/' . $base . strtolower($view) . 'defs.php';
     if (!file_exists($source)) {
         $source = $base . strtolower($view) . 'defs.php';
         if (!file_exists($source)) {
             //if our view does not exist default to EditView
             $view = 'EditView';
             $source = 'custom/' . $base . 'editviewdefs.php';
             if (!file_exists($source)) {
                 $source = $base . 'editviewdefs.php';
             }
         }
     }
     $ev = new EditView();
     $ev->view = $view;
     $ev->ss = new Sugar_Smarty();
     $ev->ss->assign('isDCForm', $this->_isDCForm);
     //$_REQUEST['return_action'] = 'SubPanelViewer';
     $ev->setup($module, null, $source);
     $ev->showSectionPanelsTitles = false;
     $ev->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
     $ev->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
     $ev->defs['templateMeta']['form']['buttons'] = array('DCMENUSAVE', 'DCMENUCANCEL', 'DCMENUFULLFORM');
     $ev->defs['templateMeta']['form']['button_location'] = 'bottom';
     $ev->defs['templateMeta']['form']['hidden'] = '<input type="hidden" name="is_ajax_call" value="1" />';
     $ev->defs['templateMeta']['form']['hidden'] .= '<input type="hidden" name="from_dcmenu" value="1" />';
     $defaultProcess = true;
     if (file_exists('modules/' . $module . '/views/view.edit.php')) {
         include 'modules/' . $module . '/views/view.edit.php';
         $c = $module . 'ViewEdit';
         if (class_exists($c)) {
             $view = new $c();
             if ($view->useForSubpanel) {
                 $defaultProcess = false;
                 //Check if we shold use the module's QuickCreate.tpl file
                 if ($view->useModuleQuickCreateTemplate && file_exists('modules/' . $module . '/tpls/QuickCreate.tpl')) {
                     $ev->defs['templateMeta']['form']['headerTpl'] = 'modules/' . $module . '/tpls/QuickCreate.tpl';
                 }
                 $view->ev =& $ev;
                 $view->ss =& $ev->ss;
                 $class = $GLOBALS['beanList'][$module];
                 if (!empty($GLOBALS['beanFiles'][$class])) {
                     require_once $GLOBALS['beanFiles'][$class];
                     $bean = new $class();
                     $view->bean = $bean;
                 }
                 $view->ev->formName = 'form_DC' . $view->ev->view . '_' . $module;
                 $view->showTitle = false;
                 // Do not show title since this is for subpanel
                 $view->display();
             }
         }
     }
     //if
     if ($defaultProcess) {
         $form_name = 'form_DC' . $ev->view . '_' . $module;
         $ev->formName = $form_name;
         $ev->process(true, $form_name);
         echo $ev->display(false, true);
     }
 }
/**
 * function to retrieve webtolead image and title. path to help file
 * refactored to use EditView::getModuleTitle()
 *
 * @deprecated use EditView::getModuleTitle() instead
 *
 * @param  $module       string  not used, only for backward compatibility
 * @param  $image_name   string  image name
 * @param  $module_title string  to display as the module title
 * @param  $show_help    boolean which determines if the print and help links are shown.
 * @return string HTML
 */
function get_webtolead_title($module, $image_name, $module_title, $show_help)
{
    $ev = new EditView();
    return $ev->getModuleTitle($image_name, $module_title, $show_help);
}
 /**
  * Override to pass in the relation Id as the modelId. In the case of lead conversion, the lead->id is the
  * $modelId. This can then be used for a cancel button to return to the lead detailview.
  * @param string $controllerId
  * @param string $moduleId
  * @param RedsBeanModel $model
  * @param integer $modelId
  */
 public function __construct($controllerId, $moduleId, $model, $modelId)
 {
     assert('is_int($modelId)');
     parent::__construct($controllerId, $moduleId, $model);
     $this->modelId = $modelId;
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     if (!empty($_REQUEST['handle']) && $_REQUEST['handle'] == 'save') {
         return $this->handleSave();
     }
     global $beanList;
     // get the EditView defs to check if opportunity_name exists, for a check below for populating data
     $opportunityNameInLayout = false;
     $editviewFile = 'modules/Leads/metadata/editviewdefs.php';
     $this->medataDataFile = $editviewFile;
     if (file_exists("custom/{$editviewFile}")) {
         $this->medataDataFile = "custom/{$editviewFile}";
     }
     include $this->medataDataFile;
     foreach ($viewdefs['Leads']['EditView']['panels'] as $panel_index => $section) {
         foreach ($section as $row_array) {
             foreach ($row_array as $cell) {
                 if (isset($cell['name']) && $cell['name'] == 'opportunity_name') {
                     $opportunityNameInLayout = true;
                 }
             }
         }
     }
     $this->medataDataFile = $this->fileName;
     if (file_exists("custom/{$this->fileName}")) {
         $this->medataDataFile = "custom/{$this->fileName}";
     }
     $this->loadDefs();
     $this->getRecord();
     $this->checkForDuplicates($this->focus);
     $smarty = new Sugar_Smarty();
     $ev = new EditView();
     $ev->ss = $smarty;
     $ev->view = "ConvertLead";
     echo $this->getModuleTitle();
     require_once "include/QuickSearchDefaults.php";
     $qsd = new QuickSearchDefaults();
     $qsd->setFormName("ConvertLead");
     $this->contact = new Contact();
     $smarty->assign("contact_def", $this->contact->field_defs);
     $smarty->assign("form_name", "ConvertLead");
     $smarty->assign("form_id", "ConvertLead");
     $smarty->assign("module", "Leads");
     $smarty->assign("view", "convertlead");
     $smarty->assign("bean", $this->focus);
     $smarty->assign("record_id", $this->focus->id);
     $smarty->display("modules/Leads/tpls/ConvertLeadHeader.tpl");
     echo "<div class='edit view' style='width:auto;'>";
     foreach ($this->defs as $module => $vdef) {
         if (!isset($beanList[$module])) {
             continue;
         }
         $bean = $beanList[$module];
         $focus = new $bean();
         $focus->fill_in_additional_detail_fields();
         foreach ($focus->field_defs as $field => $def) {
             if (isset($vdef[$ev->view]['copyData']) && $vdef[$ev->view]['copyData']) {
                 if ($module == "Accounts" && $field == 'name') {
                     $focus->name = $this->focus->account_name;
                 } else {
                     if ($module == "Opportunities" && $field == 'amount') {
                         $focus->amount = unformat_number($this->focus->opportunity_amount);
                     } else {
                         if ($module == "Opportunities" && $field == 'name') {
                             if ($opportunityNameInLayout && !empty($this->focus->opportunity_name)) {
                                 $focus->name = $this->focus->opportunity_name;
                             }
                         } else {
                             if ($field == "id") {
                                 //If it is not a contact, don't copy the ID from the lead
                                 if ($module == "Contacts") {
                                     $focus->{$field} = $this->focus->{$field};
                                 }
                             } else {
                                 if (is_a($focus, "Company") && $field == 'phone_office') {
                                     //Special case where company and person have the same field with a different name
                                     $focus->phone_office = $this->focus->phone_work;
                                 } else {
                                     if (isset($this->focus->{$field})) {
                                         $focus->{$field} = $this->focus->{$field};
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         //Copy over email data
         $ev->setup($module, $focus, $this->medataDataFile, "modules/Leads/tpls/ConvertLead.tpl", false);
         $ev->process();
         echo $ev->display(false);
         echo $this->getValidationJS($module, $focus, $vdef[$ev->view]);
     }
     echo "</div>";
     echo $qsd->getQSScriptsJSONAlreadyDefined();
     $smarty->display("modules/Leads/tpls/ConvertLeadFooter.tpl");
 }
<?php

require_once '../../views/_secureHead.php';
require_once '../../models/_edit.php';
if (isset($sessionManager) && $sessionManager->getUserType() == 'ADMIN') {
    $id = request_isset('id');
    $settingsManager = new SettingsManager();
    $record = $settingsManager->getRecord($id);
    $page_title = 'Edit | Settings';
    // build edit view
    $editView = new EditView('Edit', 'update_by_id', $id);
    $editView->addRow('key', 'Key', $record['key']);
    $editView->addRow('value', 'Value', $record['value']);
    $views_to_load = array();
    $views_to_load[] = '../../views/_edit.php';
    include '../../views/_generic.php';
}
Exemple #21
0
<?php

require_once '../../views/_secureHead.php';
require_once '../../libs/simple_html_dom.php';
require_once '../../models/_edit.php';
if (isset($sessionManager) && $sessionManager->isAuthorized()) {
    $STOCK_ID = request_isset('id');
    $stockManager = new StockManager();
    $record = $stockManager->getRecord($STOCK_ID);
    $page_title = 'Edit | Stocks';
    // build edit view
    $editView = new EditView('Edit', 'update_by_id', $STOCK_ID);
    $editView->addRow('stock', 'Stock', $record->getStock());
    $editView->addRow('ticker', 'Ticker', $record->getSymbol());
    $views_to_load = array();
    $views_to_load[] = '../../views/_edit.php';
    include '../../views/_generic.php';
}
Exemple #22
0
/**
 * Wrapper function for the get_module_title function, which is mostly used for pre-MVC modules.
 * 
 * @deprecated use EditView2.php EditView::getModuleTitle() for MVC modules
 *
 * @param  $module       string  to next to the title.  Typically used for form buttons.
 * @param  $module_title string  to display as the module title
 * @param  $show_help    boolean which determines if the print and help links are shown.
 * @return string HTML
 */
function get_module_title($module, $module_title, $show_help)
{
    $ev = new EditView();
    return $ev->getModuleTitle($module, $module_title, $show_help);
}
Exemple #23
0
    /**
     * Renders the QuickCreate form from Smarty and returns HTML
     * @param array $vars request variable global
     * @param object $email Fetched email object
     * @param bool $addToAddressBook
     * @return array
     */
    function getQuickCreateForm($vars, $email, $addToAddressBookButton = false)
    {
        require_once "include/EditView/EditView2.php";
        global $app_strings;
        global $mod_strings;
        global $current_user;
        global $current_language;
        $module = $_REQUEST['qc_module'];
        $beanName = BeanFactory::getBeanName($module);
        //Setup the current module languge
        $mod_strings = return_module_language($current_language, $module);
        $focus = BeanFactory::getBean($module);
        $people = array('Contact', 'Lead');
        $emailAddress = array();
        // people
        if (in_array($beanName, $people)) {
            // lead specific
            $focus->lead_source = 'Email';
            $focus->lead_source_description = trim($email->name);
            $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr;
            if (isset($_REQUEST['sugarEmail']) && !empty($_REQUEST['sugarEmail'])) {
                if ($email->status == "sent") {
                    $from = isset($email->to_addrs_names) && !empty($email->to_addrs_names) ? $email->to_addrs_names : $email->to_addrs;
                } else {
                    $from = isset($email->from_name) && !empty($email->from_name) ? $email->from_name : $email->from_addr_name;
                }
            }
            $name = explode(" ", trim($from));
            $address = trim(array_pop($name));
            $address = str_replace(array("<", ">", "&lt;", "&gt;"), "", $address);
            $emailAddress[] = array('email_address' => $address, 'primary_address' => 1, 'invalid_email' => 0, 'opt_out' => 0, 'reply_to_address' => 1);
            $focus->email1 = $address;
            if (!empty($name)) {
                $focus->last_name = trim(array_pop($name));
                foreach ($name as $first) {
                    if (!empty($focus->first_name)) {
                        $focus->first_name .= " ";
                    }
                    $focus->first_name .= trim($first);
                }
            }
        } else {
            // case & bug specific
            $focus->source = 'InboundEmail';
            // bugs, cases, tasks
            $focus->name = trim($email->name);
        }
        $focus->description = trim(strip_tags($email->description));
        $focus->assigned_user_id = $current_user->id;
        $focus->team_id = $current_user->default_team;
        $EditView = new EditView();
        $EditView->ss = new Sugar_Smarty();
        //MFH BUG#20283 - checks for custom quickcreate fields
        $EditView->setup($module, $focus, SugarAutoLoader::loadWithMetafiles($module, 'editviewdefs'));
        $EditView->process();
        $EditView->render();
        $EditView->defs['templateMeta']['form']['buttons'] = array('email2save' => array('id' => 'e2AjaxSave', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(false);" />'), 'email2saveandreply' => array('id' => 'e2SaveAndReply', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_SAVE_AND_REPLY'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(\'reply\');" />'), 'email2cancel' => array('id' => 'e2cancel', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_CANCEL'] . '   " onclick="SUGAR.email2.detailView.quickCreateDialog.hide();" />'));
        if ($addToAddressBookButton) {
            $EditView->defs['templateMeta']['form']['buttons']['email2saveAddToAddressBook'] = array('id' => 'e2addToAddressBook', 'customCode' => '<input type="button" class="button" value="   ' . $app_strings['LBL_EMAIL_ADDRESS_BOOK_SAVE_AND_ADD'] . '   " onclick="SUGAR.email2.detailView.saveQuickCreate(true);" />');
        }
        //Get the module language for javascript
        if (!is_file(sugar_cached('jsLanguage/') . "{$module}/{$GLOBALS['current_language']}.js")) {
            require_once 'include/language/jsLanguage.php';
            jsLanguage::createModuleStringsCache($module, $GLOBALS['current_language']);
        }
        $jsLanguage = getVersionedScript("cache/jsLanguage/{$module}/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']);
        if ($focus->object_name == 'Contact') {
            $admin = Administration::getSettings();
            if (empty($admin->settings['portal_on']) || !$admin->settings['portal_on']) {
                unset($EditView->sectionPanels[strtoupper('lbl_portal_information')]);
            } else {
                $jsLanguage .= getVersionedScript("modules/Contacts/Contact.js");
                $jsLanguage .= getVersionedScript("modules/Contacts/QuickCreateEmailContact.js");
                $jsLanguage .= <<<EOQ
\t\t\t    <script language="javascript">
\t\t\t\t   addToValidateComparison('form_EmailQCView_Contacts', 'portal_password', 'varchar', false, SUGAR.language.get('app_strings', 'ERR_SQS_NO_MATCH_FIELD') + SUGAR.language.get('Contacts', 'LBL_PORTAL_PASSWORD'), 'portal_password1');
\t\t           addToValidateVerified('form_EmailQCView_Contacts', 'portal_name_verified', 'bool', false, SUGAR.language.get('app_strings', 'ERR_EXISTING_PORTAL_USERNAME'));
\t\t           YAHOO.util.Event.on('portal_name', 'blur', validatePortalName);
\t\t\t\t   YAHOO.util.Event.on('portal_name', 'keydown', handleKeyDown);
\t\t\t    </script>
EOQ;
            }
        }
        $EditView->view = 'EmailQCView';
        $EditView->defs['templateMeta']['form']['headerTpl'] = 'include/EditView/header.tpl';
        $EditView->defs['templateMeta']['form']['footerTpl'] = 'include/EditView/footer.tpl';
        $meta = array();
        $meta['html'] = $jsLanguage . $EditView->display(false, true);
        $meta['html'] = str_replace("src='" . getVersionedPath('include/SugarEmailAddress/SugarEmailAddress.js') . "'", '', $meta['html']);
        $meta['emailAddress'] = $emailAddress;
        $mod_strings = return_module_language($current_language, 'Emails');
        return $meta;
    }