Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <?php $tmp_head = $tmp_body = $tmp_finish = $id = $title = $key = null; include_once 'template.php'; ?>
- <?php echo $tmp_head ?>
- <title></title>
- <?php echo $tmp_body ?>
- <?php
- if (isset ($_SESSION['id'])) {
- echo '<ul id="listaPodstron">', "\n";
- require_once('connect.php');
- $pullContentList = "SELECT id, title FROM content";
- $pullContentList2 = mysql_query($pullContentList) or die($error[23]);
- $num_rows = mysql_num_rows($pullContentList2);
- if($num_rows !== 0) {
- while($row = mysql_fetch_assoc($pullContentList2)) {
- $id[$row['id']] = $row['id'];
- $title[$row['id']] = $row['title'];
- }
- foreach($id as $key) {
- echo ' <li><span class="istniejacyTitle" id="', $id[$key], '">', $title[$key], '</span> <span id="del_', $id[$key], '" onClick="usunTenArtykul(this.id);">DELETE</span></li>', "\n";
- }
- }
- echo ' <li><a id="niekliknieteDodawanie" href="#">Dodaj nową podstronę</a></li>', "\n", '</ul>';
- } else echo 'Najpierw <a href="index.php" title="">podaj swoje hasło</a>';
- ?>
- <script type="text/javascript">
- // zainiciuj
- przyciskRozpoczynajacyEdycje();
- przyciskPokazujacyInputBox();
- function usunTenArtykul(nierozbiteId) {
- var el = nierozbiteId.substr(4);
- if ( el !== '' ) {
- var xmlhttp;
- if (window.XMLHttpRequest) {
- xmlhttp=new XMLHttpRequest();
- } else {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- document.getElementById("del_"+el).outer = '';
- document.getElementById(el).outer = '';
- }
- };
- xmlhttp.open("GET","process_article_delete_inSelection.php?&id=" + (el),true);
- xmlhttp.send();
- }
- }
- function przyciskRozpoczynajacyEdycje() { // function to prepare Event Linteners for clickable titles
- <?php foreach($id as $key) echo "var items = document.getElementById('", $id[$key], "'); items.addEventListener(\"click\", function () { rozpocznijEdycjePodstrony(this.id) });"; ?>
- }
- function przyciskPokazujacyInputBox() { // function to prepare Event Listeners for adding new title
- document.getElementById('niekliknieteDodawanie').addEventListener("click", function () { narysuj_Input_Box() });
- }
- function narysuj_Input_Box() { // function to add Input box to add new title
- // narysuj Inputa
- document.getElementById('niekliknieteDodawanie').outerHTML = '<li id="dodawarka"><input type="text" name="input_givenToAdd" id="input_givenToAdd" maxlength="64"><a id="kliknieteZapisywanie" href="#">Zapisz tę podstronę</a></li>';
- // dodaj instrukcje dla narysowanego przycisku obok inputa
- document.getElementById('kliknieteZapisywanie').addEventListener("click", function () { zapiszNowyTitle() });
- }
- function zapiszNowyTitle() { // function to save given title
- var el = document.getElementById('input_givenToAdd').value;
- if ( el !== '' ) {
- var xmlhttp;
- if (window.XMLHttpRequest) {
- xmlhttp=new XMLHttpRequest();
- } else {
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- document.getElementById('dodawarka').outerHTML = '<li><span class="istniejacyTitle">' + xmlhttp.responseText + '</span></li>' + "\r\n" + '<li><a id="niekliknieteDodawanie" href="#">Dodaj nową podstronę</a></li>' + "\r\n";
- przyciskPokazujacyInputBox();
- }
- };
- el = encodeURIComponent(el);
- el = el.replace(/\#/g, '#'); // replaces all '#'
- xmlhttp.open("GET","process_add_article.php?&title=" + (el),true);
- xmlhttp.send();
- } else {
- alert('Proszę podać nazwę nowej podstrony!');
- }
- }
- function rozpocznijEdycjePodstrony(el) { // function to send edited map info to DB
- el = encodeURIComponent(el);
- el = el.replace(/\#/g, '#'); // replaces all '#'
- window.location.href = "process_article_selection.php?&id=" + (el);
- }
- </script>
- <div id="WYSWIG"></div>
- <?php echo $tmp_finish ?>
Add Comment
Please, Sign In to add comment