Skip to content

Commit

Permalink
1.0.9
Browse files Browse the repository at this point in the history
Fixed: Fix consignment update TNT error when one of the ids is invalid
Fixed: Fix the getAddressComponents hat separates address into parts
Fixed: Fix the function processConsignmentSelection (bulk action)
  • Loading branch information
Liannemyparcel authored and Liannemyparcel committed Aug 24, 2016
0 parents commit f586820
Show file tree
Hide file tree
Showing 55 changed files with 3,176 additions and 0 deletions.
8 changes: 8 additions & 0 deletions administrator/access.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<access component="com_myparcel">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
</section>

</access>
1 change: 1 addition & 0 deletions administrator/assets/css/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body></body></html>
10 changes: 10 additions & 0 deletions administrator/assets/css/myparcel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.icon-48-configs {
background-image: url(../images/l_configs.png);
padding-left:60px!important;
}

.icon-48-config {
background-image: url(../images/l_configs.png);
padding-left:60px!important;
}

1 change: 1 addition & 0 deletions administrator/assets/images/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body></body></html>
Binary file added administrator/assets/images/l_com_myparcel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added administrator/assets/images/l_configs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added administrator/assets/images/myparcel_pdf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added administrator/assets/images/myparcel_pdf_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added administrator/assets/images/myparcel_retour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added administrator/assets/images/s_com_myparcel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added administrator/assets/images/s_configs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions administrator/assets/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body></body></html>
232 changes: 232 additions & 0 deletions administrator/assets/js/myparcel_plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
if (typeof MyParcel == 'undefined') { MyParcel = {}; }
//alert("aa");
var popup; // Handle to popup window
var consignments = {}; // Hyperlinks to consignments that haven't been processed yet
var locked = false; // Lock to prevent more than one consignment being created at a time

function onClickOnUnprocessedConsignment(event) {
if (!popup || popup.closed) {
// User closed the popup
this.remove(); // Delete the link
} else {
popup.focus();
}
}

MyParcel.virtuemart = {
setConsignmentId: function(orderId, timestamp, consignmentId, tracktrace_link, retour, addresas){
//alert("order: " + orderId + " time:"+timestamp+" cons:"+consignmentId+" trac:"+tracktrace_link+" ret:"+retour);
var mypa_div = document.createElement('div');

// print checkbox
var mypa_check = document.createElement('input');
mypa_check.className = 'mypaleft mypacheck';
mypa_check.type = 'checkbox';
mypa_check.value = consignmentId;

// pdf image
var mypa_img = document.createElement('img');
mypa_img.alt = 'print';
mypa_img.src = addresas+'administrator/components/com_myparcel/assets/images/myparcel_pdf.png';
if(retour == 1) mypa_img.src = addresas+'administrator/components/com_myparcel/assets/images/myparcel_retour.png';
mypa_img.style.border = 0;

// pdf image link
var mypa_link = document.createElement('a');
mypa_link.className = 'myparcel-pdf';
mypa_link.onclick = new Function('return printConsignments(' + consignmentId + ');');
mypa_link.href = '#';
mypa_link.appendChild(mypa_img);

// tracktrace link
var mypa_track = document.createElement('a');
mypa_track.target = '_blank';
mypa_track.href = tracktrace_link;
mypa_track.innerHTML = 'Track&Trace';

// shove into DOM
mypa_div.appendChild(mypa_check);
mypa_div.appendChild(mypa_track);
mypa_div.appendChild(mypa_link);
var orderdiv = document.getElementById('mypa_exist_' + orderId);
orderdiv.insertBefore(mypa_div, orderdiv.firstChild);

popup.close();
locked = false;
}
};

var lastTimestamp = 0;
function _getTimestamp() {
var ret = Math.round(new Date().getTime() / 1000);
if (ret <= lastTimestamp) {
ret = lastTimestamp + 1; // Make sure it is unique
}
return lastTimestamp = ret;
}

