<?php
/**
*
*/

// Disallow direct access.
defined('ABSPATH') or die("Access denied");

	    // Add activeFileId into codeFile object.
	    $this->block->file->activeFileId = $this->block->activeFileId;
			// Hidden fields.
			$fields = array('name', 'type', 'activeFileId');
			foreach ($fields as $field) :
				// Don't output until it has a value
				// It better for traffic, client side
				// should take care of this.
				if (!$fieldValue = $this->block->file->$field) {
					continue;
				}
?>
		<input type="hidden" name="cjtoolbox[<?php echo $this->block->id; ?>][file][<?php echo $field ?>]" value="<?php echo $fieldValue ?>" />

<?php endforeach; ?>

        <div class="cjpageblock">

            <?php do_action(CJTPluggableHelper::ACTION_BLOCK_ASSIGN_PANEL . '-' . $this->block->id, $this) ?>

            <a href="#close-panel-window" class="close-panel-window"><?php echo cssJSToolbox::getText('Close') ?></a>

            <div class="cjt-panel-item cjt-panel-genericwnd cjt-panel-window-info cjt-panel-window-assignment-info" style="display: none;"></div>

            <div class="cjt-panel-item cjt-panel-window-templates-lookup cjt-panel-window-templates" style="display: none;">

                <iframe src="" class="popup-menu templates-lookup" NOBORDER="1"></iframe>

            </div>

        </div>

		<div class="cjcontainer">
			<div class="cjcodeblock">
<?php 	echo $this->getTemplate('editor-toolbox', array(), 'tmpl/templates'); ?>
				<div class="datablock">
					<div id="editor-<?php echo $this->block->id ?>" class="code-editor"><?php echo htmlentities($this->block->file->code ?? '') ?></div>

                    <?php do_action(CJTPluggableHelper::ACTION_BLOCK_BEFORE_INFO_BAR, $this) ?>

					<div class="cjt-info-bar cjt-info-bar-bottom">

                        <span class="block-owner">
                            <span class="infobar-item-title"><?php echo cssJSToolbox::getText('User:') ?> </span>
                            <strong><?php echo get_userdata( $this->block->owner )->display_name; ?></strong>
                        </span>

                        <span class="block-created-date">
                            <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Created:') ?> </span>
                            <strong><?php echo date( 'd-m-Y, H:i', strtotime( $this->block->created ) ); ?></strong>
                        </span>

                        <span class="block-modified-date">
                            <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Modified:') ?> </span>
                            <strong><?php echo date( 'd-m-Y, H:i', strtotime( $this->block->lastModified ) ); ?></strong>
                        </span>

                        <span class="block-shortcode">
                            <span class="infobar-item-title"><?php echo cssJSToolbox::getText('Shortcode:') ?> </span>
                            <input type="text" value="[cjtoolbox name='<?php echo $this->block->name ?>']" readonly="readonly" />
                            <a class="copyshortcode" href="#"><?php echo cssJSToolbox::getText('Copy') ?></a>
                        </span>

					</div>
				</div>
			</div>
		</div>
