HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/javascript/admin.nestedcontent.js
/**
 * Nested Content Javascript File
 *
 * @author Jordie Bodlay
 */

jQuery(function($){
	var PopulateContentListByContentTypeId = function(contentTypeId) {
		contentTypeId = parseInt(contentTypeId);

		if(isNaN(contentTypeId) || contentTypeId == 0) {
			$('#contentparentid').html('<option value=0>' + iwp.lang.get('nestedNoContentTypeSelected') + '</option>');
			$('#contentparentid').attr('disabled', 'disabled');
			return;
		}

		contentId = $('#contentid').val();

		$.getJSON('remote.php?section=content&action=getnestedcontentoptions&typeid=' + contentTypeId + '&contentid=' + contentId, function(json) {
			if(!json.success){
				return;
			}

			if(json.html.length > 0) {
				$('#contentparentid').html('<option>' + iwp.lang.get('nestedChooseContentItem') + '</option>' + json.html);
				$('#contentparentid').removeAttr('disabled', 'disabled');
				$('#nestedparentcontenttype').trigger('loadednestedcontentitems');
				$('#nestedparentcontenttype').unbind('loadednestedcontentitems');
			}else{
				$('#contentparentid').html('<option value=0>' + iwp.lang.get('nestedNoExistingContent').replace('%s', $('#nestedparentcontenttype option[value=' + json.typeid + ']').text().toLowerCase()) + '</option>');
				$('#contentparentid').attr('disabled', 'disabled');
			}
		});
	};

	$('#nestedparentcontenttype').bind('change', function() { PopulateContentListByContentTypeId($(this).val()); });

	if(typeof nestedcontent_contenttypeid != 'undefined' && !isNaN(nestedcontent_contenttypeid) && nestedcontent_contenttypeid > 0) {
		$('#nestedparentcontenttype').val(nestedcontent_contenttypeid);
	}

	$('#nestedparentcontenttype').trigger('change');

	$('#nestedparentcontenttype').bind('loadednestedcontentitems', function() {
		if(typeof nestedcontent_contentid != 'undefined' && !isNaN(nestedcontent_contentid) && nestedcontent_contentid > 0) {
			$('#contentparentid').val(nestedcontent_contentid);
		}
	});
});