Commit f4ec218fa527381b22e0409fc851e26b2250cc67
- Diff rendering mode:
- inline
- side by side
server/wsgi/page_edit.js
(59 / 61)
  | |||
1 | function page_edit( boltSlug, pageSlug, uploadSlug, editMode, hasEditPermission, successUrl) | ||
1 | function page_edit_client( boltSlug, pageSlug, uploadSlug, editMode, hasEditPermission, successUrl) | ||
2 | 2 | { | |
3 | 3 | ||
4 | 4 | var console, PopupControl, M4ImageElement,locName='',langName = '',styleName='',authorValue; | |
… | … | ||
1120 | 1120 | path = "/" + xname + path; | |
1121 | 1121 | } | |
1122 | 1122 | } | |
1123 | console.log(path); | ||
1123 | 1124 | return path; | |
1124 | 1125 | }; | |
1125 | 1126 | ||
… | … | ||
1176 | 1176 | path = DOM.makePath(currentNode.parentNode); | |
1177 | 1177 | } | |
1178 | 1178 | ||
1179 | |||
1179 | console.log(path); | ||
1180 | 1180 | return path; | |
1181 | 1181 | }; | |
1182 | 1182 | ||
… | … | ||
1749 | 1749 | author.setAttribute("style","position:absolute;top:65%;left:40%;width:250px;"); | |
1750 | 1750 | target.appendChild(author); | |
1751 | 1751 | ||
1752 | ourcheck = document.createElement("input"); | ||
1753 | ourcheck.setAttribute("id","your-check"); | ||
1754 | ourcheck.setAttribute("type","radio"); | ||
1755 | ourcheck.setAttribute("name", "blog"); | ||
1756 | ourcheck.setAttribute("alipielements", "alipi"); | ||
1757 | ourcheck.setAttribute("style","position:absolute;top:85%;left:40%;"); | ||
1758 | target.appendChild(ourcheck); | ||
1759 | |||
1760 | 1752 | yourcheck = document.createElement("input"); | |
1761 | yourcheck.setAttribute("id","our-check"); | ||
1753 | yourcheck.setAttribute("id","your-check"); | ||
1762 | 1754 | yourcheck.setAttribute("type","radio"); | |
1763 | 1755 | yourcheck.setAttribute("name", "blog"); | |
1764 | 1756 | yourcheck.setAttribute("alipielements", "alipi"); | |
1765 | yourcheck.setAttribute("style","position:absolute;top:85%;left:70%;"); | ||
1757 | yourcheck.setAttribute("style","position:absolute;top:85%;left:40%;"); | ||
1766 | 1758 | target.appendChild(yourcheck); | |
1759 | yourcheck.disabled = true; | ||
1760 | |||
1761 | ourcheck = document.createElement("input"); | ||
1762 | ourcheck.setAttribute("id","our-check"); | ||
1763 | ourcheck.setAttribute("type","radio"); | ||
1764 | ourcheck.setAttribute("name", "blog"); | ||
1765 | ourcheck.setAttribute("alipielements", "alipi"); | ||
1766 | ourcheck.setAttribute("style","position:absolute;top:85%;left:70%;"); | ||
1767 | target.appendChild(ourcheck); | ||
1767 | 1768 | ||
1768 | 1769 | yourLabel = document.createElement('label'); | |
1769 | 1770 | yourLabel.textContent = "Your blog"; | |
… | … | ||
1781 | 1781 | locButton.setAttribute("title","Set your preferred location"); | |
1782 | 1782 | locButton.value="+"; | |
1783 | 1783 | locButton.setAttribute("type","button"); | |
1784 | locButton.setAttribute("style","position:absolute;top:5%;left:90%;width:20px;"); | ||
1784 | locButton.setAttribute("style","position:absolute;top:6%;right:4%;width:20px;"); | ||
1785 | 1785 | locButton.setAttribute("alipielements", "alipi"); | |
1786 | 1786 | //locButton.setAttribute("type","button"); | |
1787 | 1787 | if (window.location.hostname != '127.0.0.1') { | |
… | … | ||
1793 | 1793 | langButton.setAttribute("title","Set your preferred location"); | |
1794 | 1794 | langButton.value="+"; | |
1795 | 1795 | langButton.setAttribute("type","button"); | |
1796 | langButton.setAttribute("style","position:absolute;top:25%;left:90%;width:20px;"); | ||
1796 | langButton.setAttribute("style","position:absolute;top:26%;right:4%;width:20px;"); | ||
1797 | 1797 | langButton.setAttribute("alipielements", "alipi"); | |
1798 | 1798 | //locButton.setAttribute("type","button"); | |
1799 | 1799 | if (window.location.hostname != '127.0.0.1') { | |
… | … | ||
1823 | 1823 | if(document.getElementById('loc-bt').value == '+'){ | |
1824 | 1824 | //remove input field and create a combo box | |
1825 | 1825 | $('#loc-select').hide(); | |
1826 | var def_loc = ['Srilanka','su','sa']; | ||
1827 | locSel = document.createElement("select"); | ||
1826 | locSel = document.createElement("select"); | ||
1828 | 1827 | locSel.setAttribute("id","loct-select"); | |
1829 | 1828 | locSel.setAttribute("type","text"); | |
1830 | 1829 | locSel.setAttribute("alipielements", "alipi"); | |
1831 | 1830 | locSel.setAttribute("style","position:absolute;top:5%;left:40%;width:250px;"); | |
1832 | for(i=0;i<def_loc.length;i++){ | ||
1831 | for(i=0;i<client_json.def_loc.length;i++){ | ||
1833 | 1832 | locopt = document.createElement("option"); | |
1834 | theText=document.createTextNode(def_loc[i]); | ||
1833 | theText=document.createTextNode(client_json.def_loc[i]); | ||
1835 | 1834 | locopt.appendChild(theText); | |
1836 | 1835 | locSel.appendChild(locopt); | |
1837 | 1836 | } | |
… | … | ||
1851 | 1851 | if(document.getElementById('lang-bt').value == '+'){ | |
1852 | 1852 | //remove input field and create a combo box | |
1853 | 1853 | $('#lang-select').hide(); | |
1854 | var def_lang = ['Srilanka','su','sa']; | ||
1855 | 1854 | langSel= document.createElement("select"); | |
1856 | 1855 | langSel.setAttribute("id","langs-select"); | |
1857 | 1856 | langSel.setAttribute("type","text"); | |
1858 | 1857 | langSel.setAttribute("alipielements", "alipi"); | |
1859 | 1858 | langSel.setAttribute("style","position:absolute;top:25%;left:40%;width:250px;"); | |
1860 | for(i=0;i<def_lang.length;i++){ | ||
1859 | for(i=0;i<client_json.def_lang.length;i++){ | ||
1861 | 1860 | langopt = document.createElement("option"); | |
1862 | theText=document.createTextNode(def_lang[i]); | ||
1861 | theText=document.createTextNode(client_json.def_lang[i]); | ||
1863 | 1862 | langopt.appendChild(theText); | |
1864 | 1863 | langSel.appendChild(langopt); | |
1865 | 1864 | } | |
… | … | ||
1878 | 1878 | ||
1879 | 1879 | ||
1880 | 1880 | $( "#loc-select" ).autocomplete({ | |
1881 | source: function(req, add){ | ||
1881 | source: function(req, add){ | ||
1882 | 1882 | ||
1883 | //pass request to server | ||
1884 | $.getJSON("http://localhost/getData?", req, function(data) { | ||
1885 | //create array for response objects | ||
1886 | var suggestions = []; | ||
1883 | //pass request to server | ||
1884 | $.getJSON("http://y.a11y.in/loc?", req, function(data) { | ||
1885 | //create array for response objects | ||
1886 | var suggestions = []; | ||
1887 | 1887 | ||
1888 | //process response | ||
1889 | $.each(data, function(i, val){ | ||
1890 | //suggestions.push(val.country); | ||
1891 | for(i=0;i<val.length;i++){ | ||
1892 | suggestions.push(val[i]+', '+val[i+1]+', '+val[i+2]); | ||
1893 | i +=2; | ||
1894 | } | ||
1895 | }); | ||
1888 | //process response | ||
1889 | $.each(data, function(i, val){ | ||
1890 | for(i=0;i<val.length;i++){ | ||
1891 | suggestions.push(val[i]); | ||
1892 | } | ||
1893 | }); | ||
1896 | 1894 | ||
1897 | //pass array to callback | ||
1898 | add(suggestions); | ||
1899 | }); | ||
1900 | }, | ||
1901 | }); | ||
1895 | //pass array to callback | ||
1896 | add(suggestions); | ||
1897 | }); | ||
1898 | }, | ||
1899 | }); | ||
1902 | 1900 | ||
1903 | 1901 | $( "#lang-select" ).autocomplete({ | |
1904 | source: function(req, add){ | ||
1902 | source: function(req, add){ | ||
1905 | 1903 | ||
1906 | //pass request to server | ||
1907 | $.getJSON("http://localhost/getLang?", req, function(data) { | ||
1904 | //pass request to server | ||
1905 | $.getJSON("http://y.a11y.in/lang?", req, function(data) { | ||
1908 | 1906 | ||
1909 | //create array for response objects | ||
1910 | var suggestions = []; | ||
1907 | //create array for response objects | ||
1908 | var suggestions = []; | ||
1911 | 1909 | ||
1912 | //process response | ||
1913 | $.each(data, function(i, val){ | ||
1914 | //suggestions.push(val.country); | ||
1915 | for(i=0;i<val.length;i++){ | ||
1916 | suggestions.push(val[i]); | ||
1917 | } | ||
1918 | }); | ||
1910 | //process response | ||
1911 | $.each(data, function(i, val){ | ||
1912 | //suggestions.push(val.country); | ||
1913 | for(i=0;i<val.length;i++){ | ||
1914 | suggestions.push(val[i]); | ||
1915 | } | ||
1916 | }); | ||
1919 | 1917 | ||
1920 | //pass array to callback | ||
1921 | add(suggestions); | ||
1922 | }); | ||
1923 | }, | ||
1924 | }); | ||
1918 | //pass array to callback | ||
1919 | add(suggestions); | ||
1920 | }); | ||
1921 | }, | ||
1922 | }); | ||
1925 | 1923 | ||
1926 | 1924 | ||
1927 | 1925 | ||
… | … | ||
2263 | 2263 | } | |
2264 | 2264 | } | |
2265 | 2265 | } | |
2266 | xmlhttp.open("POST","http://localhost/narration",true); | ||
2266 | xmlhttp.open("POST","http://y.a11y.in/narration",true); | ||
2267 | 2267 | xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
2268 | 2268 | xmlhttp.send(data); | |
2269 | 2269 | ||
… | … | ||
3346 | 3346 | ||
3347 | 3347 | this.publish = function publish() { | |
3348 | 3348 | var result; | |
3349 | if(document.getElementById('our-check').checked) | ||
3349 | if(document.getElementById('your-check').checked) | ||
3350 | 3350 | { | |
3351 | 3351 | localStorage.myContent = buildDataString(); | |
3352 | window.location.href = "http://localhost/test.html"; | ||
3352 | window.location.href = "http://y.a11y.in/test.html"; | ||
3353 | 3353 | window.reload(); | |
3354 | 3354 | } | |
3355 | 3355 | else | |
3356 | 3356 | { | |
3357 | AJAX.post('http://localhost/test', buildDataString(), function(result) { | ||
3357 | AJAX.post('http://y.a11y.in/test', buildDataString(), function(result) { | ||
3358 | 3358 | ajaxResultProcessor.processPublishedResponse(result); | |
3359 | 3359 | }); | |
3360 | 3360 | } | |
… | … | ||
3408 | 3408 | UTIL.forEach(history, function(index, command) { | |
3409 | 3409 | buffer.append('###'); //separates the commands | |
3410 | 3410 | buffer.append('about='); //url=about //removed '&' on purpose | |
3411 | buffer.append(window.location.search.split('=')[1]); | ||
3411 | buffer.append(window.location.href); | ||
3412 | 3412 | buffer.append('&lang=');//lang | |
3413 | 3413 | if (langName.value != "" ) | |
3414 | 3414 | buffer.append(encodeURIComponent(langName.value)); |