mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 20:16:22 +05:30
Content Type
Trying to add content type: image, video, audio, link, and quote. No styling yet.
This commit is contained in:
parent
01c3a98824
commit
dd6942e439
27 changed files with 3011 additions and 105 deletions
130
system/admin/views/add-audio.html.php
Normal file
130
system/admin/views/add-audio.html.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="tag" value="<?php if (isset($postTag)) {
|
||||
echo $postTag;
|
||||
} ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
|
||||
echo $postUrl;
|
||||
} ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
Featured Audio <span class="required">*</span> (SoundCloud Only)<br><textarea maxlength="200" class="text <?php if (isset($postAudio)) {
|
||||
if (empty($postAudio)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="audio"><?php if (isset($postAudio)) {
|
||||
echo $postAudio;
|
||||
} ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
|
||||
echo $postContent;
|
||||
} ?></textarea><br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
130
system/admin/views/add-image.html.php
Normal file
130
system/admin/views/add-image.html.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="tag" value="<?php if (isset($postTag)) {
|
||||
echo $postTag;
|
||||
} ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
|
||||
echo $postUrl;
|
||||
} ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
Featured Image <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postImage)) {
|
||||
if (empty($postImage)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="image"><?php if (isset($postImage)) {
|
||||
echo $postImage;
|
||||
} ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
|
||||
echo $postContent;
|
||||
} ?></textarea><br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
130
system/admin/views/add-link.html.php
Normal file
130
system/admin/views/add-link.html.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="tag" value="<?php if (isset($postTag)) {
|
||||
echo $postTag;
|
||||
} ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
|
||||
echo $postUrl;
|
||||
} ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
Featured Link <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postLink)) {
|
||||
if (empty($postLink)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="link" ><?php if (isset($postLink)) {
|
||||
echo $postLink;
|
||||
} ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
|
||||
echo $postContent;
|
||||
} ?></textarea><br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br>
|
||||
<br><br>
|
||||
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
|
|
|
|||
|
|
@ -35,13 +35,6 @@
|
|||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
Featured Image (optional)<br><input type="text" class="text" name="img" value="<?php if (isset($postImg)) {
|
||||
echo $postImg;
|
||||
} ?>"/><br><br>
|
||||
Embed Youtube Video (optional)<br><input type="text" class="text" name="vid" value="<?php if (isset($postVid)) {
|
||||
echo $postVid;
|
||||
} ?>"/><br><br>
|
||||
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
|
|
|
|||
130
system/admin/views/add-quote.html.php
Normal file
130
system/admin/views/add-quote.html.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="tag" value="<?php if (isset($postTag)) {
|
||||
echo $postTag;
|
||||
} ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
|
||||
echo $postUrl;
|
||||
} ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
Featured Quote <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postQuote)) {
|
||||
if (empty($postQuote)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="quote"><?php if (isset($postQuote)) {
|
||||
echo $postQuote;
|
||||
} ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
|
||||
echo $postContent;
|
||||
} ?></textarea><br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
130
system/admin/views/add-video.html.php
Normal file
130
system/admin/views/add-video.html.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="tag" value="<?php if (isset($postTag)) {
|
||||
echo $postTag;
|
||||
} ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
|
||||
echo $postUrl;
|
||||
} ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
Featured Video <span class="required">*</span> (YouTube Only)<br><textarea maxlength="200" class="text <?php if (isset($postVideo)) {
|
||||
if (empty($postVideo)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="video" ><?php if (isset($postVideo)) {
|
||||
echo $postVideo;
|
||||
} ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
|
||||
echo $postContent;
|
||||
} ?></textarea><br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="publish" class="submit" value="Publish"/> <input type="submit" name="draft" class="draft" value="Save as draft"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
9
system/admin/views/content-type.html.php
Normal file
9
system/admin/views/content-type.html.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<h2>Add content</h2>
|
||||
|
||||
<p><a href="<?php echo site_url();?>add/post">Regular post</a><br>Creating regular blog post.</p>
|
||||
<p><a href="<?php echo site_url();?>add/image">Image post</a><br>Creating blog post with featured image.</p>
|
||||
<p><a href="<?php echo site_url();?>add/video">Video post</a><br>Creating blog post with featured video.</p>
|
||||
<p><a href="<?php echo site_url();?>add/audio">Audio post</a><br>Creating blog post with featured audio.</p>
|
||||
<p><a href="<?php echo site_url();?>add/link">Link post</a><br>Creating blog post with featured link.</p>
|
||||
<p><a href="<?php echo site_url();?>add/quote">Quote post</a><br>Creating blog post with fetaured quote.</p>
|
||||
<p><a href="<?php echo site_url();?>add/page">Static page</a><br>Creating static page.</p>
|
||||
167
system/admin/views/edit-audio.html.php
Normal file
167
system/admin/views/edit-audio.html.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
if (isset($p->file)) {
|
||||
$url = $p->file;
|
||||
} else {
|
||||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldaudio = get_content_tag('audio', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$isdraft = explode('/', $dir);
|
||||
$oldurl = explode('_', $url);
|
||||
|
||||
$oldtag = $oldurl[1];
|
||||
|
||||
$oldmd = str_replace('.md', '', $oldurl[2]);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
} else {
|
||||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
$timestamp = $time->format("Y-m-d");
|
||||
// The post date
|
||||
$postdate = strtotime($timestamp);
|
||||
// The post URL
|
||||
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
|
||||
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" name="title"
|
||||
class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtag ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
|
||||
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
Featured Audio <span class="required">*</span> (SoundCloud Only)<br><textarea maxlength="200" class="text <?php if (isset($postAudio)) {
|
||||
if (empty($postAudio)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="audio" ><?php echo $oldaudio ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="is_audio" class="text" value="is_audio"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
167
system/admin/views/edit-image.html.php
Normal file
167
system/admin/views/edit-image.html.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
if (isset($p->file)) {
|
||||
$url = $p->file;
|
||||
} else {
|
||||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldimage = get_content_tag('image', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$isdraft = explode('/', $dir);
|
||||
$oldurl = explode('_', $url);
|
||||
|
||||
$oldtag = $oldurl[1];
|
||||
|
||||
$oldmd = str_replace('.md', '', $oldurl[2]);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
} else {
|
||||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
$timestamp = $time->format("Y-m-d");
|
||||
// The post date
|
||||
$postdate = strtotime($timestamp);
|
||||
// The post URL
|
||||
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
|
||||
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" name="title"
|
||||
class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtag ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
|
||||
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
Featured Image <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postImage)) {
|
||||
if (empty($postImage)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="image" ><?php echo $oldimage ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="is_image" class="text" value="is_image"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
167
system/admin/views/edit-link.html.php
Normal file
167
system/admin/views/edit-link.html.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
if (isset($p->file)) {
|
||||
$url = $p->file;
|
||||
} else {
|
||||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldlink = get_content_tag('link', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$isdraft = explode('/', $dir);
|
||||
$oldurl = explode('_', $url);
|
||||
|
||||
$oldtag = $oldurl[1];
|
||||
|
||||
$oldmd = str_replace('.md', '', $oldurl[2]);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
} else {
|
||||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
$timestamp = $time->format("Y-m-d");
|
||||
// The post date
|
||||
$postdate = strtotime($timestamp);
|
||||
// The post URL
|
||||
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
|
||||
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" name="title"
|
||||
class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtag ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
|
||||
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
Featured Link <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postLink)) {
|
||||
if (empty($postLink)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="link" ><?php echo $oldlink ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="is_link" class="text" value="is_link"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
|
@ -7,6 +7,7 @@ if (isset($p->file)) {
|
|||
}
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
|
|
@ -18,7 +19,17 @@ $dir = substr($url, 0, strrpos($url, '/'));
|
|||
$oldurl = str_replace($dir . '/', '', $url);
|
||||
$oldmd = str_replace('.md', '', $oldurl);
|
||||
|
||||
$delete = $p->url . '/delete?destination=' . $destination;
|
||||
if (isset($p->url)) {
|
||||
$delete = $p->url . '/delete?destination=' . $destination;
|
||||
}
|
||||
else {
|
||||
if(empty($sub)) {
|
||||
$delete = site_url() . $oldmd . '/delete?destination=' . $destination;
|
||||
}
|
||||
else {
|
||||
$delete = site_url() . $static .'/'. $sub . '/delete?destination=' . $destination;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
|
|
@ -46,9 +57,8 @@ $delete = $p->url . '/delete?destination=' . $destination;
|
|||
<span class="help">If the url leave empty we will use the page title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ if (isset($p->file)) {
|
|||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$oldimg = get_content_tag('img', $content);
|
||||
$oldvid = get_content_tag('vid', $content);
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
|
|
@ -68,17 +67,15 @@ $delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destinat
|
|||
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
} else { echo $olddescription;} ?></textarea>
|
||||
<br><br>
|
||||
Featured Image (optional)<br><input type="text" class="text" name="img" value="<?php echo $oldimg ?>"/><br><br>
|
||||
Embed Youtube Video (optional)<br><input type="text" class="text" name="vid" value="<?php echo $oldvid ?>"/><br><br>
|
||||
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="is_post" class="text" value="is_post"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
|
|
|
|||
167
system/admin/views/edit-quote.html.php
Normal file
167
system/admin/views/edit-quote.html.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
if (isset($p->file)) {
|
||||
$url = $p->file;
|
||||
} else {
|
||||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldquote = get_content_tag('quote', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$isdraft = explode('/', $dir);
|
||||
$oldurl = explode('_', $url);
|
||||
|
||||
$oldtag = $oldurl[1];
|
||||
|
||||
$oldmd = str_replace('.md', '', $oldurl[2]);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
} else {
|
||||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
$timestamp = $time->format("Y-m-d");
|
||||
// The post date
|
||||
$postdate = strtotime($timestamp);
|
||||
// The post URL
|
||||
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
|
||||
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" name="title"
|
||||
class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtag ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
|
||||
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
Featured Quote <span class="required">*</span> <br><textarea maxlength="200" class="text <?php if (isset($postQuote)) {
|
||||
if (empty($postQuote)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="quote"><?php echo $oldquote ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="is_quote" class="text" value="is_quote"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
167
system/admin/views/edit-video.html.php
Normal file
167
system/admin/views/edit-video.html.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
if (isset($p->file)) {
|
||||
$url = $p->file;
|
||||
} else {
|
||||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldvideo = get_content_tag('video', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$isdraft = explode('/', $dir);
|
||||
$oldurl = explode('_', $url);
|
||||
|
||||
$oldtag = $oldurl[1];
|
||||
|
||||
$oldmd = str_replace('.md', '', $oldurl[2]);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
} else {
|
||||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
$timestamp = $time->format("Y-m-d");
|
||||
// The post date
|
||||
$postdate = strtotime($timestamp);
|
||||
// The post URL
|
||||
$delete = site_url() . date('Y/m', $postdate) . '/' . $oldmd . '/delete?destination=' . $destination;
|
||||
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<?php if (config("jquery") != "enable"):?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php endif;?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" name="title"
|
||||
class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtag ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the post title.</span><br><br>
|
||||
Date Time<br><input type="date" name="date" class="text" value="<?php echo $timestamp; ?>"><br><input
|
||||
type="time" name="time" class="text" value="<?php echo $time->format('H:i'); ?>"><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" maxlength="200"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
Featured Video <span class="required">*</span> (YouTube Only)<br><textarea maxlength="200" class="text <?php if (isset($postVideo)) {
|
||||
if (empty($postVideo)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="video" ><?php echo $oldvideo ?></textarea><br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="is_video" class="text" value="is_video"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var converter = new Markdown.Converter();
|
||||
var editor = new Markdown.Editor(converter);
|
||||
|
||||
var $dialog = $('#insertImageDialog').dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
});
|
||||
|
||||
var $url = $('input[type=text]', $dialog);
|
||||
var $file = $('input[type=file]', $dialog);
|
||||
var base = '<?php echo site_url() ?>';
|
||||
|
||||
editor.hooks.set('insertImageDialog', function(callback) {
|
||||
|
||||
var dialogInsertClick = function() {
|
||||
callback($url.val().length > 0 ? $url.val(): null);
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
var dialogCancelClick = function() {
|
||||
dialogClose();
|
||||
callback(null);
|
||||
};
|
||||
|
||||
var dialogClose = function() {
|
||||
$url.val('');
|
||||
$file.val('');
|
||||
$dialog.dialog('close');
|
||||
};
|
||||
|
||||
$dialog.dialog( 'option', 'buttons', {
|
||||
'Insert': dialogInsertClick,
|
||||
'Cancel': dialogCancelClick
|
||||
});
|
||||
|
||||
var uploadComplete = function(response) {
|
||||
if (response.error == '0') {
|
||||
$url.val(base + response.path);
|
||||
} else {
|
||||
alert(response.error);
|
||||
$file.val('');
|
||||
}
|
||||
};
|
||||
|
||||
$file.ajaxfileupload({
|
||||
'action': '<?php echo site_url() ?>upload.php',
|
||||
'onComplete': uploadComplete,
|
||||
});
|
||||
|
||||
$dialog.dialog('open');
|
||||
|
||||
return true; // tell the editor that we'll take care of getting the image url
|
||||
});
|
||||
|
||||
editor.run();
|
||||
|
||||
})();
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue