示例#1
0
    $Form->radio_input('import_type', $import_type, array(array('value' => 'append', 'label' => T_('Append to existing contents'), 'id' => 'import_type_append')), '', array('lines' => true));
    $Form->end_fieldset();
    $Form->buttons(array(array('submit', 'submit', T_('Continue!'), 'SaveButton')));
}
$Form->end_form();
?>
<script type="text/javascript">
jQuery( '.table_scroll td' ).click( function()
{
	jQuery( this ).parent().find( 'input[type=radio]' ).attr( 'checked', 'checked' );
} );
<?php 
if ($import_perm_view) {
    // Current user must has access to the import dir
    // Initialize JavaScript to build and open window
    echo_modalwindow_js();
    ?>

function import_files_window()
{
	openModalWindow( '<span class="loader_img absolute_center" title="<?php 
    echo T_('Loading...');
    ?>
"></span>',
		'90%', '80%', true, '<?php 
    echo TS_('Add/Link files');
    ?>
', '', true );
	jQuery.ajax(
	{
		type: 'POST',
示例#2
0
/**
 * Initialize JavaScript for AJAX loading of popup window to report user
 *
 * @param array Params
 */
function echo_file_properties()
{
    global $admin_url;
    ?>
<script type="text/javascript">
	//<![CDATA[
<?php 
    // Initialize JavaScript to build and open window
    echo_modalwindow_js();
    ?>
	// Window to edit file
	function file_properties( root, path, file )
	{
		openModalWindow( '<span class="loader_img loader_file_edit absolute_center" title="<?php 
    echo T_('Loading...');
    ?>
"></span>',
			'80%', '', true,
			'<?php 
    echo TS_('File properties');
    ?>
',
			'<?php 
    echo TS_('Save Changes!');
    ?>
', true, true );
		jQuery.ajax(
		{
			type: 'POST',
			url: '<?php 
    echo $admin_url;
    ?>
',
			data:
			{
				'ctrl': 'files',
				'action': 'edit_properties',
				'root': root,
				'path': path,
				'fm_selected': [ file ],
				'mode': 'modal',
				'crumb_file': '<?php 
    echo get_crumb('file');
    ?>
',
			},
			success: function( result )
			{
				openModalWindow( result, '80%', '',true,
					'<?php 
    echo TS_('File properties');
    ?>
',
					'<?php 
    echo TS_('Save Changes!');
    ?>
', false, true );
			}
		} );
		return false;
	}
	//]]>
</script>
<?php 
}
示例#3
0
/**
 * Compose screen: display link files iframe
 *
 * @param object Form
 * @param object LinkOwner object
 * @param string iframe name
 * @param boolean true if creating new owner object, false otherwise
 * @param boolean true to allow folding for this fieldset, false otherwise
 */
function attachment_iframe(&$Form, &$LinkOwner, $iframe_name = NULL, $creating = false, $fold = false)
{
    global $admin_url;
    global $current_User, $action;
    if ($LinkOwner->type == 'item' && !$LinkOwner->Item->get_type_setting('allow_attachments')) {
        // Attachments are not allowed for current post type
        return;
    }
    if (!isset($GLOBALS['files_Module'])) {
        return;
    }
    // Set title for modal window:
    $window_title = TS_('Attach files');
    if ($LinkOwner->type == 'item') {
        // Item
        $window_title = format_to_js(sprintf(T_('Attach files to "%s"'), $LinkOwner->Item->get('title')));
    } elseif ($LinkOwner->type == 'comment') {
        // Comment
        $window_title = format_to_js(sprintf(T_('Attach files to comment #%s'), $LinkOwner->Comment->ID));
    }
    $fieldset_title = T_('Images &amp; Attachments');
    if ($creating) {
        // Creating new Item
        $fieldset_title .= ' ' . get_manual_link('images-attachments-panel') . ' - <a id="title_file_add" href="#" class="action_icon">' . get_icon('folder') . ' ' . T_('Attach existing files') . '</a>';
        $Form->begin_fieldset($fieldset_title, array('id' => 'itemform_createlinks', 'fold' => $fold));
        $Form->submit(array('actionArray[create_edit]', T_('Save post to start uploading files'), 'SaveEditButton'));
        if (get_param('p') > 0) {
            // Display a button to duplicate the attachments to new item:
            $Form->submit(array('actionArray[create_link]', T_('Save & Link files from original'), 'SaveEditButton'));
        }
        $Form->end_fieldset();
        return;
    }
    // Editing link owner
    $Blog =& $LinkOwner->get_Blog();
    if ($iframe_name == NULL) {
        $iframe_name = 'attach_' . generate_random_key(16);
    }
    $fieldset_title .= ' ' . get_manual_link('images-attachments-panel') . ' - ' . action_icon(T_('Refresh'), 'refresh', $admin_url . '?ctrl=links&amp;action=edit_links&amp;link_type=' . $LinkOwner->type . '&amp;mode=iframe&amp;iframe_name=' . $iframe_name . '&amp;link_object_ID=' . $LinkOwner->get_ID(), T_('Refresh'), 3, 4, array('target' => $iframe_name));
    if ($current_User->check_perm('files', 'view', false, $Blog->ID) && $LinkOwner->check_perm('edit', false)) {
        // Check that we have permission to edit owner:
        $attach_files_url = $admin_url . '?ctrl=files&amp;fm_mode=link_object&amp;link_type=item&amp;link_object_ID=' . $LinkOwner->get_ID();
        if ($linkowner_FileList = $LinkOwner->get_attachment_FileList(1)) {
            // Get first file of the Link Owner:
            $linkowner_File =& $linkowner_FileList->get_next();
            if (!empty($linkowner_File) && $current_User->check_perm('files', 'view', false, $linkowner_File->get_FileRoot())) {
                // Obtain and use file root of first file:
                $linkowner_FileRoot =& $linkowner_File->get_FileRoot();
                $attach_files_url .= '&amp;root=' . $linkowner_FileRoot->ID;
                $attach_files_url .= '&amp;path=' . dirname($linkowner_File->get_rdfs_rel_path()) . '/';
            }
        }
        $fieldset_title .= ' - ' . action_icon(T_('Attach existing files'), 'folder', $attach_files_url, T_('Attach existing files'), 3, 4, array('onclick' => 'return link_attachment_window( \'' . $iframe_name . '\', \'' . $LinkOwner->type . '\', \'' . $LinkOwner->get_ID() . '\' )')) . action_icon(T_('Attach existing files'), 'permalink', $attach_files_url, T_('Attach existing files'), 1, 0, array('target' => '_blank'));
    }
    // Get a count of links in order to deny folding when there is at least one link
    $links_count = count($LinkOwner->get_Links());
    $Form->begin_fieldset($fieldset_title, array('id' => 'itemform_links', 'fold' => $fold, 'deny_fold' => $links_count > 0));
    echo '<div id="attachmentframe_wrapper">' . '<iframe src="' . $admin_url . '?ctrl=links&amp;link_type=' . $LinkOwner->type . '&amp;action=edit_links&amp;mode=iframe&amp;iframe_name=' . $iframe_name . '&amp;link_object_ID=' . $LinkOwner->get_ID() . '" name="' . $iframe_name . '"' . ' width="100%" marginwidth="0" height="100%" marginheight="0" align="top" scrolling="auto" frameborder="0" id="attachmentframe"></iframe>' . '</div>';
    $Form->end_fieldset();
    ?>
<script type="text/javascript">
<?php 
    // Initialize JavaScript to build and open window
    echo_modalwindow_js();
    ?>

function link_attachment_window( iframe_name, link_owner_type, link_owner_ID, root, path, fm_highlight )
{
	openModalWindow( '<span class="loader_img loader_user_report absolute_center" title="<?php 
    echo T_('Loading...');
    ?>
"></span>',
		'90%', '80%', true, '<?php 
    echo $window_title;
    ?>
', '', true );
	jQuery.ajax(
	{
		type: 'POST',
		url: '<?php 
    echo get_samedomain_htsrv_url();
    ?>
async.php',
		data:
		{
			'action': 'link_attachment',
			'iframe_name': iframe_name,
			'link_owner_type': link_owner_type,
			'link_owner_ID': link_owner_ID,
			'crumb_link': '<?php 
    echo get_crumb('link');
    ?>
',
			'root': typeof( root ) == 'undefined' ? '' : root,
			'path': typeof( path ) == 'undefined' ? '' : path,
			'fm_highlight': typeof( fm_highlight ) == 'undefined' ? '' : fm_highlight
		},
		success: function(result)
		{
			openModalWindow( result, '90%', '80%', true, '<?php 
    echo $window_title;
    ?>
', '' );
		}
	} );
	return false;
}

jQuery( document ).ready( function()
{
	function update_attachment_frame_height()
	{
		var body_height = jQuery( '#attachmentframe' ).contents().find( 'body' ).height();
		if( body_height == 0 )
		{ // Some browsers cannot get iframe body height correctly, Use this default min value:
			body_height = 91;
		}

		if( body_height > jQuery( '#attachmentframe_wrapper' ).height() )
		{ // Expand the frame height if it is more than wrapper height (but max height is 320px):
			jQuery( '#attachmentframe_wrapper' ).css( 'height', body_height < 320 ? body_height : 320 );
		}
		// Set max-height on each iframe reload in order to avoid a space after upload button:
		jQuery( '#attachmentframe_wrapper' ).css( 'max-height', body_height );
	}

	jQuery( '#attachmentframe' ).bind( 'load', function()
	{ // Set proper height on frame loading:
		update_attachment_frame_height();
	} );

	jQuery( '#icon_folding_itemform_links, #title_folding_itemform_links' ).click( function()
	{ // Use this hack to fix frame height on show attachments fieldset if it was hidden before:
		update_attachment_frame_height();
	} );

	jQuery( '#attachmentframe_wrapper' ).resizable(
	{ // Make the frame wrapper resizable
		minHeight: 80,
		handles: 's',
		start: function( e, ui )
		{ // Create a temp div to disable the mouse over events inside the frame
			ui.element.append( '<div id="attachmentframe_disabler"></div>' );
		},
		stop: function( e, ui )
		{ // Remove the temp div element
			ui.element.find( '#attachmentframe_disabler' ).remove();
		},
		resize: function( e, ui )
		{ // Limit max height
			jQuery( '#attachmentframe_wrapper' ).resizable( 'option', 'maxHeight', jQuery( '#attachmentframe' ).contents().find( 'body' ).height() );
		}
	} );
	jQuery( document ).on( 'click', '#attachmentframe_wrapper .ui-resizable-handle', function()
	{ // Increase height on click
		jQuery( '#attachmentframe_wrapper' ).css( 'height', jQuery( '#attachmentframe_wrapper' ).height() + 80 );
	} );
} );
</script>
<?php 
}
示例#4
0
/**
 * Initialize JavaScript for AJAX loading of popup window to delete the posts, the comments and the messages of user
 *
 * @param array Params
 */
function echo_user_deldata_js($params = array())
{
    global $admin_url;
    ?>
<script type="text/javascript">
<?php 
    // Initialize JavaScript to build and open window
    echo_modalwindow_js();
    ?>

function user_deldata( user_ID, user_tab_from )
{
	openModalWindow( '<span class="loader_img loader_user_deldata absolute_center" title="<?php 
    echo T_('Loading...');
    ?>
"></span>',
		'auto', '', true,
		'<?php 
    echo TS_('Delete user data') . get_manual_link('delete-user-data');
    ?>
',
		[ '<?php 
    echo TS_('Delete selected data');
    ?>
', 'btn-danger' ], true );
	jQuery.ajax(
	{
		type: 'POST',
		url: '<?php 
    echo $admin_url;
    ?>
',
		data:
		{
			'ctrl': 'user',
			'user_tab': 'deldata',
			'user_tab_from': user_tab_from,
			'user_ID': user_ID,
			'display_mode': 'js',
			'crumb_user': '******'user');
    ?>
',
		},
		success: function(result)
		{
			openModalWindow( result, 'auto', '', true,
			'<?php 
    echo TS_('Delete user data') . get_manual_link('delete-user-data');
    ?>
',
			[ '<?php 
    echo TS_('Delete selected data');
    ?>
', 'btn-danger' ] );
		}
	} );
	return false;
}
</script>
<?php 
}