示例#1
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $beanFiles, $mod_strings;
     // the user admin (MLA) cannot edit any administrator holidays
     global $current_user;
     if (isset($_REQUEST['record'])) {
         $result = $GLOBALS['db']->query("SELECT is_admin FROM users WHERE id=(SELECT person_id FROM holidays WHERE id='{$_REQUEST['record']}')");
         $row = $GLOBALS['db']->fetchByAssoc($result);
         if (!is_admin($current_user) && $current_user->isAdminForModule('Users') && $row['is_admin'] == 1) {
             sugar_die('Unauthorized access');
         }
     }
     $this->ev->process();
     if ($_REQUEST['return_module'] == 'Project') {
         $projectBean = BeanFactory::getBean('Project', $_REQUEST['return_id']);
         $userBean = BeanFactory::getBean('Users');
         $contactBean = BeanFactory::getBean('Contacts');
         $projectBean->load_relationship("user_resources");
         $userResources = $projectBean->user_resources->getBeans($userBean);
         $projectBean->load_relationship("contact_resources");
         $contactResources = $projectBean->contact_resources->getBeans($contactBean);
         ksort($userResources);
         ksort($contactResources);
         $this->ss->assign("PROJECT", true);
         $this->ss->assign("USER_RESOURCES", $userResources);
         $this->ss->assign("CONTACT_RESOURCES", $contactResources);
         $this->ss->assign("MOD", $mod_strings);
         $holiday_js = "<script type='text/javascript'>\n";
         $holiday_js .= $projectBean->resourceSelectJS();
         $holiday_js .= "\n</script>";
         echo $holiday_js;
     }
     echo $this->ev->display();
     //echo the javascript that will validate the form
     $javascript = new javascript();
     $javascript->setFormName("EditView");
     $javascript->addFieldGeneric('holiday_date', '', 'LBL_HOLIDAY_DATE', 'true');
     $javascript->addFieldGeneric('person_type', '', 'LBL_PERSON_TYPE', 'true');
     //note that the person type and person id labels are use the resource name label on purpose for a clearer UI
     $javascript->addToValidateBinaryDependency('person_id', 'alpha', 'LBL_RESOURCE_NAME', 'true', '', 'person_type');
     echo $javascript->getScript();
 }
示例#2
0
function get_new_record_form()
{
    if (!ACLController::checkAccess('Press', 'edit', true)) {
        return '';
    }
    global $app_strings;
    global $mod_strings;
    global $currentModule;
    global $current_user;
    $the_form = get_left_form_header($mod_strings['LBL_QUICK_NEW_PRESS']);
    $form = new XTemplate('modules/Press/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);
    $json = getJSONobj();
    $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'quick_save', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
    $form->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
    $form->parse('main');
    $the_form .= $form->text('main');
    require_once 'modules/Press/Press.php';
    $focus = new Press();
    require_once 'include/QuickSearchDefaults.php';
    $qsd = new QuickSearchDefaults();
    $sqs_objects = array('assigned_user_name' => $qsd->getQSUser());
    $quicksearch_js = $qsd->getQSScripts();
    $quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
    echo $quicksearch_js;
    require_once 'include/javascript/javascript.php';
    $javascript = new javascript();
    $javascript->setFormName('quick_save');
    $javascript->setSugarBean($focus);
    $javascript->addRequiredFields('');
    $javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
    $jscript = $javascript->getScript();
    $the_form .= $jscript . get_left_form_footer();
    return $the_form;
}
$xtpl->assign("DOMAIN_NAME", $focus->domain_name);
if (empty($focus->list_type) or $focus->list_type != 'exempt_domain') {
    $xtpl->assign("DOMAIN_HIDDEN", "display:none");
}
if (empty($focus->assigned_user_id) && empty($focus->id)) {
    $focus->assigned_user_id = $current_user->id;
}
if (empty($focus->list_type)) {
    $focus->list_type = 'default';
}
$xtpl->assign("LIST_OPTIONS", get_select_options_with_id($app_list_strings['prospect_list_type_dom'], $focus->list_type));
global $current_user;
if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
    $record = '';
    if (!empty($_REQUEST['record'])) {
        $record = $_REQUEST['record'];
    }
    $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $record . "'>" . get_image($image_path . "EditLayout", "border='0' alt='Edit Layout' align='bottom'") . "</a>");
}
//Add Custom Fields
require_once 'modules/DynamicFields/templates/Files/EditView.php';
$xtpl->parse("main.open_source");
$xtpl->parse("main");
$xtpl->out("main");
require_once 'include/javascript/javascript.php';
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addAllFields('');
$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
echo $javascript->getScript();
    $focus->assigned_user_name = $current_user->user_name;
}
$xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
$xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
$xtpl->assign("REDIRECT_URL_DEFAULT", 'http://');
//required fields on Webtolead form
$campaign = new Campaign();
$javascript = new javascript();
$javascript->setFormName('WebToLeadCreation');
$javascript->setSugarBean($lead);
$javascript->addAllFields('');
//$javascript->addFieldGeneric('redirect_url', '', 'LBL_REDIRECT_URL' ,'true');
$javascript->addFieldGeneric('campaign_name', '', 'LBL_RELATED_CAMPAIGN', 'true');
$javascript->addFieldGeneric('assigned_user_name', '', 'LBL_ASSIGNED_TO', 'true');
$javascript->addToValidateBinaryDependency('campaign_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_LEAD_NOTIFY_CAMPAIGN'], 'false', '', 'campaign_id');
$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
echo $javascript->getScript();
$json = getJSONobj();
$lead_fields = $json->encode($fields);
$xtpl->assign("LEAD_FIELDS", $lead_fields);
$classname = "SUGAR_GRID";
$xtpl->assign("CLASSNAME", $classname);
$xtpl->assign("DRAG_DROP_CHOOSER_WEB_TO_LEAD", constructDDWebToLeadFields($fields, $classname));
$xtpl->parse("main");
$xtpl->out("main");
/*
$str = "<script>
WebToLeadForm.lead_fields = {$lead_fields};
</script>";
echo $str;
示例#5
0
}
echo getClassicModuleTitle("Schedulers", $params, true);
Log::info("Scheduler Edit View");
/* End standard EditView setup logic */
// javascript calls
$javascript = new javascript();
$javascript->setSugarBean($focus);
$javascript->setFormName('EditView');
$javascript->addAllFields('');
$javascript->addFieldGeneric('mins', 'alpha', 'Mins', true, $prefix = '');
$javascript->addFieldGeneric('day_of_month', 'alpha', 'Days of Month', true, $prefix = '');
$javascript->addFieldGeneric('months', 'alpha', 'Months', true, $prefix = '');
$javascript->addFieldGeneric('day_of_week', 'alpha', 'Days of Week', true, $prefix = '');
$javascript->addFieldGeneric('date_start', 'date', 'Start Date', true, $prefix = '');
//$javascript->addFieldDateBeforeAllowBlank('date_start', 'date', 'Date End', 'false', $prefix='', 'date_end', 'true'); // cn: disabled because it does not handle user-pref date format
$javascript->addToValidateBinaryDependency('time_hour_from', 'alpha', 'Active From (hr) must be set with Active To (hr) ', 'false', $prefix = '', 'time_hour_to');
$javascript->addToValidateBinaryDependency('time_minute_from', 'alpha', 'Active From (min) must be set with Active To (min) ', 'false', $prefix = '', 'time_minute_to');
//($field, $type,$displayName, $required, $prefix='',$compareTo)
// split the date/time of start/end
$dtStart = $focus->date_time_start;
$dtEnd = $focus->date_time_end;
if (!empty($dtStart)) {
    $exStart = explode(" ", $dtStart);
    $date_start = $exStart[0];
    $time_start = $exStart[1];
} else {
    $prefDate = $current_user->getUserDateTimePreferences();
    $date_start = $timedate->asUserDate($timedate->fromString('2005-01-01'));
    $time_start = '';
}
if (!empty($dtEnd) && $dtEnd != '2020-12-31 23:59') {
示例#6
0
 /**
  * Builds a template
  * This is a private function that should be called only from checkTemplate method
  *
  * @param module string module name
  * @param view string view need (eg DetailView, EditView, etc)
  * @param tpl string generic tpl to use
  * @param ajaxSave boolean parameter indicating whether or not this is coming from an Ajax call
  * @param metaDataDefs metadata definition as Array
  **/
 function buildTemplate($module, $view, $tpl, $ajaxSave, $metaDataDefs)
 {
     $this->loadSmarty();
     $cacheDir = create_cache_directory($this->templateDir . $module . '/');
     $file = $cacheDir . $view . '.tpl';
     $string = '{* Create Date: ' . date('Y-m-d H:i:s') . "*}\n";
     $this->ss->left_delimiter = '{{';
     $this->ss->right_delimiter = '}}';
     $this->ss->assign('module', $module);
     $this->ss->assign('built_in_buttons', array('CANCEL', 'DELETE', 'DUPLICATE', 'EDIT', 'FIND_DUPLICATES', 'SAVE', 'CONNECTOR'));
     $contents = $this->ss->fetch($tpl);
     //Insert validation and quicksearch stuff here
     if ($view == 'EditView' || strpos($view, 'QuickCreate') || $ajaxSave || $view == "ConvertLead") {
         global $dictionary, $beanList, $app_strings, $mod_strings;
         $mod = $beanList[$module];
         if ($mod == 'aCase') {
             $mod = 'Case';
         }
         $defs = $dictionary[$mod]['fields'];
         $defs2 = array();
         //Retrieve all panel field definitions with displayParams Array field set
         $panelFields = array();
         foreach ($metaDataDefs['panels'] as $panel) {
             foreach ($panel as $row) {
                 foreach ($row as $entry) {
                     if (empty($entry)) {
                         continue;
                     }
                     if (is_array($entry) && isset($entry['name']) && isset($entry['displayParams']) && isset($entry['displayParams']['required']) && $entry['displayParams']['required']) {
                         $panelFields[$entry['name']] = $entry;
                     }
                     if (is_array($entry)) {
                         $defs2[$entry['name']] = $entry;
                     } else {
                         $defs2[$entry] = array('name' => $entry);
                     }
                 }
                 //foreach
             }
             //foreach
         }
         //foreach
         foreach ($panelFields as $field => $value) {
             $nameList = array();
             if (!is_array($value['displayParams']['required'])) {
                 $nameList[] = $field;
             } else {
                 foreach ($value['displayParams']['required'] as $groupedField) {
                     $nameList[] = $groupedField;
                 }
             }
             foreach ($nameList as $x) {
                 if (isset($defs[$x]) && isset($defs[$x]['type']) && !isset($defs[$x]['required'])) {
                     $defs[$x]['required'] = true;
                 }
             }
         }
         //foreach
         //Create a base class with field_name_map property
         $sugarbean = new stdClass();
         $sugarbean->field_name_map = $defs;
         $sugarbean->module_dir = $module;
         $javascript = new javascript();
         $view = $view == 'QuickCreate' ? "QuickCreate_{$module}" : $view;
         $javascript->setFormName($view);
         $javascript->setSugarBean($sugarbean);
         if ($view != "ConvertLead") {
             $javascript->addAllFields('', null, true);
         }
         $validatedFields = array();
         $javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD') . ': ' . $javascript->buildStringToTranslateInSmarty('LBL_ASSIGNED_TO'), 'false', '', 'assigned_user_id');
         $validatedFields[] = 'assigned_user_name';
         //Add remaining validation dependency for related fields
         //1) a relate type as defined in vardefs
         //2) set in metadata layout
         //3) not have validateDepedency set to false in metadata
         //4) have id_name in vardef entry
         //5) not already been added to Array
         foreach ($sugarbean->field_name_map as $name => $def) {
             if ($def['type'] == 'relate' && isset($defs2[$name]) && (!isset($defs2[$name]['validateDependency']) || $defs2[$name]['validateDependency'] === true) && isset($def['id_name']) && !in_array($name, $validatedFields)) {
                 if (isset($mod_strings[$def['vname']]) || isset($app_strings[$def['vname']]) || translate($def['vname'], $sugarbean->module_dir) != $def['vname']) {
                     $vname = $def['vname'];
                 } else {
                     $vname = "undefined";
                 }
                 $javascript->addToValidateBinaryDependency($name, 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD') . ': ' . $javascript->buildStringToTranslateInSmarty($vname), !empty($def['required']) ? 'true' : 'false', '', $def['id_name']);
                 $validatedFields[] = $name;
             }
         }
         //foreach
         $contents .= "{literal}\n";
         $contents .= $javascript->getScript();
         $contents .= $this->createQuickSearchCode($defs, $defs2, $view, $module);
         $contents .= "{/literal}\n";
     } else {
         if (preg_match('/^SearchForm_.+/', $view)) {
             global $dictionary, $beanList, $app_strings, $mod_strings;
             $mod = $beanList[$module];
             if ($mod == 'aCase') {
                 $mod = 'Case';
             }
             $defs = $dictionary[$mod]['fields'];
             $contents .= '{literal}';
             $contents .= $this->createQuickSearchCode($defs, array(), $view);
             $contents .= '{/literal}';
         }
     }
     //if
     //Remove all the copyright comments
     $contents = preg_replace('/\\{\\*[^\\}]*?\\*\\}/', '', $contents);
     if ($fh = @sugar_fopen($file, 'w')) {
         fputs($fh, $contents);
         fclose($fh);
     }
     $this->ss->left_delimiter = '{';
     $this->ss->right_delimiter = '}';
 }
示例#7
0
$xtpl->assign('DESCRIPTION', $focus->description);
$buttons = array('<input id="btn_teamnotices_save" title="' . $app_strings['LBL_SAVE_BUTTON_TITLE'] . '" accessKey="' . $app_strings['LBL_SAVE_BUTTON_KEY'] . '" class="button primary" onclick="this.form.action.value=\'Save\'; return check_form(\'EditView\');" type="submit" name="button" value="' . $app_strings['LBL_SAVE_BUTTON_LABEL'] . '">', '<input id="btn_teamnotices_cancel" title="' . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . '" accessKey="' . $app_strings['LBL_CANCEL_BUTTON_KEY'] . '" onclick="this.form.action.value=\'index\';" class="button" type="submit" name="button" value="' . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . '">');
require_once 'include/SugarSmarty/plugins/function.sugar_action_menu.php';
$action_button = smarty_function_sugar_action_menu(array('id' => 'teamnotices_editview_buttons', 'buttons' => $buttons, 'flat' => true), $xtpl);
$xtpl->assign('ACTION_BUTTON', $action_button);
require_once 'include/SugarFields/Fields/Teamset/SugarFieldTeamset.php';
$teamSetField = new SugarFieldTeamset('Teamset');
$code = $teamSetField->getClassicView($focus->field_defs);
$xtpl->assign("TEAM_SET_FIELD", $code);
if (!isset($focus->date_start)) {
    $xtpl->assign('DATE_START', $timedate->nowDate());
} else {
    $xtpl->assign('DATE_START', $focus->date_start);
}
if (!isset($focus->date_start)) {
    $xtpl->assign('DATE_END', $timedate->asUser($timedate->getNow()->get('+1 week')));
} else {
    $xtpl->assign('DATE_END', $focus->date_end);
}
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
$xtpl->assign("STATUS_OPTIONS", get_select_options_with_id($mod_strings['dom_status'], $focus->status));
$xtpl->parse("main.pro");
$xtpl->parse("main");
$xtpl->out("main");
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addAllFields('');
$javascript->addFieldGeneric('team_name', 'varchar', $app_strings['LBL_TEAM'], 'true');
$javascript->addToValidateBinaryDependency('team_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_TEAM'], 'false', '', 'team_id');
echo $javascript->getScript();
示例#8
0
    }
    $xtpl->assign('ASSIGNED_USER_ID', $current_user->id);
    $xtpl->assign('MYINBOX', 'this.form.type.value=\'inbound\';');
}
////	END SPECIAL INBOUND LANDING SCREEN ASSIGNS
///////////////////////////////////////
echo '<script>var disabledModules=' . $json->encode($disabled_parent_types) . ';</script>';
$jsVars = 'var lbl_send_anyways = "' . $mod_strings['LBL_SEND_ANYWAYS'] . '";';
$xtpl->assign('JS_VARS', $jsVars);
$xtpl->parse("main");
$xtpl->out("main");
echo '<script>checkParentType(document.EditView.parent_type.value, document.EditView.change_parent);</script>';
////	END XTEMPLATE ASSIGNMENT
///////////////////////////////////////////////////////////////////////////////
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$skip_fields = array();
if ($email_type == 'out') {
    $skip_fields['name'] = 1;
    $skip_fields['date_start'] = 1;
}
$javascript->addAllFields('', $skip_fields);
$javascript->addToValidateBinaryDependency('parent_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_MEMBER_OF'], 'false', '', 'parent_id');
$javascript->addToValidateBinaryDependency('parent_type', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_MEMBER_OF'], 'false', '', 'parent_id');
$javascript->addToValidateBinaryDependency('user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
if ($email_type == 'archived') {
    $javascript->addFieldIsValidDate('date_start', 'date', $mod_strings['LBL_DATE'], $mod_strings['ERR_DATE_START'], true);
    $javascript->addFieldIsValidTime('time_start', 'time', $mod_strings['LBL_TIME'], $mod_strings['ERR_TIME_SENT'], true);
}
echo $javascript->getScript();
safe_map('contact_name', $focus);
safe_map('contact_id', $focus);
safe_map('contact_role', $focus);
$GLOBALS['log']->info("Contact opportunity relationship");
$json = getJSONobj();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('opportunity_name' => $qsd->getQSParent());
$sqs_objects['opportunity_name']['populate_list'] = array('opportunity_name', 'opportunity_id');
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
echo $quicksearch_js;
$xtpl = new XTemplate('modules/Contacts/ContactOpportunityRelationshipEdit.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("RETURN_URL", "&return_module={$currentModule}&return_action=DetailView&return_id={$focus->id}");
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("CONTACT", $contactName = array("NAME" => $focus->contact_name, "ID" => $focus->contact_id));
$xtpl->assign("OPPORTUNITY", $oppName = array("NAME" => $focus->opportunity_name, "ID" => $focus->opportunity_id));
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONTACT_OPP_FORM_TITLE'] . " " . $contactName['NAME'] . " - " . $oppName['NAME'], true);
$xtpl->assign("CONTACT_ROLE_OPTIONS", get_select_options_with_id($app_list_strings['opportunity_relationship_type_dom'], $focus->contact_role));
$xtpl->parse("main");
$xtpl->out("main");
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addToValidateBinaryDependency('opportunity_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_OPP_NAME'], 'false', '', 'opportunity_id');
echo $javascript->getScript();
echo <<<EOQ
<script>
function changeQS() {
\tnew_module = document.EditView.parent_type.value;
\tif(new_module == 'Contacts' || new_module == 'Leads' || typeof(disabledModules[new_module]) != 'undefined') {
\t\tsqs_objects['parent_name']['disable'] = true;
\t\tdocument.getElementById('parent_name').readOnly = true;
\t}
\telse {
\t\tsqs_objects['parent_name']['disable'] = false;
\t\tdocument.getElementById('parent_name').readOnly = false;
\t}
\t
\tsqs_objects['parent_name']['module'] = new_module;\t
}
</script>
EOQ;
echo '<script>var disabledModules=' . $json->encode($disabled_parent_types) . ';</script>';
if (!ACLController::checkAccess('Contacts', 'list', true)) {
    $xtpl->assign('CONTACT_DISABLED', 'disabled="disabled"');
}
$xtpl->parse("main");
$xtpl->out("main");
echo '<script>checkParentType(document.EditView.parent_type.value, document.EditView.change_parent);</script>';
require_once 'include/javascript/javascript.php';
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addAllFields('');
$javascript->addToValidateBinaryDependency('parent_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_MEMBER_OF'], 'false', '', 'parent_id');
echo $javascript->getScript();
示例#11
0
foreach ($javascript->sugarbean->field_name_map as $field => $value) {
    if (isset($value['custom_type'])) {
        if ($value['custom_type'] != 'link') {
            //pass in required flag if set to required
            if (isset($value['required']) && $value['required']) {
                $javascript->addField($field, true);
            } else {
                //if not required, then just pass in to validate
                $javascript->addField($field, false);
            }
        }
    }
}
$javascript->addFieldGeneric('kbdocument_name', '', 'LBL_ARTICLE_TITLE', 'true');
$javascript->addFieldGeneric('assigned_user_name', 'varchar', $mod_strings['LBL_ARTICLE_AUTHOR'], 'true');
$javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_ARTICLE_AUTHOR'], 'false', '', 'assigned_user_id');
$javascript->addToValidateBinaryDependency('kbdoc_approver_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_ARTICLE_APPROVED_BY'], 'false', '', 'kbdoc_approver_id');
$javascript->addFieldGeneric('kbdocument_revision_number', '', 'LBL_DOC_VERSION', 'true');
$javascript->addFieldGeneric('team_name', 'varchar', $app_strings['LBL_TEAM'], 'true');
$javascript->addToValidateBinaryDependency('team_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_TEAM'], 'false', '', 'team_id');
$javascript->addFieldGeneric('tiny_vals', '', 'LBL_ARTICLE_BODY', 'true');
echo $javascript->getScript();
//Add Custom Fields
require_once 'modules/DynamicFields/templates/Files/EditView.php';
$xtpl->parse("main");
$xtpl->out("main");
$savedSearch = BeanFactory::getBean('SavedSearch');
$json = getJSONobj();
$savedSearchSelects = $json->encode(array($GLOBALS['app_strings']['LBL_SAVED_SEARCH_SHORTCUT'] . '<br>' . $savedSearch->getSelect('KBDocuments')));
$str = "<script>\nYAHOO.util.Event.addListener(window, 'load', SUGAR.util.fillShortcuts, {$savedSearchSelects});\n</script>";
echo $str;
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
$xtpl->assign("ID", $focus->id);
$xtpl->assign("SECURITYGROUP", $securityGroup = array("NAME" => $focus->securitygroup_name, "ID" => $focus->securitygroup_id));
$xtpl->assign("USER", $user = array("NAME" => $focus->user_name, "ID" => $focus->user_id));
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_SECURITYGROUP_USER_FORM_TITLE'] . ": " . $securityGroup['NAME'] . " - " . $user['NAME'], true);
echo "\n</p>\n";
// noninheritable
$noninheritable = '';
if (isset($focus->noninheritable) && $focus->noninheritable == true) {
    $noninheritable = 'CHECKED';
}
$xtpl->assign('noninheritable', $noninheritable);
// primary_group
$primary_group = '';
if (isset($focus->primary_group) && $focus->primary_group == true) {
    $primary_group = 'CHECKED';
}
$xtpl->assign('primary_group', $primary_group);
$xtpl->parse("main");
$xtpl->out("main");
require_once 'include/javascript/javascript.php';
$javascript = new javascript();
$javascript->setFormName('EditView');
$javascript->setSugarBean($focus);
$javascript->addToValidateBinaryDependency('user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_USER_NAME'], 'false', '', 'user_id');
echo $javascript->getScript();