From c1d277be9cfebc14a4e20fe81c8b9acfc8651003 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Sun, 15 Mar 2020 23:06:54 +0000 Subject: [PATCH] Authorisation template work --- PyRIGS/decorators.py | 2 +- PyRIGS/urls.py | 12 +- RIGS/static/js/raven.js | 2 + RIGS/static/js/ravenjs.js | 1 - RIGS/templates/client_eventdetails.html | 68 ++++----- RIGS/templates/event_detail.html | 2 +- RIGS/templates/event_detail_buttons.html | 6 +- RIGS/templates/event_table.html | 5 +- RIGS/templates/eventauthorisation_form.html | 19 +-- .../templates/eventauthorisation_request.html | 37 ++--- .../eventauthorisation_request_error.html | 14 +- RIGS/templates/profile_detail.html | 16 +- RIGS/urls.py | 2 +- RIGS/views.py | 5 + gulpfile.js | 6 +- package.json | 2 +- templates/base.html | 50 +++--- templates/base_client.html | 112 +------------- templates/base_embed.html | 2 +- templates/base_rigs.html | 143 ++++++++++-------- templates/registration/login.html | 2 +- templates/registration/loginform.html | 2 +- 22 files changed, 202 insertions(+), 308 deletions(-) create mode 100644 RIGS/static/js/raven.js delete mode 100644 RIGS/static/js/ravenjs.js diff --git a/PyRIGS/decorators.py b/PyRIGS/decorators.py index 6d48e5e1..3ad24ccb 100644 --- a/PyRIGS/decorators.py +++ b/PyRIGS/decorators.py @@ -111,7 +111,7 @@ def nottinghamtec_address_required(function): def wrap(request, *args, **kwargs): # Fail if current user's email address isn't @nottinghamtec.co.uk if not request.user.email.endswith('@nottinghamtec.co.uk'): - error_resp = render(request, 'RIGS/eventauthorisation_request_error.html') + error_resp = render(request, 'eventauthorisation_request_error.html') return error_resp return function(request, *args, **kwargs) diff --git a/PyRIGS/urls.py b/PyRIGS/urls.py index 646e2dbf..96367865 100644 --- a/PyRIGS/urls.py +++ b/PyRIGS/urls.py @@ -15,21 +15,21 @@ urlpatterns = [ path('', include('RIGS.urls')), path('assets/', include('assets.urls')), + path('user/', include('django.contrib.auth.urls')), + path('user/', include('registration.backends.default.urls')), path('user/register/', RegistrationView.as_view(form_class=forms.ProfileRegistrationFormUniqueEmail), name="registration_register"), path('user/login/', LoginView.as_view(authentication_form=forms.CheckApprovedForm), name='login'), path('user/login/embed/', xframe_options_exempt(views.LoginEmbed.as_view()), name='login_embed'), # User editing - path('user/', login_required(views.ProfileDetail.as_view()), name='profile_detail'), - path('user//', - permission_required_with_403('RIGS.view_profile')(views.ProfileDetail.as_view()), - name='profile_detail'), path('user/edit/', login_required(views.ProfileUpdateSelf.as_view()), name='profile_update_self'), path('user/reset_api_key', login_required(views.ResetApiKey.as_view(permanent=False)), name='reset_api_key'), - path('user/', include('django.contrib.auth.urls')), - path('user/', include('registration.backends.default.urls')), + path('user/', login_required(views.ProfileDetail.as_view()), name='profile_detail'), + path('user//', + permission_required_with_403('RIGS.view_profile')(views.ProfileDetail.as_view()), + name='profile_detail'), path('admin/', admin.site.urls), ] diff --git a/RIGS/static/js/raven.js b/RIGS/static/js/raven.js new file mode 100644 index 00000000..4f682811 --- /dev/null +++ b/RIGS/static/js/raven.js @@ -0,0 +1,2 @@ +/*! Raven.js 3.27.2 (6d91db933) | github.com/getsentry/raven-js */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Raven=e()}}((function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){var n=t[a][1][e];return i(n||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;athis._globalOptions.maxBreadcrumbs&&this._breadcrumbs.shift(),this},addPlugin:function(e){var t=[].slice.call(arguments,1);return this._plugins.push([e,t]),this._isRavenInstalled&&this._drainPlugins(),this},setUserContext:function(e){return this._globalContext.user=e,this},setExtraContext:function(e){return this._mergeContext("extra",e),this},setTagsContext:function(e){return this._mergeContext("tags",e),this},clearContext:function(){return this._globalContext={},this},getContext:function(){return JSON.parse(i(this._globalContext))},setEnvironment:function(e){return this._globalOptions.environment=e,this},setRelease:function(e){return this._globalOptions.release=e,this},setDataCallback:function(e){var t=this._globalOptions.dataCallback;return this._globalOptions.dataCallback=K(t,e),this},setBreadcrumbCallback:function(e){var t=this._globalOptions.breadcrumbCallback;return this._globalOptions.breadcrumbCallback=K(t,e),this},setShouldSendCallback:function(e){var t=this._globalOptions.shouldSendCallback;return this._globalOptions.shouldSendCallback=K(t,e),this},setTransport:function(e){return this._globalOptions.transport=e,this},lastException:function(){return this._lastCapturedException},lastEventId:function(){return this._lastEventId},isSetup:function(){return!!this._hasJSON&&(!!this._globalServer||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this._logDebug("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var e=A.RavenConfig;e&&this.config(e.dsn,e.config).install()},showReportDialog:function(e){if(q){if(!(e=y({eventId:this.lastEventId(),dsn:this._dsn,user:this._globalContext.user||{}},e)).eventId)throw new a("Missing eventId");if(!e.dsn)throw new a("Missing DSN");var t=encodeURIComponent,n=[];for(var r in e)if("user"===r){var i=e.user;i.name&&n.push("name="+t(i.name)),i.email&&n.push("email="+t(i.email))}else n.push(t(r)+"="+t(e[r]));var o=this._getGlobalServer(this._parseDSN(e.dsn)),s=q.createElement("script");s.async=!0,s.src=o+"/api/embed/error-page/?"+n.join("&"),(q.head||q.body).appendChild(s)}},_ignoreNextOnError:function(){var e=this;this._ignoreOnError+=1,setTimeout((function(){e._ignoreOnError-=1}))},_triggerEvent:function(e,t){var n,r;if(this._hasDocument){for(r in t=t||{},e="raven"+e.substr(0,1).toUpperCase()+e.substr(1),q.createEvent?(n=q.createEvent("HTMLEvents")).initEvent(e,!0,!0):(n=q.createEventObject()).eventType=e,t)w(t,r)&&(n[r]=t[r]);if(q.createEvent)q.dispatchEvent(n);else try{q.fireEvent("on"+n.eventType.toLowerCase(),n)}catch(e){}}},_breadcrumbEventHandler:function(e){var t=this;return function(n){if(t._keypressTimeout=null,t._lastCapturedEvent!==n){var r;t._lastCapturedEvent=n;try{r=C(n.target)}catch(e){r=""}t.captureBreadcrumb({category:"ui."+e,message:r})}}},_keypressEventHandler:function(){var e=this;return function(t){var n;try{n=t.target}catch(e){return}var r=n&&n.tagName;if(r&&("INPUT"===r||"TEXTAREA"===r||n.isContentEditable)){var i=e._keypressTimeout;i||e._breadcrumbEventHandler("input")(t),clearTimeout(i),e._keypressTimeout=setTimeout((function(){e._keypressTimeout=null}),1e3)}}},_captureUrlChange:function(e,t){var n=T(this._location.href),r=T(t),i=T(e);this._lastHref=t,n.protocol===r.protocol&&n.host===r.host&&(t=r.relative),n.protocol===i.protocol&&n.host===i.host&&(e=i.relative),this.captureBreadcrumb({category:"navigation",data:{to:t,from:e}})},_patchFunctionToString:function(){var e=this;e._originalFunctionToString=Function.prototype.toString,Function.prototype.toString=function(){return"function"==typeof this&&this.__raven__?e._originalFunctionToString.apply(this.__orig__,arguments):e._originalFunctionToString.apply(this,arguments)}},_unpatchFunctionToString:function(){this._originalFunctionToString&&(Function.prototype.toString=this._originalFunctionToString)},_instrumentTryCatch:function(){var e=this,t=e._wrappedBuiltIns;function n(t){return function(n,r){for(var i=new Array(arguments.length),o=0;o"}}},a)),t.apply?t.apply(this,i):t(i[0],i[1])}}var r=this._globalOptions.autoBreadcrumbs;function i(n){var i=A[n]&&A[n].prototype;i&&i.hasOwnProperty&&i.hasOwnProperty("addEventListener")&&(D(i,"addEventListener",(function(t){return function(i,o,a,s){try{o&&o.handleEvent&&(o.handleEvent=e.wrap({mechanism:{type:"instrument",data:{target:n,function:"handleEvent",handler:o&&o.name||""}}},o.handleEvent))}catch(e){}var c,l,u;return r&&r.dom&&("EventTarget"===n||"Node"===n)&&(l=e._breadcrumbEventHandler("click"),u=e._keypressEventHandler(),c=function(e){if(e){var t;try{t=e.type}catch(e){return}return"click"===t?l(e):"keypress"===t?u(e):void 0}}),t.call(this,i,e.wrap({mechanism:{type:"instrument",data:{target:n,function:"addEventListener",handler:o&&o.name||""}}},o,c),a,s)}}),t),D(i,"removeEventListener",(function(e){return function(t,n,r,i){try{n=n&&(n.__raven_wrapper__?n.__raven_wrapper__:n)}catch(e){}return e.call(this,t,n,r,i)}}),t))}D(A,"setTimeout",n,t),D(A,"setInterval",n,t),A.requestAnimationFrame&&D(A,"requestAnimationFrame",(function(t){return function(n){return t(e.wrap({mechanism:{type:"instrument",data:{function:"requestAnimationFrame",handler:t&&t.name||""}}},n))}}),t);for(var o=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],a=0;a"}}},n)}))}if(t.xhr&&"XMLHttpRequest"in A){var i=A.XMLHttpRequest&&A.XMLHttpRequest.prototype;D(i,"open",(function(t){return function(n,r){return m(r)&&-1===r.indexOf(e._globalKey)&&(this.__raven_xhr={method:n,url:r,status_code:null}),t.apply(this,arguments)}}),n),D(i,"send",(function(t){return function(){var n=this;function i(){if(n.__raven_xhr&&4===n.readyState){try{n.__raven_xhr.status_code=n.status}catch(e){}e.captureBreadcrumb({type:"http",category:"xhr",data:n.__raven_xhr})}}for(var o=["onload","onerror","onprogress"],a=0;a"}}},t,i)})):n.onreadystatechange=i,t.apply(this,arguments)}}),n)}t.xhr&&F()&&D(A,"fetch",(function(t){return function(){for(var n=new Array(arguments.length),r=0;r2?arguments[2]:void 0;return n&&e._captureUrlChange(e._lastHref,n+""),t.apply(this,arguments)}};D(A.history,"pushState",c,n),D(A.history,"replaceState",c,n)}if(t.console&&"console"in A&&console.log){var l=function(t,n){e.captureBreadcrumb({message:t,level:n.level,category:"console"})};b(["debug","info","warn","error","log"],(function(e,t){N(console,t,l)}))}},_restoreBuiltIns:function(){for(var e;this._wrappedBuiltIns.length;){var t=(e=this._wrappedBuiltIns.shift())[0],n=e[1],r=e[2];t[n]=r}},_restoreConsole:function(){for(var e in this._originalConsoleMethods)this._originalConsole[e]=this._originalConsoleMethods[e]},_drainPlugins:function(){var e=this;b(this._plugins,(function(t,n){var r=n[0],i=n[1];r.apply(e,[e].concat(i))}))},_parseDSN:function(e){var t=I.exec(e),n={},r=7;try{for(;r--;)n[L[r]]=t[r]||""}catch(t){throw new a("Invalid DSN: "+e)}if(n.pass&&!this._globalOptions.allowSecretKey)throw new a("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return n},_getGlobalServer:function(e){var t="//"+e.host+(e.port?":"+e.port:"");return e.protocol&&(t=e.protocol+":"+t),t},_handleOnErrorStackInfo:function(e,t){(t=t||{}).mechanism=t.mechanism||{type:"onerror",handled:!1},this._ignoreOnError||this._handleStackInfo(e,t)},_handleStackInfo:function(e,t){var n=this._prepareFrames(e,t);this._triggerEvent("handle",{stackInfo:e,options:t}),this._processException(e.name,e.message,e.url,e.lineno,n,t)},_prepareFrames:function(e,t){var n=this,r=[];if(e.stack&&e.stack.length&&(b(e.stack,(function(t,i){var o=n._normalizeFrame(i,e.url);o&&r.push(o)})),t&&t.trimHeadFrames))for(var i=0;i0&&(e.breadcrumbs={values:[].slice.call(this._breadcrumbs,0)}),this._globalContext.user&&(e.user=this._globalContext.user),t.environment&&(e.environment=t.environment),t.release&&(e.release=t.release),t.serverName&&(e.server_name=t.serverName),e=this._sanitizeData(e),Object.keys(e).forEach((function(t){(null==e[t]||""===e[t]||_(e[t]))&&delete e[t]})),g(t.dataCallback)&&(e=t.dataCallback(e)||e),e&&!_(e)&&(g(t.shouldSendCallback)&&!t.shouldSendCallback(e)||(this._shouldBackoff()?this._logDebug("warn","Raven dropped error due to backoff: ",e):"number"==typeof t.sampleRate?Math.random() ".length;e&&r++<5&&!("html"===(t=d(e))||r>1&&i+n.length*o+t.length>=80);)n.push(t),i+=t.length,e=e.parentNode;return n.reverse().join(" > ")},htmlElementAsString:d,isSameException:function(e,t){return!g(e,t)&&(e=e.values[0],t=t.values[0],e.type===t.type&&e.value===t.value&&(n=e.stacktrace,r=t.stacktrace,(!o(n)||!o(r))&&m(e.stacktrace,t.stacktrace)));var n,r},isSameStacktrace:m,parseUrl:function(e){if("string"!=typeof e)return{};var t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/),n=t[6]||"",r=t[8]||"";return{protocol:t[2],host:t[4],path:t[5],relative:t[5]+n+r}},fill:function(e,t,n,r){if(null!=e){var i=e[t];e[t]=n(i),e[t].__raven__=!0,e[t].__orig__=i,r&&r.push([e,t,i])}},safeJoin:function(e,t){if(!c(e))return"";for(var n=[],r=0;ri?e(t,n-1):o},serializeKeysForMessage:function(e,t){if("number"==typeof e||"string"==typeof e)return e.toString();if(!Array.isArray(e))return"";if(0===(e=e.filter((function(e){return"string"==typeof e}))).length)return"[object has no keys]";if(t="number"!=typeof t?40:t,e[0].length>=t)return e[0];for(var n=e.length;n>0;n--){var r=e.slice(0,n).join(", ");if(!(r.length>t))return n===e.length?r:r+"…"}return""},sanitize:function(e,t){if(!c(t)||c(t)&&0===t.length)return e;var n,i=p(t);try{n=JSON.parse(r(e))}catch(t){return e}return function e(t){return c(t)?t.map((function(t){return e(t)})):a(t)?Object.keys(t).reduce((function(n,r){return i.test(r)?n[r]="********":n[r]=e(t[r]),n}),{}):t}(n)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{7:7}],6:[function(e,t,n){(function(n){var r=e(5),i={collectWindowErrors:!0,debug:!1},o="undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:{},a=[].slice,s=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function c(){return"undefined"==typeof document||null==document.location?"":document.location.href}i.report=function(){var e,t,n=[],l=null,u=null,f=null;function h(e,t){var r=null;if(!t||i.collectWindowErrors){for(var o in n)if(n.hasOwnProperty(o))try{n[o].apply(null,[e].concat(a.call(arguments,2)))}catch(e){r=e}if(r)throw r}}function p(t,n,o,a,l){var u=r.isErrorEvent(l)?l.error:l,p=r.isErrorEvent(t)?t.message:t;if(f)i.computeStackTrace.augmentStackTraceWithInitialElement(f,n,o,p),d();else if(u&&r.isError(u))h(i.computeStackTrace(u),!0);else{var g,m={url:n,line:o,column:a},v=void 0;if("[object String]"==={}.toString.call(p))(g=p.match(s))&&(v=g[1],p=g[2]);m.func="?",h({name:v,message:p,url:c(),stack:[m]},!0)}return!!e&&e.apply(this,arguments)}function d(){var e=f,t=l;l=null,f=null,u=null,h.apply(null,[e,!1].concat(t))}function g(e,t){var n=a.call(arguments,1);if(f){if(u===e)return;d()}var r=i.computeStackTrace(e);if(f=r,u=e,l=n,setTimeout((function(){u===e&&d()}),r.incomplete?2e3:0),!1!==t)throw e}return g.subscribe=function(r){!function(){if(t)return;e=o.onerror,o.onerror=p,t=!0}(),n.push(r)},g.unsubscribe=function(e){for(var t=n.length-1;t>=0;--t)n[t]===e&&n.splice(t,1)},g.uninstall=function(){!function(){if(!t)return;o.onerror=e,t=!1,e=void 0}(),n=[]},g}(),i.computeStackTrace=function(){function e(e){if(void 0!==e.stack&&e.stack){for(var t,n,r,i=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack||[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,o=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,s=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,l=/\((\S*)(?::(\d+))(?::(\d+))\)/,u=e.stack.split("\n"),f=[],h=(/^(.*) is undefined$/.exec(e.message),0),p=u.length;h eval")>-1&&(t=s.exec(n[3]))?(n[3]=t[1],n[4]=t[2],n[5]=null):0!==h||n[5]||void 0===e.columnNumber||(f[0].column=e.columnNumber+1),r={url:n[3],func:n[1]||"?",args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}if(!r.func&&r.line&&(r.func="?"),r.url&&"blob:"===r.url.substr(0,5)){var g=new XMLHttpRequest;if(g.open("GET",r.url,!1),g.send(null),200===g.status){var m=g.responseText||"",v=(m=m.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(v){var _=v[1];"~"===_.charAt(0)&&(_=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+_.slice(1)),r.url=_.slice(0,-4)}}}f.push(r)}return f.length?{name:e.name,message:e.message,url:c(),stack:f}:null}}function t(e,t,n,r){var i={url:t,line:n};if(i.url&&i.line){if(e.incomplete=!1,i.func||(i.func="?"),e.stack.length>0&&e.stack[0].url===i.url){if(e.stack[0].line===i.line)return!1;if(!e.stack[0].line&&e.stack[0].func===i.func)return e.stack[0].line=i.line,!1}return e.stack.unshift(i),e.partial=!0,!0}return e.incomplete=!0,!1}function n(e,o){for(var a,s,l=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,u=[],f={},h=!1,p=n.caller;p&&!h;p=p.caller)if(p!==r&&p!==i.report){if(s={url:null,func:"?",line:null,column:null},p.name?s.func=p.name:(a=l.exec(p.toString()))&&(s.func=a[1]),void 0===s.func)try{s.func=a.input.substring(0,a.input.indexOf("{"))}catch(e){}f[""+p]?h=!0:f[""+p]=!0,u.push(s)}o&&u.splice(0,o);var d={name:e.name,message:e.message,url:c(),stack:u};return t(d,e.sourceURL||e.fileName,e.line||e.lineNumber,e.message||e.description),d}function r(t,r){var o=null;r=null==r?0:+r;try{if(o=e(t))return o}catch(e){if(i.debug)throw e}try{if(o=n(t,r+1))return o}catch(e){if(i.debug)throw e}return{name:t.name,message:t.message,url:c()}}return r.augmentStackTraceWithInitialElement=t,r.computeStackTraceFromStackProp=e,r}(),t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{5:5}],7:[function(e,t,n){function r(e,t){for(var n=0;n0){var s=r(n,this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,o):i.push(o),~r(n,a)&&(a=t.call(this,o,a))}else n.push(a);return null==e?a instanceof Error?function(e){var t={stack:e.stack,message:e.message,name:e.name};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(a):a:e.call(this,o,a)}}(t.exports=function(e,t,n,r){return JSON.stringify(e,i(t,r),n)}).getSerialize=i},{}],8:[function(e,t,n){function r(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function i(e,t,n,i,o,a){return r((s=r(r(t,e),r(i,a)))<<(c=o)|s>>>32-c,n);var s,c}function o(e,t,n,r,o,a,s){return i(t&n|~t&r,e,t,o,a,s)}function a(e,t,n,r,o,a,s){return i(t&r|n&~r,e,t,o,a,s)}function s(e,t,n,r,o,a,s){return i(t^n^r,e,t,o,a,s)}function c(e,t,n,r,o,a,s){return i(n^(t|~r),e,t,o,a,s)}function l(e,t){var n,i,l,u,f;e[t>>5]|=128<>>9<<4)]=t;var h=1732584193,p=-271733879,d=-1732584194,g=271733878;for(n=0;n>5]>>>t%32&255);return n}function f(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+"0123456789abcdef".charAt(15&t);return r}function p(e){return unescape(encodeURIComponent(e))}function d(e){return function(e){return u(l(f(e),8*e.length))}(p(e))}function g(e,t){return function(e,t){var n,r,i=f(e),o=[],a=[];for(o[15]=a[15]=void 0,i.length>16&&(i=l(i,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^i[n],a[n]=1549556828^i[n];return r=l(o.concat(f(t)),512+8*t.length),u(l(a.concat(r),640))}(p(e),p(t))}t.exports=function(e,t,n){return t?n?g(t,e):h(g(t,e)):n?d(e):h(d(e))}},{}]},{},[4])(4)})); \ No newline at end of file diff --git a/RIGS/static/js/ravenjs.js b/RIGS/static/js/ravenjs.js deleted file mode 100644 index 97a01483..00000000 --- a/RIGS/static/js/ravenjs.js +++ /dev/null @@ -1 +0,0 @@ -var querystring=require("querystring"),RavenClient=require("./lib/RavenClient"),HiLoIdGenerator=require("./lib/HiLoIdGenerator"),filter=require("./lib/filter");errorCodes=require("./lib/errorCodes"),_=require("lodash"),inflect=require("i")();var settings={host:"http://localhost:80",idFinder:defaultIdFinder,idGenerator:defaultIdGenerator,useOptimisticConcurrency:!1};function defaultIdFinder(e){if(e)return e["@metadata"]&&e["@metadata"]["@id"]?e["@metadata"]["@id"]:e.hasOwnProperty("id")?e.id:e.hasOwnProperty("Id")?e.Id:void 0}function defaultIdGenerator(e,t,r){if(!e)throw Error("Expected a valid doc object.");if(!t)throw Error("Expected a valid setings object.");if(!t.host)throw Error("Invalid settings. Expected host property.");if(!r||!_(r).isFunction)throw Error("Exepected a valid callback function.");new HiLoIdGenerator(t).nextId((function(t,i){return t?r(t):(collectionName="",e&&e["@metadata"]&&_.isString(e["@metadata"]["Raven-Entity-Name"])&&(collectionName=inflect.camelize(inflect.underscore(e["@metadata"]["Raven-Entity-Name"]),!1)+"/"),i=collectionName+i,r(void 0,i.toString()))}))}exports.connectionString=function(e){var t=this;if(!arguments.length)return settings.host;if(!_.isString(e))throw new Error("Expected a valid raven connection string");var r=querystring.parse(e,";","=");if(!r.Url)throw new Error('Required connection string property "Url" was not specified!');t.host(r.Url),t.database(r.Database),t.username(r.UserName),t.password(r.Password),t.apiKey(r.ApiKey)},exports.host=function(e){if(!arguments.length)return settings.host;if(!_.isString(e))throw new Error("Expected a valid raven host name");if(!~e.indexOf("http://")&&!~e.indexOf("https://"))throw new Error("Expected a host address with http:// or https://");settings.host=e},exports.database=function(e){if(!arguments.length)return settings.database;if(e){if(!_.isString(e))throw new Error("Expected a string for database name");settings.database=e}else settings.database&&delete settings.database},exports.username=function(e){if(!arguments.length)return settings.username;if(e){if(!_.isString(e))throw new Error("Expected a string for username");settings.username=e}else settings.username&&delete settings.username},exports.password=function(e){if(!arguments.length)return settings.password;if(e){if(!_.isString(e))throw new Error("Expected a string for password");settings.password=e}else settings.password&&delete settings.password},exports.apiKey=function(e){if(!arguments.length)return settings.apiKey;if(e){if(!_.isString(e))throw new Error("Expected a string for apiKey");settings.apiKey=e}else settings.apiKey&&delete settings.apiKey},exports.idFinder=function(e){if(!e)return settings.idFinder=defaultidFinder;if(!_(e).isFunction())throw new Error("Expected a valid function to use as the default key finder.");settings.idFinder=e},exports.idGenerator=function(e){if(!e)return settings.idGenerator=defaultIdGenerator;if(!_(e).isFunction())throw new Error("Expected a valid function to use as the default key generator.");settings.idGenerator=e},exports.useOptimisticConcurrency=function(e){if(!e)return settings.useOptimisticConcurrency;if(!_(e).isBoolean())throw new Error("Expected a boolean value when setting useOptimisticConcurrency");settings.useOptimisticConcurrency=e},exports.proxy=function(e){if(!e)return settings.proxy;if(!_.isString(e))throw new Error("Expected a valid proxy host address.");if(!~e.indexOf("http://")&&!~e.indexOf("https://"))throw new Error("Invaid proxy address scheme. Expected http or https scheme.");settings.proxy=e},exports.configure=function(e,t){_(e).isFunction()&&(t=e,e="all");var r=process.env.NODE_ENV||"development";("all"===e||~e.indexOf(r))&&t.call(this)},exports.defaultIdFinder=defaultIdFinder,exports.defaultIdGenerator=defaultIdGenerator,exports.connect=function(e){var t=_(settings).clone();return _(e).isObject()&&(t.host=e.host||t.host,t.database=e.database||t.database,t.username=e.username||t.username,t.password=e.password||t.password,t.apiKey=e.apiKey||t.apiKey,t.idFinder=e.idFinder||t.idFinder,t.idGenerator=e.idGenerator||t.idGenerator,t.proxy=e.proxy||t.proxy,t.useOptimisticConcurrency=e.useOptimisticConcurrency||t.useOptimisticConcurrency),new RavenClient(t)},exports.create=function(e,t){var r={},i={},n=!1;if(e){if(!_(e).isString())throw new Error("Expected a valid string for typeName");i["Raven-Clr-Type"]=e}if(_(t).isBoolean()&&(n=!1===t,t=void 0),t){if(!_(t).isString())throw new Error("Expected a valid string or bool for collectionName");i["Raven-Entity-Name"]=t}else e&&(t=n?e:inflect.pluralize(e),i["Raven-Entity-Name"]=t);return _.isEmpty(i)||(r["@metadata"]=i),r},exports.errorCodes=errorCodes; \ No newline at end of file diff --git a/RIGS/templates/client_eventdetails.html b/RIGS/templates/client_eventdetails.html index 2ec1c56d..e7b88151 100644 --- a/RIGS/templates/client_eventdetails.html +++ b/RIGS/templates/client_eventdetails.html @@ -1,51 +1,51 @@ -
-
-
+
+
+
Contact Details
-
-
Person
-
+
+
Person
+
{% if event.person %} {{ event.person.name }} {% endif %}
-
Email
-
+
Email
+
{{ event.person.email }}
-
Phone Number
-
{{ event.person.phone }}
+
Phone Number
+
{{ event.person.phone }}
{% if event.organisation %} -
-
Organisation
+
+
Organisation Details
-
-
Organisation
-
+
+
Organisation
+
{{ event.organisation.name }}
-
Phone Number
-
{{ object.organisation.phone }}
+
Phone Number
+
{{ object.organisation.phone }}
{% endif %}
-
- {% if event.is_rig and event.internal and perms.RIGS.view_event %} -
+
+
@@ -22,7 +22,7 @@ class="hidden-xs">Duplicate {% if event.is_rig %} {% if event.internal %} - event.auth_request_at %} @@ -32,7 +32,7 @@ {% endif %} " href="{% url 'event_authorise_request' object.pk %}"> - +
{% if event.meet_at %} diff --git a/RIGS/templates/eventauthorisation_form.html b/RIGS/templates/eventauthorisation_form.html index 17762911..41549024 100644 --- a/RIGS/templates/eventauthorisation_form.html +++ b/RIGS/templates/eventauthorisation_form.html @@ -3,12 +3,11 @@ {% load static %} {% block js %} - + - + {% block preload_js %} {% endblock %} @@ -33,39 +33,23 @@ {% include "analytics.html" %} - + +{% endblock %}
{% block content-header %} diff --git a/templates/base_client.html b/templates/base_client.html index 08a2e0ad..4d0191d9 100644 --- a/templates/base_client.html +++ b/templates/base_client.html @@ -1,75 +1,10 @@ -{% load static %} -{% load raven %} +{% extends 'base.html' %} - - - - - {% block title %}{% endblock %} | Rig Information Gathering System - - - - - - - - - - {% block css %} - {% endblock %} - - - - - {% block preload_js %} - {% endblock %} - - {% block extra-head %}{% endblock %} - - - -{% include "analytics.html" %} - - - - - - - - - - -{% block js %} -{% endblock %} - - diff --git a/templates/base_embed.html b/templates/base_embed.html index c4fb417b..bd0f381e 100644 --- a/templates/base_embed.html +++ b/templates/base_embed.html @@ -18,7 +18,7 @@ - + diff --git a/templates/base_rigs.html b/templates/base_rigs.html index f11b05d1..ad86a0f0 100644 --- a/templates/base_rigs.html +++ b/templates/base_rigs.html @@ -8,70 +8,95 @@ {% block titleelements %} {% if user.is_authenticated %} - - + + {% if perms.RIGS.view_invoice %} + {% endif %} - {% if perms.RIGS.add_event %} - - New Event + {% if perms.RIGS.view_person %} + {% endif %} -
- -{% if perms.RIGS.view_invoice %} - {% endif %} - Outstanding - Archive -
- -{% endif %} -{% if perms.RIGS.view_person %} - -{% endif %} -{% if perms.RIGS.view_organisation %} - -{% endif %} -{% if perms.RIGS.view_venue %} - -{% endif %} -
-
-
- + {% if perms.RIGS.view_venue %} + + {% endif %} + +
+
+ +
+
- -
- - - + + + {% endif %} + {% endblock %} {% block js %} diff --git a/templates/registration/login.html b/templates/registration/login.html index be02db72..60ef2d24 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -7,4 +7,4 @@

Rig Information Gathering System

{% include 'registration/loginform.html' %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/templates/registration/loginform.html b/templates/registration/loginform.html index 20fde945..fe1ee44f 100644 --- a/templates/registration/loginform.html +++ b/templates/registration/loginform.html @@ -1,6 +1,6 @@ {% load widget_tweaks %} {% include 'form_errors.html' %} -
+
{% csrf_token %}