本文整理汇总了PHP中data_entry_helper::onload_javascript方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::onload_javascript方法的具体用法?PHP data_entry_helper::onload_javascript怎么用?PHP data_entry_helper::onload_javascript使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::onload_javascript方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node)
{
data_entry_helper::$website_id = $args['website_id'];
if (!empty($args['high_volume']) && $args['high_volume']) {
// node level caching for most page hits
$cached = data_entry_helper::cache_get(array('node' => $node->nid), HIGH_VOLUME_CACHE_TIMEOUT);
if ($cached !== false) {
$cached = explode('|!|', $cached);
data_entry_helper::$javascript = $cached[1];
data_entry_helper::$late_javascript = $cached[2];
data_entry_helper::$onload_javascript = $cached[3];
data_entry_helper::$required_resources = json_decode($cached[4], true);
return $cached[0];
}
}
self::$node = $node;
self::$called_class = 'iform_' . $node->iform;
// Convert parameter, defaults, into structured array
self::parse_defaults($args);
// Supply parameters that may be missing after form upgrade
if (method_exists(self::$called_class, 'getArgDefaults')) {
$args = call_user_func(array(self::$called_class, 'getArgDefaults'), $args);
}
// Get authorisation tokens to update and read from the Warehouse. We allow child classes to generate this first if subclassed.
if (self::$auth) {
$auth = self::$auth;
} else {
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
self::$auth = $auth;
}
// Determine how the form was requested and therefore what to output
$mode = method_exists(self::$called_class, 'getMode') ? call_user_func(array(self::$called_class, 'getMode'), $args, $node) : '';
self::$mode = $mode;
if ($mode === self::MODE_GRID) {
// Output a grid of existing records
$r = call_user_func(array(self::$called_class, 'getGrid'), $args, $node, $auth);
} else {
if (($mode === self::MODE_EXISTING || $mode === self::MODE_EXISTING_RO || $mode === self::MODE_CLONE) && is_null(data_entry_helper::$entity_to_load)) {
// only load if not in error situation.
call_user_func_array(array(self::$called_class, 'getEntity'), array(&$args, $auth));
}
// attributes must be fetched after the entity to load is filled in - this is because the id gets filled in then!
$attributes = method_exists(self::$called_class, 'getAttributes') ? call_user_func(array(self::$called_class, 'getAttributes'), $args, $auth) : array();
$r = call_user_func(array(self::$called_class, 'get_form_html'), $args, $auth, $attributes);
}
if (!empty($args['high_volume']) && $args['high_volume']) {
$c = $r . '|!|' . data_entry_helper::$javascript . '|!|' . data_entry_helper::$late_javascript . '|!|' . data_entry_helper::$onload_javascript . '|!|' . json_encode(data_entry_helper::$required_resources);
data_entry_helper::cache_set(array('node' => $node->nid), $c, HIGH_VOLUME_CACHE_TIMEOUT);
}
return $r;
}
示例2: get_form
//.........这里部分代码省略.........
' . data_entry_helper::select($insect_ctrl_args) . '
<input type="text" name="insect:taxon_extra_info" class="taxon-info" value="' . lang::get('LANG_More_Precise') . '"
onclick="if(this.value==\'' . lang::get('LANG_More_Precise') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_More_Precise') . '\'; this.style.color=\'#555\'}" />
</div>
<div id="conditions-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
<div id="fold-conditions-button" class="ui-state-default ui-corner-all fold-button fold-button-folded"> </div>
<div id="reset-conditions-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="conditions-filter-title">
<span>' . lang::get('LANG_Conditions_Filter_Title') . '</span>
</div>
</div>
<div id="conditions-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
' . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['sky_state_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['temperature_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['wind_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['shade_attr_id']], $defAttrOptions)) . '
</div>
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">
' . data_entry_helper::georeference_lookup(iform_map_get_georef_options($args)) . '
<span id="location-georef-notes" >' . lang::get('LANG_Georef_Notes') . '</span>
<label for="place:INSEE">' . lang::get('LANG_Or') . '</label>
<input type="text" id="place:INSEE" name="place:INSEE" value="' . lang::get('LANG_INSEE') . '"
onclick="if(this.value==\'' . lang::get('LANG_INSEE') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_INSEE') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="' . lang::get('search') . '" />
</div>';
// this is a bit of a hack, because the apply_template method is not public in data entry helper.
$tempScript = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = '';
$r .= data_entry_helper::map_panel($options, $olOptions);
$map1JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
$r .= '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
</div>
<div id="results-insects-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
</div>
<div id="focus-collection" class="ui-accordion ui-widget ui-helper-reset">
<div id="fc-header" class="ui-accordion-content ui-helper-reset ui-state-active ui-corner-top ui-accordion-content-active">
<div id="fc-header-buttons">';
if (user_access('IForm n' . $node->nid . ' add preferred collection')) {
$r .= '<span id="fc-add-preferred" class="ui-state-default ui-corner-all preferred-button">' . lang::get('LANG_Add_Preferred_Collection') . '</span>';
示例3: loading_block_end
/**
* Allows the demarcation of the end of a region of the page HTML to be declared which will be replaced by
* a loading message whilst the page is loading.
*
* @return string HTML and JavaScript to insert into the page at the start of the block
* which is replaced by a loading panel while the page is loading.
*/
public static function loading_block_end()
{
global $indicia_templates;
// First hide the message, then hide the form, slide it into view, then show it.
// This script must precede the other scripts onload, otherwise they may have problems because
// of assumptions that the controls are visible.
self::$onload_javascript = "\$('.loading-panel').remove();\n" . "var panel=\$('.loading-hide')[0];\n" . "\$(panel).hide();\n" . "\$(panel).removeClass('loading-hide');\n" . "\$(panel).fadeIn('slow');\n" . self::$onload_javascript;
return $indicia_templates['loading_block_end'];
}
示例4: dump_javascript
/**
* Helper function to collect javascript code in a single location. Should be called at the end of each HTML
* page which uses the data entry helper so output all JavaScript required by previous calls.
*
* @return string JavaScript to insert into the page for all the controls added to the page so far.
*
* @link http://code.google.com/p/indicia/wiki/TutorialBuildingBasicPage#Build_a_data_entry_page
*/
public static function dump_javascript()
{
// Add the default stylesheet to the end of the list, so it has highest CSS priority
if (self::$default_styles) {
self::add_resource('defaultStylesheet');
}
self::setup_jquery_validation_js();
$dump = self::internal_dump_javascript(self::$javascript, self::$late_javascript, self::$onload_javascript, self::$required_resources);
// ensure scripted JS does not output again if recalled.
self::$javascript = "";
self::$late_javascript = "";
self::$onload_javascript = "";
return $dump;
}
示例5: dump_javascript
/**
* Helper function to collect javascript code in a single location. Should be called at the end of each HTML
* page which uses the data entry helper so output all JavaScript required by previous calls.
*
* @return string JavaScript to insert into the page for all the controls added to the page so far.
*
* @link http://code.google.com/p/indicia/wiki/TutorialBuildingBasicPage#Build_a_data_entry_page
*/
public static function dump_javascript()
{
global $indicia_resources, $indicia_templates;
// Add the default stylesheet to the end of the list, so it has highest CSS priority
if (self::$default_styles) {
self::add_resource('defaultStylesheet');
}
// If required, setup jQuery validation. We can't prep this JavaScript earlier since we would
// not know all the control messages.
// In the following block, we set the validation plugin's error class to our template.
// We also define the error label to be wrapped in a <p> if it is on a newline.
if (self::$validated_form_id) {
self::$javascript .= "\$('#" . self::$validated_form_id . "').validate({\n errorClass: \"" . $indicia_templates['error_class'] . "\",\n " . (in_array('inline', self::$validation_mode) ? "\n " : "errorElement: 'p',\n ") . "highlight: function(element, errorClass) {\n // Don't highlight the actual control, as it could be hidden anyway\n },\n messages: " . json_encode(self::$validation_messages) . "\n });\n";
}
$dump = self::internal_dump_javascript(self::$javascript, self::$late_javascript, self::$onload_javascript, $indicia_resources);
// ensure scripted JS does not output again if recalled.
self::$javascript = "";
self::$late_javascript = "";
self::$onload_javascript = "";
return $dump;
}
示例6: get_form
//.........这里部分代码省略.........
' . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$skyAttrID], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$temperatureAttrID], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$windAttrID], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$shadeAttrID], $defAttrOptions)) . '
</div>
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">';
$searches = explode(';', trim($args['Localisation_spec']));
if (count($searches) == 1) {
$parts = explode(':', $searches[0]);
$r .= '<input type="hidden" id="place:INSEE_Type" name="place:INSEE_Type" value="0"><label for="place:INSEE">' . lang::get('LANG_Search') . ' ' . $parts[0] . '</label>';
} else {
$r .= '<label for="place:INSEE_Type">' . lang::get('LANG_Search') . ' </label><select id="place:INSEE_Type" name="place:INSEE_Type">';
for ($i = 0; $i < count($searches); $i++) {
$parts = explode(':', $searches[$i]);
$r .= '<option value="' . $i . '">' . $parts[0] . '</option>';
}
$r .= '</select>';
}
$r .= '<input type="text" id="place:INSEE" name="place:INSEE" class="INSEE-search" value="' . lang::get('LANG_Enter_Location') . '"
onclick="if(this.value==\'' . lang::get('LANG_Enter_Location') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_Enter_Location') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="' . lang::get('search') . '" />
<div class="ui-corner-all ui-widget-content ui-helper-hidden" id="imp-insee-div" style="display: none;">
<div id="imp-insee-output-div"></div>
<a id="imp-insee-close-btn" href="#" class="ui-corner-all ui-widget-content ui-state-default indicia-button">' . lang::get('close') . '</a>
</div>
</div>';
// this is a bit of a hack, because the apply_template method is not public in data entry helper.
$tempScript = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = '';
$r .= data_entry_helper::map_panel($options, $olOptions);
$map1JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
$r .= '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" style="display: none">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom" style="display: none">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top" style="display: none">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
</div>
<div id="results-insects-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom" style="display: none">
</div>';
if (user_access('IForm n' . $node->nid . ' insect expert') || user_access('IForm n' . $node->nid . ' flower expert')) {
$r .= '
<form id="bulk-validation-form" action="' . iform_ajaxproxy_url($node, 'determination') . '" method="POST" style="display:none;">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="determination:occurrence_id" value="" />
<input type="hidden" name="determination:cms_ref" value="' . $uid . '" />