<td><?php 
            print caHTMLRadioButtonInput("{$vs_id_prefix}_derivative_options_mode", array('value' => 'timecode', 'id' => "{$vs_id_prefix}derivative_options_mode_timecode")) . ' ' . _t('Update using frame at timecode') . ' ';
            print caHTMLTextInput("{$vs_id_prefix}_derivative_options_mode_timecode_value", array('id' => "{$vs_id_prefix}_derivative_options_mode_timecode_value", 'class' => 'timecodeBg', 'onclick' => "jQuery('#{$vs_id_prefix}derivative_options_mode_timecode').attr('checked', '1');"), array("width" => 30, "height" => 1));
            ?>
</td>
					<td>
					
					</td>
				</tr>
<?php 
            break;
        case 'Document':
            ?>
				<tr>
					<td><?php 
            print caHTMLRadioButtonInput("{$vs_id_prefix}_derivative_options_mode", array('value' => 'page', 'id' => "{$vs_id_prefix}_derivative_options_mode_page")) . ' ' . _t('Update using page #') . ' ';
            print caHTMLTextInput("{$vs_id_prefix}_derivative_options_mode_page_value", array('id' => "{$vs_id_prefix}_derivative_options_mode_page_value", 'onclick' => "jQuery('#{$vs_id_prefix}_derivative_options_mode_page').attr('checked', '1');"), array("width" => 4, "height" => 1));
            ?>
</td>
					<td>
					
					</td>
				</tr>
<?php 
            break;
    }
    ?>
			</table>
	
			<div class="objectRepresentationMediaDisplayDerivativeHeader"><?php 
    print _t("Update preview versions") . ":";
Ejemplo n.º 2
0
/**
 *
 */
