コード例 #1
0
        print "<a href='#' onClick='jQuery(\"#{$vs_container_id}\").load(\"" . caNavUrl($this->request, 'Detail', 'Object', 'GetRepresentationInfo', array('representation_id' => (int) $vn_id, 'object_id' => (int) $t_object->getPrimaryKey())) . "\");'>→</a>";
    }
    ?>
						</div>
					</td>
<?php 
    if (caObjectsDisplayDownloadLink($this->request)) {
        ?>
					<td align="right" text-align="right">
<?php 
        print caFormTag($this->request, 'DownloadRepresentation', 'downloadRepresentationForm', 'Detail/Object', 'get', 'multipart/form-data', null, array('disableUnsavedChangesWarning' => true));
        print caHTMLSelect('version', $va_versions, array('id' => $vs_display_type == 'media_overlay' ? 'caMediaOverlayVersionControl' : 'caMediaDisplayVersionControl', 'class' => 'caMediaOverlayControls'), array('value' => 'original'));
        print ' ' . caFormSubmitLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_DOWNLOAD__, null, array('align' => 'middle')), '', 'downloadRepresentationForm');
        print caHTMLHiddenInput('representation_id', array('value' => $t_rep->getPrimaryKey()));
        print caHTMLHiddenInput('object_id', array('value' => $t_object->getPrimaryKey()));
        print caHTMLHiddenInput('download', array('value' => 1));
        ?>
						</form>
					</td>
<?php 
    }
    ?>
				</tr>
			</table>
	</div><!-- end caMediaOverlayControls -->

	<div id="<?php 
    print $vs_display_type == 'media_overlay' ? 'caMediaOverlayContent' : 'caMediaDisplayContent';
    ?>
">
<?php 
コード例 #2
0
ファイル: ca_acl_access.php プロジェクト: guaykuru/pawtucket
    print "<div><span class='accessName'>" . ucwords($va_group_access_item['name']) . "</span> <b>(group)</b>: " . $va_group_access_item['access_display'] . "</div>";
}
$va_user_access = $t_instance->getACLUsers(array('returnAsInitialValuesForBundle' => true));
foreach ($va_user_access as $va_user_access_item) {
    print "<div><span class='accessName'>" . $va_user_access_item['lname'] . ", " . $va_user_access_item['fname'] . "</span>: " . $va_user_access_item['access_display'] . "</div>";
}
?>
		
		<div id='editUserAccess'>
		<h2><?php 
print _t('Group access');
?>
</h2>
	<?php 
print $t_instance->getACLGroupHTMLFormBundle($this->request, 'caAccessControlList');
print caHTMLHiddenInput($t_instance->primaryKey(), array('value' => $t_instance->getPrimaryKey()));
?>
	
		<h2><?php 
print _t('User access');
?>
</h2>
	<?php 
print $t_instance->getACLUserHTMLFormBundle($this->request, 'caAccessControlList');
?>

		</div>
<?php 
if ($t_instance->getACLUserGroups() || $t_instance->getACLUsers()) {
    ?>
			<div id='editUserAccessLink' class='editLink'><a href='#' onclick='jQuery("#editUserAccess").show(250); jQuery("#editUserAccessLink").hide()'><img src='<?php 
コード例 #3
0
					
							jQuery('#caShippingFields select[name=shipping_country]').val(d['country']);
							jQuery('#shipping_country').click();
					
							jQuery('#caShippingFields #shipping_zone_select').val(d['state']);
							jQuery('#caShippingFields #shipping_zone_text').val(d['state']);
						});
					}
				}
			}
		);
	</script>
<?php 
} else {
    if (!$vn_order_id) {
        print caHTMLHiddenInput('transaction_id', array('value' => $vn_transaction_id));
    }
}
?>
	<h2><?php 
print _t('Customer information');
?>
</h2>
	<div class="formContainerBg" style="padding-top:0px;">
		<table width="100%">
			<tr>
				<td>
					<h2><?php 
print _t('Billing');
?>
</h2>
コード例 #4
0
				<td class="caConfirmBatchExecutionPanelAlertControl">
<?php 
    print _t('Send SMS to <strong>%1</strong> when done', $vs_sms);
    ?>
			
				</td>
<?php 
}
?>

			<div id="caTypeChangePanelControlButtons">
				<table>
					<tr>
						<td align="right"><?php 
print caFormSubmitButton($this->request, __CA_NAV_BUTTON_SAVE__, _t('Save'), 'caChangeTypeForm');
?>
</td>
						<td align="left"><?php 
print caJSButton($this->request, __CA_NAV_BUTTON_CANCEL__, _t('Cancel'), 'caChangeTypeFormCancelButton', array('onclick' => 'caTypeChangePanel.hidePanel(); return false;'), array());
?>
</td>
					</tr>
				</table>
			</div>
			
			<?php 
print caHTMLHiddenInput('set_id', array('value' => $this->getVar('set_id')));
?>
		</form>
	</div>
</div>
コード例 #5
0
 /**
  *
  *
  */
 public function htmlFormElement($pa_element_info, $pa_options = null)
 {
     $o_config = Configuration::load();
     $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth', 'fieldHeight'));
     $vs_element = '<div id="infoservice_' . $pa_element_info['element_id'] . '_input{n}">' . caHTMLTextInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_autocomplete{n}', array('size' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : $va_settings['fieldWidth'], 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : $va_settings['fieldHeight'], 'value' => '{{' . $pa_element_info['element_id'] . '}}', 'maxlength' => 512, 'id' => "infoservice_" . $pa_element_info['element_id'] . "_autocomplete{n}", 'class' => 'lookupBg')) . caHTMLHiddenInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}', array('value' => '{{' . $pa_element_info['element_id'] . '}}', 'id' => '{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}'));
     if ($pa_options['request']) {
         $vs_url = caNavUrl($pa_options['request'], 'lookup', 'InformationService', 'Get', array('max' => 100, 'element_id' => $pa_element_info['element_id']));
         $vs_detail_url = caNavUrl($pa_options['request'], 'lookup', 'InformationService', 'GetDetail', array('element_id' => $pa_element_info['element_id']));
     } else {
         // hardcoded default for testing.
         $vs_url = '/index.php/lookup/InformationService/Get';
         $vs_detail_url = '/index.php/lookup/InformationService/GetDetail';
     }
     $vs_element .= " <a href='#' class='caInformationServiceMoreLink' id='{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}'>" . _t("More &rsaquo;") . "</a>";
     $vs_element .= "<div id='{fieldNamePrefix}" . $pa_element_info['element_id'] . "_detail{n}' class='caInformationServiceDetail'>" . ($pa_options['request'] ? caBusyIndicatorIcon($pa_options['request']) : '') . "</div></div>";
     $vs_element .= "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\tjQuery('#infoservice_" . $pa_element_info['element_id'] . "_autocomplete{n}').autocomplete(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tminLength: 3,delay: 800,\n\t\t\t\t\t\t\t\tsource: '{$vs_url}',\n\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}').val(ui.item.label + '|' + ui.item.idno + '|' + ui.item.url);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).click(function() { this.select(); });\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ('{{" . $pa_element_info['element_id'] . "}}') {\n\t\t\t\t\t\t\tvar re = /\\[([A-Za-z]+:\\/\\/[^\\]]+)\\]/; \n\t\t\t\t\t\t\tvar infoservice = re.exec('{{" . $pa_element_info['element_id'] . "}}');\n\t\t\t\t\t\t\tif (infoservice && infoservice.length > 1) { \n\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}').css('display', 'inline').on('click', function(e) {\n\t\t\t\t\t\t\t\t\tif (jQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_detail{n}').css('display') == 'none') {\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_detail{n}').slideToggle(250, function() { \n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_detail{n}').load('{$vs_detail_url}/id/{n}');\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}').html('" . addslashes(_t("Less &rsaquo;")) . "');\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_detail{n}').slideToggle(250);\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}').html('" . addslashes(_t("More &rsaquo;")) . "');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t";
     return $vs_element;
 }
コード例 #6
0
    // !ajax
    ?>
<div id="bViewButtons">
<?php 
    foreach ($va_views as $vs_view => $va_view_info) {
        if ($vs_current_view === $vs_view) {
            print '<a href="#" class="active"><span class="glyphicon ' . $va_view_icons[$vs_view]['icon'] . '"></span></a> ';
        } else {
            print caNavLink($this->request, '<span class="glyphicon ' . $va_view_icons[$vs_view]['icon'] . '"></span>', 'disabled', '*', '*', '*', array('view' => $vs_view, 'key' => $vs_browse_key)) . ' ';
        }
    }
    if ($this->request->user->hasUserRole("founders_new") || $this->request->user->hasUserRole("admin") || $this->request->user->hasUserRole("curatorial_all_new") || $this->request->user->hasUserRole("curatorial_basic_new") || $this->request->user->hasUserRole("archives_new") || $this->request->user->hasUserRole("library_new")) {
        // Export as PDF
        print "<div class='reportTools'>";
        print caFormTag($this->request, 'view/pdf', 'caExportForm', ($this->request->getModulePath() ? $this->request->getModulePath() . '/' : '') . $this->request->getController() . '/' . $this->request->getAction(), 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
        print caHTMLHiddenInput('key', array('value' => $vs_browse_key));
        print "{$vs_export_format_select}" . caFormSubmitLink($this->request, _t('Download'), 'button', 'caExportForm') . "</form>\n";
        print "</div>";
    }
    ?>
</div>		
<H1>
<?php 
    if ($t_instance->getProperty('NAME_SINGULAR') == "object") {
        print _t('%1 %2 %3', $qr_res->numHits(), ucwords($va_browse_info['displayName']), $qr_res->numHits() == 1 ? _t("Result") : _t("Results"));
    } else {
        print _t('%1 %2 %3', $qr_res->numHits(), ucwords($t_instance->getProperty('NAME_SINGULAR')), $qr_res->numHits() == 1 ? _t("Result") : _t("Results"));
    }
    ?>
		
	<div class="btn-group">
コード例 #7
0
        $vn_cnt++;
        if ($vn_cnt >= $vn_max_cols) {
            $vn_cnt = 0;
            print "</tr>\n";
        }
    }
    if ($vn_cnt > 0) {
        print "</tr>\n";
    }
    ?>
				</table>
			<?php 
    print caHTMLHiddenInput("target", array('value' => $t_subject->tableName()));
    ?>
			<?php 
    print caHTMLHiddenInput("_fields", array('value' => join(';', array_keys($va_form_field_with_subelements))));
    ?>
		</form>
		<div style="height:1px; clear:both;"></div>
			<div id="buttons">
				<input type="submit" style="position: absolute; left: -9999px"/>
				<div style="text-align:left">
					<a href="#" onclick="jQuery('#caAdvancedSearch input[type!=hidden]').val(''); jQuery('#caAdvancedSearch select').val('');"><?php 
    print _t('Reset');
    ?>
</a>
					
					<a href="#" onclick="jQuery('#caAdvancedSearch').submit(); return false;"><?php 
    print _t('Search');
    ?>
</a>
コード例 #8
0
<?php

AssetLoadManager::register("directoryBrowser");
$vs_id = $this->getVar('id');
$vs_default = $this->getVar('defaultPath');
?>
<div id="<?php 
print $vs_id;
?>
directoryBrowser" class='directoryBrowserSmall'>
	<!-- Content for directory browser is dynamically inserted here by ca.hierbrowser -->
