Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ Page Language="VB" AutoEventWireup="false" CodeFile="PagesForMenu.aspx.vb" Inherits="cms_PagesForMenu" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title></title>
- <link href="style/StyleSheet.css" rel="stylesheet" />
- <script src="../js/jquery-1.8.3.min.js"></script>
- <script src="../ckeditor/ckeditor.js"></script>
- <link href="../style/sen.css" rel="stylesheet" />
- <link href="style/sen.extra.css" rel="stylesheet" />
- <script src="../js/jquery.validate.min.js"></script>
- <script>
- function showNotificationBar(message, duration, bgColor, txtColor, height) {
- /*set default values*/
- duration = typeof duration !== 'undefined' ? duration : 1500;
- bgColor = typeof bgColor !== 'undefined' ? bgColor : "#eee";
- txtColor = typeof txtColor !== 'undefined' ? txtColor : "#333";
- height = typeof height !== 'undefined' ? height : 40;
- /*create the notification bar div if it doesn't exist*/
- if ($('#notification-bar').size() == 0) {
- var HTMLmessage = "<div class='notification-message' style='text-align:center; line-height: " + height + "px; direction:ltr; font-family:Trebuchet MS, Arial;'> " + message + " </div>";
- $('body').prepend("<div id='notification-bar' style='display:none; width:100%; height:" + height + "px; background-color: " + bgColor + "; position: fixed; z-index: 100; color: " + txtColor + ";border-bottom: 1px solid " + txtColor + ";'>" + HTMLmessage + "</div>");
- } else {
- $('.notification-message').html(message);
- }
- /*animate the bar*/
- $('#notification-bar').slideDown(function () {
- setTimeout(function () {
- $('#notification-bar').slideUp(function () { });
- }, duration);
- });
- }
- </script>
- <script>
- function InsertHTML() {
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- var value = document.getElementById('htmlArea').value;
- alert('sasa');
- // Check the active editing mode.
- if (editor.mode == 'wysiwyg') {
- // Insert HTML code.
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertHtml
- editor.insertHtml(value);
- }
- else
- alert('You must be in WYSIWYG mode!');
- }
- function InsertText() {
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- var value = document.getElementById('txtArea').value;
- // Check the active editing mode.
- if (editor.mode == 'wysiwyg') {
- // Insert as plain text.
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertText
- editor.insertText(value);
- }
- else
- alert('You must be in WYSIWYG mode!');
- }
- function SetContents() {
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- var value = document.getElementById('htmlArea').value;
- // Set editor contents (replace current contents).
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData
- editor.setData(value);
- }
- function GetContents() {
- // Get the editor instance that you want to interact with.
- var editor = CKEDITOR.instances.editor1;
- // Get editor contents
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData
- alert(editor.getData());
- }
- function ExecuteCommand(commandName) {
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- // Check the active editing mode.
- if (editor.mode == 'wysiwyg') {
- // Execute the command.
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-execCommand
- editor.execCommand(commandName);
- }
- else
- alert('You must be in WYSIWYG mode!');
- }
- function CheckDirty() {
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- // Checks whether the current editor contents present changes when compared
- // to the contents loaded into the editor at startup
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty
- alert(editor.checkDirty());
- }
- function ResetDirty() {
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- // Resets the "dirty state" of the editor (see CheckDirty())
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-resetDirty
- editor.resetDirty();
- alert('The "IsDirty" status has been reset');
- }
- function Focus() {
- CKEDITOR.instances.editor1.focus();
- }
- function onFocus() {
- //document.getElementById('eMessage').innerHTML = '<b>' + this.name + ' is focused </b>';
- }
- function onBlur() {
- //document.getElementById('eMessage').innerHTML = this.name + ' lost focus';
- }
- </script>
- <script>
- $(document).ready(function () {
- //validator//////////////////////////////
- var rules = {
- webPagePriority: { required: true, number: true },
- webPageTitle: "required"
- };
- var messages = {
- webPagePriority: { required: "Title is required", number: "Page priority must be a number" },
- webPageTitle: "Page priority is requried"
- };
- //end validator/////////////////////////
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.editor1;
- // Set editor contents (replace current contents).
- // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData
- //editor.setData(value);
- //alert(editor.getData());
- $('#webSubmit').click(function () {
- if ($("#form1").valid() == true) {
- submitForm();
- }
- });
- $('#webAddNew').click(function () {
- window.location.href = '<%=ResolveClientUrl("~/cms/")%>pages.aspx?section=<%=_Section%>&lang=<%=_lang%>'
- });
- $('#webUpdate').click(function () {
- if ($("#form1").valid() == true) {
- updateForm();
- }
- });
- $('#webDelete').live('click', function (event_ref) {
- event_ref.preventDefault();
- if (confirm('Are you sure?')) {
- window.location.href = '<%=ResolveClientUrl("~/cms/")%>delete.aspx?r=pages.aspx?section=<%=_Section%>,lang=<%=_lang%>' +
- '&t=Pages&k=id&kv=<%=_PageID%>';
- }
- })
- });
- function submitForm() {
- $('#webSubmit').attr('disabled', 'disabled');
- var editor = CKEDITOR.instances.editor1;
- $.post(
- '<%=ResolveClientUrl("~/ajax/") %>pages.aspx',
- {
- webPageTitle: $("#webPageTitle").val(), webPagePriority: $('#webPagePriority').val(), webPageContent: editor.getData(),
- lang: '<%=_Lang%>', webPageOwner: '0', webSection: '<%=_Section%>', actionMode: 'add'
- //lang: <asp lang>
- },
- function (data) {
- if (data.toString() == "done") {
- $('#webSubmit').removeAttr('disabled');
- showNotificationBar('Saved Successfully.');
- setTimeout(redirectPage, 500);
- } else {
- var now = new Date();
- var outStr = now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
- showNotificationBar(data.toString());
- alert(data.toString());
- }
- },
- "html"
- );
- }
- function updateForm() {
- $('#webUpdate').attr('disabled', 'disabled');
- var editor = CKEDITOR.instances.editor1;
- $.post(
- '<%=ResolveClientUrl("~/ajax/") %>pages.aspx',
- {
- webPageTitle: $("#webPageTitle").val(), webPagePriority: $('#webPagePriority').val(), webPageContent: editor.getData(),
- webClause: 'ID=<%=_PageID%>', id: '<%=_PageID%>', actionMode: 'edit'
- },
- function (data) {
- if (data.toString() == "done") {
- $('#webUpdate').removeAttr('disabled');
- showNotificationBar('Saved Successfully.');
- setTimeout(redirectPage, 500);
- } else {
- var now = new Date();
- var outStr = now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
- showNotificationBar(data.toString());
- alert(data.toString());
- }
- },
- "html"
- );
- }
- function redirectPage() {
- window.location.href = "<%=ResolveClientUrl("~/ajax/")%>ident.aspx?page=pages.aspx§ion=<%=_Section%>&lang=<%=_lang%>";
- }
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <div id="wrapper">
- <div class="horizontalSpacer" id="TopSpacer" runat="server"></div>
- <p class="notice centeredText" id="webMessageBox" runat="server">Hello</p>
- <div class="verticalSpacer"> </div>
- <div id="right"> </div>
- <div id="content" class="roundedCorner padding boxShadow">
- <fieldset>
- <legend>Page</legend>
- <label for="webPageTitle">Title</label>
- <input id="webPageTitle" type="text" maxlength="30" runat="server" class="required" />
- <label for="editor1">Full content</label>
- <textarea cols="80" id="editor1" name="editor1" rows="10" runat="server"></textarea>
- <label for="webPagePriority">Page Priority (Decimal)</label>
- <input id="webPagePriority" type="text" maxlength="2" runat="server" class="required number" style="width: 50px;" />
- <button type="button" id="webSubmit" runat="server">Submit</button>
- <button type="button" id="webUpdate" runat="server" style="display: inline-block !important;">Update</button>
- <button type="button" id="webAddNew" runat="server" style="display: inline-block !important;">Add New</button>
- <button type="button" id="webDelete" runat="server" class="redColor" style="display: inline-block !important;">Delete</button>
- </fieldset>
- </div>
- </div>
- </form>
- <script>
- // Replace the <textarea id="editor1"> with an CKEditor instance.
- CKEDITOR.replace('editor1', {
- on: {
- focus: onFocus,
- blur: onBlur,
- // Check for availability of corresponding plugins.
- pluginsLoaded: function (evt) {
- var doc = CKEDITOR.document, ed = evt.editor;
- if (!ed.getCommand('bold'))
- doc.getById('exec-bold').hide();
- if (!ed.getCommand('link'))
- doc.getById('exec-link').hide();
- }
- }
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment