Exemplo n.º 1
0
         $xtpl->assign("CALENDAR_LANG", "en");
         $xtpl->assign("USER_DATEFORMAT", $timedate->get_user_time_format());
         $xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());
         $xtpl->assign("EDIT_FIELD_VALUE", $select_row_curr_field_value);
         $xtpl->assign("CELL_WIDTH", $col_width);
         $xtpl->assign("THEME", $theme);
         $xtpl->parse("main." . $section_name . ".merge_cell_edit_datetime");
         break;
     case 'teamset':
         require_once 'include/SugarFields/Fields/Teamset/EmailSugarFieldTeamsetCollection.php';
         $mod = isset($_REQUEST['action_module']) ? $_REQUEST['action_module'] : $_REQUEST['merge_module'];
         $bean = BeanFactory::getBean($mod, $base_id);
         $teamsWidget = new EmailSugarFieldTeamsetCollection($bean, $bean->field_defs, '', 'EditView');
         $teamsWidget->hideShowHideButton = true;
         $xtpl->assign('TEAM_FIELD', $teamsWidget->get_code());
         $xtpl->assign('TEAM_FIELD_QUICKSEARCH', $teamsWidget->createQuickSearchCode(true));
         $xtpl->parse("main." . $section_name . ".merge_cell_edit_teamset");
         break;
     default:
         break;
 }
 //render a column for each selected record to merge
 foreach ($merge_ids_array as $id) {
     $xtpl->assign("CELL_WIDTH", $col_width);
     $field_name = null;
     switch ($field_check) {
         case 'bool':
             if (($mergeBeanArray[$id]->{$field_array}['name'] == '1' || $mergeBeanArray[$id]->{$field_array}['name'] == 'yes' || $mergeBeanArray[$id]->{$field_array}['name'] == 'on') && !empty($mergeBeanArray[$id]->{$field_array}['name'])) {
                 $xtpl->assign("FIELD_VALUE", " checked");
             } else {
                 $xtpl->assign("FIELD_VALUE", "");
Exemplo n.º 2
0
 /**
  * Renders the Import form from Smarty and returns HTML
  * @param array $vars request variable global
  * @param object $email Fetched email object
  * @param bool $addToAddressBook
  * @return array
  */
 function getImportForm($vars, $email, $formName = 'ImportEditView')
 {
     require_once "include/EditView/EditView2.php";
     require_once "include/TemplateHandler/TemplateHandler.php";
     require_once 'include/QuickSearchDefaults.php';
     $qsd = QuickSearchDefaults::getQuickSearchDefaults();
     $qsd->setFormName($formName);
     global $app_strings;
     global $current_user;
     global $app_list_strings;
     $sqs_objects = array("{$formName}_parent_name" => $qsd->getQSParent());
     $smarty = new Sugar_Smarty();
     $smarty->assign("APP", $app_strings);
     $smarty->assign('formName', $formName);
     $showTeam = false;
     if (!isset($vars['showTeam']) || $vars['showTeam'] == true) {
         $showTeam = true;
     }
     // if
     if ($showTeam) {
         $smarty->assign("teamId", $current_user->default_team);
         $email->team_id = $current_user->default_team;
         $email->team_set_id = $current_user->team_set_id;
     }
     $smarty->assign("showTeam", $showTeam);
     require_once 'include/SugarFields/Fields/Teamset/EmailSugarFieldTeamsetCollection.php';
     $teamSetField = new EmailSugarFieldTeamsetCollection($email, $email->field_defs, '', $formName);
     $code = $teamSetField->get_code();
     $sqs_objects1 = $teamSetField->createQuickSearchCode(true);
     //$sqs_objects = array_merge($sqs_objects, $sqs_objects1);
     $smarty->assign("TEAM_SET_FIELD", $code . $sqs_objects1);
     $showAssignTo = false;
     if (!isset($vars['showAssignTo']) || $vars['showAssignTo'] == true) {
         $showAssignTo = true;
     }
     // if
     if ($showAssignTo) {
         if (empty($email->assigned_user_id) && empty($email->id)) {
             $email->assigned_user_id = $current_user->id;
         }
         if (empty($email->assigned_name) && empty($email->id)) {
             $email->assigned_user_name = $current_user->user_name;
         }
         $sqs_objects["{$formName}_assigned_user_name"] = $qsd->getQSUser();
     }
     $smarty->assign("showAssignedTo", $showAssignTo);
     $showDelete = false;
     if (!isset($vars['showDelete']) || $vars['showDelete'] == true) {
         $showDelete = true;
     }
     $smarty->assign("showDelete", $showDelete);
     $smarty->assign("userId", $email->assigned_user_id);
     $smarty->assign("userName", $email->assigned_user_name);
     $parent_types = $app_list_strings['record_type_display'];
     $smarty->assign('parentOptions', get_select_options_with_id($parent_types, $email->parent_type));
     $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . json_encode($sqs_objects) . '</script>';
     $smarty->assign('SQS', $quicksearch_js);
     $meta = array();
     $meta['html'] = $smarty->fetch("modules/Emails/templates/importRelate.tpl");
     return $meta;
 }
Exemplo n.º 3
0
if (!empty($focus->team_id)) {
    $my_team_id = $focus->team_id;
} else {
    $my_team_id = '';
}
$team_id = get_select_options_with_id($teamArr, $my_team_id);
if ($focus->is_personal) {
    $code = "<select name='team_id' id ='team_id' tabindex='211' disabled >{$team_id}</select>";
} else {
    //$xtpl->assign('TEAM_ID', $team_id);
    require_once 'include/QuickSearchDefaults.php';
    $qsd = QuickSearchDefaults::getQuickSearchDefaults();
    $sqs_objects = array('team_name' => $qsd->getQSTeam());
    require_once 'include/SugarFields/Fields/Teamset/EmailSugarFieldTeamsetCollection.php';
    $teamSetField = new EmailSugarFieldTeamsetCollection($focus, $focus->field_defs, "get_non_private_teams_array");
    $sqs_objects = array_merge($sqs_objects, $teamSetField->createQuickSearchCode(false));
    $json = getJSONobj();
    $quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
    //add custom fields to validation
    foreach ($javascript->sugarbean->field_name_map as $field => $value) {
        if (isset($value['custom_type'])) {
            if ($value['custom_type'] != 'link') {
                // fixing bug #49015: The same error message is shown three times
                // all required fields were added to validate before
                if (!isset($value['required']) || !$value['required']) {
                    //if not required, then just pass in to validate
                    $javascript->addField($field, false);
                }
            }
        }
    }
Exemplo n.º 4
0
             $email->et->folder->updateFolder(array("record" => $_REQUEST['folderId'], "name" => $email->et->folder->name, "parent_folder" => $_REQUEST['newParentId'], "team_id" => $email->et->folder->team_id, "team_set_id" => $email->et->folder->team_set_id));
         } else {
             echo $mod_strings['LBL_NOT_SUGAR_FOLDER'];
         }
     }
     break;
 case "getGroupFolder":
     $email->et->folder->retrieve($_REQUEST['folderId']);
     $_REQUEST['record'] = $_REQUEST['folderId'];
     $ret = array();
     $ret['folderId'] = $email->et->folder->id;
     $ret['folderName'] = $email->et->folder->name;
     $ret['parentFolderId'] = $email->et->folder->parent_folder;
     require_once 'include/SugarFields/Fields/Teamset/EmailSugarFieldTeamsetCollection.php';
     $teamSetField = new EmailSugarFieldTeamsetCollection($email->et->folder, $ie->field_defs, "get_non_private_teams_array", 'EditViewGroupFolder');
     $sqs_objects = $teamSetField->createQuickSearchCode(true);
     //$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
     $code = $teamSetField->get_code();
     $ret['team_id'] = $code . $sqs_objects;
     $out = $json->encode($ret);
     echo $out;
     break;
 case "retrieveTeamsInfoForSettings":
     $emailUI = new EmailUI();
     $returnArray = $emailUI->retrieveTeamInfoForSettingsUI();
     $out = $json->encode($returnArray);
     echo $out;
     break;
 case "rebuildFolders":
     $GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: rebuildFolders");
     $tree = $email->et->getMailboxNodes(false);
Exemplo n.º 5
0
    function distributionForm($where)
    {
        global $app_list_strings;
        global $app_strings;
        global $mod_strings;
        global $theme;
        global $current_user;
        $distribution = get_select_options_with_id($app_list_strings['dom_email_distribution'], '');
        $_SESSION['distribute_where'] = $where;
        require_once 'include/SugarFields/Fields/Teamset/EmailSugarFieldTeamsetCollection.php';
        $teamSetField = new EmailSugarFieldTeamsetCollection($this, $this->field_defs, '', 'Distribute');
        $code = $teamSetField->get_code();
        $sqs_objects = $teamSetField->createQuickSearchCode(true);
        $teamWidget = $code . $sqs_objects;
        $out = '<form name="Distribute" id="Distribute">';
        $out .= get_form_header($mod_strings['LBL_DIST_TITLE'], '', false);
        $out .= <<<eoq
\t\t<script>
\t\t\tenableQS(true);
\t\t</script>
eoq;
        $out .= '
		<table cellpadding="0" cellspacing="0" width="100%" border="0">
			<tr>
				<td>
					<script type="text/javascript">


						function checkDeps(form) {
							return;
						}

						function mySubmit() {
							var assform = document.getElementById("Distribute");
							var select = document.getElementById("userSelect");
							var assign1 = assform.r1.checked;
							var assign2 = assform.r2.checked;
							var dist = assform.dm.value;
							var assign = false;
							var users = false;
							var rules = false;
							var warn1 = "' . $mod_strings['LBL_WARN_NO_USERS'] . '";
							var warn2 = "";

							if(assign1 || assign2) {
								assign = true;

							}

							for(i=0; i<select.options.length; i++) {
								if(select.options[i].selected == true) {
									users = true;
									warn1 = "";
								}
							}

							if(dist != "") {
								rules = true;
							} else {
								warn2 = "' . $mod_strings['LBL_WARN_NO_DIST'] . '";
							}

							if(assign && users && rules) {

								if(document.getElementById("r1").checked) {
									var mu = document.getElementById("MassUpdate");
									var grabbed = "";

									for(i=0; i<mu.elements.length; i++) {
										if(mu.elements[i].type == "checkbox" && mu.elements[i].checked && mu.elements[i].name.value != "massall") {
											if(grabbed != "") { grabbed += "::"; }
											grabbed += mu.elements[i].value;
										}
									}
									var formgrab = document.getElementById("grabbed");
									formgrab.value = grabbed;
								}
								assform.submit();
							} else {
								alert("' . $mod_strings['LBL_ASSIGN_WARN'] . '" + "\\n" + warn1 + "\\n" + warn2);
							}
						}

						function submitDelete() {
							if(document.getElementById("r1").checked) {
								var mu = document.getElementById("MassUpdate");
								var grabbed = "";

								for(i=0; i<mu.elements.length; i++) {
									if(mu.elements[i].type == "checkbox" && mu.elements[i].checked && mu.elements[i].name != "massall") {
										if(grabbed != "") { grabbed += "::"; }
										grabbed += mu.elements[i].value;
									}
								}
								var formgrab = document.getElementById("grabbed");
								formgrab.value = grabbed;
							}
							if(grabbed == "") {
								alert("' . $mod_strings['LBL_MASS_DELETE_ERROR'] . '");
							} else {
								document.getElementById("Distribute").submit();
							}
						}

					</script>
						<input type="hidden" name="module" value="Emails">
						<input type="hidden" name="action" id="action">
						<input type="hidden" name="grabbed" id="grabbed">

					<table cellpadding="1" cellspacing="0" width="100%" border="0" class="edit view">
						<tr height="20">
							<td scope="col" scope="row" NOWRAP align="center">
								&nbsp;' . $mod_strings['LBL_ASSIGN_SELECTED_RESULTS_TO'] . '&nbsp;';
        $out .= $this->userSelectTable();
        $out .= '</td>
							<td scope="col" scope="row" NOWRAP align="left">
								&nbsp;' . $mod_strings['LBL_USING_RULES'] . '&nbsp;
								<select name="distribute_method" id="dm" onChange="checkDeps(this.form);">' . $distribution . '</select>
							</td>';
        $out .= '</td>
							</tr>';
        $out .= '<tr><td/>';
        $out .= '<td>' . translate('LBL_TEAMS', 'EmailTemplates');
        $out .= $teamWidget;
        $out .= '</td>
							</tr>';
        $out .= '<tr>
								<td scope="col" width="50%" scope="row" NOWRAP align="right" colspan="2">
								<input title="' . $mod_strings['LBL_BUTTON_DISTRIBUTE_TITLE'] . '"
									id="dist_button"
									class="button" onClick="AjaxObject.detailView.handleAssignmentDialogAssignAction();"
									type="button" name="button"
									value="  ' . $mod_strings['LBL_BUTTON_DISTRIBUTE'] . '  ">';
        $out .= '</tr>
					</table>
				</td>
			</tr>
		</table>
		</form>';
        return $out;
    }