Пример #1
0
function displaySearchForm($searchRequest)
{
    registerShortcut("Ctrl+Alt+W", "addReturningObjectRow(document.getElementById('numReturningObjects').value++);" . "toggleFieldDisabled();");
    print "<script>\n";
    print "var searchable_objects = new Array();\n";
    foreach (describeGlobal("searchable") as $obj) {
        print "searchable_objects[\"{$obj}\"]=\"{$obj}\";\n";
    }
    print "</script>\n";
    print "<script src='" . getPathToStaticResource('/script/search.js') . "' type='text/javascript'></script>\n";
    print "<form method='POST' name='search_form' action='search.php'>\n";
    print getCsrfFormTag();
    print "<input type='hidden' id='numReturningObjects' name='numReturningObjects' value='" . count($searchRequest->getReturningObjects()) . "' />";
    print "<p class='instructions'>Enter a search string and optionally select the objects and fields to return to build a SOSL search below:</p>\n";
    print "<table id='search_form_table' border='0' width='1'>\n<tr>\n";
    print "<td NOWRAP>Search for </td><td NOWRAP colspan='2'><input type='text' id='SB_searchString' name='SB_searchString' value=\"" . htmlspecialchars($searchRequest->getSearchString(), ENT_QUOTES) . "\" size='37' onKeyUp='buildSearch();' /> in ";
    $fieldTypeSelectOptions = array('ALL FIELDS' => 'All Fields', 'NAME FIELDS' => 'Name Fields', 'PHONE FIELDS' => 'Phone Fields', 'EMAIL FIELDS' => 'Email Fields');
    print "<select id='SB_fieldTypeSelect' name='SB_fieldTypeSelect' onChange='buildSearch();' onkeyup='buildSearch();'>\n";
    foreach ($fieldTypeSelectOptions as $opKey => $op) {
        print "<option value='{$opKey}'";
        if ($opKey == $searchRequest->getFieldType()) {
            print " selected='selected' ";
        }
        print ">{$op}</option>";
    }
    print "</select>";
    print " limited to <input id='SB_limit' name='SB_limit' type='text'  value='" . htmlspecialchars($searchRequest->getLimit(), ENT_QUOTES) . "' size='5' onKeyUp='buildSearch();' /> maximum records</td></tr>\n";
    print "<tr id='sosl_search_textarea_row'><td valign='top' colspan='3'><br/>Enter or modify a SOSL search below:" . "<br/><textarea id='sosl_search_textarea' type='text' name='sosl_search' cols='100' rows='" . WorkbenchConfig::get()->value("textareaRows") . "' style='overflow: auto; font-family: monospace, courier;'>" . htmlspecialchars($searchRequest->getSoslSearch(), ENT_QUOTES) . "</textarea>" . "</td></tr>";
    print "<tr><td><input type='submit' name='searchSubmit' value='Search' />";
    print "<td colspan=4 align='right'>";
    print "&nbsp;&nbsp;" . "<img onmouseover=\"Tip('Where did saved searches go? They have been replaced with bookmarkable and shareable searched! Just run a search and bookmark the URL to save or copy and paste to share.')\" align='absmiddle' src='" . getPathToStaticResource('/images/help16.png') . "'/>";
    print "</td></tr></table><p/>\n";
    print "</form>\n";
    $rowNum = 0;
    foreach ($searchRequest->getReturningObjects() as $ro) {
        print "<script>addReturningObjectRow(" . $rowNum++ . ", " . "\"" . htmlspecialchars($ro->getObject(), ENT_QUOTES) . "\", " . "\"" . htmlspecialchars($ro->getFields(), ENT_QUOTES) . "\"" . ");</script>";
    }
    print "<script>toggleFieldDisabled();</script>";
}
Пример #2
0
}
require_once "header.php";
?>

<p>
    <?php 
if (count($c->getErrors()) > 0) {
    displayError($c->getErrors());
}
?>
</p>

<div id="loginBlockContainer">
    <form id="login_form" action="login.php" method="post">
        <?php 
print getCsrfFormTag();
?>
        <input type="hidden" id="startUrl" name="startUrl" value="<?php 
print htmlspecialchars($c->getStartUrl(), ENT_QUOTES);
?>
">
        <div id="login_type_selection" style="text-align: right; <?php 
if ($c->isOAuthRequired()) {
    print "display:none;";
}
?>
">
            <input type="radio" id="loginType_std" name="loginType" value="std"/>
            <label for="loginType_std">Standard</label>

            <input type="radio" id="loginType_adv" name="loginType" value="adv"/>
Пример #3
0
/**
 * Display the screen for field mapping user set for confirmation.
 * Also allows user to choose to use Bulk API to
 * do an async PUT opertion
 *
 * @param $action
 * @param $fieldMap
 * @param $csvArray
 * @param $extId
 */