function caDeleteRemapper($po_request, $t_instance)
{
    $vs_instance_table = $t_instance->tableName();
    $vn_count = 0;
    $va_buf = array();
    switch ($vs_instance_table) {
        case 'ca_relationship_types':
            // get # of relationships using this type
            $vn_rel_count = $t_instance->getRelationshipCountForType();
            $t_rel_instance = $t_instance->getAppDatamodel()->getInstanceByTableNum($t_instance->get('table_num'));
            if (!$t_rel_instance->load($t_instance->get('table_num'))) {
                return '';
            }
            if ($vn_rel_count == 1) {
                $va_buf[] = _t("Type is used by %1 %2", $vn_rel_count, $t_rel_instance->getProperty('NAME_PLURAL')) . "<br>\n";
            } else {
                $va_buf[] = _t("Type is used by %1 %2", $vn_rel_count, $t_rel_instance->getProperty('NAME_PLURAL')) . "<br>\n";
            }
            $vn_count += $vn_rel_count;
            $vs_typename = _t('relationship type');
            break;
        default:
            // Check relationships
            $va_tables = array('ca_objects', 'ca_object_lots', 'ca_entities', 'ca_places', 'ca_occurrences', 'ca_collections', 'ca_storage_locations', 'ca_list_items', 'ca_loans', 'ca_movements', 'ca_tours', 'ca_tour_stops', 'ca_object_representations');
            if (!in_array($t_instance->tableName(), $va_tables)) {
                return null;
            }
            foreach ($va_tables as $vs_table) {
                $va_items = $t_instance->getRelatedItems($vs_table);
                if (!($vn_c = sizeof($va_items))) {
                    continue;
                }
                if ($vn_c == 1) {
                    $va_buf[] = _t("Has %1 relationship to %2", $vn_c, caGetTableDisplayName($vs_table, true)) . "<br>\n";
                } else {
                    $va_buf[] = _t("Has %1 relationships to %2", $vn_c, caGetTableDisplayName($vs_table, true)) . "<br>\n";
                }
                $vn_count += $vn_c;
            }
            // Check attributes
            if ($vn_datatype = $t_instance->authorityElementDatatype()) {
                if ($vn_c = $t_instance->getAuthorityElementReferences(array('countOnly' => true))) {
                    if ($vn_c == 1) {
                        $va_buf[] = _t("Is referenced %1 time", $vn_c) . "<br>\n";
                    } else {
                        $va_buf[] = _t("Is referenced %1 times", $vn_c) . "<br>\n";
                    }
                    $vn_count += $vn_c;
                }
            }
            $vs_typename = $t_instance->getTypeName();
    }
    $vs_output = '';
    if (sizeof($va_buf)) {
        // add autocompleter for remapping
        if ($vn_count == 1) {
            $vs_output .= "<h3 id='caDeleteReferenceCount'>" . _t('This %1 is referenced %2 time', $vs_typename, $vn_count) . ". " . _t('When deleting this %1:', $vs_typename) . "</h3>\n";
        } else {
            $vs_output .= "<h3 id='caDeleteReferenceCount'>" . _t('This %1 is referenced %2 times', $vs_typename, $vn_count) . ". " . _t('When deleting this %1:', $vs_typename) . "</h3>\n";
        }
        $vs_output .= caHTMLRadioButtonInput('referenceHandling', array('value' => 'delete', 'checked' => 1, 'id' => 'caReferenceHandlingDelete')) . ' ' . _t('remove all references') . "<br/>\n";
        $vs_output .= caHTMLRadioButtonInput('referenceHandling', array('value' => 'remap', 'id' => 'caReferenceHandlingRemap')) . ' ' . _t('transfer references to') . ' ' . caHTMLTextInput('remapTo', array('value' => '', 'size' => 40, 'id' => 'remapTo', 'class' => 'lookupBg', 'disabled' => 1));
        $vs_output .= "<a href='#' class='button' onclick='jQuery(\"#remapToID\").val(\"\"); jQuery(\"#remapTo\").val(\"\"); jQuery(\"#caReferenceHandlingClear\").css(\"display\", \"none\"); return false;' style='display: none;' id='caReferenceHandlingClear'>" . _t('Clear') . '</a>';
        $vs_output .= caHTMLHiddenInput('remapToID', array('value' => '', 'id' => 'remapToID'));
        $vs_output .= "<script type='text/javascript'>";
        $va_service_info = caJSONLookupServiceUrl($po_request, $t_instance->tableName(), array('noSymbols' => 1, 'noInline' => 1, 'exclude' => (int) $t_instance->getPrimaryKey(), 'table_num' => (int) $t_instance->get('table_num')));
        $vs_output .= "jQuery(document).ready(function() {";
        $vs_output .= "jQuery('#remapTo').autocomplete(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: '" . $va_service_info['search'] . "', html: true,\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\tjQuery('#remapToID').val(ui.item.id);\n\t\t\t\t\t\t\tjQuery('#caReferenceHandlingClear').css('display', 'inline');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);";
        $vs_output .= "jQuery('#caReferenceHandlingRemap').click(function() {\n\t\t\t\tjQuery('#remapTo').attr('disabled', false);\n\t\t\t});\n\t\t\tjQuery('#caReferenceHandlingDelete').click(function() {\n\t\t\t\tjQuery('#remapTo').attr('disabled', true);\n\t\t\t});\n\t\t\t";
        $vs_output .= "});";
        $vs_output .= "</script>\n";
        TooltipManager::add('#caDeleteReferenceCount', "<h2>" . _t('References to this %1', $t_instance->getProperty('NAME_SINGULAR')) . "</h2>\n" . join("\n", $va_buf));
    }
    return $vs_output;
}
Ejemplo n.º 3
0
$va_attr = array('value' => 'file', 'onclick' => 'caSetBatchMetadataImportFormState();', 'id' => 'caFileInputRadio');
if (caGetOption('fileInput', $va_last_settings, 'file') === 'file') {
    $va_attr['checked'] = 'checked';
}
print caHTMLRadioButtonInput("fileInput", $va_attr) . "</td><td class='formLabel caFileSourceControls'>" . _t('From a file') . " <span id='caFileInputContainer'><input type='file' name='sourceFile' id='caSourceFile'/></span>";
?>
								</td>
							</tr>
							<tr class="caFileSourceControls">
								<td class="caSourceFileControlRadio">
