<commit_before>/**
 * @properties={typeid:35,uuid:"4FDACEFD-6F16-47F7-827B-375E25824AD6"}
 */
var _license_dsa_mosaic_WEB_cms = 'Module: _dsa_mosaic_WEB_cms \
									Copyright (C) 2011 Data Mosaic \
									MIT Licensed';

/**
 * @properties={typeid:35,uuid:"CE572FF5-8795-41C4-972B-CED24975F685",variableType:-4}
 */
var _assetChosen = null;

/**
 *
 * @properties={typeid:24,uuid:"28E098A0-3AFB-45D5-974D-5097C511ED6E"}
 */
function ACTION_cancel()
{
	//not already ok to close, cancel
	if (!globals.CODE_hide_form) {
		//enable closing the form
		globals.CODE_hide_form = 1
		
		application.closeFormDialog('CMS_assetChoose')
	}
}

/**
 * @properties={typeid:24,uuid:"F7D6A97F-52AD-47A0-A840-614BF18CC717"}
 */
function ACTION_ok() {
	//something selected
	if (utils.hasRecords(forms.WEB_P__asset_1L_asset_2L_asset_instance.foundset)) {
		// choose image from FiD
		var assetRec = forms.WEB_P__asset_1L_asset_2L_asset_instance.foundset.getSelectedRecord()
		
		//get meta data points we need
		var metaRows = new Object()
		for (var j = 1; j <= assetRec.web_asset_instance_to_asset_instance_meta.getSize(); j++) {
			var record = assetRec.web_asset_instance_to_asset_instance_meta.getRecord(j)
			metaRows[record.data_key] = record.data_value
		}
		
		// set record to form to be used elsewhere
		_assetChosen = {
				asset: assetRec,
				meta: metaRows
			}
	
		//enable closing the form
		globals.CODE_hide_form = 1
		
		//close the form
		application.closeFormDialog('CMS_assetChoose')
	}
	//nothing selected
	else {
		plugins.dialogs.showErrorDialog(
					'Error',
					'Nothing chosen'
			)
	}
}

/**
 *	Only show the type of data interested in selecting
 * 
 * @param	{Integer}	assetType Type of asset to select (1 image, 2 file, etc)
 * 
 * @properties={typeid:24,uuid:"BE1F62DB-1D14-464C-96F5-1A8D252C761B"}
 */
function LOAD_data(assetType) {
	var fsAsset = forms.WEB_P__asset_1L_asset.foundset
	
	//asset type specified, only show those records
	if (assetType) {
		//only load up images
		fsAsset.find()
		fsAsset.asset_type = assetType
		var results = fsAsset.search()
		
		//set title text
		elements.lbl_heading.text = 'Choose ' + application.getValueListDisplayValue('WEB_asset_type',assetType)
		
		//show preview
		if (assetType == 1) {
			forms.WEB_P__asset_1L_asset.elements.fld_thumb.visible = true
		}
		//hide preview
		else {
			forms.WEB_P__asset_1L_asset.elements.fld_thumb.visible = false
		}
	}
	//no asset type specified, show everything all together
	else {
		fsAsset.loadAllRecords()
		
		//set title text
		elements.lbl_heading.text = 'Choose Asset'
		
		//show preview
		forms.WEB_P__asset_1L_asset.elements.fld_thumb.visible = true
	}
	
	//close form in dialog or warn if nothing
	if (!results) {
		
	}
}<commit_msg>scope asset picker FiD to site<commit_after>/**
 * @properties={typeid:35,uuid:"4FDACEFD-6F16-47F7-827B-375E25824AD6"}
 */
var _license_dsa_mosaic_WEB_cms = 'Module: _dsa_mosaic_WEB_cms \
									Copyright (C) 2011 Data Mosaic \
									MIT Licensed';

/**
 * @properties={typeid:35,uuid:"CE572FF5-8795-41C4-972B-CED24975F685",variableType:-4}
 */
var _assetChosen = null;

/**
 *
 * @properties={typeid:24,uuid:"28E098A0-3AFB-45D5-974D-5097C511ED6E"}
 */
function ACTION_cancel()
{
	//not already ok to close, cancel
	if (!globals.CODE_hide_form) {
		//enable closing the form
		globals.CODE_hide_form = 1
		
		application.closeFormDialog('CMS_assetChoose')
	}
}

/**
 * @properties={typeid:24,uuid:"F7D6A97F-52AD-47A0-A840-614BF18CC717"}
 */
function ACTION_ok() {
	//something selected
	if (utils.hasRecords(forms.WEB_P__asset_1L_asset_2L_asset_instance.foundset)) {
		// choose image from FiD
		var assetRec = forms.WEB_P__asset_1L_asset_2L_asset_instance.foundset.getSelectedRecord()
		
		//get meta data points we need
		var metaRows = new Object()
		for (var j = 1; j <= assetRec.web_asset_instance_to_asset_instance_meta.getSize(); j++) {
			var record = assetRec.web_asset_instance_to_asset_instance_meta.getRecord(j)
			metaRows[record.data_key] = record.data_value
		}
		
		// set record to form to be used elsewhere
		_assetChosen = {
				asset: assetRec,
				meta: metaRows
			}
	
		//enable closing the form
		globals.CODE_hide_form = 1
		
		//close the form
		application.closeFormDialog('CMS_assetChoose')
	}
	//nothing selected
	else {
		plugins.dialogs.showErrorDialog(
					'Error',
					'Nothing chosen'
			)
	}
}

/**
 *	Only show the type of data interested in selecting
 * 
 * @param	{Integer}	assetType Type of asset to select (1 image, 2 file, etc)
 * 
 * @properties={typeid:24,uuid:"BE1F62DB-1D14-464C-96F5-1A8D252C761B"}
 */
function LOAD_data(assetType) {
	var fsAsset = forms.WEB_P__asset_1L_asset.foundset
	
	//asset type specified, only show those records
	if (assetType) {
		//only load up requested assets, scope by site
		fsAsset.find()
		fsAsset.asset_type = assetType
		fsAsset.id_site = forms.WEB_0F_site.id_site
		var results = fsAsset.search()
		
		//set title text
		elements.lbl_heading.text = 'Choose ' + application.getValueListDisplayValue('WEB_asset_type',assetType)
		
		//show preview
		if (assetType == 1) {
			forms.WEB_P__asset_1L_asset.elements.fld_thumb.visible = true
		}
		//hide preview
		else {
			forms.WEB_P__asset_1L_asset.elements.fld_thumb.visible = false
		}
	}
	//no asset type specified, show everything all together
	else {
		fsAsset.loadAllRecords()
		
		//set title text
		elements.lbl_heading.text = 'Choose Asset'
		
		//show preview
		forms.WEB_P__asset_1L_asset.elements.fld_thumb.visible = true
	}
	
	//close form in dialog or warn if nothing
	if (!results) {
		
	}
}
{'fraction_non_alphanumeric': 0.11561829878484632, 'fraction_numerical': 0.04699785561115082, 'mean_word_length': 3.825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2883160', 'n_tokens_mistral': 2404, 'n_tokens_neox': 2041, 'n_words': 403}