web/ldt/templates/admin/cms_change_form.html
changeset 0 ecdfc63274bf
equal deleted inserted replaced
-1:000000000000 0:ecdfc63274bf
       
     1 {% extends "admin/page_change_form.html" %}
       
     2 {% load i18n admin_modify adminmedia cms_tags cms_admin %}
       
     3 {% block js_import %}
       
     4 {% endblock %}
       
     5 {% block extrahead %}
       
     6 {{ block.super }}
       
     7 {% if not add %}
       
     8 	<script type="text/javascript" src="{{ CMS_MEDIA_URL }}js/change_form.js"></script>
       
     9 {% endif %}
       
    10 <script type="text/javascript" src="{% admin_media_prefix %}js/urlify.js"></script>
       
    11 
       
    12 {% if add %}
       
    13 	<script type="text/javascript">
       
    14 	$(document).ready(function(){
       
    15 		$("#id_title").keyup(function() {
       
    16 	        var e = $("#id_slug")[0];
       
    17 	        if (!e._changed) {
       
    18 	            e.value = URLify(this.value, 64);
       
    19 	        }
       
    20 	    });
       
    21 	});
       
    22 	</script>
       
    23 {% endif %}
       
    24 
       
    25 
       
    26 {% endblock %}
       
    27 
       
    28 {% block content_title %}
       
    29 	{% if moderation_delete_request %}
       
    30 	<h1 class="moderation-approve-deletion">{% trans "Approve page deletion" %}</h1>
       
    31 
       
    32 	{% else %}
       
    33 
       
    34 	<h1>{{ title }}
       
    35 	{% if CMS_MODERATOR %}
       
    36 		{% if moderation_required %}<span class="moderation-requires-approvement">{% blocktrans %}(requires approvement at {{ moderation_level }} level){% endblocktrans %}</span>
       
    37 		{% else %}<span>{% trans '(you can perform actions on this page directly)' %}</span>
       
    38 		{% endif %}
       
    39 	{% endif %}
       
    40 	</h1>
       
    41 	{% endif %}
       
    42 	
       
    43 {% endblock %}
       
    44 
       
    45 {% block content %}<div id="content-main">
       
    46 
       
    47 {% block object-tools %}
       
    48 {% if change %}{% if not is_popup %}
       
    49   <ul class="object-tools">
       
    50 	{% if moderation_delete_request %}<li><a href="remove-delete-state/" class="approvelink">{% trans "Remove delete request" %}</a></li>{% endif %}  	
       
    51 	{% if moderator_should_approve %}
       
    52 	<li><a href="approve/" class="approvelink">{% if moderation_delete_request %}{% trans "Approve delete" %}{% else %}{% trans "Approve" %} {% trans "draft" %}{% endif %}</a></li>
       
    53 	<li><a href="{% if cl.current_site %}{% ifnotequal cl.current_site site %}http://{{ cl.current_site.domain }}{% endifnotequal %}{% endif %}{{ page.get_absolute_url }}?preview&draft=1" class="previewdraftlink">{% trans "Preview" %} {% trans "draft" %}</a></li>
       
    54 	{% endif %}
       
    55 	
       
    56 	<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
       
    57   	{% if has_absolute_url %}<li><a href="{% if cl.current_site %}{% ifnotequal cl.current_site site %}http://{{ cl.current_site.domain }}{% endifnotequal %}{% endif %}{{ page|preview_link:language }}?preview" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
       
    58   </ul>
       
    59 {% endif %}{% endif %}
       
    60 {% endblock %}
       
    61 
       
    62 
       
    63 <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="?language={{ language }}{%if request.GET.target %}&amp;target={{ request.GET.target }}{% endif %}&amp;{%if request.GET.target %}position={{ request.GET.position }}{% endif %}" method="post" id="page_form">{% block form_top %}{% endblock %}
       
    64 {{ adminForm.fields.parent }}
       
    65 
       
    66 <input type="hidden" name="language" value="{{ language }}" />
       
    67 
       
    68 {% if show_language_tabs %}
       
    69 <div id="page_form_lang_tabs">
       
    70     {% for lang_code, lang_name in traduction_language %}
       
    71         <input type="button" onclick="trigger_lang_button(this,'./?language={{lang_code}}');"
       
    72             class="language_button {% ifequal lang_code language %}selected{% endifequal %}"
       
    73             id="debutton" name="{{lang_code}}" value="{{lang_name}}" /> 
       
    74     {% endfor %}
       
    75 </div>
       
    76 {% endif %}
       
    77 
       
    78 
       
    79 <div id="lang_tab_content">
       
    80 {% if show_language_tabs %}
       
    81 <h2 class="header"></h2>
       
    82 {% endif %}
       
    83 {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
       
    84 {% if save_on_top %}{% submit_row %}{% endif %}
       
    85 {% if errors %}
       
    86     <p class="errornote">
       
    87     {% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
       
    88     </p>
       
    89     <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
       
    90 {% endif %}
       
    91 
       
    92 {% for fieldset in adminform %}
       
    93   {% include "admin/cms/page/includes/fieldset.html" %}
       
    94 {% endfor %}
       
    95 
       
    96 
       
    97 {% for inline_admin_formset in inline_admin_formsets %}
       
    98     {% include inline_admin_formset.opts.template %}
       
    99 {% endfor %}
       
   100 
       
   101 
       
   102 {% if not add %}
       
   103 	{% if CMS_PERMISSION and has_change_permissions_permission %}
       
   104 		<div class="inline-group">
       
   105 			<div class="tabular inline-related">
       
   106 				<fieldset id="inherited_permissions" class="module aligned collapse">
       
   107 				  <h2>{% trans 'All permissions' %}</h2>
       
   108 				  <div class="loading">{% trans 'Loading...' %}</div>
       
   109 				  <div class="load">./permissions/</div>
       
   110 				</fieldset>
       
   111 			</div>
       
   112 		</div>
       
   113 	{% endif %}
       
   114 
       
   115 	{% if CMS_MODERATOR and has_moderate_permission %}
       
   116 		<div class="inline-group">
       
   117 			<div class="tabular inline-related">
       
   118 				<fieldset id="inherited_permissions" class="module aligned collapse">
       
   119 				  <h2 class="load_remote">{% trans 'Page states' %}</h2>
       
   120 				  <div class="loading">{% trans 'Loading...' %}</div>
       
   121 				  <div class="load">./moderation-states/</div>
       
   122 				</fieldset>
       
   123 			</div>
       
   124 		</div>
       
   125 	{% endif %}
       
   126 
       
   127 	{% if moderation_delete_request %}<script type="text/javascript">
       
   128 		$(function(){
       
   129 			// disable all fields
       
   130 			function lockControls(){
       
   131 				$('input,select,textarea').attr("disabled", "disabled");
       
   132 				$('a[id^=add_],span[class^=add-plugin],a[class^=selector-],p[class^=selector-]').remove();
       
   133 			}
       
   134 			$('fieldset[class=collapsed]').remove();
       
   135 			lockControls();
       
   136 			setTimeout(lockControls,200);
       
   137 		});
       
   138 	</script>{% endif %}
       
   139 
       
   140 	{% if CMS_MODERATOR and moderation_required %}
       
   141 		<div id="dialog" title="Approve dialog">
       
   142 			<p>{% blocktrans %}This page must be moderated at level {{ moderation_level }}, post a message for moderator.{% endblocktrans %}</p>
       
   143 			<div class="row"><input type="text" name="df_moderator_message" id="id_df_moderator_message" class="wide" value=""/></div>
       
   144 			<div class="row"><input type="checkbox" name="df_moderator_state" id="id_df_moderator_state" value="1"/><label for="id_df_moderator_reguest">{% trans 'Request approvemet' %}</label></div>
       
   145 		</div>
       
   146 
       
   147 		<script type="text/javascript">
       
   148 			$(function(){
       
   149 				// override standard uncolapse_all javascript function, we need to call it
       
   150 				// only if there is submit, but submit might be cancelled over dialog.
       
   151 				var old_uncollapse_all = CollapsedFieldsets.uncollapse_all;
       
   152 				CollapsedFieldsets.uncollapse_all = function() {}
       
   153 
       
   154 				var submitActor;
       
   155 				var forceSubmit = false;
       
   156 				var seen = false;
       
   157 
       
   158 				// change submit states, open dialog
       
   159 				$('#page_form').submit(function(event){
       
   160 					return showDialog(event);
       
   161 				});
       
   162 
       
   163 				$('#page_form input[name=_continue]').click(function(event){
       
   164 					return showDialog(event, this);
       
   165 				});
       
   166 
       
   167 				function showDialog(event, actor) {
       
   168 					if (forceSubmit) return true; // escape sequence
       
   169 
       
   170 					if (!seen) {
       
   171 						// show previously posted message if there were an error
       
   172 						$('#id_df_moderator_message').val($('#id_moderator_message').val());
       
   173 					}
       
   174 					seen = true
       
   175 					event.preventDefault();
       
   176 					submitActor = actor;
       
   177 					$('#dialog').dialog('open');
       
   178 					return false;
       
   179 				}
       
   180 
       
   181 				function dialogSave(){
       
   182 					// assign values from dialog form to real form
       
   183 					$('#id_moderator_message').val($('#id_df_moderator_message').val());
       
   184 					$('#id_moderator_state').val(
       
   185 						$('#id_df_moderator_state').is(':checked') ? $('#id_df_moderator_state').val() : 0 
       
   186 					);
       
   187 
       
   188 					old_uncollapse_all(); // uncolapse all fields django way
       
   189 					$('#dialog').dialog('close');
       
   190 					forceSubmit = true;
       
   191 					$(submitActor || '#page_form input[name=_save]').click();
       
   192 					return false;
       
   193 				}
       
   194 
       
   195 				$('#dialog').dialog({
       
   196 					bgiframe: true,
       
   197 					autoOpen: false,
       
   198 					height: 200,
       
   199 					width: 400,
       
   200 					modal: true,
       
   201 					buttons: {
       
   202 						Cancel: function() {
       
   203 							$(this).dialog('close');
       
   204 						},
       
   205 						Save: function() {
       
   206 							dialogSave();
       
   207 						}
       
   208 
       
   209 					},
       
   210 					open: function(){
       
   211 						var val = $('#id_moderator_state').val();
       
   212 						$('#id_df_moderator_state').attr('checked', val >= 1 ? 'checked': '');
       
   213 						$('#id_df_moderator_message')
       
   214 							.focus()
       
   215 							.keydown(function(event) { if (event.keyCode == 13) dialogSave()});
       
   216 
       
   217 						// add default button class to last rendered button (Save)
       
   218 						$(this.uiDialogButtonPane).find('div.ui-dialog-buttonpane button:last').addClass('default');
       
   219 					},
       
   220 					close: function(){
       
   221 						forceSubmit = false;
       
   222 					}
       
   223 				});
       
   224 			});
       
   225 		</script>
       
   226 	{% endif %}
       
   227 
       
   228 {% endif %}
       
   229 
       
   230 {% block after_related_objects %}{% endblock %}
       
   231 
       
   232 {% if add %}
       
   233 	<div class="submit-row"{% if is_popup %} style="overflow: auto;"{% endif %}>
       
   234 		<input type="submit" name="_save" class="default" value="{% trans 'Save' %}" {{ onclick_attrib }}/>
       
   235 		<input type="submit" name="_continue" value="{% trans 'Save and continue editing' %}" {{ onclick_attrib }}/>
       
   236 	</div>
       
   237 {% else %}
       
   238 	{% if not moderation_delete_request %}{% submit_row %}{% endif %}
       
   239 {% endif %}
       
   240 
       
   241 {% if add %}
       
   242    <script type="text/javascript">document.getElementById("{{ adminform.first_field.auto_id }}").focus();</script>
       
   243 {% endif %}
       
   244 
       
   245 {# JavaScript for prepopulated fields #}
       
   246 {% prepopulated_fields_js %}
       
   247 
       
   248 </div>
       
   249 </form></div>
       
   250 {% endblock %}