<?php 
$va_attr = array('value' => 'import', 'onclick' => 'caSetBatchMetadataImportFormState();', 'id' => 'caFileBrowserRadio');
if (caGetOption('fileInput', $va_last_settings, 'file') === 'import') {
    $va_attr['checked'] = 'checked';
}
print caHTMLRadioButtonInput("fileInput", $va_attr) . "</td><td class='formLabel caFileSourceControls'>" . _t('From the import directory') . " <div id='caFileBrowserContainer'>" . $this->getVar('file_browser') . "</div>";
?>
								</td>
							</tr>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div class='bundleLabel' id="caSourceUrlContainer">
			<span class="formLabelText"><?php 
print _t('Data URL');
?>
</span> 
			<div class="bundleContainer">
				<div class="caLabelList" >
					<td class='formLabel'><?php 
    print caHTMLRadioButtonInput('{fieldNamePrefix}upload_type{n}', array('id' => '{fieldNamePrefix}upload_type_url{n}', 'class' => '{fieldNamePrefix}upload_type{n}', 'value' => 'url'), array('checked' => $vs_default_upload_type == 'url' ? 1 : 0)) . ' ' . _t('from URL');
    ?>
</td>
					<td class='formLabel'><?php 
    print caHTMLTextInput("{fieldNamePrefix}media_url_{n}", array('id' => '{fieldNamePrefix}media_url_{n}', 'class' => 'urlBg uploadInput'), array('width' => '410px'));
    ?>
</td>
				</tr>