</div><!-- end directoryBrowser -->
<?php 
print caHTMLHiddenInput($vs_id, array('value' => '', 'id' => $vs_id));
?>
<script type="text/javascript">
	var oDirBrowser;
	jQuery(document).ready(function() {
		oDirBrowser = caUI.initDirectoryBrowser('<?php 
print $vs_id;
?>
directoryBrowser', {
			levelDataUrl: '<?php 
print caNavUrl($this->request, 'batch', 'MediaImport', 'GetDirectoryLevel');
?>
',
			initDataUrl: '<?php 
print caNavUrl($this->request, 'batch', 'MediaImport', 'GetDirectoryAncestorList');
?>
',
			
コード例 #9
0
 public function htmlFormElement($pa_element_info, $pa_options = null)
 {
     $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth', 'fieldHeight'));
     $vs_element = '<div id="taxonomy_' . $pa_element_info['element_id'] . '_input{n}">' . caHTMLTextInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_autocomplete{n}', array('size' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : $va_settings['fieldWidth'], 'height' => 1, 'value' => '{{' . $pa_element_info['element_id'] . '}}', 'maxlength' => 512, 'id' => "taxonomy_" . $pa_element_info['element_id'] . "_autocomplete{n}", 'class' => 'lookupBg')) . caHTMLHiddenInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}', array('value' => '{{' . $pa_element_info['element_id'] . '}}', 'id' => '{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}'));
     if ($pa_options['request']) {
         $vs_url = caNavUrl($pa_options['request'], 'lookup', 'Taxonomy', 'Get', array('max' => 100));
     } else {
         // hardcoded default for testing.
         $vs_url = '/index.php/lookup/Taxonomy/Get';
     }
     $vs_element .= " <a href='#' style='display: none;' id='{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}' target='_taxonomy_details'>" . _t("More") . "</a>";
     $vs_element .= '</div>';
     $vs_element .= "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\tjQuery('#taxonomy_" . $pa_element_info['element_id'] . "_autocomplete{n}').autocomplete(\n\t\t\t\t\t\t\t{ \n\t\t\t\t\t\t\t\tsource: '{$vs_url}', minLength: 3, delay: 800,\n\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\tif (ui.item.id) {\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}').val(ui.item.label);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t).click(function() { this.select(); });\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t";
     return $vs_element;
 }
コード例 #10
0
ファイル: ca_lists.php プロジェクト: ffarago/pawtucket2
 /**
  * Returns HTML <select> element containing the specified list, or portion of the list.
  *
  * @param mixed $pm_list_name_or_id
  * @param string $ps_name
  * @param array $pa_attributes 
  * @param array $pa_options Array of options. Valid options include:
  * 	childrenOnlyForItemID = if set only items below item_id in the list item hierarchy are returned. Default (null) is to return all items in the list.
  * 	directChildrenOnly = if set only items with item_id=childrenOnlyForItemID as parent in the list item hierarchy are returned. Default (null) is to return all items in the list.
  *  nullOption = if set then a "null" (no value) option is available labeled with the value passed in this option
  *  additionalOptions = an optional array of options that will be passed through to caHTMLSelect; keys are display labels and values are used as option values
  *  value = if set, the <select> will have default selection set to the item whose *value* matches the option value. If none is set then the first item in the list will be selected
  *  key = ca_list_item field to be used as value for the <select> element list; can be set to either item_id or item_value; default is item_id
  *	width = the display width of the list in characters or pixels
  *  limitToItemsWithID = An optional array of list item_ids. Item_ids not in the array will be omitted from the returned list.
  *  omitItemsWithID = An optional array of list item_ids. Item_ids in the array will be omitted from the returned list.
  *  disableItemsWithID = An optional array of list item_ids. Item_ids in the array will be disabled in the returned list.	
  *
  *	limitToItemsRelatedToCollections = an array of collection_ids or collection idno's; returned items will be restricted to those attached to the specified collections
  *	limitToItemsRelatedToCollectionWithRelationshipTypes = array of collection type names or type_ids; returned items will be restricted to those attached to the specified collectionss with the specified relationship type
  *	limitToListIDs = array of list_ids to restrict returned items to when using "limitToItemsRelatedToCollections"
  *
  *  indentForHierarchy = indicate hierarchy with indentation. [Default is true]
  * 	transaction = transaction to perform database operations within. [Default is null]
  * 
  * @return string - HTML code for the <select> element; empty string if the list is empty
  */
 public static function getListAsHTMLFormElement($pm_list_name_or_id, $ps_name, $pa_attributes = null, $pa_options = null)
 {
     $t_list = new ca_lists();
     if ($o_trans = caGetOption('transaction', $pa_options, null)) {
         $t_list->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!(isset($pa_options['limitToItemsRelatedToCollection']) && is_array($pa_options['limitToItemsRelatedToCollections']))) {
         $vn_list_id = $t_list->_getListID($pm_list_name_or_id);
         $t_list->load($vn_list_id);
     }
     $vn_root_id = isset($pa_options['childrenOnlyForItemID']) && $pa_options['childrenOnlyForItemID'] ? $pa_options['childrenOnlyForItemID'] : null;
     $va_disabled_item_ids = caGetOption('disableItemsWithID', $pa_options, null);
     $vs_render_as = isset($pa_options['render']) ? $pa_options['render'] : '';
     $vn_sort_type = $t_list->get('default_sort');
     if ($vs_render_as == 'yes_no_checkboxes' && $vn_sort_type == __CA_LISTS_SORT_BY_LABEL__) {
         $vn_sort_type = __CA_LISTS_SORT_BY_IDENTIFIER__;
         // never allow sort-by-label when rendering as yes/no checkbox
     }
     if (!in_array($vs_render_as, array('lookup', 'horiz_hierbrowser', 'vert_hierbrowser'))) {
         if (isset($pa_options['limitToItemsRelatedToCollections']) && is_array($pa_options['limitToItemsRelatedToCollections'])) {
             $t_collection = new ca_collections();
             $va_collection_ids = array();
             foreach ($pa_options['limitToItemsRelatedToCollections'] as $vn_collection_id) {
                 if ($vn_collection_id && !is_numeric($vn_collection_id)) {
                     if ($vn_collection_id = $t_collection->load(array('idno' => $vn_collection_id))) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 } else {
                     if ($vn_collection_id) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 }
             }
             if (sizeof($va_collection_ids)) {
                 $qr_collections = $t_list->makeSearchResult('ca_collections', $va_collection_ids, array('restrictToRelationshipTypes' => isset($pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes']) ? $pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes'] : null));
                 $va_item_ids = array();
                 while ($qr_collections->nextHit()) {
                     $va_list_items = $qr_collections->get('ca_list_items', array('returnAsArray' => true));
                     foreach ($va_list_items as $vn_rel_id => $va_list_item) {
                         $va_item_ids[$vn_rel_id] = $va_list_item['item_id'];
                     }
                 }
                 if ($va_limit_to_listIDs = isset($pa_options['limitToListIDs']) && is_array($pa_options['limitToListIDs']) ? $pa_options['limitToListIDs'] : null) {
                     // for some reason the option comes back as array(0 => null) if no list is selected in UI
                     // -> have to make sure to catch this case here
                     if (sizeof($va_limit_to_listIDs) == 1 && empty($va_limit_to_listIDs[0])) {
                         $va_limit_to_listIDs = null;
                     }
                 }
                 if (is_array($va_limit_to_listIDs) && sizeof($va_item_ids)) {
                     // filter out items from tables we don't want
                     $qr_list_items = $t_list->makeSearchResult("ca_list_items", array_values($va_item_ids));
                     while ($qr_list_items->nextHit()) {
                         if (!in_array($qr_list_items->get('ca_list_items.list_id'), $va_limit_to_listIDs)) {
                             if (is_array($va_k = array_keys($va_item_ids, $qr_list_items->get('ca_list_items.item_id')))) {
                                 foreach ($va_k as $vs_k) {
                                     unset($va_list_items[$vs_k]);
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             $va_list_items = $t_list->getItemsForList($pm_list_name_or_id, array_merge($pa_options, array('returnHierarchyLevels' => caGetOption('indentForHierarchy', $pa_options, true), 'item_id' => $vn_root_id, 'extractValuesByUserLocale' => true, 'sort' => $vn_sort_type)));
         }
     }
     if (!is_array($va_list_items)) {
         $va_list_items = array();
     }
     $va_options = array();
     $va_disabled_options = array();
     if (!isset($pa_options['value'])) {
         $pa_options['value'] = null;
     }
     if (!isset($pa_options['key'])) {
         $pa_options['key'] = 'item_id';
     }
     if (!in_array($pa_options['key'], array('item_id', 'item_value'))) {
         $pa_options['key'] = 'item_id';
     }
     if (!isset($pa_options['limitToItemsWithID']) || !is_array($pa_options['limitToItemsWithID']) || !sizeof($pa_options['limitToItemsWithID'])) {
         $pa_options['limitToItemsWithID'] = null;
     }
     if (!isset($pa_options['omitItemsWithID']) || !is_array($pa_options['omitItemsWithID']) || !sizeof($pa_options['omitItemsWithID'])) {
         $pa_options['omitItemsWithID'] = null;
     }
     if (isset($pa_options['nullOption']) && $pa_options['nullOption'] && $vs_render_as != 'checklist') {
         $va_options[''] = $pa_options['nullOption'];
     }
     $va_colors = array();
     $vn_default_val = null;
     foreach ($va_list_items as $vn_item_id => $va_item) {
         if (is_array($pa_options['limitToItemsWithID']) && !in_array($vn_item_id, $pa_options['limitToItemsWithID'])) {
             continue;
         }
         if (is_array($pa_options['omitItemsWithID']) && in_array($vn_item_id, $pa_options['omitItemsWithID'])) {
             continue;
         }
         $va_options[$va_item[$pa_options['key']]] = str_repeat('&nbsp;', intval($va_item['LEVEL']) * 3) . ' ' . $va_item['name_singular'];
         if (!$va_item['is_enabled'] || is_array($va_disabled_item_ids) && in_array($vn_item_id, $va_disabled_item_ids)) {
             $va_disabled_options[$va_item[$pa_options['key']]] = true;
         }
         $va_colors[$vn_item_id] = $va_item['color'];
         if ($va_item['is_default']) {
             $vn_default_val = $va_item[$pa_options['key']];
         }
         // get default value
         if ($va_item['is_default'] && !isset($pa_options['nullOption'])) {
             // set default if needed, but only if there's not a null option set
             if (!is_array($pa_options['value']) && (!isset($pa_options['value']) || !strlen($pa_options['value']))) {
                 $pa_options['value'] = $vn_default_val;
             } else {
                 if (is_array($pa_options['value']) && !sizeof($pa_options['value'])) {
                     $pa_options['value'] = array(0 => $vn_default_val);
                 }
             }
         }
     }
     if (isset($pa_options['additionalOptions']) && is_array($pa_options['additionalOptions'])) {
         $va_options = array_merge($va_options, array_flip($pa_options['additionalOptions']));
     }
     $pa_options['disabledOptions'] = $va_disabled_options;
     switch ($vs_render_as) {
         case 'radio_buttons':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vn_i = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 $va_attributes['value'] = $vm_value;
                 $va_attributes['id'] = $ps_name . '_' . $vn_i;
                 if ($pa_options['value'] == $vm_value) {
                     $va_attributes['checked'] = '1';
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 $vs_buf .= "<td>" . caHTMLRadioButtonInput($ps_name, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
                 $vn_i++;
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'yes_no_checkboxes':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vb_is_checked = false;
             if (!$pa_options['value']) {
                 $pa_options['value'] = (string) $vn_default_val;
             }
             foreach ($va_options as $vm_value => $vs_label) {
                 if (strlen($vm_value) == 0) {
                     continue;
                 }
                 // don't count null values when calculating the first value for the yes/no
                 switch ($vn_c) {
                     case 0:
                         if ($pa_options['value'] === (string) $vm_value) {
                             $vb_is_checked = true;
                         }
                         $pa_attributes['value'] = $pa_options['value'] = $vm_value;
                         $pa_options['label'] = $vs_label;
                         break;
                     case 1:
                         $pa_options['returnValueIfUnchecked'] = $vm_value;
                         break;
                     default:
                         // exit
                         break 2;
                 }
                 $vn_c++;
             }
             if ($vb_is_checked) {
                 $pa_attributes['checked'] = 1;
             }
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLCheckboxInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'checklist':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (is_array($pa_options['value']) && in_array($vm_value, $pa_options['value'])) {
                     $va_attributes['checked'] = '1';
                 }
                 $vs_buf .= "<td>" . caHTMLCheckboxInput($ps_name . '_' . $vm_value, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'lookup':
             $vs_value = $vs_hidden_value = "";
             if (caGetOption('forSearch', $pa_options)) {
                 if ($vs_val_id = caGetOption('value', $pa_options)) {
                     $vs_value = $t_list->getItemFromListForDisplayByItemID($pm_list_name_or_id, $vs_val_id);
                     $vs_hidden_value = $vs_val_id;
                 }
             } else {
                 $vs_value = "{" . $pa_options['element_id'] . "_label}";
                 $vs_hidden_value = "{" . $pa_options['element_id'] . "}";
             }
             $vs_buf = caHTMLTextInput($ps_name . '_autocomplete', array('width' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : 300, 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : 1, 'value' => $vs_value, 'maxlength' => 512, 'id' => $ps_name . "_autocomplete", 'class' => 'lookupBg')) . caHTMLHiddenInput($ps_name, array('value' => $vs_hidden_value, 'id' => $ps_name));
             if ($pa_options['request']) {
                 $vs_url = caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noInline' => 1, 'noSymbols' => 1, 'max' => 100));
             } else {
                 // hardcoded default for testing.
                 $vs_url = '/index.php/lookup/ListItem/Get';
             }
             $vs_buf .= '</div>';
             $vs_buf .= "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').autocomplete({\n\t\t\t\t\t\t\t\t\tsource: '{$vs_url}', minLength: 3, delay: 800, html: true,\n\t\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (parseInt(ui.item.id) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val(ui.item.id);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').val('');\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val('');\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t";
             return $vs_buf;
             break;
         case 'horiz_hierbrowser':
         case 'horiz_hierbrowser_with_search':
         case 'vert_hierbrowser':
             $va_width = caParseFormElementDimension($pa_options['width'] ? $pa_options['width'] : $pa_options['width']);
             if ($va_width['type'] != 'pixels' && $va_width['dimension'] < 250) {
                 $va_width['dimension'] = 500;
             }
             $vn_width = $va_width['dimension'] . 'px';
             $va_height = caParseFormElementDimension($pa_options['height']);
             if ($va_height['type'] != 'pixels' && $va_height['dimension'] < 100) {
                 $va_height['dimension'] = 200;
             }
             $vn_height = $va_height['dimension'] . 'px';
             $t_root_item = new ca_list_items();
             $t_root_item->load(array('list_id' => $vn_list_id, 'parent_id' => null));
             JavascriptLoadManager::register("hierBrowser");
             $vs_buf = "<div style='width: {$vn_width}; height: {$vn_height};'><div id='{$ps_name}_hierarchyBrowser{n}' style='width: 100%; height: 100%;' class='" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserVertical' : 'hierarchyBrowser') . "'>\n\t\t\t\t\t<!-- Content for hierarchy browser is dynamically inserted here by ca.hierbrowser -->\n\t\t\t\t</div><!-- end hierarchyBrowser -->\t</div>";
             $vs_buf .= "\t<script type='text/javascript'>\n\t\tjQuery(document).ready(function() { \n\t\t\tvar oHierBrowser = caUI.initHierBrowser('{$ps_name}_hierarchyBrowser{n}', {\n\t\t\t\tuiStyle: '" . ($vs_render_as == 'vert_hierbrowser' ? 'vertical' : 'horizontal') . "',\n\t\t\t\tlevelDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyLevel', array('noSymbols' => 1)) . "',\n\t\t\t\tinitDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyAncestorList') . "',\n\t\t\t\t\n\t\t\t\tselectOnLoad : true,\n\t\t\t\tbrowserWidth: " . (int) $va_width['dimension'] . ",\n\t\t\t\t\n\t\t\t\tclassName: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserLevelVertical' : 'hierarchyBrowserLevel') . "',\n\t\t\t\tclassNameContainer: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserContainerVertical' : 'hierarchyBrowserContainer') . "',\n\t\t\t\t\n\t\t\t\teditButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_RIGHT_ARROW__) . "\",\n\t\t\t\tdisabledButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_DOT__) . "\",\n\t\t\t\tinitItemID: '{" . $pa_options['element_id'] . "}',\n\t\t\t\tdefaultItemID: '" . $t_list->getDefaultItemID() . "',\n\t\t\t\tuseAsRootID: '" . $t_root_item->getPrimaryKey() . "',\n\t\t\t\tindicatorUrl: '" . $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif',\n\t\t\t\t\n\t\t\t\tcurrentSelectionDisplayID: '{$ps_name}_browseCurrentSelectionText{n}',\n\t\t\t\tonSelection: function(item_id, parent_id, name, display) {\n\t\t\t\t\tjQuery('#{$ps_name}').val(item_id);\n\t\t\t\t}\n\t\t\t});";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "jQuery('#{$ps_name}_hierarchyBrowserSearch{n}').autocomplete(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noSymbols' => 1)) . "', \n\t\t\t\t\t\tminLength: 3, delay: 800,\n\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\toHierBrowser.setUpHierarchy(ui.item.id);\t// jump browser to selected item\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);";
             }
             $vs_buf .= "});\n\t</script>";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "<div class='hierarchyBrowserSearchBar'>" . _t('Search') . ": <input type='text' id='{$ps_name}_hierarchyBrowserSearch{n}' class='hierarchyBrowserSearchBar' name='search' value='' size='20'/></div>";
             }
             if ($vs_render_as != 'vert_hierbrowser') {
                 $vs_buf .= "<div id='{$ps_name}_browseCurrentSelection{n}' class='hierarchyBrowserCurrentSelection'>" . _t("Current selection") . ": <span id='{$ps_name}_browseCurrentSelectionText{n}' class='hierarchyBrowserCurrentSelectionText'>?</span></div>";
             }
             $vs_buf .= caHTMLHiddenInput($ps_name, array('value' => "{" . $pa_options['element_id'] . "}", 'id' => $ps_name));
             return $vs_buf;
             break;
         case 'text':
             return caHTMLTextInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'options':
             return $va_options;
             break;
         default:
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLSelect($ps_name, $va_options, $pa_attributes, array_merge($pa_options, array('contentArrayUsesKeysForValues' => true, 'colors' => $va_colors, 'height' => null)));
             break;
     }
 }
コード例 #11
0
    ?>
	<!-- Controls -->
	<div class="caMediaOverlayControls">
			<div class='close'><a href="#" onclick="caMediaPanel.hidePanel(); return false;" title="close">&nbsp;&nbsp;&nbsp;</a></div>
<?php 
    if ($this->request->user->canDoAction('can_download_media')) {
        ?>
				<div class='download'>
<?php 
        if (is_array($va_versions = $this->request->config->getList('ca_object_representation_download_versions'))) {
            // -- provide user with a choice of versions to download
            print caFormTag($this->request, 'DownloadAttributeMedia', 'caMediaDownloadForm', $this->request->getModulePath() . '/' . $this->request->getController(), 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true, 'noTimestamp' => true));
            print caHTMLSelect('version', $va_versions, array('style' => 'font-size: 9px;'));
            print caFormSubmitLink($this->request, "<img src='" . $this->request->getThemeUrlPath() . "/graphics/buttons/downloadWhite.png' border='0' title='" . _t("Download media") . "' valign='bottom'/>", '', 'caMediaDownloadForm', 'caMediaDownloadFormButton');
            print caHTMLHiddenInput('value_id', array('value' => $t_value->getPrimaryKey()));
            print caHTMLHiddenInput("download", array('value' => 1));
            print "</form>\n";
        }
        ?>
				
				</div>
<?php 
    }
    ?>
				<div class='objectInfo'>
<?php 
    //$vs_label = $t_object->getLabelForDisplay();
    //print (mb_strlen($vs_label) > 80) ? mb_substr($vs_label, 0, 80)."..." : $vs_label;
    //if($t_object->get("idno")){
    //	print " [".$t_object->get("idno")."]";
    //}
コード例 #12
0
 /**
  *
  */
 public function htmlFormElementForAttributeSearch($po_request, $pm_element_code_or_id, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!($t_element = $this->_getElementInstance($pm_element_code_or_id))) {
         return false;
     }
     $vb_is_sub_element = (bool) $t_element->get('parent_id');
     $t_parent = $vb_is_sub_element ? $this->_getElementInstance($t_element->get('parent_id')) : null;
     while ($vb_is_sub_element && $t_parent->get('datatype') == 0 && $t_parent->get('parent_id') > 0) {
         $t_parent = $this->_getElementInstance($t_parent->get('parent_id'));
     }
     $vs_element_code = $t_element->get('element_code');
     // get all elements of this element set
     $va_element_set = $vb_is_sub_element ? $t_parent->getElementsInSet() : $t_element->getElementsInSet();
     if ($vb_is_sub_element) {
         foreach ($va_element_set as $vn_i => $va_element) {
             if ($va_element['element_code'] !== $vs_element_code) {
                 unset($va_element_set[$vn_i]);
             }
         }
     }
     $t_attr = new ca_attributes();
     $t_attr->purify($this->purify());
     $va_element_codes = array();
     $va_elements_by_container = array();
     if (sizeof($va_element_set) > 1) {
         $vs_format = isset($pa_options['multivalueFormat']) ? $pa_options['multivalueFormat'] : null;
     } else {
         $vs_format = isset($pa_options['format']) ? $pa_options['format'] : null;
     }
     $pa_options['format'] = $vs_format;
     foreach ($va_element_set as $va_element) {
         $va_override_options = array();
         if ($va_element['datatype'] == 0) {
             // containers are not active form elements
             continue;
         }
         $va_label = $this->getAttributeLabelAndDescription($va_element['element_id']);
         $vs_subelement_code = $this->tableName() . '.' . ($vb_is_sub_element ? $t_parent->get('element_code') . '.' : '') . ($vs_element_code !== $va_element['element_code'] ? "{$vs_element_code}." : "") . $va_element['element_code'];
         $vs_value = isset($pa_options['values']) && isset($pa_options['values'][$vs_subelement_code]) ? $pa_options['values'][$vs_subelement_code] : '';
         $va_element_opts = array_merge(array('label' => $va_label['name'], 'description' => $va_label['description'], 't_subject' => $this, 'request' => $po_request, 'class' => $pa_options['class'], 'nullOption' => '-', 'value' => $vs_value, 'forSearch' => true, 'render' => isset($va_element['settings']['render']) && $va_element['settings']['render'] == 'lookup' ? $va_element['settings']['render'] : isset($pa_options['render']) ? $pa_options['render'] : 'select'), array_merge($pa_options, $va_override_options));
         if (caGetOption('forSimpleForm', $pa_options, false)) {
             unset($va_element_opts['nullOption']);
         }
         // We don't want to pass the entire set of values to ca_attributes::attributeHtmlFormElement() since it'll treat it as a simple list
         // of values for an individual element and the 'values' array is actually set to values for *all* elements in the form
         unset($va_element_opts['values']);
         $va_element_opts['values'] = '';
         // ... replace name of form element
         $vs_fld_name = $vs_subelement_code;
         //str_replace('.', '_', $vs_subelement_code);
         if (caGetOption('asArrayElement', $pa_options, false)) {
             $vs_fld_name .= "[]";
         }
         if ($vs_force_value = caGetOption('force', $pa_options, false)) {
             $vs_form_element = caHTMLHiddenInput($vs_fld_name, array('value' => $vs_force_value));
         } else {
             $vs_form_element = ca_attributes::attributeHtmlFormElement($va_element, $va_element_opts);
             //
             // prep element for use as search element
             //
             // ... replace value
             $vs_form_element = str_replace('{{' . $va_element['element_id'] . '}}', $vs_value, $vs_form_element);
             // escape any special characters in jQuery selectors
             $vs_form_element = str_replace("jQuery('#{fieldNamePrefix}" . $va_element['element_id'] . "_{n}')", "jQuery('#" . str_replace(array("[", "]", "."), array("\\\\[", "\\\\]", "\\\\."), $vs_fld_name) . "')", $vs_form_element);
             $vs_form_element = str_replace('{fieldNamePrefix}' . $va_element['element_id'] . '_{n}', $vs_fld_name, $vs_form_element);
             $vs_form_element = str_replace('{n}', '', $vs_form_element);
             $vs_form_element = str_replace('{' . $va_element['element_id'] . '}', '', $vs_form_element);
         }
         $va_elements_by_container[$va_element['parent_id'] ? $va_element['parent_id'] : $va_element['element_id']][] = $vs_form_element;
         // If the elements datatype returns true from renderDataType, then force render the element
         if (Attribute::renderDataType($va_element)) {
             return array_pop($va_elements_by_container[$va_element['element_id']]);
         }
         $va_element_ids[] = $va_element['element_id'];
     }
     $vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $po_request->getViewsDirectoryPath();
     $o_view = new View($po_request, "{$vs_view_path}/bundles/");
     $o_view->setVar('request', $po_request);
     $o_view->setVar('elements', $va_elements_by_container);
     $o_view->setVar('element_ids', $va_element_ids);
     $o_view->setVar('element_set_label', $this->getAttributeLabel($t_element->get('element_id')));
     return $o_view->render(caGetOption('view', $pa_options, 'ca_search_form_attributes.php'));
 }
コード例 #13
0
print $this->request->getThemeUrlPath();
?>
/graphics/icons/indicator.gif',

			currentSelectionDisplayID: 'browseCurrentSelection',

			onSelection: function(item_id, path, name, type) {
				if (type == 'DIR') { jQuery('#caDirectoryValue').val(path); }
			}
		});

		jQuery('#progressbar').progressbar({ value: 0 });
	});
</script>
<?php 
print caHTMLHiddenInput('directory', array('value' => '', 'id' => 'caDirectoryValue'));
?>
				</div>
				<div style="margin: 8px 0px 0px 0px; padding-bottom:5px;">
<?php 
$va_opts = array('id' => 'caIncludeSubDirectories', 'value' => 1);
if (isset($va_last_settings['includeSubDirectories']) && $va_last_settings['includeSubDirectories']) {
    $va_opts['checked'] = 1;
}
print caHTMLCheckboxInput('include_subdirectories', $va_opts) . ' ' . _t('Include all sub-directories');
$va_opts['style'] = 'margin-left: 10px';
print caHTMLCheckboxInput('delete_media_on_import', $va_opts) . ' ' . _t('Delete media after import');
?>
				</div>
			</div>
		</div>
コード例 #14
0
    $vs_buf .= caFormTag($this->request, 'Edit', 'NewChildForm', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
    $vs_buf .= _t('Add a %1 under this', $vs_type_list) . caHTMLHiddenInput($t_item->primaryKey(), array('value' => '0')) . caHTMLHiddenInput('parent_id', array('value' => $t_item->getPrimaryKey()));
    $vs_buf .= '<div id="caTypeChangePanelControlButtons">';
    $vs_buf .= '<div class="saveButton">' . caFormSubmitLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_SAVE__), '', 'NewChildForm') . " " . _t('Save') . "</div>";
    $vs_buf .= caJSButton($this->request, __CA_NAV_BUTTON_CANCEL__, _t('Cancel'), 'caChangeTypeFormCancelButton', array('onclick' => 'caCreateChildPanel.hidePanel(); return false;'), array());
    $vs_buf .= "</div>";
    $vs_buf .= "</form></div>\n";
}
if ($t_item->tableName() == 'ca_collections' && $this->request->config->get('ca_objects_x_collections_hierarchy_enabled')) {
    $t_object = new ca_objects();
    if ((bool) $this->request->config->get('ca_objects_enforce_strict_type_hierarchy')) {
        // strict menu
        $vs_type_list = $t_object->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('childrenOfCurrentTypeOnly' => true, 'directChildrenOnly' => $this->request->config->get($vs_table_name . '_enforce_strict_type_hierarchy') == '~' ? false : true, 'returnHierarchyLevels' => true, 'access' => __CA_BUNDLE_ACCESS_EDIT__));
    } else {
        // all types
        $vs_type_list = $t_object->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('access' => __CA_BUNDLE_ACCESS_EDIT__));
    }
    $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px; padding-top:10px" class="addChild">';
    $vs_buf .= caFormTag($this->request, 'Edit', 'NewChildObjectForm', 'editor/objects/ObjectEditor', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
    $vs_buf .= _t('Add a %1 under this', $vs_type_list) . caHTMLHiddenInput('object_id', array('value' => '0')) . caHTMLHiddenInput('collection_id', array('value' => $t_item->getPrimaryKey()));
    $vs_buf .= '<div id="caTypeChangePanelControlButtons">';
    $vs_buf .= '<div class="saveButton">' . caFormSubmitLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_SAVE__), '', 'NewChildObjectForm') . " " . _t('Save') . "</div>";
    $vs_buf .= caJSButton($this->request, __CA_NAV_BUTTON_CANCEL__, _t('Cancel'), 'caChangeTypeFormCancelButton', array('onclick' => 'caCreateChildPanel.hidePanel(); return false;'), array());
    $vs_buf .= "</div>";
    $vs_buf .= "</form></div>\n";
}
print $vs_buf;
?>
			
	</div>
