├── serv1
├── s5
├── S3
├── s4
└── S2
/serv1:
--------------------------------------------------------------------------------
1 | @ 2sent-1 S '23'
2 | def capitalize(String):
3 | return String.title()
4 |
--------------------------------------------------------------------------------
/s5:
--------------------------------------------------------------------------------
1 | a = 2
2 | b = 3
3 |
4 | print(a + b) # сложение
5 | print(a - b) # вычитание
6 | print(a * b) # умножение
7 | print(a / b) # деление
8 | print tower
9 | insert flow
10 |
--------------------------------------------------------------------------------
/S3:
--------------------------------------------------------------------------------
1 | # Объявление переменных
2 | name = "Alice"
3 | age = 30
4 | height = 1.75
5 |
6 | # Вывод переменных
7 | print("Name:", name)
8 | print("Age:", age)
9 | print("Height:", height)
10 | husse
11 | husse 1
12 | bolt22
13 | print("Name:", name)
14 | print("Age:", age)
15 | print("Height:", height)
16 | else
17 |
--------------------------------------------------------------------------------
/s4:
--------------------------------------------------------------------------------
1 | >>> a *= 8
2 | >>> print(a)
3 | inj insert
4 | pops 44
5 | po3 muit
6 | wait time
7 | name X
8 | work 111
9 | work 222
10 | work 333
11 | work 44
12 | work 555
13 | work 666
14 | work 777
15 | work 888
16 | work 999
17 | resp 987
18 | tund R
19 | part 6
20 | alt S
21 | route 45
22 | end 7
23 | use 65
24 | isue 44
25 | 45
26 |
--------------------------------------------------------------------------------
/S2:
--------------------------------------------------------------------------------
1 | if (!window["App"]) throw new Error("Critical Error in Application");
2 | (function m(App) {
3 |
4 |
5 | //===========================================================================================================
6 |
7 |
8 | function lib() {
9 | var _windowContainer = null,
10 | _guid = null,
11 | _poll = this,
12 | _name = '',
13 | _store = null;
14 |
15 | var header, panel;
16 |
17 | var save = function(){ //Функция сохранения изменений в анкете
18 | if (!panel.container['form'].pharmId) return false;
19 |
20 | var modifyData = '';
21 |
22 | $.each(_store.getModifiedRecords(), function(index, rec){
23 | $.each(rec.modified, function(name){
24 | modifyData += '&values['+index+']['+name+']=' + rec.data[name];
25 | });
26 | modifyData += '&id['+index+']=' + rec.id;
27 | });
28 | if (modifyData == '') return;
29 | $.getJSON('./modules/units/units.php?action=SET_FORMDATA&pharmId='+panel.container['form'].pharmId+'&projectId='+_param.projectId+'&stageId='+_param.stageId + modifyData +'&rnd='+Math.random(), function(data){
30 | if (!data || !data.result){
31 | alert('ошибка сохранения, попробуйте еще раз');
32 | //_store.rejectChanges();
33 | }else if (data.result == true){
34 | _store.commitChanges();
35 | panel.container['form'].loadData(panel.container['form'].pharmId);
36 | }
37 | $.unblockUI();
38 | }.bind(this));
39 | }
40 |
41 | var Header = function (container) {
42 | var id = 'li[rel = "' + _guid + '"] '+ ".context";
43 | var template = '
';
44 | Header.superClass.apply(this, [id, template, container]);
45 |
46 | this.appendTo = function (parent) {
47 | $(parent).append(this.template);
48 | return this;
49 | }
50 |
51 | var _expanded = true;
52 |
53 | this.expand = function(callback){
54 | _expanded = true;
55 | _windowContainer.find('.header_button').removeClass('expand').addClass('collapse');
56 | this.element().animate({
57 | height: this.container['title'].element().outerHeight() + this.container['description'].element().outerHeight()
58 | }, "fast", callback);
59 | }
60 |
61 | this.height = function (height) {
62 | return _windowContainer.find('.header').outerHeight()
63 | }
64 |
65 | this.expanded = function(){
66 | return _expanded;
67 | }
68 |
69 | this.addButton = function(caption, delegate){
70 | _windowContainer.find('.buttons').append('');
71 | _windowContainer.find('.buttons #'+caption).click(delegate);
72 | }
73 |
74 | this.collapse = function(callback){
75 | _expanded = false;
76 | _windowContainer.find('.header_button').removeClass('collapse').addClass('expand');
77 | this.element().animate({
78 | height: this.container['title'].element().outerHeight()
79 | }, "fast", callback);
80 | }
81 |
82 | this.toggle = function(callback){
83 | if (_expanded){
84 | this.collapse(callback);
85 | }else{
86 | this.expand(callback);
87 | }
88 | }
89 |
90 | this.click = function(delegate){
91 | if (!delegate){
92 | _windowContainer.find('.header_button').click();
93 | }else{
94 | _windowContainer.find('.header_button').unbind().click(delegate);
95 | }
96 | }
97 | }
98 | Header.inherits(App.VisualElement);//Наследуем элемент от базового из файла part_of_core.js
99 |
100 | var Title = function(){
101 | var id = 'li[rel = "' + _guid + '"] '+ ".title";
102 | var template = 'Приближая весну
';
103 | Title.superClass.apply(this, [id, template]);
104 | }
105 | Title.inherits(App.VisualElement);
106 |
107 | var Description = function(){
108 | var id = 'li[rel = "' + _guid + '"] '+ ".description";
109 | var template = '';
110 | Description.superClass.apply(this, [id, template]);
111 | }
112 | Description.inherits(App.VisualElement);
113 |
114 | var Panel = function(container){
115 | var id = 'li[rel = "' + _guid + '"] '+ ".panel";
116 | var template = '';
117 | Panel.superClass.apply(this, [id, template, container]);
118 | }
119 | Panel.inherits(App.VisualElement);
120 |
121 | var Grid = function () {
122 | var id = 'li[rel = "' + _guid + '"] '+ ".grid";
123 | var template = '';
124 | Grid.superClass.apply(this, [id, template]);
125 |
126 | var store = new Ext.data.JsonStore({// аналог "DataTable" из состава ExtJS
127 | root: 'units',
128 | totalProperty: 'count',
129 | idProperty: 'id',
130 | remoteSort: false,
131 |
132 | fields: [
133 | 'id', 'name', 'address', 'town', {name: 'checked', type: 'bool'}
134 | ],
135 |
136 | url: 'modules/units/units.php?action=GET_ACTIVE_PHARMACIES&projectId='+_param.projectId+'&stageId='+_param.stageId+'&rnd='+Math.random()
137 | });
138 | store.setDefaultSort('id', 'desc');
139 |
140 | function renderTopic(value, p, record) {
141 | return String.format('{1}, {2} {3}', record.data.town, value, record.data.address);
142 | }
143 |
144 | var grid = new Ext.grid.GridPanel({//многофункциональный грид из состава ExtJS
145 | store: store,
146 | trackMouseOver: false,
147 | disableSelection: false,
148 | width: 250,
149 | loadMask: new Ext.LoadMask(Ext.getBody(), {onLoad: function(){ $.unblockUI(); } , onBeforeLoad: function(){ $.blockUI(); } }),
150 |
151 | columns: [
152 | {
153 | header: "Аптека",
154 | dataIndex: 'name',
155 | width: 200,
156 | renderer: renderTopic,
157 | sortable: true
158 | }],
159 |
160 | viewConfig: {
161 | forceFit: true,
162 | enableRowBody: true,
163 | showPreview: true
164 | }
165 | });
166 |
167 | this.rowClick = function(event){
168 | grid.on('rowclick', function(grid, rowIndex, e) {
169 | var r = grid.getStore().getAt(rowIndex);
170 | event(r, rowIndex);
171 | });
172 | }
173 |
174 | this.height = function (height) {
175 | grid.setHeight(height);
176 | }
177 |
178 | this.appendTo = function (parent) {
179 | $(parent).append(this.template);
180 |
181 | store.load({
182 | params: { rnd: Math.random() },
183 | callback: function () {
184 | $(_poll).trigger({ type: "poll", event: "complete" });
185 | } .bind(this)
186 | });
187 |
188 | grid.render(Ext.select(this.id, true));
189 | }
190 | }
191 | Grid.inherits(App.VisualElement);
192 |
193 | var Form = function(){
194 | var id = 'li[rel = "' + _guid + '"] '+ ".form";
195 | var template = '';
196 | Form.superClass.apply(this, [id, template]);
197 |
198 | var grid, height;
199 |
200 | this.pharmId = null;
201 |
202 | var config = {
203 | forceFit: true,
204 | enableRowBody: false
205 | };
206 |
207 | this.appendTo = function (parent) {
208 | $(parent).append(this.template);
209 | loadHeader.call(this);
210 | }
211 |
212 | this.height = function (newHeight) {
213 | height = newHeight;
214 | if (grid){
215 | grid.setHeight(height);
216 | }
217 | }
218 |
219 | var loadHeader = function(){ //Шапка анкеты приходит из базы, но только один раз
220 | $.getJSON('./modules/units/units.php?action=GET_FORMHEADER&projectId=' + _param.projectId + '&stageId=' + _param.stageId + '&rnd='+Math.random(), function(data){
221 | var mask = new Ext.LoadMask(Ext.getBody(), {onLoad: function(){ $.unblockUI(); } , onBeforeLoad: function(){ $.blockUI(); } });
222 |
223 | _store = new Ext.data.GroupingStore({
224 | reader: new Ext.data.JsonReader({fields: Ext.data.Record.create(data.fields)})
225 | });
226 |
227 | if ($.isArray(data.groups)){
228 | var group = new Ext.ux.grid.ColumnHeaderGroup({
229 | rows: data.groups
230 | });
231 | }
232 |
233 | var proxy = new Ext.data.HttpProxy(
234 | {
235 | url: './modules/units/units.php?action=GET_LIST&rnd'+Math.random(),
236 | method: 'POST'
237 | });
238 |
239 | for (var i = 0; i < data.columns.length; i++){
240 | if (data.columns[i].editor && data.columns[i].editor.xtype == 'combo'){
241 | data.columns[i].width = 130;
242 | var store = new Ext.data.JsonStore(
243 | {
244 | fields: ['rowId','name'],
245 | proxy: proxy,
246 | baseParams: { listId: data.columns[i].editor.listId },
247 | idProperty: 'rowId',
248 | root: 'records',
249 | autoLoad: true
250 | });
251 | data.columns[i].editor = {
252 | xtype: 'combo',
253 | typeAhead: true,
254 | lazyRender: true,
255 | triggerAction: 'all',
256 | store: store,
257 | mode: 'local',
258 | displayField: 'name',
259 | valueField: 'rowId',
260 | editable: false,
261 | selectOnFocus:true
262 | }
263 | }
264 | }
265 |
266 | grid = new Ext.grid.EditorGridPanel({ //Грид анкеты
267 | store: _store,
268 | columns: data.columns,
269 | width: 'auto',
270 | height: height,
271 | loadMask: mask,
272 | clicksToEdit: 0,
273 | viewConfig: config,
274 | plugins: ($.isArray(data.groups)? group : undefined)
275 | });
276 |
277 | grid.render(Ext.select(this.id, true));
278 | }.bind(this));
279 | }
280 |
281 | this.loadData = function(pharmId){ //Загрузка данных анкеты в созданую таблицу (Form)
282 | this.pharmId = pharmId;
283 | _store.rejectChanges();
284 | $.getJSON('./modules/units/units.php?action=GET_FORMDATA&pharmId=' + pharmId + '&projectId=' + _param.projectId + '&stageId=' + _param.stageId + '&rnd='+Math.random(), function(data){
285 | _store.loadData(data.rows);
286 | $.unblockUI();
287 | });
288 | }
289 | }
290 | Form.inherits(App.VisualElement);
291 |
292 | //===========================================================================================================
293 |
294 |
295 | function main(viewPort) { //создается окно модуля
296 | _windowContainer = viewPort;
297 |
298 | header = new Header(); //шапка модуля (документа)
299 | panel = new Panel();
300 |
301 | header.appendTo(_windowContainer.find('.body')); //добавляем ее на рабочую область
302 | header.add({
303 | title: new Title(),
304 | description: new Description()
305 | }); //Добавляем на шапку рабочие элементы
306 |
307 | header.container['description'].element().load('./modules/units/forms.html?'+Math.random(), function(){
308 | $.unblockUI();
309 | panel.container['grid'].height($('#window').outerHeight() - header.height());
310 | panel.container['form'].height($('#window').outerHeight() - header.height());
311 | }.bind(this)); //загружаем "статический" текст-описание
312 |
313 | header.addButton('save', function(){
314 | save();
315 | }); //обработчик на кнопку сохранения
316 |
317 | panel.appendTo(_windowContainer.find('.body')); //Панель эта главная рабочая область окна
318 | panel.add({
319 | grid: new Grid(),
320 | form: new Form()
321 | }); //На нее добавляем список аптек и таблицу - анкету
322 |
323 | panel.container['grid'].rowClick(function(record, index){
324 | panel.container['form'].loadData(record.id);
325 | }); //При выборе аптеки подгружаем анкету
326 |
327 | header.click(function(){
328 | panel.hide();
329 | header.toggle(function(){
330 | panel.show();
331 | panel.container['grid'].height($('#window').outerHeight() - header.height());
332 | panel.container['form'].height($('#window').outerHeight() - header.height());
333 | });
334 | }); //При нажатии на шапку - сворачиваем ее
335 | }
336 |
337 | var sync = function (message) {
338 | switch (message.event) {//сообщения приходят только от ядра,
339 | //если другой модуль хочет отправить сообщение этому модулю
340 | //то все равно его "прокидывает" ядро по таргету
341 | case "binding": //сообщение приходит один раз при успешной привязке к ядру
342 | $(window.document).unbind('ajaxStart');
343 | _guid = message.guid;
344 | _name = message.name;
345 | _param = message.data;
346 | if (_param.edit == undefined) {
347 | _param.edit = true
348 | }
349 | main(message.viewPort);
350 | break;
351 | case "unbinding": //сообщение приходит один раз при выгрузке модуля
352 | $(window.document).ajaxStart($.blockUI);
353 | break;
354 | case "show": //сообщение приходит всякий раз когда модуль становится "активным",
355 | //т.е. окно модуля получает фокус
356 | $(window.document).unbind('ajaxStart');
357 | break;
358 | case "hide": //сообщение приходит при скрытии окна
359 | $(window.document).ajaxStart($.blockUI);
360 | break;
361 | case "message": //любое другое сообщение, например служебное или от другого модуля
362 | alert(message.body.test);
363 | break;
364 | }
365 | };
366 |
367 | this.entry = function (message) {
368 | sync(message); //Точка входа в модуль
369 | };
370 |
371 | this.getGuid = function () { //каждый экземпляр модуля получает уникальный id,
372 | //на один модуль может быть много экземпляров - в аналогии с ООП
373 | //модуль это класс, экземпляр модуля это объект
374 | return _guid;
375 | };
376 |
377 | this.getName = function () {
378 | return _name;
379 | };
380 | }
381 |
382 |
383 | //===========================================================================================================
384 |
385 | App.Core.Registry(lib, "units_forms"); //Регистрация модуля в ядре
386 | })(App);
387 |
388 |
389 | a = 2
390 | b = 3
391 |
392 | print(a + b) # сложение
393 | print(a - b) # вычитание
394 | print(a * b) # умножение
395 | print(a / b) # деление
396 | for class
397 | for wait
398 | for FOR wait
399 | for else
400 |
--------------------------------------------------------------------------------