merged in default
--HG-- branch : kf-wiki
This commit is contained in:
@@ -5,6 +5,7 @@ function ${ id }_load() {
|
||||
update_schematics();
|
||||
|
||||
$('#check_${ id }').click(function() {
|
||||
$("input.schematic").each(function(index,element){ element.schematic.update_value(); });
|
||||
var submit_data={};
|
||||
$.each($("[id^=input_${ id }_]"), function(index,value){
|
||||
submit_data[value.id]=value.value;
|
||||
@@ -36,7 +37,7 @@ function ${ id }_load() {
|
||||
$('#show_${ id }').click(function() {
|
||||
postJSON('/modx/problem/${ id }/problem_show', {}, function(data) {
|
||||
for (var key in data) {
|
||||
$("#answer_${ id }_"+key).text(data[key]);
|
||||
$("#answer_"+key).text(data[key]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -44,6 +45,7 @@ function ${ id }_load() {
|
||||
});
|
||||
|
||||
$('#save_${ id }').click(function() {
|
||||
$("input.schematic").each(function(index,element){ element.schematic.update_value(); });
|
||||
var submit_data={};
|
||||
$.each($("[id^=input_${ id }_]"), function(index,value){
|
||||
submit_data[value.id]=value.value;});
|
||||
|
||||
19
schematicinput.html
Normal file
19
schematicinput.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<span>
|
||||
<input type="hidden" class="schematic" height="${height}" width="${width}" name="input_${id}" id="input_${id}" value="" />
|
||||
<div id="hidden_${id}" style="display:none">
|
||||
${value}
|
||||
</div>
|
||||
<script>
|
||||
$("#input_${id}").attr("value",$("#hidden_${id}").text())
|
||||
</script>
|
||||
<span id="answer_${id}"></span>
|
||||
% if state == 'unsubmitted':
|
||||
<span class="ui-icon ui-icon-bullet" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
<span class="ui-icon ui-icon-check" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
|
||||
% endif
|
||||
</span>
|
||||
@@ -80,9 +80,24 @@
|
||||
<%block name="wiki_panel">
|
||||
|
||||
<div id="wiki_panel">
|
||||
|
||||
<%
|
||||
if (wiki_article is not UNDEFINED):
|
||||
baseURL = reverse("wiki_view", args=[wiki_article.get_url()])
|
||||
else:
|
||||
baseURL = reverse("wiki_view", args=[""])
|
||||
%>
|
||||
|
||||
<ul class="action">
|
||||
<li>
|
||||
<div class="wiki_box_title">Search</div>
|
||||
<form method="POST" action='${reverse("wiki_search_articles", args=[""])}'>
|
||||
<div style="display:none">
|
||||
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
|
||||
</div>
|
||||
<input type="text" name="value" id="wiki_search_input" style="width: 72%" value="${wiki_search_query if wiki_search_query is not UNDEFINED else '' |h}"/>
|
||||
<input type="submit" id="wiki_search_input_submit" value=Go! style="width: 20%" />
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_random", args=["wiki_articleget_url"])}'" value="Random article" class="button" />
|
||||
</li>
|
||||
@@ -136,12 +151,15 @@
|
||||
|
||||
%if wiki_article is not UNDEFINED:
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_view", args=[wiki_article.get_url()])}'" value="View" />
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_edit", args=[wiki_article.get_url()])}'" value="Edit" ${'disabled="true"' if not wiki_write else ""}/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_history", args=[wiki_article.get_url(),1])}'" value="History" class="button" />
|
||||
</li>
|
||||
|
||||
177
simplewiki_base.html.orig
Normal file
177
simplewiki_base.html.orig
Normal file
@@ -0,0 +1,177 @@
|
||||
##This file is based on the template from the SimpleWiki source which carries the GPL license
|
||||
|
||||
<%inherit file="main.html"/>
|
||||
|
||||
<%block name="title"><title>${"wiki_title"}</title></%block>
|
||||
|
||||
<%block name="headextra">
|
||||
<!-- <link rel="stylesheet" media="screen,print" href="/static/simplewiki/css/base.css" /> -->
|
||||
<!-- <link rel="stylesheet" media="print" href="/static/simplewiki/css/base_print.css" /> -->
|
||||
<!-- <link rel="stylesheet" href="/static/simplewiki/css/autosuggest_inquisitor.css" /> -->
|
||||
<!-- <link rel="stylesheet" href="/static/css/local.css" type="text/css" media="all" /> -->
|
||||
<script type="text/javascript" src="/static/simplewiki/js/bsn.AutoSuggest_c_2.0.js"></script>
|
||||
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<script type="text/javascript">
|
||||
function set_related_article_id(s) {
|
||||
document.getElementById('wiki_related_input_id').value = s.id;
|
||||
document.getElementById('wiki_related_input_submit').disabled=false;
|
||||
}
|
||||
%if wiki_article is not UNDEFINED:
|
||||
var x = window.onload;
|
||||
window.onload = function(){
|
||||
var options = {
|
||||
script: "${reverse("search_related", args=[wiki_article.get_url()] )}/?self=${wiki_article.pk}&",
|
||||
json: true,
|
||||
varname: "query",
|
||||
maxresults: 35,
|
||||
callback: set_related_article_id,
|
||||
noresults: "Nothing found!"
|
||||
};
|
||||
var as = new AutoSuggest('wiki_related_input', options);
|
||||
if (typeof x == 'function')
|
||||
x();
|
||||
}
|
||||
%endif
|
||||
</script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
|
||||
});
|
||||
</script> <script type="text/javascript" src="/static/lib/mathjax/MathJax.js?config=TeX-AMS_HTML-full"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
$.ajaxSetup ({
|
||||
// Disable caching of AJAX responses
|
||||
cache: false
|
||||
});
|
||||
|
||||
$(".div_wiki_circuit").each(function(d,e) {
|
||||
id = $(this).attr("id");
|
||||
name = id.substring(17);
|
||||
//alert(name);
|
||||
$("#"+id).load("/edit_circuit/"+name);
|
||||
f=this;
|
||||
});
|
||||
|
||||
$("#wiki_create_form").hide();
|
||||
|
||||
$("#create-article").click(function() {
|
||||
$("#wiki_create_form").slideToggle();
|
||||
$(this).parent().toggleClass("active");
|
||||
});
|
||||
|
||||
update_schematics();});
|
||||
</script>
|
||||
|
||||
|
||||
<%block name="bodyextra">
|
||||
<%block name="wiki_head"/>
|
||||
</%block>
|
||||
|
||||
<%include file="navigation.html" />
|
||||
|
||||
<section class="main-content">
|
||||
<div class="wiki-wrapper">
|
||||
<%block name="wiki_panel">
|
||||
|
||||
<div id="wiki_panel">
|
||||
<%
|
||||
if (wiki_article is not UNDEFINED):
|
||||
baseURL = reverse("wiki_view", args=[wiki_article.get_url()])
|
||||
else:
|
||||
baseURL = reverse("wiki_view", args=[""])
|
||||
%>
|
||||
|
||||
<ul class="action">
|
||||
<li>
|
||||
<div class="wiki_box_title">Search</div>
|
||||
<form method="POST" action='${reverse("wiki_search_articles", args=[""])}'>
|
||||
<div style="display:none">
|
||||
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
|
||||
</div>
|
||||
<input type="text" name="value" id="wiki_search_input" style="width: 72%" value="${wiki_search_query if wiki_search_query is not UNDEFINED else '' |h}"/>
|
||||
<input type="submit" id="wiki_search_input_submit" value=Go! style="width: 20%" />
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_random", args=["wiki_articleget_url"])}'" value="Random article" class="button" />
|
||||
</li>
|
||||
|
||||
<li class="create-article">
|
||||
<h3>
|
||||
<a href="#" id="create-article"/>Create Article</a>
|
||||
</h3>
|
||||
|
||||
<div id="wiki_create_form">
|
||||
<%
|
||||
theaction = "this.wiki_article_name.value.replace(/([^a-zA-Z0-9\-])/g, '')+'/_create/'"
|
||||
if (wiki_article is not UNDEFINED):
|
||||
baseURL = reverse("wiki_view", args=[wiki_article.get_url()])
|
||||
else:
|
||||
baseURL = reverse("wiki_view", args=[""])
|
||||
%>
|
||||
|
||||
<form method="GET" onsubmit="this.action='${baseURL + "/' + " + theaction};">
|
||||
|
||||
<div>
|
||||
<label for="id_wiki_article_name">Title of article</label>
|
||||
<input type="text" name="wiki_article_name" id="id_wiki_article_name" /><br/>
|
||||
<!-- <label for="id_wiki_article_is_child">Create as a child of current article</label> -->
|
||||
<!-- <input type="checkbox" name="wiki_article_is_child" id="id_wiki_artcile_is_child" disabled="true" ${ 'checked="checked"' if wiki_article is not UNDEFINED else ""}> -->
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<input type="submit" class="button" value="Create" style="display: inline-block; margin-right: 2px; font-weight: bold;" />
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</%block>
|
||||
|
||||
<section class="wiki-body">
|
||||
<header>
|
||||
%if wiki_article is not UNDEFINED:
|
||||
%if wiki_article.locked:
|
||||
<p><strong>This article has been locked</strong></p>
|
||||
%endif
|
||||
<p>Last modified: ${wiki_article.modified_on.strftime("%b %d, %Y, %I:%M %p")}</p>
|
||||
%endif
|
||||
|
||||
%if wiki_article is not UNDEFINED:
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_view", args=[wiki_article.get_url()])}'" value="View" />
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_edit", args=[wiki_article.get_url()])}'" value="Edit" ${'disabled="true"' if not wiki_write else ""}/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<input type="button" onclick="javascript:location.href='${reverse("wiki_history", args=[wiki_article.get_url(),1])}'" value="History" class="button" />
|
||||
</li>
|
||||
</ul>
|
||||
%endif
|
||||
</header>
|
||||
|
||||
<h1 class="wiki-title"><%block name="wiki_page_title"/></h1>
|
||||
|
||||
<%block name="wiki_body"/>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</%block>
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
<%inherit file="simplewiki_base.html"/>
|
||||
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<%block name="wiki_page_title">
|
||||
Oops...
|
||||
</%block>
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
<%inherit file="simplewiki_base.html"/>
|
||||
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<%block name="wiki_page_title">
|
||||
${ wiki_article.title }
|
||||
</%block>
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
<%inherit file="simplewiki_base.html"/>
|
||||
|
||||
<%!
|
||||
from django.core.urlresolvers import reverse
|
||||
%>
|
||||
|
||||
<%block name="wiki_page_title">
|
||||
%if wiki_search_query:
|
||||
Search results for ${wiki_search_query | h}
|
||||
@@ -12,7 +16,7 @@
|
||||
|
||||
<%block name="wiki_body">
|
||||
%for article in wiki_search_results:
|
||||
%if article.get_url:
|
||||
%if article is not UNDEFINED:
|
||||
<a href="${reverse("wiki_view", args=[article.get_url()])}">${article.get_url()}</a><br/>
|
||||
%else:
|
||||
<a href="${reverse("wiki_view", args=[''])}">/</a><br/>
|
||||
@@ -20,6 +24,6 @@
|
||||
%endfor
|
||||
|
||||
%if not wiki_search_results:
|
||||
No articles were found!
|
||||
No articles matching <b>${wiki_search_query if wiki_search_query is not UNDEFINED else ""} </b>!
|
||||
%endif
|
||||
</%block>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##This file is based on the template from the SimpleWiki source which carries the GPL license
|
||||
|
||||
##This file has been converted to Mako, but not tested. It is because uploads are disabled for the wiki. If they are reenabled, this may contain bugs.
|
||||
<%!
|
||||
from django.template.defaultfilters import filesizeformat
|
||||
%>
|
||||
|
||||
13
textinput.html
Normal file
13
textinput.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<span>
|
||||
<input type="text" name="input_${id}" id="input_${id}" value="${value}" />
|
||||
<span id="answer_${id}"></span>
|
||||
% if state == 'unsubmitted':
|
||||
<span class="ui-icon ui-icon-bullet" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'correct':
|
||||
<span class="ui-icon ui-icon-check" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'incorrect':
|
||||
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
|
||||
% elif state == 'incomplete':
|
||||
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span>
|
||||
% endif
|
||||
</span>
|
||||
Reference in New Issue
Block a user