</div>
コード例 #15
0
 /**
  * Return HTML form element for editing.
  *
  * @param array $pa_element_info An array of information about the metadata element being edited
  * @param array $pa_options array Options include:
  *			forSearch = simple text entry is returned for use with search forms [Default=false]
  *			class = the CSS class to apply to all visible form elements [Default=lookupBg]
  *			width = the width of the form element [Default=field width defined in metadata element definition]
  *			height = the height of the form element [Default=field height defined in metadata element definition]
  *			request = the RequestHTTP object for the current request; required for lookups to work [Default is null]
  *			disableMap = don't show map with Geonames data [Default=false]
  *
  * @return string
  */
 public function htmlFormElement($pa_element_info, $pa_options = null)
 {
     $vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : '');
     if (isset($pa_options['forSearch']) && $pa_options['forSearch']) {
         return caHTMLTextInput("{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}", array('id' => "{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}", 'value' => $pa_options['value']), $pa_options);
     }
     $o_config = Configuration::load();
     $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth', 'fieldHeight', 'disableMap', 'maxResults', 'gnElements', 'gnDelimiter'));
     $vn_max_results = isset($va_settings['maxResults']) ? intval($va_settings['maxResults']) : 20;
     $vs_gn_elements = $va_settings['gnElements'];
     $vs_gn_delimiter = $va_settings['gnDelimiter'];
     if ($pa_options['request']) {
         $vs_url = caNavUrl($pa_options['request'], 'lookup', 'GeoNames', 'Get', array('maxRows' => $vn_max_results, 'gnElements' => urlencode($vs_gn_elements), 'gnDelimiter' => urlencode($vs_gn_delimiter)));
     }
     $vs_element = '<div id="geonames_' . $pa_element_info['element_id'] . '_input{n}">' . caHTMLTextInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_autocomplete{n}', array('size' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : $va_settings['fieldWidth'], 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : $va_settings['fieldHeight'], 'value' => '{{' . $pa_element_info['element_id'] . '}}', 'maxlength' => 512, 'id' => "geonames_" . $pa_element_info['element_id'] . "_autocomplete{n}", 'class' => $vs_class ? $vs_class : 'lookupBg')) . caHTMLHiddenInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}', array('value' => '{{' . $pa_element_info['element_id'] . '}}', 'id' => '{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}'));
     $vs_element .= '</div>';
     $vs_element .= "\n\t\t\t<script type='text/javascript'>\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#geonames_" . $pa_element_info['element_id'] . "_autocomplete{n}').autocomplete(\n\t\t\t\t\t\t{ \n\t\t\t\t\t\t\tsource: '{$vs_url}',\n\t\t\t\t\t\t\tminLength: 3, delay: 800,\n\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}').val(ui.item.label + ' [id:' + ui.item.id + ']');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t).click(function() { this.select(); });\n\t\t\t\t});\n\t\t\t</script>\n\t\t";
     if (!caGetOption("disableMap", $va_settings, false) && !caGetOption("disableMap", $pa_options, false)) {
         JavascriptLoadManager::register('maps');
         $vs_element .= "\n\t\t\t\t<div id='map_" . $pa_element_info['element_id'] . "{n}' style='width:700px; height:160px;'>\n\n\t\t\t\t</div>\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tif ('{n}'.substring(0,3) == 'new') {\n\t\t\t\t\t\tjQuery('#map_" . $pa_element_info['element_id'] . "{n}').hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t";
         $vs_element .= "\n\t\t\t\t\tvar re = /\\[([\\d\\.\\-,; ]+)\\]/;\n\t\t\t\t\tvar r = re.exec('{{" . $pa_element_info['element_id'] . "}}');\n\t\t\t\t\tvar latlong = (r) ? r[1] : null;\n\n\t\t\t\t\tif (latlong) {\n\t\t\t\t\t\t// map vars are global\n\t\t\t\t\t\tmap_" . $pa_element_info['element_id'] . "{n} = new google.maps.Map(document.getElementById('map_" . $pa_element_info['element_id'] . "{n}'), {\n\t\t\t\t\t\t\tdisableDefaultUI: false,\n\t\t\t\t\t\t\tmapTypeId: google.maps.MapTypeId.SATELLITE\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tvar tmp = latlong.split(',');\n\t\t\t\t\t\tvar pt = new google.maps.LatLng(tmp[0], tmp[1]);\n\t\t\t\t\t\tmap_" . $pa_element_info['element_id'] . "{n}.setCenter(pt);\n\t\t\t\t\t\tmap_" . $pa_element_info['element_id'] . "{n}.setZoom(15);\t\t// todo: make this a user preference of some sort\n\t\t\t\t\t\tvar marker = new google.maps.Marker({\n\t\t\t\t\t\t\tposition: pt,\n\t\t\t\t\t\t\tmap: map_" . $pa_element_info['element_id'] . "{n}\n\t\t\t\t\t\t});\n\t\t\t\t\t}";
         $vs_element .= "\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t</script>";
     }
     return $vs_element;
 }
コード例 #16
0
	<span class="formLabelText" id="_ca_metadata_element_labels_"><?php 
print _t("Labels");
?>
</span>
<?php 
print $t_element->getPreferredLabelHTMLFormBundle($this->request, 'element_labels', 'element_labels');
?>
</div>
<?php 
$va_lookup_url_info = caJSONLookupServiceUrl($this->request, $t_element->tableName());
$va_options = array('error_icon' => $this->request->getThemeUrlPath() . "/graphics/icons/warning_small.gif", 'progress_indicator' => $this->request->getThemeUrlPath() . "/graphics/icons/indicator.gif", 'lookup_url' => $va_lookup_url_info['intrinsic'], 'no_tooltips' => false);
foreach ($t_element->getFormFields() as $vs_f => $va_user_info) {
    print $t_element->htmlFormElement($vs_f, null, array_merge($va_options, array('field_errors' => $this->request->getActionErrors('field_' . $vs_f))));
}
if ($vn_parent_id) {
    print caHTMLHiddenInput('parent_id', array('value' => $vn_parent_id));
}
if (!is_array($va_available_settings = $this->getVar('available_settings'))) {
    $va_available_settings = array();
}
?>
		<div id='elementSettingsForm' class='formSettings'>
			<div class='formLabel'><span id="_ca_metadata_element_labels_"><?php 
print _t("Datatype-specific options");
?>
</span><br/></div>
			<div style="margin-left: 20px;">
<?php 
foreach ($va_available_settings as $vs_code => $va_properties) {
    print $t_element->settingHTMLFormElement($vs_code, array('label_id' => "setting_{$vs_code}_datatype_label_{$vn_element_id}"));
}
コード例 #17
0
<?php 
        $vn_cnt++;
        if ($vn_cnt >= $vn_max_cols) {
            $vn_cnt = 0;
            print "</tr>\n";
        }
    }
    if ($vn_cnt > 0) {
        print "</tr>\n";
    }
    ?>
				</table>
			<?php 
    print caHTMLHiddenInput("target", array('value' => $t_subject->tableName()));
    ?>
			<?php 
    print caHTMLHiddenInput("_fields", array('value' => join(';', array_keys($va_form_fields))));
    ?>
		</form>
	
	</div><!-- end advancedSearch -->
	<script type="text/javascript">
		function caLoadAdvancedSearchForm() {
			jQuery('#caAdvancedSearchForm').load('<?php 
    print caNavUrl($this->request, '', 'AdvancedSearch', 'getAdvancedSearchForm', array());
    ?>
/form/' + jQuery('#caAdvancedSearchFormSelector').val());
		}
	</script>
<?php 
}
コード例 #18
0
        $vs_subject = isset($va_last_message['subject']) ? $va_last_message['subject'] : '';
        if (sizeof($va_messages_by_transaction) && !preg_match('!' . _t("Re:") . '!i', $vs_subject)) {
            $vs_subject = _t("Re:") . ' ' . $vs_subject;
        }
        $t_comm->set('subject', $vs_subject);
        foreach ($t_comm->getFormFields() as $vs_f => $va_info) {
            switch ($vs_f) {
                case 'subject':
                case 'message':
                case 'transaction_id':
                    print $t_comm->htmlFormElement($vs_f, "<div class='formLabel'>^LABEL<br/>^ELEMENT</div>") . "\n";
                    break;
            }
        }
        print caHTMLHiddenInput('transaction_id', array('value' => $t_order->get("transaction_id")));
        print caHTMLHiddenInput('order_id', array('value' => $t_order->get("order_id")));
        print "<a href='#' onclick='jQuery(\"#caClientCommunicationsReplyFormMyAccount\").submit(); return false;' class='save'>" . _t("Send") . "</a>";
        ?>
				</form>
			</div><!-- end messageForm -->
<?php 
        if (sizeof($va_messages_by_transaction)) {
            ?>
 			<div id="messageInbox"><h2><?php 
            print _t("Inbox");
            ?>
</h2>
 				<div id="caClientCommunicationsMessageList">
<?php 
            //
            // List of messages
コード例 #19
0
$t_ui = $this->getVar('t_ui');
?>
	<div class="sectionBox">
<?php 
print $vs_control_box = caFormControlBox(caFormSubmitButton($this->request, __CA_NAV_BUTTON_SAVE__, _t("Save"), 'SetEditorForm') . ' ' . caNavButton($this->request, __CA_NAV_BUTTON_CANCEL__, _t("Cancel"), '', 'manage/sets', 'SetEditor', 'Edit/' . $this->request->getActionExtra(), array('set_id' => $vn_set_id)), '', intval($vn_set_id) > 0 && $can_delete ? caNavButton($this->request, __CA_NAV_BUTTON_DELETE__, _t("Delete"), '', 'manage/sets', 'SetEditor', 'Delete/' . $this->request->getActionExtra(), array('set_id' => $vn_set_id)) : '');
print caFormTag($this->request, 'Save/' . $this->request->getActionExtra() . '/set_id/' . $vn_set_id, 'SetEditorForm', null, 'POST', 'multipart/form-data');
$va_form_elements = $t_set->getBundleFormHTMLForScreen($this->request->getActionExtra(), array('request' => $this->request, 'formName' => 'SetEditorForm'));
if (!$vn_set_id) {
    // For new sets, show mandatory fields...
    // ... BUT ...
    // if table_num is set on the url then create a hidden element rather than show it as a mandatory field
    // This allows us to set the content type for the set from the calling control
    $va_mandatory_fields = $t_set->getMandatoryFields();
    if (($vn_index = array_search('table_num', $va_mandatory_fields)) !== false) {
        if (($vn_table_num = $t_set->get('table_num')) > 0) {
            print caHTMLHiddenInput('table_num', array('value' => $vn_table_num));
            unset($va_form_elements['table_num']);
            unset($va_mandatory_fields[$vn_index]);
        }
    }
}
print join("\n", $va_form_elements);
print $vs_control_box;
?>
			<input type='hidden' name='set_id' value='<?php 
print $vn_set_id;
?>
'/>
		</form>
	
		<div class="editorBottomPadding"><!-- empty --></div>
コード例 #20
0
/**
 *
 * 
 *
 * Options:
 * 	disableUnsavedChangesWarning = if true, unsaved change warnings (when user tries to navigate away from the form before saving) are disabled. [Default is false]
 *	noTimestamp = if true no form timestamp (used to determine if other users have made changes while the form is being displayed) is included. [Default is false]
 *	disableSubmit = don't allow form to be submitted. [Default is false]
 */
function caFormTag($po_request, $ps_action, $ps_id, $ps_module_and_controller_path = null, $ps_method = 'post', $ps_enctype = 'multipart/form-data', $ps_target = '_top', $pa_options = null)
{
    if ($ps_target) {
        $vs_target = "target='" . $ps_target . "'";
    } else {
        $vs_target = '';
    }
    if ($ps_module_and_controller_path) {
        $vs_action = $po_request->getBaseUrlPath() . '/' . $po_request->getScriptName() . '/' . $ps_module_and_controller_path . '/' . $ps_action;
    } else {
        $vs_action = $po_request->getControllerUrl() . '/' . $ps_action;
    }
    $vs_buf = "<form action='" . $vs_action . "' method='" . $ps_method . "' id='" . $ps_id . "' {$vs_target} enctype='" . $ps_enctype . "'>\n<input type='hidden' name='_formName' value='{$ps_id}'/>\n";
    if (!caGetOption('noTimestamp', $pa_options, false)) {
        $vs_buf .= caHTMLHiddenInput('form_timestamp', array('value' => time()));
    }
    if (!caGetOption('disableUnsavedChangesWarning', $pa_options, false)) {
        $vs_buf .= "<script type='text/javascript'>jQuery(document).ready(\n\t\t\t\tfunction() {\n\t\t\t\t\tjQuery('#{$ps_id} select, #{$ps_id} input, #{$ps_id} textarea').change(function() { caUI.utils.showUnsavedChangesWarning(true); });\n\t\t\t\t\tjQuery('#{$ps_id}').submit(function() { caUI.utils.disableUnsavedChangesWarning(true); });\n\t\t\t\t}\n\t\t\t);</script>";
    }
    if (caGetOption('disableSubmit', $pa_options, false)) {
        $vs_buf .= "<script type='text/javascript'>jQuery(document).ready(\n\t\t\t\tfunction() {\n\t\t\t\t\tjQuery('#{$ps_id}').submit(function() { return false; });\n\t\t\t\t}\n\t\t\t);</script>";
    }
    if (caGetOption('submitOnReturn', $pa_options, false)) {
        $vs_buf .= "<script type='text/javascript'>jQuery(document).ready(\n\t\t\t\tfunction() {\n\t\t\t\t\tjQuery('#{$ps_id}').keydown(function(e) { \n\t\t\t\t\t   if(e && e.keyCode == 13)\n\t\t\t\t\t   {\n\t\t\t\t\t\t  jQuery('#{$ps_id}').submit();\n\t\t\t\t\t   }\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);</script>";
    }
    return $vs_buf;
}
コード例 #21
0
print caNavUrl($this->request, 'client/orders', 'Communications', 'ViewMessage', array('communication_id' => $pn_communication_id));
?>
');"><?php 
print _t('Cancel');
?>
 &rsaquo;</a>
<?php 
print caFormTag($this->request, 'SendReply', 'caClientCommunicationsReplyForm');
$t_comm = new ca_commerce_communications($pn_communication_id);
$vn_to_user_id = $t_comm->get('from_user_id');
if (!preg_match('!' . _t("Re:") . '!i', $vs_subject = $t_comm->get('subject'))) {
    $vs_subject = _t("Re:") . ' ' . $vs_subject;
}
$t_comm->clear();
$t_comm->set('subject', $vs_subject);
print "<div class='replyMessageHeader'><span class='replyMessageHeaderHeading'>" . _t('Date') . ':</span> ' . caGetLocalizedDateRange($t = time(), $t) . "</div>";
print "<div class='replyMessageHeader'><span class='replyMessageHeaderHeading'>" . _t('To') . ':</span> ' . caClientServicesGetSenderName(array('from_user_id' => $vn_to_user_id)) . "</div>";
foreach ($t_comm->getFormFields() as $vs_f => $va_info) {
    switch ($vs_f) {
        case 'subject':
        case 'message':
        case 'transaction_id':
            print $t_comm->htmlFormElement($vs_f) . "<br/>\n";
            break;
    }
}
print caHTMLHiddenInput('transaction_id', array('value' => $t_transaction->getPrimaryKey()));
print caFormSubmitButton($this->request, __CA_NAV_BUTTON_SAVE__, _t("Send"), 'caClientCommunicationsReplyForm');
?>
		</form>
	</div>
コード例 #22
0
 /**
  * Return HTML form element for editing.
  *
  * @param array $pa_element_info An array of information about the metadata element being edited
  * @param array $pa_options array Options include:
  *			forSearch = settings and options regarding visual text editor are ignored [Default=false]
  *			class = the CSS class to apply to all visible form elements [Default=lookupBg]
  *			width = the width of the form element [Default=field width defined in metadata element definition]
  *			height = the height of the form element [Default=field height defined in metadata element definition]
  *			request = the RequestHTTP object for the current request; required for lookups to work [Default is null]
  *
  * @return string
  */
 public function htmlFormElement($pa_element_info, $pa_options = null)
 {
     $vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : '');
     if (isset($pa_options['forSearch']) && $pa_options['forSearch']) {
         return caHTMLTextInput("{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}", array('id' => "{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}", 'value' => $pa_options['value'], 'class' => $vs_class), $pa_options);
     }
     $o_config = Configuration::load();
     $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth', 'fieldHeight'));
     $vs_element = '<div id="lcsh_' . $pa_element_info['element_id'] . '_input{n}">' . caHTMLTextInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_autocomplete{n}', array('size' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : $va_settings['fieldWidth'], 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : $va_settings['fieldHeight'], 'value' => '{{' . $pa_element_info['element_id'] . '}}', 'maxlength' => 512, 'id' => "lcsh_" . $pa_element_info['element_id'] . "_autocomplete{n}", 'class' => $vs_class ? $vs_class : 'lookupBg')) . caHTMLHiddenInput('{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}', array('value' => '{{' . $pa_element_info['element_id'] . '}}', 'id' => '{fieldNamePrefix}' . $pa_element_info['element_id'] . '_{n}'));
     if ($pa_options['request']) {
         $vs_url = caNavUrl($pa_options['request'], 'lookup', 'LCSH', 'Get', array('max' => 100, 'element_id' => (int) $pa_element_info['element_id']));
     } else {
         // hardcoded default for testing.
         $vs_url = '/index.php/lookup/LCSH/Get';
     }
     $vs_element .= " <a href='#' class='caLCSHServiceMoreLink' id='{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}' target='_lcsh_details'>" . _t("More &rsaquo;") . "</a>";
     $vs_element .= '</div>';
     $vs_element .= "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\tjQuery('#lcsh_" . $pa_element_info['element_id'] . "_autocomplete{n}').autocomplete(\n\t\t\t\t\t\t\t{ source: '{$vs_url}', minLength: 3, delay: 800, \n\t\t\t\t\t\t\t\tselect: function( event, ui ) {\n\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_{n}').val(ui.item.label + ' [' + ui.item.idno + ']|' + ui.item.url);\n     \t\t\t\t\t\t\t}\n     \t\t\t\t\t\t}\n\t\t\t\t\t\t).click(function() { this.select(); });\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ('{{" . $pa_element_info['element_id'] . "}}') {\n\t\t\t\t\t\t\tvar re = /\\[info:lc([^\\]]+)\\]/; \n\t\t\t\t\t\t\tvar r = re.exec('{{" . $pa_element_info['element_id'] . "}}');\n\t\t\t\t\t\t\tvar lcsh_id = (r) ? r[1] : null;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (!lcsh_id) {\n\t\t\t\t\t\t\t\tre = /\\[sh([^\\]]+)\\]/; \n\t\t\t\t\t\t\t\tvar r = re.exec('{{" . $pa_element_info['element_id'] . "}}');\n\t\t\t\t\t\t\t\tvar lcsh_id = (r) ? '/authorities/subjects/sh' + r[1] : null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (lcsh_id) {\n\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}" . $pa_element_info['element_id'] . "_link{n}').css('display', 'inline').attr('href', 'http://id.loc.gov' + lcsh_id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t";
     return $vs_element;
 }
 /**
  * Returns a list of HTML fragments implementing all bundles in an HTML form for the specified screen
  * $pm_screen can be a screen tag (eg. "Screen5") or a screen_id (eg. 5) 
  *
  * @param mixed $pm_screen screen_id or code in default UI to return bundles for
  * @param array $pa_options Array of options. Supports and option getBundleFormHTML() supports plus:
  *		request = the current request object; used to apply user privs to bundle generation
  *		force = list of bundles to force onto form if they are not included in the UI; forced bundles will be included at the bottom of the form
  *		forceHidden = list of *intrinsic* fields to force onto form as hidden <input> elements if they are not included in the UI; NOTE: only intrinsic fields may be specified
  *		omit = list of bundles to omit from form in the event they are included in the UI
  *		restrictToTypes = 
  *	@return array List of bundle HTML to display in form, keyed on placement code
  */
 public function getBundleFormHTMLForScreen($pm_screen, $pa_options, &$pa_placements = null)
 {
     $va_omit_bundles = isset($pa_options['omit']) && is_array($pa_options['omit']) ? $pa_options['omit'] : array();
     $vs_table_name = $this->tableName();
     if (isset($pa_options['ui_instance']) && $pa_options['ui_instance']) {
         $t_ui = $pa_options['ui_instance'];
     } else {
         $t_ui = ca_editor_uis::loadDefaultUI($vs_table_name, $pa_options['request'], $this->getTypeID());
     }
     if (!$t_ui) {
         return false;
     }
     if (isset($pa_options['bundles']) && is_array($pa_options['bundles'])) {
         $va_bundles = $pa_options['bundles'];
     } else {
         $va_bundles = $t_ui->getScreenBundlePlacements($pm_screen);
     }
     $vs_form_name = caGetOption('formName', $pa_options, '');
     $va_bundle_html = array();
     $vn_pk_id = $this->getPrimaryKey();
     $va_bundles_present = array();
     if (is_array($va_bundles)) {
         $o_dm = $this->getAppDatamodel();
         $va_definition_bundle_names = array();
         foreach ($va_bundles as $va_bundle) {
             if ($va_bundle['bundle_name'] === $vs_type_id_fld) {
                 continue;
             }
             // skip type_id
             if (!$vn_pk_id && $va_bundle['bundle_name'] === $vs_hier_parent_id_fld) {
                 continue;
             }
             if (in_array($va_bundle['bundle_name'], $va_omit_bundles)) {
                 continue;
             }
             $va_definition_bundle_names[(!$o_dm->tableExists($va_bundle['bundle_name']) ? "{$vs_table_name}." : "") . str_replace("ca_attribute_", "", $va_bundle['bundle_name'])] = 1;
         }
         ca_metadata_dictionary_entries::preloadDefinitions(array_keys($va_definition_bundle_names));
         if (is_subclass_of($this, 'BaseRelationshipModel')) {
             $vs_type_id_fld = $this->getTypeFieldName();
             if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes'])) {
                 $va_valid_element_codes = $this->getApplicableElementCodesForTypes(caMakeRelationshipTypeIDList($vs_table_name, $pa_options['restrictToTypes']));
             } else {
                 $va_valid_element_codes = null;
             }
         } else {
             $vs_type_id_fld = isset($this->ATTRIBUTE_TYPE_ID_FLD) ? $this->ATTRIBUTE_TYPE_ID_FLD : null;
             $vs_hier_parent_id_fld = isset($this->HIERARCHY_PARENT_ID_FLD) ? $this->HIERARCHY_PARENT_ID_FLD : null;
             if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes'])) {
                 $va_valid_element_codes = $this->getApplicableElementCodesForTypes(caMakeTypeIDList($vs_table_name, $pa_options['restrictToTypes']));
             } else {
                 $va_valid_element_codes = null;
             }
         }
         $vn_c = 0;
         foreach ($va_bundles as $va_bundle) {
             if ($va_bundle['bundle_name'] === $vs_type_id_fld) {
                 continue;
             }
             // skip type_id
             if (!$vn_pk_id && $va_bundle['bundle_name'] === $vs_hier_parent_id_fld) {
                 continue;
             }
             if (in_array($va_bundle['bundle_name'], $va_omit_bundles)) {
                 continue;
             }
             if ($va_valid_element_codes && substr($va_bundle['bundle_name'], 0, 13) == 'ca_attribute_') {
                 if (!in_array(substr($va_bundle['bundle_name'], 13), $va_valid_element_codes)) {
                     continue;
                 }
             }
             // Test for user action restrictions on intrinsic fields
             $vb_output_bundle = true;
             if ($this->hasField($va_bundle['bundle_name'])) {
                 if (is_array($va_requires = $this->getFieldInfo($va_bundle['bundle_name'], 'REQUIRES'))) {
                     foreach ($va_requires as $vs_required_action) {
                         if (!$pa_options['request']->user->canDoAction($vs_required_action)) {
                             $vb_output_bundle = false;
                             break;
                         }
                     }
                 }
             }
             if (!$vb_output_bundle) {
                 continue;
             }
             $va_bundle['settings']['placement_id'] = $va_bundle['placement_id'];
             if ($vs_bundle_form_html = $this->getBundleFormHTML($va_bundle['bundle_name'], 'P' . $va_bundle['placement_id'], $va_bundle['settings'], $pa_options, $vs_bundle_display_name)) {
                 $va_bundle_html[$va_bundle['placement_code']] = "<a name=\"{$pm_screen}_{$vn_c}\"></a>{$vs_bundle_form_html}";
                 $va_bundles_present[$va_bundle['bundle_name']] = true;
                 $pa_placements["{$pm_screen}_{$vn_c}"] = array('name' => $vs_bundle_display_name ? $vs_bundle_display_name : $this->getDisplayLabel($vs_table_name . "." . $va_bundle['bundle_name']), 'placement_id' => $va_bundle['placement_id'], 'bundle' => $va_bundle['bundle_name'], 'id' => 'P' . $va_bundle['placement_id'] . caGetOption('formName', $pa_options, ''));
             }
             $vn_c++;
         }
     }
     // is this a form to create a new item?
     if (!$vn_pk_id) {
         // auto-add mandatory fields if this is a new object
         $va_mandatory_fields = $this->getMandatoryFields();
         foreach ($va_mandatory_fields as $vs_field) {
             if (!isset($va_bundles_present[$vs_field]) || !$va_bundles_present[$vs_field]) {
                 $va_bundle_html[$vs_field] = $this->getBundleFormHTML($vs_field, 'mandatory_' . $vs_field, array(), $pa_options);
             }
         }
         // add type_id
         if (isset($this->ATTRIBUTE_TYPE_ID_FLD) && $this->ATTRIBUTE_TYPE_ID_FLD && !in_array('type_id', $va_omit_bundles)) {
             $va_bundle_html[$this->ATTRIBUTE_TYPE_ID_FLD] = caHTMLHiddenInput($this->ATTRIBUTE_TYPE_ID_FLD, array('value' => $pa_options['request']->getParameter($this->ATTRIBUTE_TYPE_ID_FLD, pString)));
         }
         // add parent_id
         if (isset($this->HIERARCHY_PARENT_ID_FLD) && $this->HIERARCHY_PARENT_ID_FLD && !in_array('parent_id', $va_omit_bundles)) {
             $va_bundle_html[$this->HIERARCHY_PARENT_ID_FLD] = caHTMLHiddenInput($this->HIERARCHY_PARENT_ID_FLD, array('value' => $pa_options['request']->getParameter($this->HIERARCHY_PARENT_ID_FLD, pInteger)));
         }
         // add forced bundles
         if (isset($pa_options['force']) && $pa_options['force']) {
             if (!is_array($pa_options['force'])) {
                 $pa_options['force'] = array($pa_options['force']);
             }
             foreach ($pa_options['force'] as $vn_x => $vs_bundle) {
                 if (!isset($va_bundles_present[$vs_bundle]) || !$va_bundles_present[$vs_bundle]) {
                     $va_bundle_html['_force_' . $vs_bundle] = $this->getBundleFormHTML($vs_bundle, 'force_' . $vs_field, array(), $pa_options);
                 }
             }
         }
         // add forced hidden intrinsic fields
         if (isset($pa_options['forceHidden']) && $pa_options['forceHidden']) {
             if (!is_array($pa_options['forceHidden'])) {
                 $pa_options['forceHidden'] = array($pa_options['forceHidden']);
             }
             foreach ($pa_options['forceHidden'] as $vn_x => $vs_field) {
                 if (!isset($va_bundles_present[$vs_field]) || !$va_bundles_present[$vs_field]) {
                     $va_bundle_html['_force_hidden_' . $vs_field] = caHTMLHiddenInput($vs_field, array('value' => $pa_options['request']->getParameter($vs_field, pString)));
                 }
             }
         }
     }
     return $va_bundle_html;
 }
