OpenCar tError on OCMOD - opencart2.x

iam trying make some modification in OpenCart Admin so i created ocmod file but it doesn`t working !
when using position "After" it replaced code !! and "After" not working !
this code
<modification>
<code>31111</code>
<name><![CDATA[<font color="#0000"><b> DK Setting Modification</font>]]></name>
<version><![CDATA[<b>1.0</b>]]></version>
<author><![CDATA[<font color="#CC0000"><b>abada henno</font>]]></author>
<link><![CDATA[http://abadahenno.com]]></link>
<file name="admin/language/english/common/menu.php">
<operation error="log">
<search ><![CDATA[// Text]]></search>
<add position="After"><![CDATA[
$_['text_dokan_menu'] = 'DK Setting';
]]></add>
</operation>
</file>
<file path="admin/controller/controller/common/menu.php">
<operation error="log">
<search><![CDATA[$this->load->language('common/menu');]]></search>
<add position="After"><![CDATA[
$data['text_dk_menu'] = $this->language->get('text_dk_menu');
]]></add>
</operation>
<operation error="log">
<search ><![CDATA[$data['home'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL');]]></search>
<add position="After"><![CDATA[
$data['dk'] = $this->url->link('setting/dk', 'token=' . $this->session->data['token'], 'SSL');
]]></add>
</operation>
</file>
<file path="admin/view/template/common/menu.tpl">
<operation error="log">
<search><![CDATA[
<li><?php echo $text_setting; ?></li>
]]></search>
<add position="After"><![CDATA[
<li> <?php echo $text_dk_menu; ?> </li>
]]></add>
</operation>
</file>
</modification>
position "After" not working always "Replace" !
what error on my code
<li> <b>Notice</b>: Undefined variable: text_dk_menu in <b>/home/vagrant/Code/dk/system/modification/admin/view/template/common/menu.tpl</b> on line <b>116</b> </li>

Related

Callback when Ext.NET Combobox local query returns no data

Using Ext.NET combobox.
<ext:ComboBox runat="server"
ID="ComboBoxCategorizedList"
QueryMode="Local"
ValueField="Id"
EmptyText="Type to begin search..."
TypeAhead="false"
DisplayField="Name"
Width="500"
NoteAlign="Down" EnableKeyEvents="true"
Note="Press 'Search' icon or Press ENTER for more results"
RemoveClearTrigger="true">
<%--Note="Type '*' for a full list"--%>
<HtmlBin>
<ext:XScript runat="server">
<script type="text/javascript">
$(window).on("__refresh__", function () {
#{ StoreComboBoxCategorizedList }.reload();
});
</script>
</ext:XScript>
</HtmlBin>
<Store>
<ext:Store runat="server" ID="StoreComboBoxCategorizedList" OnReadData="ComboBoxCategorizedList_ReadData">
<Proxy>
<ext:PageProxy />
</Proxy>
<Model>
<ext:Model Id="ModelCategorizedComboBox" runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Type" />
<ext:ModelField Name="RefId" />
<ext:ModelField Name="Description" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Update Handler="#{ComboBoxCategorizedList}.expand();" />
<EndUpdate Handler="categorizedList();" />
</Listeners>
<Parameters>
<ext:StoreParameter Mode="Raw" Name="filter" Value="#{ComboBoxCategorizedList}.getValue()" />
</Parameters>
</ext:Store>
</Store>
<Triggers>
<ext:FieldTrigger Icon="Clear"/>
<ext:FieldTrigger Icon="Search"></ext:FieldTrigger>
</Triggers>
<Listeners>
<SpecialKey Fn="enterKeyPressHandler" />
<Expand Handler="categorizedList();" Delay="100" />
<BeforeSelect Fn="onBeforeSelect" />
<KeyPress Handler="#{ComboBoxCategorizedList}.getTrigger(1).onClick();" Buffer="1000" />
<Change Handler="filterComboxBoxFunction(#{StoreComboBoxCategorizedList}, #{ComboBoxCategorizedList}.getValue()); #{ComboBoxCategorizedList}.expand(); categorizedList();" Delay="100" />
</Listeners>
Not asking for debugging help, but I want to know if an Ext.NET or Extjs dev has a generic solution: Very simply ... I want to initiate a remote search only when the local search returns no records. So I am looking for the best way to wire this up to the combobox. I've looked at using the Expand event and BeforeQuery event but this seems to come up short.
I'm looking for best practices so i can add a "OnLocalQuery" event to my comboboxes; and then take action if the local query returns 0 matches.
I use this function and it works fine .. and without QueryMode="Local":
<ext:ComboBox ID="cmb_name" runat="server" FieldLabel="ComboBox" EmptyText="-Select-" HideTrigger="true" TriggerAction="All" SelectOnFocus="true" DisplayField="Name" ValueField="Id" Editable="true" TabIndex="11">
<Store>
<ext:Store ID="str_ComboBox" runat="server" PageSize="10">
<Model>
<ext:Model ID="mdl_ComboBox" runat="server">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Type" />
<ext:ModelField Name="RefId" />
<ext:ModelField Name="Description" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Listeners>
<Change Fn="fn_filter" />
</Listeners>
</ext:ComboBox>
<script type="text/javascript">
var fn_filter = function (_this, newValue, oldValue, eOpts) {
var n = 0;
if (_this.lastQuery == undefined || _this.lastQuery == null) {
_this.lastQuery = "";
}
_this.getStore().clearFilter(true);
_this.getStore().load();
_this.store.filter(function (item) {
if (item.get('Name').includes(_this.getRawValue())) {
n = n + 1;
return true;
}
else {
return false;
}
});
_this.expand();
if (n == 0) {
//returns no records
//enter code here Callback
}
}
</script>

UI to manage one to many relationship between classes in custom module in Kentico

I have created a Clinic module within Kentico V12 with two classes: Doctor and Appointment. There is a 1 to many relationship between Doctor and Appointment. How could I display the name and surname of the doctors in the Appointment grid?
<?xml version="1.0" encoding="utf-8" ?>
<grid>
<actions>
<action name="edit" caption="$General.Edit$" fonticonclass="icon-edit" fonticonstyle="allow" />
<action name="#delete" caption="$General.Delete$" fonticonclass="icon-bin" fonticonstyle="critical" confirmation="$General.ConfirmDelete$" />
</actions>
<columns>
<column source="AppointmentPatientFirstName" caption="First name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientLastName" caption="Last name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientEmail" caption="Email" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientPhoneNumber" caption="Phone Number" wrap="false" localize="true">
<filter type="text" size="15" />
</column>
<column source="Date" caption="Date" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientBirthDate" caption="BirthDate" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentDoctorID" caption="Doctor ID" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
</columns>
<options>
<key name="DisplayFilter" value="true" />
</options>
</grid>
Kind regards.
Appointment List: https://i.stack.imgur.com/Ft1pE.png
Using this column AppointmentDoctorID modify the XML to use a transformation like so:
<column source="AppointmentDoctorID" caption="Doctor" externalsourcename="#transform: yournamespace.doctor: {%FirstName%} {%LastName%}" wrap="false" localize="true"></column>
Check out more documentation on unigrids in the Kentico Documentation.

Ext Net TimeField in an editable grid

I have a grid panel which display two TimeSpans in two columns and all is well when I load the page but when I go server side the validation on my editors always fail. I don't understand why the store can display the TimeSpans but cannot return it after...
Here my code :
<ext:GridPanel ID="WeekParams" runat="server" >
<Store>
<ext:Store runat="server">
<Reader>
<ext:JsonReader IDProperty="GUID">
<Fields>
<ext:RecordField Name="Day" Type="String" />
<ext:RecordField Name="UATNumber" Type="int" />
<ext:RecordField Name="From" Type="Date" />
<ext:RecordField Name="To" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ColumnID="Day" DataIndex="Day" />
<ext:NumberColumn ColumnID="UATNumber" DataIndex="UATNumber" Format="0" />
<ext:DateColumn ColumnID="From" DataIndex="From" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
<ext:DateColumn ColumnID="To" DataIndex="To" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
</Columns>
</ColumnModel>
<Plugins>
<ext:EditableGrid runat="server" />
</Plugins>
</ext:GridPanel>
And here the result when I'm going to the server side :

Xquery calculate average on attribute

I have an XML file like this :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="class3.xsl" type="text/xsl" ?>
<school>
<student><name>Jack T</name>
<course title="INF8430" note="78" />
<course title="INF1030" note="69" />
<course title="INF1230" note="85" /></student>
<student><name>Marty L</name>
<course title="INF8430" note="95" />
<course title="INF1030" note="82" />
<course title="INF1230" note="77" /></student>
<student><name>Ben L</name>
<course title="INF9430" note="59" />
<course title="INF1030" note="78" />
<course title="INF1230" note="79" /></student>
</school>
In my XQuery I use this :
{
for $s in distinct-values(doc("class3.xml")//course/#title)
return
<course title="{$s}">
</course>
}
I try to get an average from each different title.
I get the title correctly, but How I can count the average ?
I try many thing between the course tag to find the avg, can someone help me
thanks
Add this within your return statement:
avg(doc("class3.xml")//course[#title=$s]/#note)
I'm sure there are better ways... not sure this is what you wanted but it wil help you get there I hope :)
let $doc :=
<school>
<student><name>Jack T</name>
<course title="INF8430" note="78" />
<course title="INF1030" note="69" />
<course title="INF1230" note="85" /></student>
<student><name>Marty L</name>
<course title="INF8430" note="95" />
<course title="INF1030" note="82" />
<course title="INF1230" note="77" /></student>
<student><name>Ben L</name>
<course title="INF9430" note="59" />
<course title="INF1030" note="78" />
<course title="INF1230" note="79" /></student>
</school>
return
for $s in $doc//student
let $total := sum($s/course/#note) div count($s/course)
return <name>{$s/name}<avg>{$total}</avg></name>

NLog code line logging

I am using NLog to log error messages into csv:
<target name="csv" xsi:type="File"
fileName="${basedir}/Logs/log.csv"
archiveFileName="${basedir}/Logs/Archives/log.{#####}.csv"
archiveAboveSize="10240"
archiveNumbering="Sequence"
concurrentWrites="true"
keepFileOpen="false">
<layout xsi:type="CSVLayout" delimiter="Comma" withHeader="false">
<column name="time" layout="${longdate}" />
<column name="message" layout="${message}" />
<column name="logger" layout="${logger}"/>
<column name="level" layout="${level}"/>
</layout>
</target>
How can I add a column to track the code line number?
Thank you.
Try to add ${callsite} layout renderer.
<column name="source" layout="${callsite:fileName=true}" />

Resources