Skip to content

Commit

Permalink
Scrolling position is saving (possible to disable this feature with e…
Browse files Browse the repository at this point in the history
…xtConf). Delete tt_product items right from manager is allowed
  • Loading branch information
uoziod committed Aug 25, 2014
1 parent 9ef02d0 commit ed8c943
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 26 deletions.
Binary file modified doc/manual.sxw
Binary file not shown.
2 changes: 2 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ orderEmail_from = [email protected]
iconsInsteadImages = 0
# cat=basic/enable; type=integer; label=Image previews width
imagesWidth = 50
# cat=basic/enable; type=boolean; label=Disable "Fixed position"
disableFixedPosition = 0
8 changes: 4 additions & 4 deletions ext_emconf.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
########################################################################
# Extension Manager/Repository config file for ext "shop_manager".
#
# Auto generated 25-08-2014 13:29
# Auto generated 25-08-2014 22:01
#
# Manual updates:
# Only the data in the array - everything else is removed by next
Expand All @@ -15,7 +15,7 @@
'description' => 'Shop System (tt_products) management system. This is backend module with 2 sections. With "Catalog Items" you can manage shop categories and items pretty simple. "Categories Manager" is a useful order status manager with customers e-mail notification support.',
'category' => 'module',
'shy' => 0,
'version' => '1.0.5',
'version' => '1.0.6',
'dependencies' => '',
'conflicts' => '',
'priority' => '',
Expand All @@ -34,15 +34,15 @@
'CGLcompliance_note' => '',
'constraints' => array(
'depends' => array(
'php' => '5.2.0-0.0.0',
'php' => '5.2.0-5.5.99',
'typo3' => '4.1.0-6.2.99',
),
'conflicts' => array(
),
'suggests' => array(
),
),
'_md5_values_when_last_written' => 'a:15:{s:9:"README.md";s:4:"4386";s:21:"ext_conf_template.txt";s:4:"7283";s:12:"ext_icon.gif";s:4:"a39a";s:14:"ext_tables.php";s:4:"6598";s:14:"doc/manual.sxw";s:4:"2ca5";s:13:"mod1/conf.php";s:4:"18a3";s:14:"mod1/footer.js";s:4:"e151";s:14:"mod1/header.js";s:4:"b57d";s:14:"mod1/index.php";s:4:"b03b";s:14:"mod1/jquery.js";s:4:"73a9";s:18:"mod1/locallang.xml";s:4:"426f";s:22:"mod1/locallang_mod.xml";s:4:"3ea7";s:22:"mod1/mod_template.html";s:4:"6122";s:19:"mod1/moduleicon.gif";s:4:"a39a";s:15:"mod1/styles.css";s:4:"2a7a";}',
'_md5_values_when_last_written' => 'a:16:{s:9:"README.md";s:4:"4386";s:21:"ext_conf_template.txt";s:4:"2f8c";s:12:"ext_icon.gif";s:4:"a39a";s:14:"ext_tables.php";s:4:"6598";s:14:"doc/manual.sxw";s:4:"20f5";s:13:"mod1/conf.php";s:4:"18a3";s:14:"mod1/footer.js";s:4:"e151";s:14:"mod1/header.js";s:4:"582d";s:14:"mod1/index.php";s:4:"f09c";s:21:"mod1/jquery.cookie.js";s:4:"d552";s:14:"mod1/jquery.js";s:4:"73a9";s:18:"mod1/locallang.xml";s:4:"ac6f";s:22:"mod1/locallang_mod.xml";s:4:"3ea7";s:22:"mod1/mod_template.html";s:4:"6122";s:19:"mod1/moduleicon.gif";s:4:"a39a";s:15:"mod1/styles.css";s:4:"2a7a";}',
'suggests' => array(
),
);
Expand Down
52 changes: 35 additions & 17 deletions mod1/header.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,81 @@
script_ended = 0;