コード例 #24
0
 /** 
  * 
  */
 public function advanced()
 {
     $o_config = caGetSearchConfig();
     $ps_function = strtolower($this->request->getActionExtra());
     if (!($va_search_info = caGetInfoForAdvancedSearchType($ps_function))) {
         // invalid advanced search type – throw error
         die("Invalid advanced search type");
     }
     $vs_class = $va_search_info['table'];
     $va_types = caGetOption('restrictToTypes', $va_search_info, array(), array('castTo' => 'array'));
     $this->opo_result_context = new ResultContext($this->request, $va_search_info['table'], $this->ops_find_type . '_advanced');
     $this->opo_result_context->setAsLastFind();
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Search %1", $va_search_info["displayName"]));
     $this->view->setVar('searchInfo', $va_search_info);
     $this->view->setVar('options', caGetOption('options', $va_search_info, array(), array('castTo' => 'array')));
     $va_default_form_values = $this->opo_result_context->getParameter("pawtucketAdvancedSearchFormContent_{$ps_function}");
     $va_default_form_booleans = $this->opo_result_context->getParameter("pawtucketAdvancedSearchFormBooleans_{$ps_function}");
     $va_tags = $this->view->getTagList($va_search_info['view']);
     $t_subject = $this->request->datamodel->getInstanceByTableName($va_search_info['table'], true);
     $va_form_elements = array();
     $vs_script = null;
     foreach ($va_tags as $vs_tag) {
         $va_parse = caParseTagOptions($vs_tag);
         $vs_tag_proc = $va_parse['tag'];
         $va_opts = $va_parse['options'];
         if (($vs_default_value = caGetOption('default', $va_opts, null)) || ($vs_default_value = caGetOption($vs_tag_proc, $va_default_form_values, null))) {
             $va_default_form_values[$vs_tag_proc] = $vs_default_value;
             unset($va_opts['default']);
         }
         $vs_tag_val = null;
         switch (strtolower($vs_tag_proc)) {
             case 'submit':
                 $this->view->setVar($vs_tag, "<a href='#' class='caAdvancedSearchFormSubmit'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Submit')) . "</a>");
                 break;
             case 'reset':
                 $this->view->setVar($vs_tag, "<a href='#' class='caAdvancedSearchFormReset'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Reset')) . "</a>");
                 $vs_script = "<script type='text/javascript'>\n\tjQuery('.caAdvancedSearchFormSubmit').bind('click', function() {\n\t\tjQuery('#caAdvancedSearch').submit();\n\t\treturn false;\n\t});\n\tjQuery('.caAdvancedSearchFormReset').bind('click', function() {\n\t\tjQuery('#caAdvancedSearch').find('input[type!=\"hidden\"],textarea').val('');\n\t\tjQuery('#caAdvancedSearch').find('select.caAdvancedSearchBoolean').val('AND');\n\t\tjQuery('#caAdvancedSearch').find('select').prop('selectedIndex', 0);\n\t\treturn false;\n\t});\n\tjQuery(document).ready(function() {\n\t\tvar f, defaultValues = " . json_encode($va_default_form_values) . ", defaultBooleans = " . json_encode($va_default_form_booleans) . ";\n\t\tfor (f in defaultValues) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('input[name=\"' + f_proc+ '\"], textarea[name=\"' + f_proc+ '\"], select[name=\"' + f_proc+ '\"]').each(function(k, v) {\n\t\t\t\tif (defaultValues[f][k]) { jQuery(v).val(defaultValues[f][k]); } \n\t\t\t});\n\t\t}\n\t\tfor (f in defaultBooleans) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('select[name=\"' + f_proc+ '\"].caAdvancedSearchBoolean').each(function(k, v) {\n\t\t\t\tif (defaultBooleans[f][k]) { jQuery(v).val(defaultBooleans[f][k]); }\n\t\t\t});\n\t\t}\n\t});\n</script>\n";
                 break;
             default:
                 if (preg_match("!^(.*):label\$!", $vs_tag_proc, $va_matches)) {
                     $this->view->setVar($vs_tag, $vs_tag_val = $t_subject->getDisplayLabel($va_matches[1]));
                 } elseif (preg_match("!^(.*):boolean\$!", $vs_tag_proc, $va_matches)) {
                     $this->view->setVar($vs_tag, caHTMLSelect($vs_tag_proc . '[]', array(_t('AND') => 'AND', _t('OR') => 'OR', 'AND NOT' => 'AND NOT'), array('class' => 'caAdvancedSearchBoolean')));
                 } else {
                     $va_opts['asArrayElement'] = true;
                     if (isset($va_opts['restrictToTypes']) && $va_opts['restrictToTypes'] && !is_array($va_opts['restrictToTypes'])) {
                         $va_opts['restrictToTypes'] = explode(";", $va_opts['restrictToTypes']);
                     }
                     if ($vs_tag_val = $t_subject->htmlFormElementForSearch($this->request, $vs_tag_proc, $va_opts)) {
                         $this->view->setVar($vs_tag, $vs_tag_val);
                     }
                     $va_tmp = explode('.', $vs_tag_proc);
                     if (($t_element = ca_metadata_elements::getInstance($va_tmp[1])) && $t_element->get('datatype') == 0) {
                         if (is_array($va_elements = $t_element->getElementsInSet())) {
                             foreach ($va_elements as $va_element) {
                                 if ($va_element['datatype'] > 0) {
                                     $va_form_elements[] = $va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code'];
                                 }
                             }
                         }
                         break;
                     }
                 }
                 if ($vs_tag_val) {
                     $va_form_elements[] = $vs_tag_proc;
                 }
                 break;
         }
     }
     $this->view->setVar("form", caFormTag($this->request, "{$ps_function}", 'caAdvancedSearch', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true, 'submitOnReturn' => true)));
     $this->view->setVar("/form", $vs_script . caHTMLHiddenInput("_advancedFormName", array("value" => $ps_function)) . caHTMLHiddenInput("_formElements", array("value" => join(';', $va_form_elements))) . caHTMLHiddenInput("_advanced", array("value" => 1)) . "</form>");
     $this->render($va_search_info['view']);
 }
コード例 #25
0
 /**
  * Return HTML form element for editing.
  *
  * @param array $pa_element_info An array of information about the metadata element being edited
  * @param array $pa_options array Options include:
  *			class = the CSS class to apply to all visible form elements [Default=lookupBg]
  *			width = the width of the form element [Default=field width defined in metadata element definition]
  *			height = the height of the form element [Default=field height defined in metadata element definition]
  *			request = the RequestHTTP object for the current request; required for lookups to work [Default is null]
  *
  * @return string
  */
 public function htmlFormElement($pa_element_info, $pa_options = null)
 {
     $o_config = Configuration::load();
     $va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth'));
     $vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : 'lookupBg');
     $vs_element = "<div id='{fieldNamePrefix}{$pa_element_info['element_id']}_display{n}' style='float: right;'> </div>" . caHTMLTextInput("{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}", array('size' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : $va_settings['fieldWidth'], 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : 1, 'value' => '{{' . $pa_element_info['element_id'] . '}}', 'maxlength' => 512, 'id' => "{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}", 'class' => $vs_class)) . caHTMLHiddenInput("{fieldNamePrefix}{$pa_element_info['element_id']}_{n}", array('value' => '{{' . $pa_element_info['element_id'] . '}}', 'id' => "{fieldNamePrefix}{$pa_element_info['element_id']}_{n}"));
     $va_params = array('max' => 50);
     if ($pa_options['request']) {
         if ($vs_restrict_to_type = caGetOption('restrictTo' . $this->ops_name_singular . 'TypeIdno', $pa_element_info['settings'], null)) {
             $va_params = array("type" => $vs_restrict_to_type);
         } else {
             $va_params = null;
         }
         $vs_url = caNavUrl($pa_options['request'], 'lookup', $this->ops_name_singular, 'Get', $va_params);
     } else {
         // no lookup is possible
         return $this->getDisplayValue();
     }
     $vs_element .= "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\tvar v = jQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}').val();\t\n\t\t\t\t\t\tv=v.replace(/(<\\/?[^>]+>)/gi, function(m, p1, offset, val) {\n\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_display{n}').html(p1);\n\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t});\n\t\t\t\t\t\tv=v.replace(/\\[([\\d]+)\\]\$/gi, function(m, p1, offset, val) {\n\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_{n}').val(parseInt(p1));\n\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}').val(v.trim());\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}').autocomplete( \n\t\t\t\t\t\t\t{ minLength: 3, delay: 800, html: true,\n\t\t\t\t\t\t\t\tsource: function( request, response ) {\n\t\t\t\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t\t\t\turl: '{$vs_url}',\n\t\t\t\t\t\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t\t\t\t\t\tdata: { term: request.term, quickadd: 0, noInline: 1 },\n\t\t\t\t\t\t\t\t\t\tsuccess: function( data ) {\n\t\t\t\t\t\t\t\t\t\t\tresponse(data);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}, \n\t\t\t\t\t\t\t\tselect: function( event, ui ) {\n\t\t\t\t\t\t\t\t\tif(!parseInt(ui.item.id) || (ui.item.id <= 0)) {\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}').val('');  // no matches so clear text input\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_{n}').val(ui.item.id);\n\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}').val(jQuery.trim(ui.item.label.replace(/<\\/?[^>]+>/gi, '')));\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tchange: function( event, ui ) {\n\t\t\t\t\t\t\t\t\t//If nothing has been selected remove all content from  text input\n\t\t\t\t\t\t\t\t\tif(!jQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_{n}').val()) {\n\t\t\t\t\t\t\t\t\t\tjQuery('#{fieldNamePrefix}{$pa_element_info['element_id']}_autocomplete{n}').val('');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t).click(function() { this.select(); });\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t";
     return $vs_element;
 }
