PageSourceSearch

https://www.ppfmembers.org.uk/civica/Resources/scripts/Documents/Widgets/DocumentViewer.widget.js

js ppfmembers.org.uk collected 2026-10-07 01:48:33 UTC 3,468 bytes, 85 lines download raw bytes

1/*globals Civica:false */
2/*jshint white: false */
3/*jshint maxlen: 400 */
4/*jshint onevar: false */
5/*jshint nomen: false */
6with (Civica.Globals) {
7    (function (undefined) {
8        $.widget('civica.documentviewer', $.civica.basewidget,
9        {
10            options:
11            {
12                /**
13                 * The document number
14                 * @property options.DocNO
15                 * @type int  */
16                DocNo: null,
17                /**
18                 * Register a callback function to generate the document header
19                 * @property options.GenerateHeaderCallback
20                 * @type function  */
21                GenerateHeaderCallback: null,
22                /**
23                 * Pass in a custom header template
24                 * @property options.HeaderTemplate
25                 * @type function  */
26                HeaderTemplate: null,
27                /**
28                 * OpenLayers specific configuration options
29                 * @property OpenLayersConfiguration
30                 * @type object
31                 * @default {EnableFullScreen:true,EnableZoom: true, EnableRotation: true, EnableMenu: true, EnableMeasurement: true, EnableNotes: true } */
32                OpenLayersConfiguration:
33                {
34                    EnableFullScreen: true,
35                   
36                    EnableZoom: true,
37                    EnableRotation: true,
38                    EnableMenu: true,
39                    EnableMeasurement: true,
40                    EnableNotes: true
41                },
42                UseEmbededViewerForExteranlDoc: false
43            },
44            _create: function () {
45                // Ensure the language data is loaded
46                Civica.Factory.Service('API.Language').WaitForLang('core', $.proxy(this, '_doCreate'), $.proxy(this, '_setUpFail'));
47            },
48            _setUpFail: function () {
49                this.raiseError('Unable to get core language');
50            },
51            _doCreate: function () {
52                if (this.options.DocNo === null || this.options.DocNo === '0') {
53                    this.options.DocNo = Civica.Util.getUrlParameter("DocNo");
54                }
55                this.model = Civica.Factory.Model('UI.DocumentViewer.Main', this.options);
56                // Create view
57                this.controller = Civica.Factory.Controller('DocumentViewer.DocumentViewer',
58                {
59                    el: Civica.Util.CreateChildDOMNode(this.element[0], 'div'),
60                    model: this.model
61                });
62            },
63            _setOption: function (key, value) {
64                this.options[key] = value;
65                if (key === 'DocNo') {
66                    // Recreate the widget if the docno changes
67                    ko.removeNode(this.element);
68                    this.element.empty();
69                    this._doCreate();
70                }
71            },
72            destroy: function () {
73                /// <summary>
74                /// remove contents as the original should be an empty placeholder
75                /// </summary>
76                // remove all children
77                this.element.children().each(function (i, e) {
78                    ko.removeNode(e);
79                });
80                // In jQuery UI 1.8, you must invoke the destroy method from the base widget
81                $.Widget.prototype.destroy.call(this);
82            }
83        });
84    })();
85};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.