function createNewConsignment(orderId, retour)
{
if (locked) {
if (!popup || popup.closed) {
// User closed the popup
} else {
popup.focus();
return;
}
}
locked = true;
var timestamp = _getTimestamp();

var retourparam = '';
if(retour == true) retourparam = '&retour=true';

popup = window.open(
'components/com_myparcel/myparcel_plugin.php?action=post' + '&order_id=' + orderId + '&timestamp=' + timestamp + retourparam,
'myparcel',
'width=730,height=830,dependent,resizable,scrollbars'
);
if (window.focus) { popup.focus(); }
return false;
}

function printConsignments(consignmentList)
{
if (locked) {
if (!popup || popup.closed) {
// User closed the popup
} else {
popup.focus();
return;
}
}
locked = true;
var timestamp = _getTimestamp();

popup = window.open(
'components/com_myparcel/myparcel_plugin.php?action=print' + '&consignments=' + consignmentList + '&timestamp=' + timestamp,
'myparcel',
'width=415,height=365,dependent,resizable,scrollbars'
);
if (window.focus) { popup.focus(); }
return false;
}

function printConsignmentSelection()
{
var consignmentList = Array();
var checkboxes = document.getElementsByClassName('mypacheck');
for(var i = checkboxes.length - 1; i >= 0; i--)
{
if(checkboxes[i].checked == true && checkboxes[i].value != '')
{
consignmentList.push(checkboxes[i].value);
}
}
return (consignmentList.length == 0) ? false : printConsignments(consignmentList.join('|'));
}


/*
function checkAll(a, b) {
console.log(a);
b || (b = "cb");
if (a.form) {
for (var c = 0, d = 0, f = a.form.elements.length; d < f; d++) {
var e = a.form.elements[d];
if (e.type == a.type && (b && 0 == e.id.indexOf(b) || !b)) e.checked = a.checked, c += !0 == e.checked ? 1 : 0
}
if (a.form.boxchecked) a.form.boxchecked.value = c;
return !0
}
for (var e = document.adminForm, c = e.toggle.checked, f = a, g = 0, d = 0; d < f; d++) {
var h = e[b + "" + d];
if (h) h.checked = c, g++
}
document.adminForm.boxchecked.value = c ? g : 0
}
*/

function processConsignmentSelection(a, b)
{
var consignmentList2 = Array();

/** Start @Since version 1.0.9 **/
var checkboxes = document.getElementsByClassName('mypafunc');
a = checkboxes.length;
/** End @Since version 1.0.9 **/

b || (b = "cb");
for (var e = document.adminForm, c = e.toggle.checked, f = a, g = 0, d = 0; d < f; d++) {
var h = e[b + "" + d];
if (h)
{
if (h.checked == true)
{
consignmentList2.push(h.value);
console.log(h.value);
}

g++;
}
}
return (consignmentList2.length > 0 && confirm("Hiermee creëert u " + consignmentList2.length + " MyParcel labels.\n\nKlik op OK om door te gaan.")) //return (consignmentList2.length > 0 && confirm("This will create " + consignmentList2.length + " labels.\n\nAre you sure?"))
? processConsignments(consignmentList2.join('|'))
: false;


/*
var consignmentList = Array();
var checkboxes = document.getElementsByClassName('mypacheck');
for(var i = checkboxes.length - 1; i >= 0; i--)
{
if(checkboxes[i].checked == true)
{
consignmentList.push(checkboxes[i].value);
}
}
return (consignmentList.length > 0 && confirm("This will create " + consignmentList.length + " labels.\n\nAre you sure?"))
? processConsignments(consignmentList.join('|'))
: false;
*/
}

function processConsignments(consignmentList)
{
if (locked) {
if (!popup || popup.closed) {
// User closed the popup
} else {
popup.focus();
return;
}
}
locked = true;
var timestamp = _getTimestamp();

popup = window.open(
'components/com_myparcel/myparcel_plugin.php?action=process' + '&order_ids=' + consignmentList + '&timestamp=' + timestamp,
'myparcel',
'width=415,height=365,dependent,resizable,scrollbars'
);
if (window.focus) { popup.focus(); }
return false;
}