コード例 #26
0
ファイル: ModelSettings.php プロジェクト: guaykuru/pawtucket
 /**
  * Returns HTML form element for editing of setting
  *
  * Options:
  *
  * 	'name' => sets the name of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  * 	'id' => sets the id of the HTML form element explicitly, otherwise 'setting_<name_of_setting>' is used
  *  'value' => sets the value of the HTML form element explicitly, otherwise the current value for the setting in the loaded row is used
  *  'label_id' => sets the id of the label for the setting form element (used to link tools tips to the label); if not set then the default is to set it to  'setting_<name_of_setting>_label'
  */
 public function settingHTMLFormElement($ps_setting, $pa_options = null)
 {
     if (!$this->isValidSetting($ps_setting)) {
         return false;
     }
     $va_available_settings = $this->getAvailableSettings();
     $va_properties = $va_available_settings[$ps_setting];
     if (isset($pa_options['name'])) {
         $vs_input_name = $pa_options['name'];
     } else {
         $vs_input_name = "setting_{$ps_setting}";
     }
     if (isset($pa_options['id'])) {
         $vs_input_id = $pa_options['id'];
     } else {
         $vs_input_id = "setting_{$ps_setting}";
     }
     if (isset($pa_options['value'])) {
         $vs_value = $pa_options['value'];
     } else {
         $vs_value = $this->getSetting(trim($ps_setting));
     }
     if (isset($pa_options['label_id'])) {
         $vs_label_id = $pa_options['label_id'];
     } else {
         $vs_label_id = "setting_{$ps_setting}_label";
     }
     $vs_return = "\n" . '<div class="formLabel" id="' . $vs_input_id . '_container">' . "\n";
     $vs_return .= '<span id="' . $vs_label_id . '"  class="' . $vs_label_id . '">' . $va_properties['label'] . '</span>';
     if ($vs_help_text = $pa_options['helpText']) {
         $vs_return .= "<a href='#' onclick='jQuery(\"#" . str_replace(".", "_", $vs_label_id) . "_help_text\").slideToggle(250); return false;' class='settingsKeyButton'>" . _t('Key') . "</a>";
     }
     $vs_return .= '<br />' . "\n";
     if ($vs_help_text) {
         $vs_return .= "\n<div id='" . str_replace(".", "_", $vs_label_id) . "_help_text' class='settingsKey'>{$vs_help_text}</div>\n";
     }
     switch ($va_properties['displayType']) {
         # --------------------------------------------
         case DT_FIELD:
             $vb_takes_locale = false;
             if (isset($va_properties['takesLocale']) && $va_properties['takesLocale']) {
                 $vb_takes_locale = true;
                 $va_locales = ca_locales::getLocaleList(array('sort_field' => '', 'sort_order' => 'asc', 'index_by_code' => true, 'available_for_cataloguing_only' => true));
             } else {
                 $va_locales = array('_generic' => array());
             }
             foreach ($va_locales as $vs_locale => $va_locale_info) {
                 if ($vb_takes_locale && sizeof($va_locales) > 1) {
                     $vs_locale_label = " (" . $va_locale_info['name'] . ")";
                     $vs_input_name_suffix = '_' . $vs_locale;
                 } else {
                     if ($vb_takes_locale) {
                         $vs_input_name_suffix = '_' . $vs_locale;
                     } else {
                         $vs_input_name_suffix = $vs_locale_label = '';
                     }
                 }
                 if ($vs_locale != '_generic' && is_array($vs_value)) {
                     // _generic means this setting doesn't take a locale
                     if (!($vs_text_value = $vs_value[$va_locale_info['locale_id']])) {
                         $vs_text_value = is_array($vs_value) && isset($vs_value[$va_locale_info['code']]) ? $vs_value[$va_locale_info['code']] : '';
                     }
                 } else {
                     $vs_text_value = $vs_value;
                 }
                 $vs_return .= caHTMLTextInput($vs_input_name . $vs_input_name_suffix, array('size' => $va_properties["width"], 'height' => $va_properties["height"], 'value' => $vs_text_value, 'id' => $vs_input_id)) . "{$vs_locale_label}<br/>\n";
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_CHECKBOXES:
             $va_attributes = array('value' => '1', 'id' => $vs_input_id);
             if ((int) $vs_value === 1) {
                 $va_attributes['checked'] = '1';
             }
             if (isset($va_properties['hideOnSelect'])) {
                 if (!is_array($va_properties['hideOnSelect'])) {
                     $va_properties['hideOnSelect'] = array($va_properties['hideOnSelect']);
                 }
                 $va_ids = array();
                 foreach ($va_properties['hideOnSelect'] as $vs_n) {
                     $va_ids[] = "#" . $pa_options['id_prefix'] . "_{$vs_n}_container";
                 }
                 $va_attributes['onchange'] = 'jQuery(this).prop("checked") ? jQuery("' . join(",", $va_ids) . '").slideUp(250).find("input, textarea").val("") : jQuery("' . join(",", $va_ids) . '").slideDown(250);';
             }
             $vs_return .= caHTMLCheckboxInput($vs_input_name, $va_attributes, array());
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_COLORPICKER:
             $va_attributes = array('value' => $vs_value, 'id' => $vs_input_id);
             $vs_return .= caHTMLHiddenInput($vs_input_name, $va_attributes, array());
             $vs_return .= "<div id='{$vs_input_id}_colorchip' class='colorpicker_chip' style='background-color: #{$vs_value}'><!-- empty --></div>";
             $vs_return .= "<script type='text/javascript'>jQuery(document).ready(function() { jQuery('#{$vs_input_name}_colorchip').ColorPicker({\n\t\t\t\t\t\t\t\tonShow: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeIn(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonHide: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeOut(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}').val(hex);\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}_colorchip').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcolor: jQuery('#" . $pa_options["name"] . "').val()\n\t\t\t\t\t\t\t})}); </script>\n";
             JavascriptLoadManager::register('jquery', 'colorpicker');
             break;
             # --------------------------------------------
         # --------------------------------------------
         case DT_SELECT:
             include_once __CA_MODELS_DIR__ . '/ca_relationship_types.php';
             $vn_width = isset($va_properties['width']) && strlen($va_properties['width']) > 0 ? $va_properties['width'] : "100px";
             $vn_height = isset($va_properties['height']) && strlen($va_properties['height']) > 0 ? $va_properties['height'] : "50px";
             $vs_select_element = '';
             if (($vs_rel_table = $va_properties['useRelationshipTypeList']) || ($vb_locale_list = (bool) $va_properties['useLocaleList']) || ($vs_list_code = $va_properties['useList']) || ($vb_show_lists = (bool) $va_properties['showLists'] || (bool) $va_properties['showVocabularies'])) {
                 if ($vs_rel_table) {
                     $t_rel = new ca_relationship_types();
                     $va_rels = $t_rel->getRelationshipInfo($vs_rel_table);
                     $va_rel_opts = array();
                     if (isset($va_properties['allowNull']) && $va_properties['allowNull']) {
                         $va_rel_opts['-'] = null;
                     }
                     foreach ($va_rels as $vn_type_id => $va_rel_type_info) {
                         if (!$va_rel_type_info['parent_id']) {
                             continue;
                         }
                         $va_rel_opts[$va_rel_type_info['typename'] . '/' . $va_rel_type_info['typename_reverse']] = $va_rel_type_info['type_id'];
                     }
                 } else {
                     if ($vb_locale_list) {
                         include_once __CA_MODELS_DIR__ . '/ca_locales.php';
                         $va_rel_opts = array_flip(ca_locales::getLocaleList(array('return_display_values' => true)));
                     } else {
                         if ($vb_show_lists) {
                             include_once __CA_MODELS_DIR__ . '/ca_lists.php';
                             $t_list = new ca_lists();
                             $va_lists = caExtractValuesByUserLocale($t_list->getListOfLists());
                             $va_rel_opts = array();
                             foreach ($va_lists as $vn_list_id => $va_list_info) {
                                 if ($va_properties['showVocabularies'] && !$va_list_info['use_as_vocabulary']) {
                                     continue;
                                 }
                                 $va_rel_opts[$va_list_info['name'] . ' (' . $va_list_info['list_code'] . ')'] = $vn_list_id;
                             }
                         }
                     }
                 }
                 $va_attr = array();
                 if ($vn_height > 1) {
                     $va_attr['multiple'] = 1;
                     $vs_input_name .= '[]';
                 }
                 $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height);
                 if ($vn_height > 1) {
                     if ($vs_value && !is_array($vs_value)) {
                         $vs_value = array($vs_value);
                     }
                     $va_opts['values'] = $vs_value;
                 } else {
                     if (is_array($vs_value)) {
                         $va_opts['value'] = array_pop($vs_value);
                     } else {
                         if ($vs_value) {
                             $va_opts['value'] = $vs_value;
                         } else {
                             $va_opts['value'] = null;
                         }
                     }
                 }
                 if ($vs_list_code) {
                     $t_list = new ca_lists();
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = $t_list->getListAsHTMLFormElement($vs_list_code, $vs_input_name, $va_attr, $va_opts);
                 } else {
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_rel_opts, $va_attr, $va_opts);
                 }
             } else {
                 if (strlen($va_properties['showSortableBundlesFor']) > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $o_dm = Datamodel::load();
                     if (!($t_rel = $o_dm->getInstanceByTableName($va_properties['showSortableBundlesFor'], true))) {
                         break;
                     }
                     $va_elements = ca_metadata_elements::getSortableElements($va_properties['showSortableBundlesFor']);
                     $va_select_opts = array(_t('User defined sort order') => '', _t('Order created') => 'relation_id', _t('Preferred label') => $va_properties['showSortableBundlesFor'] . ".preferred_labels." . $t_rel->getLabelDisplayField());
                     foreach ($va_elements as $vn_element_id => $va_element) {
                         if (!$va_element['display_label']) {
                             continue;
                         }
                         $va_select_opts[_t('Element: %1', $va_element['display_label'])] = $va_properties['showSortableBundlesFor'] . "." . $va_element['element_code'];
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                 } elseif ((int) $va_properties['showSortableElementsFor'] > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $t_element = new ca_metadata_elements($va_properties['showSortableElementsFor']);
                     if (!$t_element->getPrimaryKey()) {
                         return '';
                     }
                     $va_elements = $t_element->getElementsInSet();
                     $va_select_opts = array(_t('Order created') => '');
                     foreach ($va_elements as $vn_i => $va_element) {
                         if ((int) $va_element['element_id'] == (int) $va_properties['showSortableElementsFor']) {
                             continue;
                         }
                         if (!$va_element['display_label']) {
                             continue;
                         }
                         $va_select_opts[_t('Element: %1', $va_element['display_label'])] = $va_element['element_code'];
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                 } elseif ((int) $va_properties['showMetadataElementsWithDataType'] > 0) {
                     require_once __CA_MODELS_DIR__ . '/ca_metadata_elements.php';
                     $va_rep_elements = ca_metadata_elements::getElementsAsList(true, $va_properties['table'], null, true, false, true, array($va_properties['showMetadataElementsWithDataType']));
                     if (is_array($va_rep_elements)) {
                         $va_select_opts = array();
                         foreach ($va_rep_elements as $vs_element_code => $va_element_info) {
                             $va_select_opts[$va_element_info['display_label']] = $vs_element_code;
                         }
                         $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                         $vs_select_element = caHTMLSelect($vs_input_name, $va_select_opts, array(), $va_opts);
                     }
                 } else {
                     // Regular drop-down with configured options
                     if ($vn_height > 1) {
                         $va_attr['multiple'] = 1;
                         $vs_input_name .= '[]';
                     }
                     $va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height, 'value' => is_array($vs_value) ? $vs_value[0] : $vs_value, 'values' => is_array($vs_value) ? $vs_value : array($vs_value));
                     if (!isset($va_opts['value'])) {
                         $va_opts['value'] = -1;
                     }
                     // make sure default list item is never selected
                     $vs_select_element = caHTMLSelect($vs_input_name, $va_properties['options'], array(), $va_opts);
                 }
             }
             if ($vs_select_element) {
                 $vs_return .= $vs_select_element;
             } else {
                 return '';
             }
             break;
             # --------------------------------------------
         # --------------------------------------------
         default:
             break;
             # --------------------------------------------
     }
     $vs_return .= '</div>' . "\n";
     TooltipManager::add('.' . $vs_label_id, "<h3>" . $va_properties["label"] . "</h3>" . $va_properties["description"]);
     return $vs_return;
 }
コード例 #27
0
                //
                ?>
			<div id="<?php 
                print $vs_id_prefix;
                ?>
StorageLocationMovementForm" style="width: 98%; margin: 5px 0px 2px 6px;">
				<h3><?php 
                print _t('Movement details');
                ?>
</h3>
<?php 
                $va_nav = $t_ui->getScreensAsNavConfigFragment($this->request, null, $this->request->getModulePath(), $this->request->getController(), $this->request->getAction(), array(), array());
                $t_movement = new ca_movements();
                $va_form_elements = $t_movement->getBundleFormHTMLForScreen($va_nav['defaultScreen'], array('request' => $this->request, 'formName' => $vs_id_prefix . 'StorageLocationMovementForm', 'omit' => array('ca_storage_locations')));
                print caHTMLHiddenInput($vs_id_prefix . '_movement_screen', array('value' => $va_nav['defaultScreen']));
                print caHTMLHiddenInput($vs_id_prefix . '_movement_form_name', array('value' => $vs_id_prefix . 'StorageLocationMovementForm'));
                print join("\n", $va_form_elements);
                ?>
			</div>
			<script type="text/javascript">
				jQuery("#<?php 
                print $vs_id_prefix;
                ?>
StorageLocationMovementForm textarea, #<?php 
                print $vs_id_prefix;
                ?>
StorageLocationMovementForm input").css("max-width", "600px");
			</script>
<?php 
            }
        }
コード例 #28
0
print "caWidgetSettings_{$vs_widget_id}";
?>
" action="#" method="get">
<?php 
if ($vs_form = $this->getVar('form')) {
    ?>
		<h1><?php 
    print _t('Settings');
    ?>
</h1>
<?php 
    print $vs_form;
    print caJSButton($po_request, __CA_NAV_BUTTON_SAVE__, _t('Save'), '', array('onclick' => 'jQuery("#caWidgetSettingForm_' . $vs_widget_id . '").load("' . caNavUrl($this->request, '', 'Dashboard', 'saveSettings', array()) . '", jQuery("#caWidgetSettings_' . $vs_widget_id . '").serializeArray());'), array()) . ' ';
} else {
    ?>
		<h1><?php 
    print _t('No settings available');
    ?>
</h1>
<?php 
}
print caJSButton($po_request, __CA_NAV_BUTTON_CANCEL__, _t('Cancel'), '', array('onclick' => 'jQuery("#caWidgetSettingForm_' . $vs_widget_id . '").load("' . caNavUrl($this->request, '', 'Dashboard', 'getWidget', array()) . '", jQuery("#caWidgetSettings_' . $vs_widget_id . '").serializeArray());', array()));
?>
			<?php 
print caHTMLHiddenInput('widget_id', array('value' => $vs_widget_id));
?>
	</form>
</div>

<?php 
print TooltipManager::getLoadHTML();
コード例 #29
0
ファイル: displayHelpers.php プロジェクト: kai-iak/providence
/**
 * Generates standard-format inspector panels for editors
 *
 * @param View $po_view Inspector view object
 * @param array $pa_options Optional array of options. Supported options are:
 *		backText = a string to use as the "back" button text; default is "Results"
 *
 * @return string HTML implementing the inspector
 */
