-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d5316ba
Showing
23 changed files
with
3,035 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<Class name="SampleUI.Category"> | ||
<Super>%Persistent,Form.Adaptor</Super> | ||
<TimeCreated>64386,71828.248833</TimeCreated> | ||
|
||
<Parameter name="FORMNAME"> | ||
<Default>Category</Default> | ||
</Parameter> | ||
|
||
<Parameter name="OBJPERMISSIONS"> | ||
<Type>%String</Type> | ||
<Default>CRUD</Default> | ||
</Parameter> | ||
|
||
<Parameter name="DISPLAYPROPERTY"> | ||
<Type>%String</Type> | ||
<Default>Name</Default> | ||
</Parameter> | ||
|
||
<Property name="Name"> | ||
<Type>%String</Type> | ||
<Parameter name="DISPLAYNAME" value="Name"/> | ||
</Property> | ||
|
||
<Index name="NameInd"> | ||
<Properties>Name</Properties> | ||
<Unique>1</Unique> | ||
</Index> | ||
|
||
<Property name="Tasks"> | ||
<Type>SampleUI.Task</Type> | ||
<Cardinality>many</Cardinality> | ||
<Inverse>Category</Inverse> | ||
<Relationship>1</Relationship> | ||
</Property> | ||
|
||
<Method name="Populate"> | ||
<ClassMethod>1</ClassMethod> | ||
<ReturnType>%Status</ReturnType> | ||
<Implementation><![CDATA[ | ||
set sc = $$$OK | ||
set listOfCategories = $LISTBUILD("Home", "Work", "Education", "Hobby", "Leisure", "Other") | ||
for i=1:1:$LISTLENGTH(listOfCategories) { | ||
set obj = ..%New() | ||
set obj.Name = $LISTGET(listOfCategories, i) | ||
set sc = obj.%Save() | ||
} | ||
quit sc | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Storage name="Default"> | ||
<Type>%Library.CacheStorage</Type> | ||
<DataLocation>^SampleUI.CategoryD</DataLocation> | ||
<DefaultData>CategoryDefaultData</DefaultData> | ||
<IdLocation>^SampleUI.CategoryD</IdLocation> | ||
<IndexLocation>^SampleUI.CategoryI</IndexLocation> | ||
<StreamLocation>^SampleUI.CategoryS</StreamLocation> | ||
<Data name="CategoryDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Name</Value> | ||
</Value> | ||
</Data> | ||
</Storage> | ||
</Class> | ||
</Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<Class name="SampleUI.Task"> | ||
<Super>%Persistent,Form.Adaptor,%Populate</Super> | ||
<TimeCreated>64386,71727.552483</TimeCreated> | ||
|
||
<Parameter name="FORMNAME"> | ||
<Default>Task</Default> | ||
</Parameter> | ||
|
||
<Parameter name="OBJPERMISSIONS"> | ||
<Type>%String</Type> | ||
<Default>CRUD</Default> | ||
</Parameter> | ||
|
||
<Parameter name="DISPLAYPROPERTY"> | ||
<Type>%String</Type> | ||
<Default>Text</Default> | ||
</Parameter> | ||
|
||
<Parameter name="FORMORDERBY"> | ||
<Type>%String</Type> | ||
<Default>Created</Default> | ||
</Parameter> | ||
|
||
<Property name="Status"> | ||
<Type>%Boolean</Type> | ||
<Parameter name="DISPLAYNAME" value="Status"/> | ||
<Parameter name="POPORDER" value="3"/> | ||
<Parameter name="POPSPEC" value=".setStatus()"/> | ||
</Property> | ||
|
||
<Property name="Text"> | ||
<Type>%String</Type> | ||
<Parameter name="DISPLAYNAME" value="Text"/> | ||
<Parameter name="MAXLEN" value="100"/> | ||
<Parameter name="POPSPEC" value="StringMin(10, 100)"/> | ||
</Property> | ||
|
||
<Property name="Created"> | ||
<Type>%TimeStamp</Type> | ||
<Parameter name="POPORDER" value="1"/> | ||
<Parameter name="POPSPEC" value="TimeStamp($zdt((+$zts-20)_","_$random(86400), 3, 1, 3), $zdt($zts, 3, 1, 3))"/> | ||
</Property> | ||
|
||
<Property name="Performed"> | ||
<Type>%TimeStamp</Type> | ||
<SqlComputeCode>set {*} = $case({Status}, 0:"", 1:$case({*}, "":$ZDT($NOW(), 3, 1, 3), :{*})) | ||
</SqlComputeCode> | ||
<SqlComputed>1</SqlComputed> | ||
<SqlComputeOnChange>Status</SqlComputeOnChange> | ||
<Parameter name="POPORDER" value="2"/> | ||
<Parameter name="POPSPEC" value=".performedDate()"/> | ||
</Property> | ||
|
||
<Property name="Category"> | ||
<Type>SampleUI.Category</Type> | ||
<Cardinality>one</Cardinality> | ||
<Inverse>Tasks</Inverse> | ||
<Relationship>1</Relationship> | ||
</Property> | ||
|
||
<Index name="CategoryIndex"> | ||
<Properties>Category</Properties> | ||
</Index> | ||
|
||
<Method name="%OnNew"> | ||
<Private>1</Private> | ||
<ReturnType>%Status</ReturnType> | ||
<ServerOnly>1</ServerOnly> | ||
<Implementation><![CDATA[ | ||
if i%Created = "" { | ||
set i%Created = $ZDATETIME($NOW(), 3, 1, 3) | ||
} | ||
set i%Status = 0 | ||
Quit $$$OK | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="performedDate"> | ||
<ReturnType>%TimeStamp</ReturnType> | ||
<Implementation><![CDATA[ | ||
set CreatedDate = $ZDATETIMEH(i%Created, 3, 1, 3) | ||
if ($RANDOM(2)) { | ||
set date = (+CreatedDate+$RANDOM(10))_","_$RANDOM(86400) | ||
if (date < $NOW()) { | ||
quit $ZDATETIME(date, 3, 1, 3) | ||
} else { | ||
quit "" | ||
} | ||
} else { | ||
quit "" | ||
} | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="setStatus"> | ||
<ReturnType>%Boolean</ReturnType> | ||
<Implementation><![CDATA[ | ||
if i%Performed '= "" quit 1 | ||
quit 0 | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Storage name="Default"> | ||
<Type>%Library.CacheStorage</Type> | ||
<DataLocation>^SampleUI.TaskD</DataLocation> | ||
<DefaultData>TaskDefaultData</DefaultData> | ||
<IdLocation>^SampleUI.TaskD</IdLocation> | ||
<IndexLocation>^SampleUI.TaskI</IndexLocation> | ||
<StreamLocation>^SampleUI.TaskS</StreamLocation> | ||
<ExtentSize>100</ExtentSize> | ||
<Data name="TaskDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Status</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>Text</Value> | ||
</Value> | ||
<Value name="4"> | ||
<Value>Created</Value> | ||
</Value> | ||
<Value name="5"> | ||
<Value>Performed</Value> | ||
</Value> | ||
<Value name="6"> | ||
<Value>Deleted</Value> | ||
</Value> | ||
<Value name="7"> | ||
<Value>Category</Value> | ||
</Value> | ||
<Value name="8"> | ||
<Value>rand</Value> | ||
</Value> | ||
</Data> | ||
<Property name="%%CLASSNAME"> | ||
<Selectivity>100.0000%</Selectivity> | ||
<AverageFieldSize>1</AverageFieldSize> | ||
</Property> | ||
<Property name="%%ID"> | ||
<Selectivity>1</Selectivity> | ||
<AverageFieldSize>1.92</AverageFieldSize> | ||
</Property> | ||
<Property name="Category"> | ||
<Selectivity>16.6667%</Selectivity> | ||
<AverageFieldSize>1</AverageFieldSize> | ||
</Property> | ||
<Property name="Created"> | ||
<Selectivity>2.3256%</Selectivity> | ||
<AverageFieldSize>19</AverageFieldSize> | ||
</Property> | ||
<Property name="Deleted"> | ||
<Selectivity>50.0000%</Selectivity> | ||
<AverageFieldSize>1</AverageFieldSize> | ||
</Property> | ||
<Property name="Performed"> | ||
<Selectivity>1.0000%</Selectivity> | ||
<OutlierSelectivity>.65:</OutlierSelectivity> | ||
<AverageFieldSize>6.65</AverageFieldSize> | ||
</Property> | ||
<Property name="Status"> | ||
<Selectivity>50.0000%</Selectivity> | ||
<AverageFieldSize>1</AverageFieldSize> | ||
</Property> | ||
<Property name="Text"> | ||
<Selectivity>1.0000%</Selectivity> | ||
<AverageFieldSize>55.64</AverageFieldSize> | ||
</Property> | ||
<SQLMap name="CategoryIndex"> | ||
<BlockCount>-4</BlockCount> | ||
</SQLMap> | ||
<SQLMap name="IDKEY"> | ||
<BlockCount>-8</BlockCount> | ||
</SQLMap> | ||
</Storage> | ||
</Class> | ||
</Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<Class name="SampleUI.Utils"> | ||
<TimeCreated>64386,77189.276428</TimeCreated> | ||
|
||
<Method name="repopulateAll"> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>num=100</FormalSpec> | ||
<ReturnType>%Integer</ReturnType> | ||
<Implementation><![CDATA[ | ||
set sc = $$$OK | ||
do ##class(SampleUI.Category).%KillExtent() | ||
do ##class(SampleUI.Task).%KillExtent() | ||
set sc = ##class(SampleUI.Category).Populate() | ||
if $$$ISERR(sc) { | ||
quit -1 | ||
} | ||
set col = ##class(SampleUI.Task).Populate(num) | ||
quit col | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="repopulateTasks"> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>num=100</FormalSpec> | ||
<ReturnType>%Integer</ReturnType> | ||
<Implementation><![CDATA[ | ||
do ##class(SampleUI.Task).%KillExtent() | ||
set col = ##class(SampleUI.Task).Populate(num) | ||
quit col | ||
]]></Implementation> | ||
</Method> | ||
</Class> | ||
</Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<CSP name="Task_1.js" application="/csp/sampleuidev/" default="1"><![CDATA[ | ||
'use strict' | ||
/** | ||
*Функция отечающая за получение категорий. | ||
*Помимо получения категорий подгружает задачи состоящие в данной категории. | ||
*Требуется: | ||
* 1.Указать такой REST API URL предоставляемый RESTForms, чтобы | ||
* получить категории задач. | ||
* 2.Указать тип запроса. | ||
* 3.Заполнить обьект данными полученными спомошью запроса. | ||
*/ | ||
/*Подсказка: рекомендуется использовать query запрос типа info*/ | ||
function getCategoriesAJAX() | ||
{ | ||
$.ajax({ | ||
url: '', /*Сюда введите URL запроса*/ | ||
type: '', /*Сюда введите тип запроса*/ | ||
success: function(data) { | ||
/*data - переменная содержащая в себе JSON обьект возвращённый запросом*/ | ||
var option_setup = Array(); | ||
for (var i = 0; i < data.total; i++) { | ||
option_setup[i] = { | ||
id: '', /*Сюда требуется установить ID категории*/ | ||
text: '' /*Сюда требуется установить название категории*/ | ||
} | ||
} | ||
//===================Код не относящийся к заданию========================================== | ||
$('select#cat option').remove(); | ||
var select = $('select#cat'); | ||
for (var i = 0; i < data.total; i++) { | ||
$('<option/>', option_setup[i]) | ||
.appendTo(select); | ||
} | ||
select.show(); | ||
getTasksAJAX($('select#cat option:selected').attr('id')); | ||
}, | ||
dataType: 'json' | ||
}); | ||
} | ||
//=========================================================================================== | ||
]]></CSP> | ||
</Export> |
Oops, something went wrong.