function selectAllConsignmentsForPrint(checkboxas)
{
var checkboxes = document.getElementsByClassName('mypacheck');
if (checkboxas.checked == true) {
for(var i = checkboxes.length - 1; i >= 0; i--)
{
checkboxes[i].checked = true;
}
}
else
{
for(var i = checkboxes.length - 1; i >= 0; i--)
{
checkboxes[i].checked = false;
}
}
}
109 changes: 109 additions & 0 deletions administrator/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset name="component"
label="COM_MYPARCEL_COMPONENT_LABEL"
description="COM_MYPARCEL_COMPONENT_DESC"
>

<field name="test"
type="radio"
default="1"
label="COM_MYPARCEL_TEST_LABEL"
description="COM_MYPARCEL_TEST_DESC">
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>

</fieldset>

<fieldset name="permissions"
description="JCONFIG_PERMISSIONS_DESC"
label="JCONFIG_PERMISSIONS_LABEL"
>

<field
name="rules"
type="rules"
component="com_myparcel"
class="inputbox"
filter="rules"
validate="rules"
label="JCONFIG_PERMISSIONS_LABEL"
section="component" />
</fieldset>

</config>
<!--
########################################################################################
The following are a list of all the different types of fields you can add to this file
They are here for copy pasting - neat eh?
########################################################################################
http://docs.joomla.org/Calendar_parameter_type
<field name="mycalendar" type="calendar" default="5-10-2008" label="Select a date" description="" format="%d-%m-%Y" />
http://docs.joomla.org/Category_parameter_type
<field name="mycategory" type="category" label="Select a category" description="" section="3" />
http://docs.joomla.org/Editors_parameter_type
<field name="myeditor" type="editors" default="none" label="Select an editor" />
http://docs.joomla.org/Filelist_parameter_type
<field name="myfile" type="filelist" default="" label="Select a file" description="" directory="administrator" filter="" exclude="" stripext="" />
http://docs.joomla.org/Folderlist_parameter_type
<field name="myfolder" type="folderlist" default="" label="Select a folder" directory="administrator" filter="" exclude="" stripext="" />
http://docs.joomla.org/Helpsites_parameter_type
<field name="myhelpsite" type="helpsites" default="" label="Select a help site" description="" />
http://docs.joomla.org/Hidden_parameter_type
<field name="mysecretvariable" type="hidden" default="" />
http://docs.joomla.org/Imagelist_parameter_type
<field name="myimage" type="imagelist" default="" label="Select an image" description="" directory="" exclude="" stripext="" />
http://docs.joomla.org/Languages_parameter_type
<field name="mylanguage" type="languages" client="site" default="en-GB" label="Select a language" description="" />
http://docs.joomla.org/List_parameter_type
<field name="mylistvalue" type="list" default="" label="Select an option" description="">
<option value="0">Option 1</option>
<option value="1">Option 2</option>
</field>
http://docs.joomla.org/Menu_parameter_type
<field name="mymenu" type="menu" default="mainmenu" label="Select a menu" description="Select a menu" />
http://docs.joomla.org/Menuitem_parameter_type
<field name="mymenuitem" type="menuitem" default="45" label="Select a menu item" description="Select a menu item" />
http://docs.joomla.org/Password_parameter_type
<field name="mypassword" type="password" default="secret" label="Enter a password" description="" size="5" />
http://docs.joomla.org/Radio_parameter_type
<field name="myradiovalue" type="radio" default="0" label="Select an option" description="">
<option value="0">1</option>
<option value="1">2</option>
</field>
http://docs.joomla.org/Spacer_parameter_type
<field type="spacer" default="&lt;b&gt;Advanced parameters&lt;/b&gt;" />
http://docs.joomla.org/Sql_parameter_type
<field name="myfield" type="sql" default="10" label="Select an article" query="SELECT id, title FROM #__content" key_field=”id” value_field=”title” />
http://docs.joomla.org/Text_parameter_type
<field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />
http://docs.joomla.org/Textarea_parameter_type
<field name="mytextarea" type="textarea" default="default" label="Enter some text" description="" rows="10" cols="5" />
http://docs.joomla.org/Timezones_parameter_type
<field name="mytimezone" type="timezones" default="-10" label="Select a timezone" description="" />
http://docs.joomla.org/Usergroup_parameter_type
<field name="myusergroups" type="usergroup" default="" label="Select a user group" description="" />
-->
Loading

0 comments on commit f586820

Please sign in to comment.