Added first files for admin and login/signup in admin
This commit is contained in:
parent
e0ed00af8c
commit
d9b62719d7
139 changed files with 18408 additions and 4 deletions
33
paramecio2/libraries/templates/forms/colorform.phtml
Normal file
33
paramecio2/libraries/templates/forms/colorform.phtml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
${add_js_home_local('jquery.min.js', 'admin')}
|
||||
${add_js_home_local('spectrum.js', 'admin')}
|
||||
${add_css_home_local('spectrum.css', 'admin')}
|
||||
<%
|
||||
|
||||
|
||||
form.default_value=str(hex(int(form.default_value))).replace('0x', '')
|
||||
|
||||
c=len(form.default_value)
|
||||
|
||||
if(c<6):
|
||||
repeat=6-c
|
||||
form.default_value=('0'*repeat)+form.default_value
|
||||
|
||||
form.default_value='#'+form.default_value
|
||||
|
||||
%>
|
||||
|
||||
<input type='text' id="${form.name_field_id}_field_form" name="${form.name}" value="${form.default_value}" />
|
||||
<script>
|
||||
$("#${form.name_field_id}_field_form").spectrum({
|
||||
allowEmpty: true
|
||||
});
|
||||
|
||||
$("#${form.name_field_id}_field_form").closest('form').submit( function () {
|
||||
|
||||
var t=$("#${form.name_field_id}_field_form").spectrum("get");
|
||||
|
||||
$('#${form.name_field_id}_field_form').val(t.toHexString());
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
71
paramecio2/libraries/templates/forms/dateform.phtml
Normal file
71
paramecio2/libraries/templates/forms/dateform.phtml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
${add_js_home_local('jquery.min.js', 'admin')}
|
||||
|
||||
<input type="number" min="1" max="31" name="${form}_day" id="time_${form}_day" class="form_day" value="${d}" size="2" maxlength="2"/>
|
||||
<input type="number" min="1" max="12" name="${form}_month" id="time_${form}_month" class="form_month" value="${m}" size="2" maxlength="2"/>
|
||||
<input type="number" name="${form}_year" id="time_${form}_year" class="form_year" value="${y}" size="4" maxlength="4"/>
|
||||
% if yes_time==True:
|
||||
<input type="text" min="0" max="23" name="${form}_hour" id="time_${form}_hour" class="form_hour" value="${h}" size="2" maxlength="2"/>
|
||||
<input type="text" min="0" max="60" name="${form}_minute" id="time_${form}_minute" class="form_minute" value="${min}" size="2" maxlength="2"/>
|
||||
<input type="text" min="0" max="60" name="${form}_second" id="time_${form}_second" class="form_second" value="${s}" size="2" maxlength="2"/>
|
||||
% endif
|
||||
<input type="hidden" name="${form}" id="time_${form}" value="" />
|
||||
|
||||
<script language="javascript">
|
||||
$(document).submit(function () {
|
||||
|
||||
year=$("#time_${form}_year").val().toString();
|
||||
month=$("#time_${form}_month").val().toString();
|
||||
day=$("#time_${form}_day").val().toString();
|
||||
|
||||
year=add_extra_length(year, 4);
|
||||
month=add_extra_length(month, 2);
|
||||
day=add_extra_length(day, 2);
|
||||
|
||||
final_time=year+month+day
|
||||
|
||||
% if yes_time==True:
|
||||
hour=$("#time_${form}_hour").val().toString();
|
||||
minute=$("#time_${form}_minute").val().toString();
|
||||
second=$("#time_${form}_second").val().toString();
|
||||
|
||||
hour=add_extra_length(hour, 2);
|
||||
minute=add_extra_length(minute, 2);
|
||||
second=add_extra_length(second, 2);
|
||||
|
||||
final_time+=final_time;
|
||||
|
||||
% else:
|
||||
|
||||
final_time+='000000';
|
||||
|
||||
% endif
|
||||
|
||||
|
||||
$("#time_${form}").val(final_time);
|
||||
|
||||
});
|
||||
|
||||
function add_extra_length(str_number, total_length)
|
||||
{
|
||||
|
||||
if(str_number.length<total_length)
|
||||
{
|
||||
c=total_length-str_number.length;
|
||||
|
||||
extra_number='';
|
||||
|
||||
for(x=0;x<c;x++)
|
||||
{
|
||||
|
||||
extra_number+='0';
|
||||
|
||||
}
|
||||
|
||||
str_number=extra_number+str_number;
|
||||
}
|
||||
|
||||
return str_number;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
12
paramecio2/libraries/templates/forms/fileform.phtml
Normal file
12
paramecio2/libraries/templates/forms/fileform.phtml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<%
|
||||
|
||||
import os
|
||||
|
||||
name_file=os.path.basename(form.default_value)
|
||||
|
||||
%>
|
||||
<input type="file" name="${form.name}_file" id="${form.name}_file_field_form" />
|
||||
% if name_file:
|
||||
${name_file}
|
||||
% endif
|
||||
<input type="hidden" name="${form.name}" id="${form.name}_field_form" value="${form.default_value}"/>
|
||||
61
paramecio2/libraries/templates/forms/i18nform.phtml
Normal file
61
paramecio2/libraries/templates/forms/i18nform.phtml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
${add_js_home_local('tools.js', 'admin')}
|
||||
<%
|
||||
|
||||
choose=''
|
||||
|
||||
%>
|
||||
<div id="languages_form">
|
||||
<%def name="select_lang(i18n, lang_selected)">
|
||||
% if i18n==lang_selected:
|
||||
<%
|
||||
return "choose_flag"
|
||||
%>
|
||||
% else:
|
||||
<%
|
||||
return "no_choose_flag"
|
||||
%>
|
||||
% endif
|
||||
</%def>
|
||||
<%def name="hide_lang(i18n, lang_selected)">
|
||||
% if i18n!=lang_selected:
|
||||
style="display:none;"
|
||||
% endif
|
||||
</%def>
|
||||
<input type="hidden" name="${real_name_form}" id="${name_form}_i18n_value" value="" />
|
||||
% if lang_selected!=None:
|
||||
% for i18n in arr_i18n:
|
||||
|
||||
${form.change_name(name_form+'_'+i18n)}
|
||||
<%
|
||||
form.default_value=default_value[i18n]
|
||||
%>
|
||||
<span id="${name_form}_${i18n}_switch" class="${name_form}_i18n_form">${form.form()|n}</span> <a class="choose_flag ${name_form}_i18n_flag lang_form" id="${name_form}_${i18n}_element" href="#"><img src="${make_media_url_module('images/languages/'+i18n+'.png', 'admin')}" alt="${name_form}_${i18n}"/></a>
|
||||
% endfor
|
||||
% endif
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
//In submit convert in json
|
||||
|
||||
$(".${name_form}_i18n_flag").closest('form').submit( function () {
|
||||
|
||||
arr_i18n={}
|
||||
|
||||
$(".${name_form}_i18n_form").each(function () {
|
||||
|
||||
var lang=$(this).attr('id').replace('${name_form}_','').replace('_switch', '');
|
||||
|
||||
var child_input=$('#${name_form}_'+lang+'_form');
|
||||
|
||||
arr_i18n[lang]=child_input.val();
|
||||
|
||||
});
|
||||
|
||||
document.getElementById("${name_form}_i18n_value").value=JSON.stringify(arr_i18n);
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
5
paramecio2/libraries/templates/forms/modelform.html
Normal file
5
paramecio2/libraries/templates/forms/modelform.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="form">
|
||||
{% for form in forms.values() %}
|
||||
<p><label>{{form.label|safe}}</label>{{form.form()}}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
21
paramecio2/libraries/templates/forms/modelform.phtml
Normal file
21
paramecio2/libraries/templates/forms/modelform.phtml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<%def name="check_required(required)">
|
||||
% if required:
|
||||
${'*'} \
|
||||
% endif
|
||||
</%def>
|
||||
<%def name="help(help, name)">
|
||||
% if help:
|
||||
<i class="fa fa-question-circle tooltip" data-tooltip-content="#tooltip_${name}_content" style="cursor:pointer;"></i> \
|
||||
<div class="tooltip_templates" style="display:none;"><div id="tooltip_${name}_content">${help|n}</div></div>
|
||||
% endif
|
||||
</%def>
|
||||
<div class="form">
|
||||
% for form in forms.values():
|
||||
% if form.type!='hidden':
|
||||
<p><label>${form.label} ${check_required(form.required)} ${help(form.help, form.name)}</label>${form.form()|n} <span class="error" id="${form.name}_error">${form.txt_error}</span></p>
|
||||
% else:
|
||||
${form.form()|n}
|
||||
% endif
|
||||
% endfor
|
||||
${csrf_token()|n}
|
||||
</div>
|
||||
22
paramecio2/libraries/templates/forms/texthtmlform.phtml
Normal file
22
paramecio2/libraries/templates/forms/texthtmlform.phtml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<p>
|
||||
<textarea name="${form.name}" id="${form.name_field_id}">
|
||||
${form.default_value}
|
||||
</textarea>
|
||||
</p>
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: '#${form.name_field_id}',
|
||||
height: 500,
|
||||
menubar: true,
|
||||
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists textcolor wordcount imagetools contextmenu colorpicker textpattern',
|
||||
toolbar: 'formatselect | fontsizeselect bold italic underline strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat',
|
||||
fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt 48pt 64pt 100pt 120pt",
|
||||
content_css: '//www.tinymce.com/css/codepen.min.css',
|
||||
setup: function (editor) {
|
||||
editor.on('change', function () {
|
||||
tinymce.triggerSave();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
${add_js_home_local('tinymce/tinymce.min.js', 'admin')}
|
||||
12
paramecio2/libraries/templates/utils/accept.phtml
Normal file
12
paramecio2/libraries/templates/utils/accept.phtml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
${question_text}: <input type="button" value="Yes" id="accept"/>
|
||||
<script language="javascript">
|
||||
|
||||
$('#accept').click( function () {
|
||||
|
||||
location.href='${url_redirect|n}'
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<%block name="form">
|
||||
</%block>
|
||||
4
paramecio2/libraries/templates/utils/admin.phtml
Normal file
4
paramecio2/libraries/templates/utils/admin.phtml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
${show_flash_message()|n}
|
||||
<!--<h1>${admin.title}</h1>-->
|
||||
<p><a href="${add_get_parameters(admin.url, op_admin='1')}">${lang('common', 'add_item', 'Add new item')}</a></p>
|
||||
${admin.list.show()|n}
|
||||
21
paramecio2/libraries/templates/utils/insertform.phtml
Normal file
21
paramecio2/libraries/templates/utils/insertform.phtml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<p><a href="${admin.url_redirect}">${admin.text_home|n}</a> >> \
|
||||
% if id!='0':
|
||||
${title_edit} \
|
||||
%else:
|
||||
${title_edit} \
|
||||
%endif
|
||||
<%
|
||||
|
||||
enctype_txt=''
|
||||
|
||||
if enctype:
|
||||
enctype_txt='enctype="multipart/form-data"'
|
||||
|
||||
%>
|
||||
</p>
|
||||
<form method="post" action="${url_action}" ${enctype_txt|n}>
|
||||
<h2>${title_edit}</h2>
|
||||
<span class="error">${model.query_error}</span>
|
||||
${ form|n }
|
||||
<p><input type="submit" value="${lang('common', 'send', 'Send') }"></p>
|
||||
</form>
|
||||
135
paramecio2/libraries/templates/utils/list.phtml
Normal file
135
paramecio2/libraries/templates/utils/list.phtml
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<%def name="select_field(field)">
|
||||
% if simplelist.search_field==field:
|
||||
selected \
|
||||
% endif
|
||||
</%def>
|
||||
<%def name="set_css_arrow(simplelist, field)">
|
||||
% if simplelist.order_field==field:
|
||||
<i class="fa fa-arrow-${simplelist.order_class[simplelist.order]}" aria-hidden="true"></i>
|
||||
% endif
|
||||
</%def>
|
||||
% if simplelist.yes_search:
|
||||
<div class="form">
|
||||
<form method="get" action="${simplelist.url}">
|
||||
${lang('common','search', 'Search')}: <input type="text" name="search_text" value="${simplelist.search_text|n}">
|
||||
<select name="search_field">
|
||||
% for field in simplelist.search_fields:
|
||||
<option value="${simplelist.model.fields[field].name}" ${select_field(field)}>${simplelist.model.fields[field].label}</option>
|
||||
% endfor
|
||||
</select>
|
||||
<input type="submit" value="${lang('common', 'search', 'Search')}" />
|
||||
</form>
|
||||
</div>
|
||||
% endif
|
||||
% if not simplelist.table_div:
|
||||
|
||||
<table class="table_list" id="${simplelist.model.name}_table">
|
||||
<tr class="title_list">
|
||||
% for field in simplelist.fields_showed:
|
||||
<td class="${simplelist.model.fields[field].name}_td"><a href="${add_get_parameters(simplelist.url, order_field=field, begin_page=simplelist.begin_page, order=simplelist.change_order[field], search_text=simplelist.search_text, search_field=simplelist.search_field)}" class="">${set_css_arrow(simplelist, field)}${simplelist.model.fields[field].label}</a></td>
|
||||
% endfor
|
||||
% for extra_field in simplelist.arr_extra_fields:
|
||||
<td class="options_td">${ extra_field }</td>
|
||||
% endfor
|
||||
</tr>
|
||||
<%
|
||||
pos=0
|
||||
%>
|
||||
% for row in list:
|
||||
<%
|
||||
if not 'pos' in row:
|
||||
row['pos']=pos
|
||||
%>
|
||||
<tr class="row_list">
|
||||
% for field in simplelist.fields_showed:
|
||||
% if simplelist.model.fields[field].escape==True:
|
||||
%if type(simplelist.model.fields[field]).__name__!='ForeignKeyField':
|
||||
<td class="${simplelist.model.fields[field].name}_td">${simplelist.model.fields[field].show_formatted(row[field])}</td>
|
||||
% else:
|
||||
<td class="${simplelist.model.fields[field].name}_td">${simplelist.model.fields[field].show_formatted(row[field])}${str(simplelist.model.fields[field].related_model.fields[simplelist.model.fields[field].named_field].show_formatted(row[field]))}</td>
|
||||
% endif
|
||||
% else:
|
||||
%if type(simplelist.model.fields[field]).__name__!='ForeignKeyField':
|
||||
<td class="${simplelist.model.fields[field].name}_td">${str(simplelist.model.fields[field].show_formatted(row[field]))|n}</td>
|
||||
% else:
|
||||
<td class="${simplelist.model.fields[field].name}_td">${str(simplelist.model.fields[field].related_model.fields[simplelist.model.fields[field].named_field].show_formatted(row[field]))|n}</td>
|
||||
% endif
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
% for extra_field_func in simplelist.arr_extra_options:
|
||||
<td class="options_td">${ simplelist.set_options(extra_field_func, row)|n }</td>
|
||||
% endfor
|
||||
</tr>
|
||||
<%
|
||||
pos+=1
|
||||
%>
|
||||
% endfor
|
||||
</table>
|
||||
|
||||
% else:
|
||||
|
||||
<%
|
||||
|
||||
size_td=round(100/(len(simplelist.fields_showed)+len(simplelist.arr_extra_options)))
|
||||
|
||||
%>
|
||||
|
||||
<div class="table_list" id="${simplelist.model.name}_table">
|
||||
<div class="${simplelist.model.name}_tr tr_list_div">
|
||||
% for field in simplelist.fields_showed:
|
||||
<div class="${simplelist.model.fields[field].name}_td fields_span_title" style="width: ${size_td}%;"><a href="${add_get_parameters(simplelist.url, order_field=field, begin_page=simplelist.begin_page, order=simplelist.change_order[field], search_text=simplelist.search_text, search_field=simplelist.search_field)}" class="">${set_css_arrow(simplelist, field)}${simplelist.model.fields[field].label}</a></div>
|
||||
% endfor
|
||||
% for extra_field in simplelist.arr_extra_fields:
|
||||
<div class="fields_span_title options_td" style="width: ${size_td}%;">${ extra_field }</div>
|
||||
% endfor
|
||||
</div>
|
||||
<div class="table_rows ${simplelist.model.name}_table_rows" id="${simplelist.model.name}_table_rows">
|
||||
<%
|
||||
pos=0
|
||||
%>
|
||||
% for row in list:
|
||||
<div id="${simplelist.model.name}_table_${row['id']}" class="${simplelist.model.name}_table_row" style="clear: both;overflow: hidden;">
|
||||
<%
|
||||
if not 'pos' in row:
|
||||
row['pos']=pos
|
||||
%>
|
||||
|
||||
% for field in simplelist.fields_showed:
|
||||
% if simplelist.model.fields[field].escape==True:
|
||||
<div class="${simplelist.model.fields[field].name}_td fields_span_table_data" style="width: ${size_td}%;">
|
||||
%if type(simplelist.model.fields[field]).__name__!='ForeignKeyField':
|
||||
${simplelist.model.fields[field].show_formatted(row[field])}
|
||||
% else:
|
||||
${str(simplelist.model.fields[field].related_model.fields[simplelist.model.fields[field].named_field].show_formatted(row[field]))}
|
||||
% endif
|
||||
</div>
|
||||
% else:
|
||||
<div class="${simplelist.model.fields[field].name}_td fields_span_table_data" style="width: ${size_td}%;">
|
||||
%if type(simplelist.model.fields[field]).__name__!='ForeignKeyField':
|
||||
${str(simplelist.model.fields[field].show_formatted(row[field]))|n}
|
||||
% else:
|
||||
${str(simplelist.model.fields[field].related_model.fields[simplelist.model.fields[field].named_field].show_formatted(row[field]))|n}
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
% for extra_field_func in simplelist.arr_extra_options:
|
||||
<div class="options_td fields_span_table_data" style="width: ${size_td}%;">${ simplelist.set_options(extra_field_func, row)|n }</div>
|
||||
% endfor
|
||||
<%
|
||||
pos+=1
|
||||
%>
|
||||
</div>
|
||||
% endfor
|
||||
</div>
|
||||
<br clear="all" />
|
||||
</div>
|
||||
|
||||
% endif
|
||||
<p>
|
||||
% if pages!='':
|
||||
${lang('common', 'pages', 'Pages')}: ${pages|n}
|
||||
% endif
|
||||
</p>
|
||||
85
paramecio2/libraries/templates/utils/translations.phtml
Normal file
85
paramecio2/libraries/templates/utils/translations.phtml
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<div id="container_translation">
|
||||
<div class="flash" style="display:none;">${lang('admin', 'translation_saved_sucessfully', 'Translation saved sucessfully')}</div>
|
||||
<br />
|
||||
<form method="get" action="">
|
||||
${lang('admin', 'modules', 'Modules')}
|
||||
${form_module.form()|n}
|
||||
<input type="submit" value="${lang('admin', 'change_module_to_translate', 'Change module to translate')}" />
|
||||
</form>
|
||||
<div id="saving" style="display:none;"><i class="fa fa-circle-o-notch fa-2x fa-spin fa-fw"></i> ${lang('admin', 'saving_translation', 'Saving translation')}</div>
|
||||
<form method="post" action="#" id="send_text">
|
||||
% if len(arr_i18n_form):
|
||||
|
||||
<p><input type="submit" value="${lang('admin', 'send', 'Send')}" /></p>
|
||||
|
||||
% for i18n_form in arr_i18n_form:
|
||||
|
||||
<p>${i18n_form.form()|n}</p>
|
||||
|
||||
% endfor
|
||||
|
||||
<p><input type="submit" value="${lang('admin', 'send', 'Send')}" /></p>
|
||||
|
||||
% endif
|
||||
${csrf_token("csrf_token")|n}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$('#send_text').submit( function () {
|
||||
|
||||
$('#send_text').hide();
|
||||
$('#saving').show();
|
||||
|
||||
url="${make_admin_url('lang/translations',{'module_admin': selected_module, 'op': '1'})}";
|
||||
|
||||
/*data=$(this).serializeArray().reduce(function(obj, item) {
|
||||
obj[item.name] = item.value;
|
||||
return obj;
|
||||
}, {});*/
|
||||
|
||||
data=$(this).serialize()
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: data,
|
||||
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
success: function (data) {
|
||||
|
||||
$('#saving').hide();
|
||||
|
||||
if(!data.error) {
|
||||
|
||||
$('#send_text').show();
|
||||
$('.flash').show();
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
$(".flash").fadeOut(1000)
|
||||
|
||||
}, 3000);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
alert('Error: cannot update the translations');
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function (data) {
|
||||
|
||||
alert(JSON.stringify(data));
|
||||
$('#send_text').show();
|
||||
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
</script>
|
||||
8
paramecio2/libraries/templates/utils/verify_delete.phtml
Normal file
8
paramecio2/libraries/templates/utils/verify_delete.phtml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<form method="post" action="${add_get_parameters(url, id=item_id, op_admin=op_admin, verified=verified)}">
|
||||
<div class="form">
|
||||
<!-- <input type="hidden" name="id" value="${item_id}">
|
||||
<input type="hidden" name="op_admin" value="${op_admin}">
|
||||
<input type="hidden" name="verified" value="${verified}">-->
|
||||
<input type="submit" value="${lang('common', 'delete_item_you_sure', 'Are you sure for delete this item?')}" />
|
||||
</div>
|
||||
</form>
|
||||
Loading…
Add table
Add a link
Reference in a new issue