<?php 
}
if ((bool) $this->request->getAppConfig()->get($t_subject->tableName() . '_allow_relationships_to_existing_representations')) {
    ?>
				<tr>
					<td class='formLabel'><?php 
    print caHTMLRadioButtonInput('{fieldNamePrefix}upload_type{n}', array('id' => '{fieldNamePrefix}upload_type_search{n}', 'class' => '{fieldNamePrefix}upload_type{n}', 'value' => 'search'), array('checked' => $vs_default_upload_type == 'search' ? 1 : 0)) . ' ' . _t('using existing');
    ?>
</td>
					<td class='formLabel'>
						<?php 
    print caHTMLTextInput('{fieldNamePrefix}autocomplete{n}', array('value' => '{{label}}', 'id' => '{fieldNamePrefix}autocomplete{n}', 'class' => 'lookupBg uploadInput'), array('width' => '425px'));
    if ($t_item_rel && $t_item_rel->hasField('type_id')) {
        ?>
						<select name="<?php 
        print $vs_id_prefix;
        ?>
_type_id{n}" id="<?php 
        print $vs_id_prefix;
        ?>
_type_id{n}" style="display: none; width: 72px;"></select>
<?php 
Ejemplo n.º 5
0
 /**
  * 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;
     }
 }
}
print caHTMLRadioButtonInput('representation_idno_mode', $va_attrs);
?>
</td>
									<td class='formLabel'><?php 
print _t('Set %1 identifier to file name without extension', caGetTableDisplayName('ca_object_representations', false));
?>
</td>
								</tr>
								<tr>
									<td><?php 
$va_attrs = array('value' => 'directory_and_filename', 'id' => 'caRepresentationIdnoDirectoryAndFilenameMode');
if (isset($va_last_settings['representationIdnoMode']) && $va_last_settings['representationIdnoMode'] == 'directory_and_filename') {
    $va_attrs['checked'] = 1;
}
print caHTMLRadioButtonInput('representation_idno_mode', $va_attrs);
?>
</td>
									<td class='formLabel'><?php 
print _t('Set %1 identifier to directory and file name', caGetTableDisplayName('ca_object_representations', false));
?>
</td>
								</tr>
							</table>
							<script type="text/javascript">
								jQuery(document).ready(function() {
									jQuery("#caRepresentationIdnoFormMode").click(function() {
										jQuery("#caRepresentationIdnoFormModeForm input").prop('disabled', false);
									});
									jQuery("#caRepresentationIdnoFilenameMode").click(function() {
										jQuery("#caRepresentationIdnoFormModeForm input").prop('disabled', true);
Ejemplo n.º 7
0
?>
</th><th><?php 
print _t('Use Pawtucket default');
?>
</th></tr>
<?php 
foreach ($va_access_status_list as $vn_id => $va_access_status) {
    print "<tr align='center' valign='middle'>";
    if (($vn_indent = 5 * (int) $va_access_status_list['access_status_info']['level']) < 0) {
        $vn_indent = 0;
    }
    print "<td align='left'>" . str_repeat("&nbsp;", $vn_indent) . $va_access_status['access_status_info']['name_plural'] . "</td>";
    $vn_access = !strlen($va_access_status['access']) ? null : (int) $va_access_status['access'];
    print "<td>" . caHTMLRadioButtonInput('access_status_' . $va_access_status['access_status_info']['item_id'], array('value' => 0), array('checked' => $vn_access === 0)) . "</td>\n";
    print "<td>" . caHTMLRadioButtonInput('access_status_' . $va_access_status['access_status_info']['item_id'], array('value' => 1), array('checked' => $vn_access === 1)) . "</td>\n";
    print "<td>" . caHTMLRadioButtonInput('access_status_' . $va_access_status['access_status_info']['item_id'], array('value' => null), array('checked' => is_null($vn_access))) . "</td>\n";
}
?>
			
				</tr>
			</table>
		</div>
	</div>
	</form>
	
	<div class="editorBottomPadding"><!-- empty --></div>
<?php 
print $vs_control_box;
?>
</div>
Ejemplo n.º 8
0
        print "<tr align='center' valign='middle'><th width='180' align='left'>" . _t('Type') . "</th><th width='180'>" . _t('No access') . "</th><th width='180'>" . _t('Read-only access') . "</th><th>" . _t('Read/edit access') . "</th></tr>\n";
        $t_instance = $o_dm->getInstanceByTableName($vs_table, true);
        $vs_pk = $t_instance->primaryKey();
        foreach ($va_types_by_table as $vn_id => $va_type) {
            if (!$va_type['type_info']['parent_id']) {
                continue;
            }
            print "<tr align='center' valign='middle'>";
            if (($vn_indent = 5 * (int) $va_type['type_info']['level']) < 0) {
                $vn_indent = 0;
            }
            print "<td align='left'>" . str_repeat("&nbsp;", $vn_indent) . $va_type['type_info']['name_plural'] . "</td>";
            $vs_access = $va_type['access'];
            print "<td>" . caHTMLRadioButtonInput($vs_table . '_type_' . $va_type['type_info']['item_id'], array('value' => __CA_BUNDLE_ACCESS_NONE__), array('checked' => $vs_access == __CA_BUNDLE_ACCESS_NONE__)) . "</td>\n";
            print "<td>" . caHTMLRadioButtonInput($vs_table . '_type_' . $va_type['type_info']['item_id'], array('value' => __CA_BUNDLE_ACCESS_READONLY__), array('checked' => $vs_access == __CA_BUNDLE_ACCESS_READONLY__)) . "</td>\n";
            print "<td>" . caHTMLRadioButtonInput($vs_table . '_type_' . $va_type['type_info']['item_id'], array('value' => __CA_BUNDLE_ACCESS_EDIT__), array('checked' => $vs_access == __CA_BUNDLE_ACCESS_EDIT__)) . "</td>\n";
        }
        print "</tr>\n";
        print "</table>\n";
    }
    ?>
		</div>
<?php 
}
?>
	</div>
	</form>
	
	<div class="editorBottomPadding"><!-- empty --></div>
<?php 
print $vs_control_box;
Ejemplo n.º 9
0
}
print caHTMLRadioButtonInput('idno_mode', $va_attrs);
?>
</td>
								<td class='formLabel'><?php 
print _t('Set object identifier to file name');
?>
</td>
							</tr>
							<tr>
								<td><?php 
$va_attrs = array('value' => 'directory_and_filename', 'id' => 'caIdnoDirectoryAndFilenameMode');
if (isset($va_last_settings['idnoMode']) && $va_last_settings['idnoMode'] == 'directory_and_filename') {
    $va_attrs['checked'] = 1;
}
print caHTMLRadioButtonInput('idno_mode', $va_attrs);
?>
</td>
								<td class='formLabel'><?php 
print _t('Set object identifier to directory and file name');
?>
</td>
							</tr>
						</table>
						<script type="text/javascript">
							jQuery(document).ready(function() {
								jQuery("#caIdnoFormMode").click(function() {
									jQuery("#caIdnoFormModeForm input").prop('disabled', false);
								});
								jQuery("#caIdnoFilenameMode").click(function() {
									jQuery("#caIdnoFormModeForm input").prop('disabled', true);