function jumpToUrl(URL) {
var blockFixedPositionSetting = false;

function jumpToUrl (URL) {
$.removeCookie('fixedPosition');
blockFixedPositionSetting = true;
document.location = URL;
}

function view_order(order) {

function view_order (order) {
$("#detailed").val(order);
$("#docForm").submit();

}

$(document).ready(function() {

$(document).ready(function () {
var detailed = parseInt($("#detailed").val());
if (detailed > 0)
$(".typo3-usersettings .td-label").each(function() {
$(".typo3-usersettings .td-label").each(function () {
if (detailed == parseInt($(this).html())) {
$(this).parent().addClass("active");
}
});

$('.typo3-usersettings TR').hover(function() {
$('.typo3-usersettings TR').hover(function () {
$(this).addClass('highlight');
}, function() {
}, function () {
$(this).removeClass('highlight');
});

$('.td-image').hover(function() {
$('.td-image').hover(function () {
$(this).addClass('showImage');
}, function() {
}, function () {
$(this).removeClass('showImage');
});

if (parseInt(extConf['disableFixedPosition'], 10) > 0) {
$.removeCookie('fixedPosition');
}

if ($.cookie('fixedPosition')) {
$('#typo3-docbody').scrollTop($.cookie('fixedPosition'));
$.removeCookie('fixedPosition');
}
});


$(window).unload(function () {
if (!blockFixedPositionSetting) {
$.cookie('fixedPosition', $('#typo3-docbody').scrollTop());
}
});

function statusChanged() {

function removeItem(displayText, id, item) {
if (confirm(displayText + ': "' + item + '"')) {
$('#deleteItem').val(id);
$('#docForm').submit();
}
}


function statusChanged () {
var currentStatus = $('#tx_shopmanager_f2_statusCurrent').val();
var newStatus = $('#tx_shopmanager_f2_statusSelect').val();
if (currentStatus != newStatus) {
$('#tx_shopmanager_f2_status').slideDown();
} else {
$('#tx_shopmanager_f2_status').slideUp();
}

}



function statusChange() {

function statusChange () {
var newStatus = $('#tx_shopmanager_f2_statusSelect').val();
var comment = $('#tx_shopmanager_f2_statusComment').val();
$('#opt1').val('statusChange');
$('#opt2').val(newStatus);
$('#opt3').val(comment);
$("#docForm").submit();

}
22 changes: 17 additions & 5 deletions mod1/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ function main() {

// JavaScript and Stylesheets
$this->doc->JScode = '<link rel="stylesheet" type="text/css" href="' . $BACK_PATH . t3lib_extMgm::extRelPath('shop_manager') . 'mod1/styles.css" media="all">';
$this->doc->JScode .= '<script type="text/javascript">var extConf = ' . json_encode($this->getMergedConfig()) . '</script>';
$this->doc->JScode .= '<script type="text/javascript" src="' . $BACK_PATH . t3lib_extMgm::extRelPath('shop_manager') . 'mod1/jquery.js"></script>';
$this->doc->JScode .= '<script type="text/javascript" src="' . $BACK_PATH . t3lib_extMgm::extRelPath('shop_manager') . 'mod1/jquery.cookie.js"></script>';
$this->doc->JScode .= '<script type="text/javascript" src="' . $BACK_PATH . t3lib_extMgm::extRelPath('shop_manager') . 'mod1/header.js"></script>';
$this->doc->postCode = '<script type="text/javascript" src="' . $BACK_PATH . t3lib_extMgm::extRelPath('shop_manager') . 'mod1/footer.js"></script>';

Expand Down Expand Up @@ -291,6 +293,11 @@ function moduleContent() {
$opt1 = t3lib_div::_POST('opt1');
$opt2 = t3lib_div::_POST('opt2');
$opt3 = t3lib_div::_POST('opt3');
$deleteItem = t3lib_div::_POST('deleteItem');

if (isset($deleteItem)) {
$TYPO3_DB->exec_UPDATEquery('tt_products', 'uid='.intval($deleteItem), array('deleted' => '1'));
}

if ($opt1 == 'statusChange') {

Expand Down Expand Up @@ -361,7 +368,8 @@ function moduleContent() {
} else {
$layout['defRow']['1'] = $layout['defRowOdd']['1'] = $layout['defRowEven']['1'] = Array('<td class="td-textLine" style="width: 65%">', '</td>');
$layout['defRow']['2'] = $layout['defRowOdd']['2'] = $layout['defRowEven']['2'] = Array('<td class="td-textLine" style="width: 35%">', '</td>');
$layout['defRow']['3'] = $layout['defRowOdd']['3'] = $layout['defRowEven']['3'] = Array('<td class="td-icons td-edge">', '</td>');
$layout['defRow']['3'] = $layout['defRowOdd']['3'] = $layout['defRowEven']['3'] = Array('<td class="td-icons">', '</td>');
$layout['defRow']['4'] = $layout['defRowOdd']['4'] = $layout['defRowEven']['4'] = Array('<td class="td-icons td-edge">', '</td>');
}
$layout['defRow']['0'] = $layout['defRowOdd']['0'] = $layout['defRowEven']['0'] = Array('<td class="td-image">', '</td>');

Expand All @@ -380,12 +388,11 @@ function moduleContent() {
else
$table[$counter][0] = $this->pictureGenerator($row['image'], $extConf['imagesWidth'], 600);
$table[$counter][1] = $row['title'];
if ($itemsFilter > 0) {
$table[$counter][2] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tt_products]['.$row['uid'].']=edit',$GLOBALS['BACK_PATH'])).'">'.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif').' title="' . $LANG->getLL('act.edit') . '" border="0" alt="" /></a>';
} else {
if ($itemsFilter == 0) {
$table[$counter][2] = $categories[$row['category']];
$table[$counter][3] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tt_products]['.$row['uid'].']=edit',$GLOBALS['BACK_PATH'])).'">'.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif').' title="' . $LANG->getLL('act.edit') . '" border="0" alt="" /></a>';
}
$table[$counter][3] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tt_products]['.$row['uid'].']=edit',$GLOBALS['BACK_PATH'])).'">'.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/edit2.gif').' title="' . $LANG->getLL('act.edit') . '" border="0" alt="" /></a>';
$table[$counter][4] = '<a href="#" onclick="removeItem(\''.$LANG->getLL('act.delete.confirm').'\', '.$row['uid'].', \''.$row['title'].'\');">'.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/garbage.gif').' title="' . $LANG->getLL('act.delete') . '" border="0" alt="" /></a>';
$counter++;
}
$TYPO3_DB->sql_free_result($res);
Expand Down Expand Up @@ -454,6 +461,8 @@ function moduleContent() {

$content .= '</td></tr></table>';

$content .= '<input type="hidden" name="deleteItem" id="deleteItem" value="0" />';

break;
case 2:

Expand Down Expand Up @@ -762,6 +771,9 @@ function getMergedConfig() {
if ($value = $GLOBALS['BE_USER']->getTSConfigVal('mod.user_shopmanager.imagesWidth'))
$extConf['imagesWidth'] = $value;

if ($value = $GLOBALS['BE_USER']->getTSConfigVal('mod.user_shopmanager.disableFixedPosition'))
$extConf['disableFixedPosition'] = $value;

return $extConf;

}
Expand Down
117 changes: 117 additions & 0 deletions mod1/jquery.cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {

var pluses = /\+/g;

function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}

function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}

function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}

function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}

try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}

function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}

var config = $.cookie = function (key, value, options) {

// Write

if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);

if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}

return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}

// Read

var result = key ? undefined : {};

// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];

for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');

if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}

// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}

return result;
};

config.defaults = {};

$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}

// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};

}));
6 changes: 6 additions & 0 deletions mod1/locallang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<label index="title">Shop Manager</label>
<label index="act.apply">Apply changes</label>
<label index="act.edit">Edit</label>
<label index="act.delete">Delete</label>
<label index="act.delete.confirm">Are you sure to delete?</label>
<label index="act.add">Add</label>
<label index="act.add_new_record">Add new record</label>
<label index="sys.list_empty">List is empty</label>
Expand Down Expand Up @@ -57,6 +59,8 @@
<label index="title">Shop Manager</label>
<label index="act.apply">Änderungen speichern</label>
<label index="act.edit">bearbeiten</label>
<label index="act.delete">löschen</label>
<label index="act.delete.confirm">Sind Sie sicher, dass Sie löschen?</label>
<label index="act.add">hinzufügen</label>
<label index="act.add_new_record">Neuen Eintrag erstellen</label>
<label index="sys.list_empty">keine Einträge vorhanden</label>
Expand Down Expand Up @@ -105,6 +109,8 @@
<label index="title">Менеджер магазина</label>
<label index="act.apply">Применить изменения</label>
<label index="act.edit">Редактировать</label>
<label index="act.delete">Удалить</label>
<label index="act.delete.confirm">Вы уверены, что хотите удалить?</label>
<label index="act.add">Добавить</label>
<label index="act.add_new_record">Добавить новую запись</label>
<label index="sys.list_empty">Список пуст</label>
Expand Down

0 comments on commit ed8c943

Please sign in to comment.