function caEditorInspector($po_view, $pa_options = null)
{
    require_once __CA_MODELS_DIR__ . '/ca_sets.php';
    require_once __CA_MODELS_DIR__ . '/ca_data_exporters.php';
    $t_item = $po_view->getVar('t_item');
    $vs_table_name = $t_item->tableName();
    if (($vs_priv_table_name = $vs_table_name) == 'ca_list_items') {
        $vs_priv_table_name = 'ca_lists';
    }
    $vn_item_id = $t_item->getPrimaryKey();
    $o_result_context = $po_view->getVar('result_context');
    $t_ui = $po_view->getVar('t_ui');
    $t_type = method_exists($t_item, "getTypeInstance") ? $t_item->getTypeInstance() : null;
    $vs_type_name = method_exists($t_item, "getTypeName") ? $t_item->getTypeName() : '';
    if (!$vs_type_name) {
        $vs_type_name = $t_item->getProperty('NAME_SINGULAR');
    }
    $va_reps = $po_view->getVar('representations');
    $o_dm = Datamodel::load();
    if ($t_item->isHierarchical()) {
        $va_ancestors = $po_view->getVar('ancestors');
        $vn_parent_id = $t_item->get($t_item->getProperty('HIERARCHY_PARENT_ID_FLD'));
    } else {
        $va_ancestors = array();
        $vn_parent_id = null;
    }
    // action extra to preserve currently open screen across next/previous links
    $vs_screen_extra = $po_view->getVar('screen') ? '/' . $po_view->getVar('screen') : '';
    if ($vs_type_name == "list item") {
        $vs_style = "style='height:auto;'";
    }
    if ($vn_item_id | $po_view->request->getAction() === 'Delete') {
        $vs_buf = '<h3 class="nextPrevious" ' . $vs_style . '>' . caEditorFindResultNavigation($po_view->request, $t_item, $o_result_context, $pa_options) . "</h3>\n";
    }
    $vs_color = null;
    if ($t_type) {
        $vs_color = trim($t_type->get('color'));
    }
    if (!$vs_color && $t_ui) {
        $vs_color = trim($t_ui->get('color'));
    }
    if (!$vs_color) {
        $vs_color = "FFFFFF";
    }
    $vs_buf .= "<h4><div id='caColorbox' style='border: 6px solid #{$vs_color};'>\n";
    $vs_icon = null;
    if ($t_type) {
        $vs_icon = $t_type->getMediaTag('icon', 'icon');
    }
    if (!$vs_icon && $t_ui) {
        $vs_icon = $t_ui->getMediaTag('icon', 'icon');
    }
    if ($vs_icon) {
        $vs_buf .= "<div id='inspectoricon' style='border-right: 6px solid #{$vs_color}; border-bottom: 6px solid #{$vs_color}; -moz-border-radius-bottomright: 8px; -webkit-border-bottom-right-radius: 8px;'>\n{$vs_icon}</div>\n";
    }
    if ($po_view->request->getAction() === 'Delete' && $po_view->request->getParameter('confirm', pInteger)) {
        $vs_buf .= "<strong>" . _t("Deleted %1", $vs_type_name) . "</strong>\n";
        $vs_buf .= "<br style='clear: both;'/></div></h4>\n";
    } else {
        if ($vn_item_id) {
            if (!$po_view->request->config->get("{$vs_priv_table_name}_inspector_disable_headline")) {
                if ($po_view->request->user->canDoAction("can_edit_" . $vs_priv_table_name) && sizeof($t_item->getTypeList()) > 1) {
                    $vs_buf .= "<strong>" . _t("Editing %1", $vs_type_name) . ": </strong>\n";
                } else {
                    $vs_buf .= "<strong>" . _t("Viewing %1", $vs_type_name) . ": </strong>\n";
                }
            }
            if ($t_item->hasField('is_deaccessioned') && $t_item->get('is_deaccessioned') && $t_item->get('deaccession_date', array('getDirectDate' => true)) <= caDateToHistoricTimestamp(_t('now'))) {
                // If currently deaccessioned then display deaccession message
                $vs_buf .= "<br/><div class='inspectorDeaccessioned'>" . _t('Deaccessioned %1', $t_item->get('deaccession_date')) . "</div>\n";
                if ($vs_deaccession_notes = $t_item->get('deaccession_notes')) {
                    TooltipManager::add(".inspectorDeaccessioned", $vs_deaccession_notes);
                }
            } else {
                if ($po_view->request->user->canDoAction('can_see_current_location_in_inspector_ca_objects')) {
                    if ($t_ui && method_exists($t_item, "getObjectHistory") && (is_array($va_placements = $t_ui->getPlacementsForBundle('ca_objects_history')) && sizeof($va_placements) > 0)) {
                        //
                        // Output current "location" of object in life cycle. Configuration is taken from a ca_objects_history bundle configured for the current editor
                        //
                        $va_placement = array_shift($va_placements);
                        $va_bundle_settings = $va_placement['settings'];
                        if (is_array($va_history = $t_item->getObjectHistory($va_bundle_settings, array('limit' => 1, 'currentOnly' => true))) && sizeof($va_history) > 0) {
                            $va_current_location = array_shift(array_shift($va_history));
                            if (!($vs_inspector_current_location_label = $po_view->request->config->get("ca_objects_inspector_current_location_label"))) {
                                $vs_inspector_current_location_label = _t('Current');
                            }
                            if ($va_current_location['display']) {
                                $vs_buf .= "<div class='inspectorCurrentLocation'><strong>" . $vs_inspector_current_location_label . ':</strong><br/>' . $va_current_location['display'] . "</div>";
                            }
                        }
                    } elseif (method_exists($t_item, "getLastLocationForDisplay")) {
                        // If no ca_objects_history bundle is configured then display the last storage location
                        if ($vs_current_location = $t_item->getLastLocationForDisplay("<ifdef code='ca_storage_locations.parent.preferred_labels'>^ca_storage_locations.parent.preferred_labels ➜ </ifdef>^ca_storage_locations.preferred_labels.name")) {
                            $vs_buf .= "<br/><div class='inspectorCurrentLocation'>" . _t('Location: %1', $vs_current_location) . "</div>\n";
                            $vs_full_location_hierarchy = $t_item->getLastLocationForDisplay("^ca_storage_locations.hierarchy.preferred_labels.name%delimiter=_➜_");
                            if ($vs_full_location_hierarchy !== $vs_current_location) {
                                TooltipManager::add(".inspectorCurrentLocation", $vs_full_location_hierarchy);
                            }
                        }
                    }
                }
            }
            //
            // Display flags; expressions for these are defined in app.conf in the <table_name>_inspector_display_flags directive
            //
            if (is_array($va_display_flags = $po_view->request->config->getAssoc("{$vs_table_name}_inspector_display_flags"))) {
                $va_display_flag_buf = array();
                foreach ($va_display_flags as $vs_exp => $vs_display_flag) {
                    $va_exp_vars = array();
                    foreach (ExpressionParser::getVariableList($vs_exp) as $vs_var_name) {
                        $va_exp_vars[$vs_var_name] = $t_item->get($vs_var_name, array('returnIdno' => true));
                    }
                    if (ExpressionParser::evaluate($vs_exp, $va_exp_vars)) {
                        $va_display_flag_buf[] = $t_item->getWithTemplate("{$vs_display_flag}");
                    }
                }
                if (sizeof($va_display_flag_buf) > 0) {
                    $vs_buf .= join("; ", $va_display_flag_buf);
                }
            }
            $vs_label = '';
            $vb_dont_use_labels_for_ca_objects = (bool) $t_item->getAppConfig()->get('ca_objects_dont_use_labels');
            if (!($vs_table_name === 'ca_objects' && $vb_dont_use_labels_for_ca_objects)) {
                if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_title")) {
                    $vs_label = caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey()));
                } else {
                    $va_object_collection_collection_ancestors = $po_view->getVar('object_collection_collection_ancestors');
                    if ($t_item->tableName() == 'ca_objects' && $t_item->getAppConfig()->get('ca_objects_x_collections_hierarchy_enabled') && is_array($va_object_collection_collection_ancestors) && sizeof($va_object_collection_collection_ancestors)) {
                        $va_collection_links = array();
                        foreach ($va_object_collection_collection_ancestors as $va_collection_ancestor) {
                            $va_collection_links[] = caEditorLink($po_view->request, $va_collection_ancestor['label'], '', 'ca_collections', $va_collection_ancestor['collection_id']);
                        }
                        $vs_label .= join(" / ", $va_collection_links) . ' &gt; ';
                    }
                    if (method_exists($t_item, 'getLabelForDisplay')) {
                        $vn_parent_index = sizeof($va_ancestors) - 1;
                        if ($vn_parent_id && ($vs_table_name != 'ca_places' || $vn_parent_index > 0)) {
                            $va_parent = $va_ancestors[$vn_parent_index];
                            $vs_disp_fld = $t_item->getLabelDisplayField();
                            if ($va_parent['NODE'][$vs_disp_fld] && ($vs_editor_link = caEditorLink($po_view->request, $va_parent['NODE'][$vs_disp_fld], '', $vs_table_name, $va_parent['NODE'][$t_item->primaryKey()]))) {
                                $vs_label .= $vs_editor_link . ' &gt; ' . $t_item->getLabelForDisplay();
                            } else {
                                $vs_label .= ($va_parent['NODE'][$vs_disp_fld] ? $va_parent['NODE'][$vs_disp_fld] . ' &gt; ' : '') . $t_item->getLabelForDisplay();
                            }
                        } else {
                            $vs_label .= $t_item->getLabelForDisplay();
                            if ($vs_table_name === 'ca_editor_uis' && in_array($po_view->request->getAction(), array('EditScreen', 'DeleteScreen', 'SaveScreen'))) {
                                $t_screen = new ca_editor_ui_screens($po_view->request->getParameter('screen_id', pInteger));
                                if (!($vs_screen_name = $t_screen->getLabelForDisplay())) {
                                    $vs_screen_name = _t('new screen');
                                }
                                $vs_label .= " &gt; " . $vs_screen_name;
                            }
                        }
                    } else {
                        $vs_label .= $t_item->get('name');
                    }
                }
            }
            $vb_show_idno = (bool) ($vs_idno = $t_item->get($t_item->getProperty('ID_NUMBERING_ID_FIELD')));
            if (!$vs_label) {
                switch ($vs_table_name) {
                    case 'ca_commerce_orders':
                        if ($t_item->get('order_type') == 'L') {
                            if ($vs_org = $t_item->get('billing_organization')) {
                                $vs_label = _t('%5 #%4 on %1 to %2 (%3)', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $vs_org, $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
                            } else {
                                $vs_label = _t('%4 #%3 on %1 to %2', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
                            }
                        } else {
                            if ($vs_org = $t_item->get('billing_organization')) {
                                $vs_label = _t('%5 #%4 on %1 from %2 (%3)', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $vs_org, $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
                            } else {
                                $vs_label = _t('%4 #%3 on %1 from %2', caGetLocalizedDate($t_item->get('created_on', array('getDirectDate' => true)), array('dateFormat' => 'delimited', 'timeOmit' => true)), $t_item->get('billing_fname') . ' ' . $t_item->get('billing_lname'), $t_item->getOrderNumber(), caUcFirstUTF8Safe($t_item->getProperty('NAME_SINGULAR')));
                            }
                        }
                        break;
                    default:
                        if ($vs_table_name === 'ca_objects' && $vb_dont_use_labels_for_ca_objects) {
                            $vs_label = $vs_idno;
                            $vb_show_idno = false;
                        } else {
                            $vs_label = '[' . _t('BLANK') . ']';
                        }
                        break;
                }
            }
            $vs_buf .= "<div class='recordTitle {$vs_table_name}' style='width:190px; overflow:hidden;'>{$vs_label}" . ($vb_show_idno ? "<a title='{$vs_idno}'>" . ($vs_idno ? " ({$vs_idno})" : '') : "") . "</a></div>";
            if ($vs_table_name === 'ca_object_lots' && $t_item->getPrimaryKey()) {
                $vs_buf .= "<div id='inspectorLotMediaDownload'><strong>" . (($vn_num_objects = $t_item->numObjects()) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n";
            }
            if ($po_view->request->config->get("include_custom_inspector")) {
                if (file_exists($po_view->request->getViewsDirectoryPath() . "/bundles/inspector_info.php")) {
                    $vo_inspector_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/");
                    $vo_inspector_view->setVar('t_item', $t_item);
                    $vs_buf .= $vo_inspector_view->render('inspector_info.php');
                }
            }
        } else {
            $vs_parent_name = '';
            if ($vn_parent_id = $po_view->request->getParameter('parent_id', pInteger)) {
                $t_parent = clone $t_item;
                $t_parent->load($vn_parent_id);
                $vs_parent_name = $t_parent->getLabelForDisplay();
            }
            $vs_buf .= "<div class='creatingNew'>" . _t("Creating new %1", $vs_type_name) . " " . ($vs_parent_name ? _t("%1 &gt; New %2", $vs_parent_name, $vs_type_name) : '') . "</div>\n";
            $vs_buf .= "<br/>\n";
        }
        // -------------------------------------------------------------------------------------
        if ($t_item->getPrimaryKey()) {
            if (sizeof($va_reps) > 0) {
                $va_imgs = array();
                $vs_buf .= "<div id='inspectorMedia'>";
                $vn_r = $vn_primary_index = 0;
                foreach ($va_reps as $va_rep) {
                    if (!($va_rep['info']['preview170']['WIDTH'] && $va_rep['info']['preview170']['HEIGHT'])) {
                        continue;
                    }
                    if ($vb_is_primary = isset($va_rep['is_primary']) && (bool) $va_rep['is_primary']) {
                        $vn_primary_index = $vn_r;
                    }
                    $va_imgs[] = "{url:'" . $va_rep['urls']['preview170'] . "', width: " . $va_rep['info']['preview170']['WIDTH'] . ", height: " . $va_rep['info']['preview170']['HEIGHT'] . ", link: '#', onclick:  'caMediaPanel.showPanel(\\'" . caNavUrl($po_view->request, '*', '*', 'GetMediaOverlay', array($t_item->primaryKey() => $vn_item_id, 'representation_id' => $va_rep['representation_id'])) . "\\')'}";
                    $vn_r++;
                }
                if (sizeof($va_reps) > 1) {
                    $vs_buf .= "\n\t\t\t\t\t<div class='leftScroll'>\n\t\t\t\t\t\t<a href='#' onclick='inspectorInfoRepScroller.scrollToPreviousImage(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_SCROLL_LT__) . "</a>\n\t\t\t\t\t</div>\n\t\t";
                }
                if (sizeof($va_imgs) > 0) {
                    $vs_buf .= "\n\t\t\t\t<div id='inspectorInfoRepScrollingViewer' style='position: relative;'>\n\t\t\t\t\t<div id='inspectorInfoRepScrollingViewerContainer'>\n\t\t\t\t\t\t<div id='inspectorInfoRepScrollingViewerImageContainer'></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t";
                    if (sizeof($va_reps) > 1) {
                        $vs_buf .= "\n\t\t\t\t\t<div class='rightScroll'>\n\t\t\t\t\t\t<a href='#' onclick='inspectorInfoRepScroller.scrollToNextImage(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_SCROLL_RT__) . "</a>\n\t\t\t\t\t</div>\n\t\t";
                    }
                    TooltipManager::add(".leftScroll", _t('Previous'));
                    TooltipManager::add(".rightScroll", _t('Next'));
                    $vs_buf .= "<script type='text/javascript'>";
                    $vs_buf .= "\n\t\t\t\t\tvar inspectorInfoRepScroller = caUI.initImageScroller([" . join(",", $va_imgs) . "], 'inspectorInfoRepScrollingViewerImageContainer', {\n\t\t\t\t\t\t\tcontainerWidth: 170, containerHeight: 170,\n\t\t\t\t\t\t\timageCounterID: 'inspectorInfoRepScrollingViewerCounter',\n\t\t\t\t\t\t\tscrollingImageClass: 'inspectorInfoRepScrollerImage',\n\t\t\t\t\t\t\tscrollingImagePrefixID: 'inspectorInfoRep',\n\t\t\t\t\t\t\tinitialIndex: {$vn_primary_index}\n\t\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t</script>";
                }
                $vs_buf .= "</div>\n";
                if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_below_media")) {
                    $vs_buf .= caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey()));
                }
            }
            $vs_buf .= "<div id='toolIcons'>";
            if ($vn_item_id) {
                # --- watch this link
                $vs_watch = "";
                if (in_array($vs_table_name, array('ca_objects', 'ca_object_lots', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations'))) {
                    require_once __CA_MODELS_DIR__ . '/ca_watch_list.php';
                    $t_watch_list = new ca_watch_list();
                    $vs_watch = "<div class='watchThis'><a href='#' title='" . _t('Add/remove item to/from watch list.') . "' onclick='caToggleItemWatch(); return false;' id='caWatchItemButton'>" . caNavIcon($po_view->request, $t_watch_list->isItemWatched($vn_item_id, $t_item->tableNum(), $po_view->request->user->get("user_id")) ? __CA_NAV_BUTTON_UNWATCH__ : __CA_NAV_BUTTON_WATCH__) . "</a></div>";
                    $vs_buf .= "\n<script type='text/javascript'>\n\t\tfunction caToggleItemWatch() {\n\t\t\tvar url = '" . caNavUrl($po_view->request, $po_view->request->getModulePath(), $po_view->request->getController(), 'toggleWatch', array($t_item->primaryKey() => $vn_item_id)) . "';\n\t\t\t\n\t\t\tjQuery.getJSON(url, {}, function(data, status) {\n\t\t\t\tif (data['status'] == 'ok') {\n\t\t\t\t\tjQuery('#caWatchItemButton').html((data['state'] == 'watched') ? '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_UNWATCH__)) . "' : '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_WATCH__)) . "');\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log('Error toggling watch status for item: ' + data['errors']);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t</script>\n";
                }
                $vs_buf .= "{$vs_watch}\n";
                TooltipManager::add("#caWatchItemButton", _t('Watch/Unwatch this record'));
                if ($po_view->request->user->canDoAction("can_change_type_{$vs_table_name}")) {
                    $vs_buf .= "<div id='inspectorChangeType'><div id='inspectorChangeTypeButton'><a href='#' onclick='caTypeChangePanel.showPanel(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_CHANGE__ . " Change Type", array('title' => _t('Change type'))) . "</a></div></div>\n";
                    $vo_change_type_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/");
                    $vo_change_type_view->setVar('t_item', $t_item);
                    FooterManager::add($vo_change_type_view->render("change_type_html.php"));
                    TooltipManager::add("#inspectorChangeType", _t('Change Record Type'));
                }
                if ($t_item->getPrimaryKey() && $po_view->request->config->get($vs_table_name . '_show_add_child_control_in_inspector')) {
                    $vb_show_add_child_control = true;
                    if (is_array($va_restrict_add_child_control_to_types = $po_view->request->config->getList($vs_table_name . '_restrict_child_control_in_inspector_to_types')) && sizeof($va_restrict_add_child_control_to_types)) {
                        $t_type_instance = $t_item->getTypeInstance();
                        if (!in_array($t_type_instance->get('idno'), $va_restrict_add_child_control_to_types) && !in_array($t_type_instance->getPrimaryKey(), $va_restrict_add_child_control_to_types)) {
                            $vb_show_add_child_control = false;
                        }
                    }
                    if ($vb_show_add_child_control) {
                        if ((bool) $po_view->request->config->get($vs_table_name . '_enforce_strict_type_hierarchy')) {
                            // strict menu
                            $vs_type_list = $t_item->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('childrenOfCurrentTypeOnly' => true, 'directChildrenOnly' => $po_view->request->config->get($vs_table_name . '_enforce_strict_type_hierarchy') == '~' ? false : true, 'returnHierarchyLevels' => true, 'access' => __CA_BUNDLE_ACCESS_EDIT__));
                        } else {
                            // all types
                            $vs_type_list = $t_item->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('access' => __CA_BUNDLE_ACCESS_EDIT__));
                        }
                        if ($vs_type_list) {
                            $vs_buf .= "<div id='inspectorCreateChild'><div id='inspectorCreateChildButton'><a href='#' onclick='caCreateChildPanel.showPanel(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_CHILD__, array('title' => _t('Create Child Record'))) . "</a></div></div>\n";
                            $vo_create_child_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/");
                            $vo_create_child_view->setVar('t_item', $t_item);
                            $vo_create_child_view->setVar('type_list', $vs_type_list);
                            FooterManager::add($vo_create_child_view->render("create_child_html.php"));
                            TooltipManager::add("#inspectorCreateChildButton", _t('Create a child record under this one'));
                        }
                    }
                }
            }
            if ($po_view->request->user->canDoAction('can_duplicate_' . $vs_table_name) && $t_item->getPrimaryKey()) {
                $vs_buf .= '<div id="caDuplicateItemButton">';
                $vs_buf .= caFormTag($po_view->request, 'Edit', 'DuplicateItemForm', $po_view->request->getModulePath() . '/' . $po_view->request->getController(), 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true, 'noTimestamp' => true));
                $vs_buf .= caFormSubmitLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DUPLICATE__), '', 'DuplicateItemForm');
                $vs_buf .= caHTMLHiddenInput($t_item->primaryKey(), array('value' => $t_item->getPrimaryKey()));
                $vs_buf .= caHTMLHiddenInput('mode', array('value' => 'dupe'));
                $vs_buf .= "</form>";
                $vs_buf .= "</div>";
                TooltipManager::add("#caDuplicateItemButton", _t('Duplicate this %1', mb_strtolower($vs_type_name, 'UTF-8')));
            }
            //
            // Download media in lot ($vn_num_objects is only set for object lots)
            if ($vn_num_objects > 0) {
                $vs_buf .= "<div id='inspectorLotMediaDownloadButton'>" . caNavLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DOWNLOAD__), "button", $po_view->request->getModulePath(), $po_view->request->getController(), 'getLotMedia', array('lot_id' => $t_item->getPrimaryKey(), 'download' => 1), array()) . "</div>\n";
                TooltipManager::add('#inspectorLotMediaDownloadButton', _t("Download all media associated with objects in this lot"));
            }
            //
            // Download media in set
            if ($vs_table_name == 'ca_sets' && sizeof($t_item->getItemRowIDs()) > 0) {
                $vs_buf .= "<div id='inspectorSetMediaDownloadButton'>" . caNavLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DOWNLOAD__), "button", $po_view->request->getModulePath(), $po_view->request->getController(), 'getSetMedia', array('set_id' => $t_item->getPrimaryKey(), 'download' => 1), array()) . "</div>\n";
                TooltipManager::add('#inspectorSetMediaDownloadButton', _t("Download all media associated with records in this set"));
            }
            $vs_more_info = '';
            // list of sets in which item is a member
            $t_set = new ca_sets();
            if (is_array($va_sets = caExtractValuesByUserLocale($t_set->getSetsForItem($t_item->tableNum(), $t_item->getPrimaryKey(), array('user_id' => $po_view->request->getUserID(), 'access' => __CA_SET_READ_ACCESS__)))) && sizeof($va_sets)) {
                $va_links = array();
                foreach ($va_sets as $vn_set_id => $va_set) {
                    $va_links[] = "<a href='" . caEditorUrl($po_view->request, 'ca_sets', $vn_set_id) . "'>" . $va_set['name'] . "</a>";
                }
                $vs_more_info .= "<div><strong>" . (sizeof($va_links) == 1 ? _t("In set") : _t("In sets")) . "</strong> " . join(", ", $va_links) . "</div>\n";
            }
            // export options
            if ($vn_item_id && ($vs_select = $po_view->getVar('available_mappings_as_html_select'))) {
                $vs_more_info .= "<div class='inspectorExportControls'>" . caFormTag($po_view->request, 'exportItem', 'caExportForm', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
                $vs_more_info .= $vs_select;
                $vs_more_info .= caHTMLHiddenInput($t_item->primaryKey(), array('value' => $t_item->getPrimaryKey()));
                $vs_more_info .= caHTMLHiddenInput('download', array('value' => 1));
                $vs_more_info .= caFormSubmitLink($po_view->request, 'Export &rsaquo;', 'button', 'caExportForm');
                $vs_more_info .= "</form></div>";
            }
            $va_creation = $t_item->getCreationTimestamp();
            $va_last_change = $t_item->getLastChangeTimestamp();
            if ($va_creation['timestamp'] || $va_last_change['timestamp']) {
                $vs_more_info .= "<div class='inspectorChangeDateList'>";
                if ($va_creation['timestamp']) {
                    if (!trim($vs_name = $va_creation['fname'] . ' ' . $va_creation['lname'])) {
                        $vs_name = null;
                    }
                    $vs_interval = ($vn_t = time() - $va_creation['timestamp']) == 0 ? _t('Just now') : _t('%1 ago', caFormatInterval($vn_t, 2));
                    $vs_more_info .= "<div class='inspectorChangeDateListLine'  id='caInspectorCreationDate'>" . ($vs_name ? _t('<strong>Created</strong><br/>%1 by %2', $vs_interval, $vs_name) : _t('<strong>Created</strong><br/>%1', $vs_interval)) . "</div>";
                    TooltipManager::add("#caInspectorCreationDate", "<h2>" . _t('Created on') . "</h2>" . _t('Created on %1', caGetLocalizedDate($va_creation['timestamp'], array('dateFormat' => 'delimited'))));
                }
                if ($va_last_change['timestamp'] && $va_creation['timestamp'] != $va_last_change['timestamp']) {
                    if (!trim($vs_name = $va_last_change['fname'] . ' ' . $va_last_change['lname'])) {
                        $vs_name = null;
                    }
                    $vs_interval = ($vn_t = time() - $va_last_change['timestamp']) == 0 ? _t('Just now') : _t('%1 ago', caFormatInterval($vn_t, 2));
                    $vs_more_info .= "<div class='inspectorChangeDateListLine' id='caInspectorChangeDate'>" . ($vs_name ? _t('<strong>Last changed</strong><br/>%1 by %2', $vs_interval, $vs_name) : _t('<strong>Last changed</strong><br/>%1', $vs_interval)) . "</div>";
                    TooltipManager::add("#caInspectorChangeDate", "<h2>" . _t('Last changed on') . "</h2>" . _t('Last changed on %1', caGetLocalizedDate($va_last_change['timestamp'], array('dateFormat' => 'delimited'))));
                }
                if (method_exists($t_item, 'getMetadataDictionaryRuleViolations') && is_array($va_violations = $t_item->getMetadataDictionaryRuleViolations()) && ($vn_num_violations = sizeof($va_violations)) > 0) {
                    $va_violation_messages = array();
                    foreach ($va_violations as $vn_violation_id => $va_violation) {
                        $vs_label = $t_item->getDisplayLabel($va_violation['bundle_name']);
                        $va_violation_messages[] = "<li><em><u>{$vs_label}</u></em> " . $va_violation['violationMessage'] . "</li>";
                    }
                    $vs_more_info .= "<div id='caInspectorViolationsList'>" . ($vs_num_violations_display = "<img src='" . $po_view->request->getThemeUrlPath() . "/graphics/icons/warning_small.gif' border='0'/> " . ($vn_num_violations > 1 ? _t('%1 problems require attention', $vn_num_violations) : _t('%1 problem requires attention', $vn_num_violations))) . "</div>\n";
                    TooltipManager::add("#caInspectorViolationsList", "<h2>{$vs_num_violations_display}</h2><ol>" . join("\n", $va_violation_messages)) . "</ol>\n";
                }
                $vs_more_info .= "</div>\n";
            }
            if ($vs_get_spec = $po_view->request->config->get("{$vs_table_name}_inspector_display_more_info")) {
                $vs_more_info .= caProcessTemplateForIDs($vs_get_spec, $vs_table_name, array($t_item->getPrimaryKey()));
            }
            if ($vs_more_info) {
                $vs_buf .= "<div class='button info'><a href='#' id='inspectorMoreInfo'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_INFO2__) . "</a></div>\n\t\t\t<div id='inspectorInfo' >";
                $vs_buf .= $vs_more_info . "</div>\n";
                TooltipManager::add("#inspectorMoreInfo", _t('See more information about this record'));
            }
            $vs_buf .= "</div><!--End tooIcons-->";
        }
        // -------------------------------------------------------------------------------------
        //
        // Item-specific information
        //
        //
        // Output info for related items
        //
        if (!$t_item->getPrimaryKey()) {
            // only applies to new records
            $vs_rel_table = $po_view->request->getParameter('rel_table', pString);
            $vn_rel_type_id = $po_view->request->getParameter('rel_type_id', pString);
            $vn_rel_id = $po_view->request->getParameter('rel_id', pInteger);
            if ($vs_rel_table && $po_view->request->datamodel->tableExists($vs_rel_table) && $vn_rel_type_id && $vn_rel_id) {
                $t_rel = $po_view->request->datamodel->getTableInstance($vs_rel_table);
                if ($t_rel && $t_rel->load($vn_rel_id)) {
                    $vs_buf .= '<strong>' . _t("Will be related to %1", $t_rel->getTypeName()) . '</strong>: ' . $t_rel->getLabelForDisplay();
                }
            }
        }
        //
        // Output lot info for ca_objects
        //
        $vb_is_currently_part_of_lot = true;
        if (!($vn_lot_id = $t_item->get('lot_id'))) {
            $vn_lot_id = $po_view->request->getParameter('lot_id', pInteger);
            $vb_is_currently_part_of_lot = false;
        }
        if ($vs_table_name === 'ca_objects' && $vn_lot_id) {
            require_once __CA_MODELS_DIR__ . '/ca_object_lots.php';
            $va_lot_lots = caGetTypeListForUser('ca_object_lots', array('access' => __CA_BUNDLE_ACCESS_READONLY__));
            $t_lot = new ca_object_lots($vn_lot_id);
            if ($t_lot->get('deleted') == 0 && in_array($t_lot->get('type_id'), $va_lot_lots)) {
                if (!($vs_lot_displayname = $t_lot->get('idno_stub'))) {
                    if (!($vs_lot_displayname = $t_lot->getLabelForDisplay())) {
                        $vs_lot_displayname = "Lot {$vn_lot_id}";
                    }
                }
                if ($vs_lot_displayname) {
                    if (!($vs_part_of_lot_msg = $po_view->request->config->get("ca_objects_inspector_part_of_lot_msg"))) {
                        $vs_part_of_lot_msg = _t('Part of lot');
                    }
                    if (!($vs_will_be_part_of_lot_msg = $po_view->request->config->get("ca_objects_inspector_will_be_part_of_lot_msg"))) {
                        $vs_will_be_part_of_lot_msg = _t('Will be part of lot');
                    }
                    $vs_buf .= "<strong>" . ($vb_is_currently_part_of_lot ? $vs_part_of_lot_msg : $vs_will_be_part_of_lot_msg) . "</strong>: " . caNavLink($po_view->request, $vs_lot_displayname, '', 'editor/object_lots', 'ObjectLotEditor', 'Edit', array('lot_id' => $vn_lot_id));
                }
            }
        }
        $va_object_container_types = $po_view->request->config->getList('ca_objects_container_types');
        $va_object_component_types = $po_view->request->config->getList('ca_objects_component_types');
        $vb_can_add_component = $vs_table_name === 'ca_objects' && $t_item->getPrimaryKey() && $po_view->request->user->canDoAction('can_create_ca_objects') && $t_item->canTakeComponents();
        if (method_exists($t_item, 'getComponentCount')) {
            if ($vn_component_count = $t_item->getComponentCount()) {
                if ($t_ui && ($vs_component_list_screen = $t_ui->getScreenWithBundle("ca_objects_components_list", $po_view->request)) && $vs_component_list_screen !== $po_view->request->getActionExtra()) {
                    $vs_component_count_link = caNavLink($po_view->request, $vn_component_count == 1 ? _t('%1 component', $vn_component_count) : _t('%1 components', $vn_component_count), '', '*', '*', $po_view->request->getAction() . '/' . $vs_component_list_screen, array($t_item->primaryKey() => $t_item->getPrimaryKey()));
                } else {
                    $vs_component_count_link = $vn_component_count == 1 ? _t('%1 component', $vn_component_count) : _t('%1 components', $vn_component_count);
                }
                $vs_buf .= "<br/><strong>" . _t('Has') . ":</strong> {$vs_component_count_link}";
            }
        }
        if ($vb_can_add_component) {
            $vs_buf .= ' <a href="#" onclick=\'caObjectComponentPanel.showPanel("' . caNavUrl($po_view->request, '*', 'ObjectComponent', 'Form', array('parent_id' => $t_item->getPrimaryKey())) . '"); return false;\')>' . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . '</a>';
            $vo_change_type_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/");
            $vo_change_type_view->setVar('t_item', $t_item);
            FooterManager::add($vo_change_type_view->render("create_component_html.php"));
        }
        //
        // Output lot info for ca_object_lots
        //
        if ($vs_table_name === 'ca_object_lots' && $t_item->getPrimaryKey()) {
            $va_component_types = $po_view->request->config->getList('ca_objects_component_types');
            if (is_array($va_component_types) && sizeof($va_component_types)) {
                $vs_buf .= "<strong>" . (($vn_num_objects = $t_item->numObjects(null, array('return' => 'objects'))) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n";
                $vs_buf .= "<strong>" . (($vn_num_components = $t_item->numObjects(null, array('return' => 'components'))) == 1 ? _t('Lot contains %1 component', $vn_num_components) : _t('Lot contains %1 components', $vn_num_components)) . "</strong>\n";
            } else {
                $vs_buf .= "<strong>" . (($vn_num_objects = $t_item->numObjects()) == 1 ? _t('Lot contains %1 object', $vn_num_objects) : _t('Lot contains %1 objects', $vn_num_objects)) . "</strong>\n";
            }
            if ((bool) $po_view->request->config->get('allow_automated_renumbering_of_objects_in_a_lot') && ($va_nonconforming_objects = $t_item->getObjectsWithNonConformingIdnos())) {
                $vs_buf .= '<br/><br/><em>' . (($vn_c = sizeof($va_nonconforming_objects)) == 1 ? _t('There is %1 object with non-conforming numbering', $vn_c) : _t('There are %1 objects with non-conforming numbering', $vn_c)) . "</em>\n";
                $vs_buf .= "<a href='#' onclick='jQuery(\"#inspectorNonConformingNumberList\").toggle(250); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__);
                $vs_buf .= "<div id='inspectorNonConformingNumberList' class='inspectorNonConformingNumberList'><div class='inspectorNonConformingNumberListScroll'><ol>\n";
                foreach ($va_nonconforming_objects as $vn_object_id => $va_object_info) {
                    $vs_buf .= '<li>' . caEditorLink($po_view->request, $va_object_info['idno'], '', 'ca_objects', $vn_object_id) . "</li>\n";
                }
                $vs_buf .= "</ol></div>";
                $vs_buf .= caNavLink($po_view->request, _t('Re-number objects') . ' &rsaquo;', 'button', $po_view->request->getModulePath(), $po_view->request->getController(), 'renumberObjects', array('lot_id' => $t_item->getPrimaryKey()));
                $vs_buf .= "</div>\n";
            }
            require_once __CA_MODELS_DIR__ . '/ca_objects.php';
            $t_object = new ca_objects();
            $vs_buf .= "<div class='inspectorLotObjectTypeControls'><form action='#' id='caAddObjectToLotForm'>";
            if ((bool) $po_view->request->config->get('ca_objects_enforce_strict_type_hierarchy')) {
                // strict menu
                $vs_buf .= _t('Add new %1 to lot', $t_object->getTypeListAsHTMLFormElement('type_id', array('id' => 'caAddObjectToLotForm_type_id'), array('childrenOfCurrentTypeOnly' => true, 'directChildrenOnly' => $po_view->request->config->get('ca_objects_enforce_strict_type_hierarchy') == '~' ? false : true, 'returnHierarchyLevels' => true, 'access' => __CA_BUNDLE_ACCESS_EDIT__)));
            } else {
                // all types
                $vs_buf .= _t('Add new %1 to lot', $t_object->getTypeListAsHTMLFormElement('type_id', array('id' => 'caAddObjectToLotForm_type_id'), array('access' => __CA_BUNDLE_ACCESS_EDIT__)));
            }
            $vs_buf .= " <a href='#' onclick='caAddObjectToLotForm()'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . '</a>';
            $vs_buf .= "</form></div>\n";
            $vs_buf .= "<script type='text/javascript'>\n\tfunction caAddObjectToLotForm() { \n\t\twindow.location='" . caEditorUrl($po_view->request, 'ca_objects', 0, false, array('lot_id' => $t_item->getPrimaryKey(), 'rel' => 1, 'type_id' => '')) . "' + jQuery('#caAddObjectToLotForm_type_id').val();\n\t}\n\tjQuery(document).ready(function() {\n\t\tjQuery('#objectLotsNonConformingNumberList').hide();\n\t});\n</script>\n";
        }
        if ($vs_table_name === 'ca_objects') {
            //
            // Output loan info for ca_objects
            //
            if ($po_view->request->user->canDoAction('can_manage_clients') && ($va_loan_details = $t_item->isOnLoan())) {
                $vs_buf .= "<div>" . caNavLink($po_view->request, _t('On loan to %1', $va_loan_details['billing_fname'] . ' ' . $va_loan_details['billing_lname']), 'inspectorOnLoan', 'client/library', 'OrderEditor', 'Edit', array('order_id' => $va_loan_details['order_id'])) . "</div>";
            }
            //
            // Output checkout info for ca_objects
            //
            if ((bool) $po_view->request->config->get('enable_client_services') && ((bool) $po_view->request->config->get('enable_client_services_sales') || (bool) $po_view->request->config->get('enable_client_services_library')) && $t_item->canBeCheckedOut() && ($va_checkout_status = $t_item->getCheckoutStatus(array('returnAsArray' => true)))) {
                $vs_buf .= "<div class='inspectorCheckedOut'>" . $va_checkout_status['status_display'];
                if ($va_checkout_status['user_name']) {
                    $vs_buf .= _t("; checked out by %1", $va_checkout_status['user_name']);
                }
                $vs_buf .= "</div>";
            }
        }
        //
        // Output related objects for ca_object_representations
        //
        if ($vs_table_name === 'ca_object_representations') {
            foreach (array('ca_objects', 'ca_object_lots', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations', 'ca_loans', 'ca_movements') as $vs_rel_table) {
                if (sizeof($va_objects = $t_item->getRelatedItems($vs_rel_table))) {
                    $vs_buf .= "<div><strong>" . _t("Related %1", $o_dm->getTableProperty($vs_rel_table, 'NAME_PLURAL')) . "</strong>: <br/>\n";
                    $vs_screen = '';
                    if ($t_ui = ca_editor_uis::loadDefaultUI($vs_rel_table, $po_view->request, null)) {
                        $vs_screen = $t_ui->getScreenWithBundle('ca_object_representations', $po_view->request);
                    }
                    foreach ($va_objects as $vn_rel_id => $va_rel_info) {
                        if ($vs_label = array_shift($va_rel_info['labels'])) {
                            $vs_buf .= caEditorLink($po_view->request, '&larr; ' . $vs_label . ' (' . $va_rel_info['idno'] . ')', '', $vs_rel_table, $va_rel_info[$o_dm->getTablePrimaryKeyName($vs_rel_table)], array(), array(), array('action' => 'Edit' . ($vs_screen ? "/{$vs_screen}" : ""))) . "<br/>\n";
                        }
                    }
                    $vs_buf .= "</div>\n";
                }
            }
        }
        //
        // Output related object reprsentation for ca_representation_annotation
        //
        if ($vs_table_name === 'ca_representation_annotations') {
            if ($vn_representation_id = $t_item->get('representation_id')) {
                $vs_buf .= "<div><strong>" . _t("Applied to representation") . "</strong>: <br/>\n";
                $t_rep = new ca_object_representations($vn_representation_id);
                $vs_buf .= caNavLink($po_view->request, '&larr; ' . $t_rep->getLabelForDisplay(), '', 'editor/object_representations', 'ObjectRepresentationEditor', 'Edit/' . $po_view->getVar('representation_editor_screen'), array('representation_id' => $vn_representation_id)) . '<br/>';
                $vs_buf .= "</div>\n";
            }
        }
        //
        // Output extra useful info for sets
        //
        if ($vs_table_name === 'ca_sets') {
            $vn_set_item_count = $t_item->getItemCount(array('user_id' => $po_view->request->getUserID()));
            if ($vn_set_item_count > 0 && $po_view->request->user->canDoAction('can_batch_edit_' . $o_dm->getTableName($t_item->get('table_num')))) {
                $vs_buf .= caNavButton($po_view->request, __CA_NAV_BUTTON_BATCH_EDIT__, _t('Batch edit'), 'editorBatchSetEditorLink', 'batch', 'Editor', 'Edit', array('set_id' => $t_item->getPrimaryKey()), array(), array('icon_position' => __CA_NAV_BUTTON_ICON_POS_LEFT__, 'no_background' => true, 'dont_show_content' => true));
            }
            $vs_buf .= "<div><strong>" . _t("Number of items") . "</strong>: {$vn_set_item_count}<br/>\n";
            if ($t_item->getPrimaryKey()) {
                $vn_set_table_num = $t_item->get('table_num');
                $vs_set_table_name = $o_dm->getTableName($vn_set_table_num);
                $vs_buf .= "<strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_set_table_num) . "<br/>\n";
                $vs_buf .= "</div>\n";
            } else {
                if ($vn_set_table_num = $po_view->request->getParameter('table_num', pInteger)) {
                    $vs_buf .= "<div><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_set_table_num) . "<br/>\n";
                    $vs_buf .= "</div>\n";
                }
            }
            $t_user = new ca_users(($vn_user_id = $t_item->get('user_id')) ? $vn_user_id : $po_view->request->getUserID());
            if ($t_user->getPrimaryKey()) {
                $vs_buf .= "<div><strong>" . _t('Owner') . "</strong>: " . $t_user->get('fname') . ' ' . $t_user->get('lname') . "</div>\n";
            }
            if ($po_view->request->user->canDoAction('can_export_' . $vs_set_table_name) && $t_item->getPrimaryKey() && sizeof(ca_data_exporters::getExporters($vn_set_table_num)) > 0) {
                $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px; text-align: right;" id="caExportItemButton">';
                $vs_buf .= _t('Export this set of records') . "&nbsp; ";
                $vs_buf .= "<a class='button' onclick='jQuery(\"#exporterFormList\").show();' style='text-align:right;' href='#'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . "</a>";
                $vs_buf .= caFormTag($po_view->request, 'ExportData', 'caExportForm', 'manage/MetadataExport', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
                $vs_buf .= "<div id='exporterFormList'>";
                $vs_buf .= ca_data_exporters::getExporterListAsHTMLFormElement('exporter_id', $vn_set_table_num, array('id' => 'caExporterList'), array('width' => '135px'));
                $vs_buf .= caHTMLHiddenInput('set_id', array('value' => $t_item->getPrimaryKey()));
                $vs_buf .= caFormSubmitLink($po_view->request, _t('Export') . " &rsaquo;", "button", "caExportForm");
                $vs_buf .= "</div>\n";
                $vs_buf .= "</form>";
                $vs_buf .= "</div>";
                $vs_buf .= "<script type='text/javascript'>";
                $vs_buf .= "jQuery(document).ready(function() {";
                $vs_buf .= "jQuery(\"#exporterFormList\").hide();";
                $vs_buf .= "});";
                $vs_buf .= "</script>";
            }
        }
        //
        // Output extra useful info for set items
        //
        if ($vs_table_name === 'ca_set_items') {
            AssetLoadManager::register("panel");
            $t_set = new ca_sets();
            if ($t_set->load($vn_set_id = $t_item->get('set_id'))) {
                $vs_buf .= "<div><strong>" . _t("Part of set") . "</strong>: " . caEditorLink($po_view->request, $t_set->getLabelForDisplay(), '', 'ca_sets', $vn_set_id) . "<br/>\n";
                $t_content_instance = $t_item->getAppDatamodel()->getInstanceByTableNum($vn_item_table_num = $t_item->get('table_num'));
                if ($t_content_instance->load($vn_row_id = $t_item->get('row_id'))) {
                    $vs_label = $t_content_instance->getLabelForDisplay();
                    if ($vs_id_fld = $t_content_instance->getProperty('ID_NUMBERING_ID_FIELD')) {
                        $vs_label .= " (" . $t_content_instance->get($vs_id_fld) . ")";
                    }
                    $vs_buf .= "<strong>" . _t("Is %1", caGetTableDisplayName($vn_item_table_num, false) . "</strong>: " . caEditorLink($po_view->request, $vs_label, '', $vn_item_table_num, $vn_row_id)) . "<br/>\n";
                }
                $vs_buf .= "</div>\n";
            }
        }
        //
        // Output extra useful info for lists
        //
        if ($vs_table_name === 'ca_lists' && $t_item->getPrimaryKey()) {
            $vs_buf .= "<strong>" . _t("Number of items") . "</strong>: " . $t_item->numItemsInList() . "<br/>\n";
            $t_list_item = new ca_list_items();
            $t_list_item->load(array('list_id' => $t_item->getPrimaryKey(), 'parent_id' => null));
            $vs_type_list = $t_list_item->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('access' => __CA_BUNDLE_ACCESS_EDIT__));
            if ($vs_type_list) {
                $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px;">';
                $vs_buf .= caFormTag($po_view->request, 'Edit', 'NewChildForm', 'administrate/setup/list_item_editor/ListItemEditor', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
                $vs_buf .= _t('Add a %1 to this list', $vs_type_list) . caHTMLHiddenInput($t_list_item->primaryKey(), array('value' => '0')) . caHTMLHiddenInput('parent_id', array('value' => $t_list_item->getPrimaryKey()));
                $vs_buf .= caFormSubmitLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__), '', 'NewChildForm');
                $vs_buf .= "</form></div>\n";
            }
        }
        //
        // Output containing list for list items
        //
        if ($vs_table_name === 'ca_list_items') {
            if ($t_list = $po_view->getVar('t_list')) {
                $vn_list_id = $t_list->getPrimaryKey();
                $vs_buf .= "<strong>" . _t("Part of") . "</strong>: " . caEditorLink($po_view->request, $t_list->getLabelForDisplay(), '', 'ca_lists', $vn_list_id) . "<br/>\n";
                if ($t_item->get('is_default')) {
                    $vs_buf .= "<strong>" . _t("Is default for list") . "</strong><br/>\n";
                }
            }
        }
        //
        // Output containing relationship type name for relationship types
        //
        if ($vs_table_name === 'ca_relationship_types') {
            if (!($t_rel_instance = $t_item->getAppDatamodel()->getInstanceByTableNum($t_item->get('table_num'), true))) {
                if ($vn_parent_id = $po_view->request->getParameter('parent_id', pInteger)) {
                    $t_rel_type = new ca_relationship_types($vn_parent_id);
                    $t_rel_instance = $t_item->getAppDatamodel()->getInstanceByTableNum($t_rel_type->get('table_num'), true);
                }
            }
            if ($t_rel_instance) {
                $vs_buf .= "<div><strong>" . _t("Is a") . "</strong>: " . $t_rel_instance->getProperty('NAME_SINGULAR') . "<br/></div>\n";
            }
        }
        //
        // Output extra useful info for metadata elements
        //
        if ($vs_table_name === 'ca_metadata_elements' && $t_item->getPrimaryKey()) {
            $vs_buf .= "<div><strong>" . _t("Element code") . "</strong>: " . $t_item->get('element_code') . "<br/></div>\n";
            if (sizeof($va_uis = $t_item->getUIs()) > 0) {
                $vs_buf .= "<div><strong>" . _t("Referenced by user interfaces") . "</strong>:<br/>\n";
                foreach ($va_uis as $vn_ui_id => $va_ui_info) {
                    $vs_buf .= caNavLink($po_view->request, $va_ui_info['name'], '', 'administrate/setup/interface_screen_editor', 'InterfaceScreenEditor', 'Edit', array('ui_id' => $vn_ui_id, 'screen_id' => $va_ui_info['screen_id']));
                    $vs_buf .= " (" . $o_dm->getTableProperty($va_ui_info['editor_type'], 'NAME_PLURAL') . ")<br/>\n";
                }
                $vs_buf .= "</div>\n";
            }
        }
        //
        // Output related objects for ca_editor_uis and ca_editor_ui_screens
        //
        if ($vs_table_name === 'ca_editor_uis') {
            $vs_buf .= "<div><strong>" . _t("Number of screens") . "</strong>: " . (int) $t_item->getScreenCount() . "\n";
            if ($t_item->getPrimaryKey()) {
                $vs_buf .= "<div><strong>" . _t("Edits") . "</strong>: " . caGetTableDisplayName($t_item->get('editor_type')) . "<br/>\n";
            } else {
                $vs_buf .= "<div><strong>" . _t("Edits") . "</strong>: " . caGetTableDisplayName($po_view->request->getParameter('editor_type', pInteger)) . "<br/>\n";
            }
            $vs_buf .= "</div>\n";
        }
        //
        // Output related objects for ca_editor_uis and ca_editor_ui_screens
        //
        if ($vs_table_name === 'ca_editor_ui_screens') {
            $t_ui = new ca_editor_uis($vn_ui_id = $t_item->get('ui_id'));
            $vs_buf .= "<div><strong>" . _t("Part of") . "</strong>: " . caNavLink($po_view->request, $t_ui->getLabelForDisplay(), '', 'administrate/setup/interface_editor', 'InterfaceEditor', 'Edit', array('ui_id' => $vn_ui_id)) . "\n";
            $vs_buf .= "</div>\n";
        }
        //
        // Output extra useful info for bundle displays
        //
        if ($vs_table_name === 'ca_bundle_displays') {
            $vs_buf .= "<div><strong>" . _t("Number of placements") . "</strong>: " . $t_item->getPlacementCount(array('user_id' => $po_view->request->getUserID())) . "<br/>\n";
            if ($t_item->getPrimaryKey()) {
                $vn_content_table_num = $t_item->get('table_num');
                $vs_buf .= "<strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n";
                $vs_buf .= "</div>\n";
            } else {
                if ($vn_content_table_num = $po_view->request->getParameter('table_num', pInteger)) {
                    $vs_buf .= "<div><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n";
                    $vs_buf .= "</div>\n";
                }
            }
            $t_user = new ca_users(($vn_user_id = $t_item->get('user_id')) ? $vn_user_id : $po_view->request->getUserID());
            if ($t_user->getPrimaryKey()) {
                $vs_buf .= "<div><strong>" . _t('Owner') . "</strong>: " . $t_user->get('fname') . ' ' . $t_user->get('lname') . "</div>\n";
            }
        }
        //
        // Output extra useful info for search forms
        //
        if ($vs_table_name === 'ca_search_forms') {
            $vs_buf .= "<div><strong>" . _t("Number of placements") . "</strong>: " . $t_item->getPlacementCount(array('user_id' => $po_view->request->getUserID())) . "<br/>\n";
            if ($t_item->getPrimaryKey()) {
                $vn_content_table_num = $t_item->get('table_num');
                $vs_buf .= "<strong>" . _t("Searches for") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n";
                $vs_buf .= "</div>\n";
            } else {
                if ($vn_content_table_num = $po_view->request->getParameter('table_num', pInteger)) {
                    $vs_buf .= "<strong>" . _t("Searches for") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "\n";
                    $vs_buf .= "</div>\n";
                }
            }
            $t_user = new ca_users(($vn_user_id = $t_item->get('user_id')) ? $vn_user_id : $po_view->request->getUserID());
            if ($t_user->getPrimaryKey()) {
                $vs_buf .= "<div><strong>" . _t('Owner') . "</strong>: " . $t_user->get('fname') . ' ' . $t_user->get('lname') . "</div>\n";
            }
        }
        //
        // Output extra useful info for tours
        //
        if ($vs_table_name === 'ca_tours' && $t_item->getPrimaryKey()) {
            $vs_buf .= "<br/><strong>" . _t("Number of stops") . "</strong>: " . $t_item->getStopCount() . "<br/>\n";
        }
        //
        // Output containing tour for tour stops
        //
        if ($vs_table_name === 'ca_tour_stops') {
            $t_tour = new ca_tours($vn_tour_id = $t_item->get('tour_id'));
            $vs_buf .= "<strong>" . _t("Part of") . "</strong>: " . caEditorLink($po_view->request, $t_tour->getLabelForDisplay(), '', 'ca_tours', $vn_tour_id) . "<br/>\n";
        }
        //
        // Output extra useful info for bundle mappings
        //
        if ($vs_table_name === 'ca_bundle_mappings') {
            if ($t_item->getPrimaryKey()) {
                $vn_content_table_num = $t_item->get('table_num');
                $vs_buf .= "<br/><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "<br/>\n";
                $vs_buf .= "<strong>" . _t("Type") . "</strong>: " . $t_item->getChoiceListValue('direction', $t_item->get('direction')) . "<br/>\n";
                $vs_buf .= "<strong>" . _t("Target format") . "</strong>: " . $t_item->get('target') . "<br/>\n";
                $va_stats = $t_item->getMappingStatistics();
                $vs_buf .= "<div><strong>" . _t("Number of groups") . "</strong>: " . $va_stats['groupCount'] . "<br/>\n";
                $vs_buf .= "<strong>" . _t("Number of rules") . "</strong>: " . $va_stats['ruleCount'] . "<br/>\n";
                $vs_buf .= "</div>\n";
            } else {
                if ($vn_content_table_num = $po_view->request->getParameter('table_num', pInteger)) {
                    $vs_buf .= "<div><strong>" . _t("Type of content") . "</strong>: " . caGetTableDisplayName($vn_content_table_num) . "<br/>\n";
                    $vs_buf .= "<strong>" . _t("Type") . "</strong>: " . $t_item->getChoiceListValue('direction', $po_view->request->getParameter('direction', pString)) . "<br/>\n";
                    $vs_buf .= "<strong>" . _t("Target format") . "</strong>: " . $po_view->request->getParameter('target', pString) . "<br/>\n";
                    $vs_buf .= "<div><strong>" . _t("Number of groups") . "</strong>: 0<br/>\n";
                    $vs_buf .= "<strong>" . _t("Number of rules") . "</strong>: 0</div>\n";
                    $vs_buf .= "</div>\n";
                }
            }
        }
        //
        // Output extra useful info for client services/commerce orders
        //
        if ($vs_table_name === 'ca_commerce_orders') {
            $o_client_services_config = Configuration::load($po_view->request->config->get('client_services_config'));
            $va_order_totals = $t_item->getOrderTotals();
            if ($va_order_totals['fee'] + $va_order_totals['tax'] + $va_order_totals['shipping'] + $va_order_totals['handling'] + $va_order_totals['additional_order_fees'] + $va_order_totals['additional_item_fees'] != 0) {
                $vs_currency_symbol = $o_client_services_config->get('currency_symbol');
                $vs_buf .= "<table style='margin-left: 10px;'>";
                $vs_buf .= "<tr><td><strong>" . _t("Items") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['fee']) . " (" . (int) $va_order_totals['items'] . ")</td></tr>\n";
                $vs_buf .= "<tr><td><strong>" . _t("S+H") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['shipping'] + $va_order_totals['handling']) . "</td></tr>\n";
                $vs_buf .= "<tr><td><strong>" . _t("Tax") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['tax']) . "</td></tr>\n";
                $vs_buf .= "<tr><td><strong>" . _t("Addtl fees") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['additional_order_fees'] + $va_order_totals['additional_item_fees']) . "</td></tr>\n";
                $vs_buf .= "<tr><td><strong>" . _t("Total") . '</strong></td><td>' . $vs_currency_symbol . sprintf("%4.2f", $va_order_totals['fee'] + $va_order_totals['tax'] + $va_order_totals['shipping'] + $va_order_totals['handling'] + $va_order_totals['additional_order_fees'] + $va_order_totals['additional_item_fees']) . "</td></tr>\n";
                $vs_buf .= "</table>";
                $vs_buf .= "<strong>" . $t_item->getFieldInfo('payment_status', 'LABEL') . "</strong>: " . $t_item->getChoiceListValue('payment_status', $t_item->get('payment_status')) . "<br/>\n";
            }
            $vs_buf .= "<br/><strong>" . $t_item->getFieldInfo('order_status', 'LABEL') . "</strong>: " . $t_item->getChoiceListValue('order_status', $t_item->get('order_status')) . "<br/>\n";
            if ($vs_shipping_date = $t_item->get('shipping_date', array('dateFormat' => 'delimited', 'timeOmit' => true))) {
                $vs_buf .= "<strong>" . $t_item->getFieldInfo('shipping_date', 'LABEL') . "</strong>: " . $vs_shipping_date;
                if ($vs_shipped_on_date = $t_item->get('shipped_on_date', array('dateFormat' => 'delimited'))) {
                    $vs_buf .= " (" . _t('shipped %1', $vs_shipped_on_date) . ")";
                } else {
                    $vs_buf .= " (" . _t('not shipped') . ")";
                }
                $vs_buf .= "<br/>\n";
            }
            if (($vn_shipping_method = $t_item->get('shipping_method')) && $t_item->getChoiceListValue('shipping_method', $vn_shipping_method) != 'None') {
                $vs_buf .= "<strong>" . $t_item->getFieldInfo('shipping_method', 'LABEL') . "</strong>: " . $t_item->getChoiceListValue('shipping_method', $vn_shipping_method) . "<br/>\n";
            }
        }
        //
        // Output configurable additional info from config, if set
        //
        if ($vs_additional_info = $po_view->request->config->get("{$vs_table_name}_inspector_additional_info")) {
            if (is_array($vs_additional_info)) {
                $vs_buf .= "<br/>";
                foreach ($vs_additional_info as $vs_info) {
                    $vs_buf .= caProcessTemplateForIDs($vs_info, $vs_table_name, array($t_item->getPrimaryKey()), array('requireLinkTags' => true)) . "<br/>\n";
                }
            } else {
                $vs_buf .= "<br/>" . caProcessTemplateForIDs($vs_additional_info, $vs_table_name, array($t_item->getPrimaryKey()), array('requireLinkTags' => true)) . "<br/>\n";
            }
        }
        // -------------------------------------------------------------------------------------
        // Export
        if ($t_item->getPrimaryKey() && $po_view->request->config->get($vs_table_name . '_show_add_child_control_in_inspector')) {
            $vb_show_add_child_control = true;
            if (is_array($va_restrict_add_child_control_to_types = $po_view->request->config->getList($vs_table_name . '_restrict_child_control_in_inspector_to_types')) && sizeof($va_restrict_add_child_control_to_types)) {
                $t_type_instance = $t_item->getTypeInstance();
                if (!in_array($t_type_instance->get('idno'), $va_restrict_add_child_control_to_types) && !in_array($t_type_instance->getPrimaryKey(), $va_restrict_add_child_control_to_types)) {
                    $vb_show_add_child_control = false;
                }
            }
        }
        if ($po_view->request->user->canDoAction('can_export_' . $vs_table_name) && $t_item->getPrimaryKey() && sizeof(ca_data_exporters::getExporters($t_item->tableNum())) > 0) {
            $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px; text-align: right;" id="caExportItemButton">';
            $vs_buf .= _t('Export this %1', mb_strtolower($vs_type_name, 'UTF-8')) . " ";
            $vs_buf .= "<a class='button' onclick='jQuery(\"#exporterFormList\").show();' style='text-align:right;' href='#'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_ADD__) . "</a>";
            $vs_buf .= caFormTag($po_view->request, 'ExportSingleData', 'caExportForm', 'manage/MetadataExport', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
            $vs_buf .= "<div id='exporterFormList'>";
            $vs_buf .= ca_data_exporters::getExporterListAsHTMLFormElement('exporter_id', $t_item->tableNum(), array('id' => 'caExporterList'), array('width' => '120px'));
            $vs_buf .= caHTMLHiddenInput('item_id', array('value' => $t_item->getPrimaryKey()));
            $vs_buf .= caFormSubmitLink($po_view->request, _t('Export') . " &rsaquo;", "button", "caExportForm");
            $vs_buf .= "</div>\n";
            $vs_buf .= "</form>";
            $vs_buf .= "</div>";
            $vs_buf .= "<script type='text/javascript'>";
            $vs_buf .= "jQuery(document).ready(function() {";
            $vs_buf .= "jQuery(\"#exporterFormList\").hide();";
            $vs_buf .= "});";
            $vs_buf .= "</script>";
        }
        $vs_buf .= "</div></h4>\n";
        $vs_buf .= "<script type='text/javascript'>\n\t\t\tvar inspectorCookieJar = jQuery.cookieJar('caCookieJar');";
        if ($t_item->getPrimaryKey()) {
            if ($vs_more_info) {
                $vs_buf .= "\t\t\t\n\t\t\tif (inspectorCookieJar.get('inspectorMoreInfoIsOpen') == undefined) {\t\t// default is to have info open\n\t\t\t\tinspectorCookieJar.set('inspectorMoreInfoIsOpen', 1);\n\t\t\t}\n\t\t\tif (inspectorCookieJar.get('inspectorMoreInfoIsOpen') == 1) {\n\t\t\t\tjQuery('#inspectorInfo').toggle(0);\n\t\t\t\tjQuery('#inspectorMoreInfo').html('" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_COLLAPSE__)) . "');\n\t\t\t}\n\t\t\n\t\t\tjQuery('#inspectorMoreInfo').click(function() {\n\t\t\t\tjQuery('#inspectorInfo').slideToggle(350, function() { \n\t\t\t\t\tinspectorCookieJar.set('inspectorMoreInfoIsOpen', (this.style.display == 'block') ? 1 : 0); \n\t\t\t\t\tjQuery('#inspectorMoreInfo').html((this.style.display == 'block') ? '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_COLLAPSE__)) . "' : '" . addslashes(caNavIcon($po_view->request, __CA_NAV_BUTTON_INFO2__)) . "');\n\t\t\t\t\tcaResizeSideNav();\n\t\t\t\t}); \n\t\t\t\treturn false;\n\t\t\t});\n\t\t";
            }
            if (sizeof($va_reps)) {
                $vs_buf .= "\n\t\tif (inspectorCookieJar.get('inspectorShowMediaIsOpen') == undefined) {\t\t// default is to have media open\n\t\t\tinspectorCookieJar.set('inspectorShowMediaIsOpen', 1);\n\t\t}\n\t\t\n\t\tif (inspectorCookieJar.get('inspectorShowMediaIsOpen') == 1) {\n\t\t\tjQuery('#inspectorMedia').toggle();\n\t\t}\n\t\n\t\tjQuery('#caColorbox').on('click', function(e) {\n\t\t\tif (e.altKey) {\n\t\t\t\tjQuery('#inspectorMedia').slideToggle(200, function() { \n\t\t\t\t\tinspectorCookieJar.set('inspectorShowMediaIsOpen', (this.style.display == 'block') ? 1 : 0); \n\t\t\t\t\t\tcaResizeSideNav();\n\t\t\t\t}); \n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\t\t\t\t";
            }
        }
        $vs_buf .= "</script>\n";
    }
    $o_app_plugin_manager = new ApplicationPluginManager();
    $va_hookAppend = $o_app_plugin_manager->hookAppendToEditorInspector(array("t_item" => $t_item));
    if (is_string($va_hookAppend["caEditorInspectorAppend"])) {
        $vs_buf .= $va_hookAppend["caEditorInspectorAppend"];
    }
    return $vs_buf;
}
コード例 #30
0
?>
</span> 
			<div class="bundleContainer">
				<div class="caLabelList" >
					<p>
<?php 
print caHTMLSelect('logLevel', caGetLogLevels(), array('id' => 'caLogLevel'), array('value' => $va_last_settings['logLevel']));
?>
					</p>
				</div>
			</div>
		</div>
<?php 
print $this->render("tools/confirm_html.php");
print $vs_control_box;
print caHTMLHiddenInput("tool", array('value' => $vs_tool_identifier));
?>
	</form>
	
<div class="editorBottomPadding"><!-- empty --></div>
	
<script type="text/javascript">
	function caShowConfirmToolExecutionPanel() {
		var msg = '<?php 
print addslashes(_t("You are about to run <em>%2</em> in <em>%1</em>", $o_tool->getToolName()));
?>
';
		msg = msg.replace("%2", jQuery('#caToolCommand').val());
		caConfirmBatchExecutionPanel.showPanel();
		jQuery('#caConfirmBatchExecutionPanelAlertText').html(msg);
	}