Просмотр исходного кода

[minor] fixed 403s and 404s

version-14
Rushabh Mehta 11 лет назад
Родитель
Сommit
a2eb9820a0
7 измененных файлов: 18 добавлений и 14 удалений
  1. +0
    -1
      public/js/legacy/form.js
  2. +3
    -1
      public/js/wn/form/layout.js
  3. +1
    -1
      public/js/wn/request.js
  4. +1
    -1
      public/js/wn/views/container.js
  5. +1
    -1
      public/js/wn/views/formview.js
  6. +11
    -8
      public/js/wn/views/pageview.js
  7. +1
    -1
      public/js/wn/views/reportview.js

+ 0
- 1
public/js/legacy/form.js Просмотреть файл

@@ -353,7 +353,6 @@ _f.Frm.prototype.check_doc_perm = function() {
this.perm = wn.perm.get_perm(dt, dn);
if(!this.perm[0][READ]) {
wn.set_route("403");
return 0;
}
return 1


+ 3
- 1
public/js/wn/form/layout.js Просмотреть файл

@@ -115,7 +115,9 @@ wn.ui.form.Layout = Class.extend({
});
}
if(df.description) {
$('<div class="col-md-12 small text-muted">' + df.description + '</div>').appendTo(this.section);
$('<div class="col-md-12 small text-muted">' + df.description + '</div>')
.css("padding-left", "40px")
.appendTo(this.section);
}
if(df.label || df.description) {
// spacer


+ 1
- 1
public/js/wn/request.js Просмотреть файл

@@ -170,7 +170,7 @@ wn.request.cleanup = function(opts, r) {
}
if(r['403']) {
wn.set_route('403');
wn.show_not_permitted(wn.get_route_str());
}

if(r.docs) {


+ 1
- 1
public/js/wn/views/container.js Просмотреть файл

@@ -88,7 +88,7 @@ wn.views.Factory = Class.extend({
if(route[1]) {
me.make(route);
} else {
wn.set_route('404');
wn.show_not_found(route);
}
}
},


+ 1
- 1
public/js/wn/views/formview.js Просмотреть файл

@@ -44,7 +44,7 @@ wn.views.FormFactory = wn.views.Factory.extend({
wn.set_route("Form", dt, new_name)
}
} else {
wn.set_route('404');
wn.show_not_found(route);
}
return;
}


+ 11
- 8
public/js/wn/views/pageview.js Просмотреть файл

@@ -38,7 +38,7 @@ wn.views.pageview = {
wn.views.pageview.with_page(name, function(r) {
if(r && r.exc) {
if(!r['403'])
wn.set_route('404');
wn.show_not_found(name);
} else if(!wn.pages[name]) {
new wn.views.Page(name);
}
@@ -59,6 +59,10 @@ wn.views.Page = Class.extend({
wn.pages[window.page_name] = this.wrapper;
} else {
this.pagedoc = locals.Page[this.name];
if(!this.pagedoc) {
wn.show_not_found(name);
return;
}
this.wrapper = wn.container.add_page(this.name);
this.wrapper.label = this.pagedoc.title || this.pagedoc.name;
this.wrapper.page_name = this.pagedoc.name;
@@ -89,21 +93,20 @@ wn.views.Page = Class.extend({
}
})


wn.standard_pages["404"] = function() {
var page = wn.container.add_page('404');
wn.show_not_found = function(page_name) {
var page = wn.pages[page_name] || wn.container.add_page(page_name);
$(page).html('<div class="appframe col-md-12">\
<h3><i class="icon-exclamation-sign"></i> '+wn._('Not Found')+'</h3><br>\
<p>'+wn._('Sorry we were unable to find what you were looking for.')+'</p>\
<p><a href="#">'+wn._('Go back to home')+'</a></p>\
</div>');
};
}

wn.standard_pages["403"] = function() {
var page = wn.container.add_page('403');
wn.show_not_permitted = function(page_name) {
var page = wn.pages[page_name] || wn.container.add_page(page_name);
$(page).html('<div class="appframe col-md-12">\
<h3><i class="icon-minus-sign"></i> '+wn._('Not Permitted')+'</h3><br>\
<p>'+wn._('Sorry you are not permitted to view this page.')+'.</p>\
<p><a href="#">'+wn._('Go back to home')+'</a></p>\
</div>');
};
}

+ 1
- 1
public/js/wn/views/reportview.js Просмотреть файл

@@ -10,7 +10,7 @@ wn.views.ReportFactory = wn.views.Factory.extend({
wn.views.ReportViewPage = Class.extend({
init: function(doctype, docname) {
if(!wn.model.can_get_report(doctype)) {
wn.set_route("403");
wn.show_not_permitted(wn.get_route_str());
return;
};



Загрузка…
Отмена
Сохранить