function confirmFieldMappings($action, $fieldMap, $csvArray, $extId)
{
    if (!($fieldMap && $csvArray)) {
        displayError("CSV file and field mapping not initialized successfully. Upload a new file and map fields.", true, true);
        exit;
    }
    $recommendDoAsync = extension_loaded('curl') && count($csvArray) >= WorkbenchConfig::get()->value("asyncRecommendationThreshold") && !in_array($action, array('Confirm Undelete', 'Confirm Purge'));
    if ($action == 'Confirm Update' || $action == 'Confirm Delete' || $action == 'Confirm Undelete' || $action == 'Confirm Purge') {
        if (!isset($fieldMap['Id'])) {
            displayError("Salesforce ID not selected. Please try again.", false, true);
        } else {
            ob_start();
            if ($action == 'Confirm Delete' || $action == 'Confirm Undelete' || $action == 'Confirm Purge') {
                displayFieldMappings($fieldMap, null, false);
            } else {
                displayFieldMappings($fieldMap, null, true);
            }
            $idCol = array_search($fieldMap['Id'], $csvArray[0]);
            for ($row = 1, $idCount = 0; $row < count($csvArray); $row++) {
                if ($csvArray[$row][$idCol]) {
                    $idCount++;
                }
            }
            $fieldMappingTable = ob_get_clean();
            displayInfo("The file uploaded contains {$idCount} records with Salesforce IDs with the field mapping below." . ($recommendDoAsync ? " Due to the number of records being processed, it is recommended to use the Bulk API." : ""));
            print "<p class='instructions'>Confirm the mappings below:</p>";
            print "<p>{$fieldMappingTable}</p>";
        }
    } else {
        $recordCount = count($csvArray) - 1;
        displayInfo("The file uploaded contains {$recordCount} records to be added to " . WorkbenchContext::get()->getDefaultObject());
        print "<p class='instructions'>Confirm the mappings below:</p>";
        displayFieldMappings($fieldMap, $extId, true);
    }
    print "<form method='POST' action=''>" . getCsrfFormTag();
    displayBulkApiOptions($action, false, $recommendDoAsync);
    print "<p>&nbsp;</p><p><input type='submit' name='action' value='{$action}' /></p>\n";
    print "</form>\n";
}
Пример #4
0
function displayForm($infos = null, $errors = null)
{
    if (isset($infos)) {
        displayInfo($infos);
    }
    if (isset($errors)) {
        displayError($errors);
    }
    ?>

<form name='passwordChange' method='post'
    action=''>
<?php 
    print getCsrfFormTag();
    ?>
<table border='0'>

    <tr>
        <td align='right' colspan='2'>
        <p><label><input type='radio' name='passwordChangeType'
            value='set' onclick="togglePasswordFields('set');"
            checked='checked' /> Set</label> &nbsp; <label><input
            type='radio' name='passwordChangeType' value='reset'
            onclick="togglePasswordFields('reset');" /> Reset</label></p>
        </td>
    </tr>

    <tr>
        <td><label for='userId'>User Id: &nbsp;</label></td>
        <td><input type='text' id='userId' name='userId' size='45' /></td>
    </tr>

    <tr>
        <td><label for='passwordOne'>Password: &nbsp;</label></td>
        <td><input type='password' id='passwordOne' name='passwordOne'
            size='45' onkeyup="doPasswordsMatch(false);" /></td>
    </tr>
    <tr>
        <td><label for='passwordConfirm'>Confirm Password: &nbsp;</label></td>
        <td><input type='password' id='passwordConfirm'
            name='passwordConfirm' size='45'
            onkeyup="doPasswordsMatch(false);" /></td>
    </tr>

    <tr>
        <td colspan='2' align='right'>
        <p><input type='submit' id='changePasswordAction'
            name='changePasswordAction' value='Change Password'
            onclick="return doPasswordsMatch(true);" /> <input
            type='button' value='Clear Form' onclick="clearForm();" /></p>
        </td>
    </tr>

</table>
</form>

<script type="text/javascript">
<!--
 
 function togglePasswordFields(changeType) {
 
     if (changeType == 'set') {
         document.getElementById('passwordOne').disabled = false;
         document.getElementById('passwordConfirm').disabled = false;
      } else if (changeType == 'reset') {
         document.getElementById('passwordOne').value = null;
         document.getElementById('passwordConfirm').value = null;
         
         document.getElementById('passwordOne').disabled = true;
         document.getElementById('passwordConfirm').disabled = true;
         
         document.getElementById('passwordOne').style.background = 'white';
         document.getElementById('passwordConfirm').style.background = 'white';
     }
     
 }
 
 
 function doPasswordsMatch(doAlert) {
      if (document.getElementById('passwordOne').value.length < document.getElementById('passwordConfirm').value.length) {     
          document.getElementById('passwordConfirm').style.background = 'LightPink';
      }
      
      if (doAlert && document.getElementById('passwordOne').value.length == 0 && document.getElementById('passwordOne').disabled == false) {     
           document.getElementById('passwordOne').style.background = 'LightPink';
            alert('Must provide a password if setting password; otherwise, choose reset');
            document.getElementById('passwordOne').focus();
           return false;
      } else {
          document.getElementById('passwordOne').style.background = 'white';
      }
      
 
      if (document.getElementById('passwordOne').value == document.getElementById('passwordConfirm').value) {
          document.getElementById('passwordConfirm').style.background = 'white';
        return true;
      } else {
           if (doAlert) {
               document.getElementById('passwordConfirm').style.background = 'LightPink';
               alert('Passwords do not match');
           }
          
          if (document.getElementById('passwordOne').value.length == document.getElementById('passwordConfirm').value.length) {     
              document.getElementById('passwordConfirm').style.background = 'LightPink';
          }
           
          return false;
      }
 }
 
 function clearForm() {
     document.getElementById('userId').value = null;
     document.getElementById('passwordOne').value = null;
     document.getElementById('passwordConfirm').value = null;
     document.getElementById('passwordOne').style.background = 'white';
     document.getElementById('passwordConfirm').style.background = 'white';
 }


//-->
</script>

<?php 
}