Skip to content

Instantly share code, notes, and snippets.

View plu's full-sized avatar
🏠
Working from home

Johannes Plunien plu

🏠
Working from home
View GitHub Profile
if(!window.console || !window.console.firebug) {
window.console = {
debug: function(){},
log: function(){}
};
}
if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}
var win = new Ext.Window({
.....
,items:[
new Ext.FormPanel({
,url:'[% Catalyst.uri_for('/save') %]'
,id: 'fp'
.....
,items: [{
fieldLabel: 'First name',
name: 'first',
var fp = win.findById('fp');
fp.on('actioncomplete', function(a, fp) {
var r = fp.result;
for (var field in r.error) {
fp.form.findField(field).markInvalid(
r.error[field].join("&lt;br/&gt;")
);
}
});
sub save : Global {
my ( $self, $c ) = @_;
$c->form(
first => [ qw/NOT_BLANK ASCII/ => [qw/LENGTH 2 20/] ],
last => [ qw/NOT_BLANK ASCII/ => [qw/LENGTH 2 20/] ],
company => [ qw/NOT_BLANK ASCII/ => [qw/LENGTH 2 20/] ],
email => [qw/NOT_BLANK EMAIL_LOOSE/],
);
svn co http://code2.0beta.co.uk/mojomojo/svn/trunk/ MojoMojo
cd MojoMojo
perl Makefile.PL
make
<Model::DBIC>
connect_info dbi:mysql:mojomojo
connect_info mojomojo
connect_info sTrOnGpAsSwOrD
</Model::DBIC>
<permissions>
check_permission_on_view 1
cache_permission_data 1
create_allowed 0
delete_allowed 0
edit_allowed 0
view_allowed 0
attachment_allowed 0
</permissions>
-- add a new role
insert into role values (null, 'user', 1);
-- add this role to the standard admin user
insert into role_member values (1, 2, 1);
-- allow everything to that new role
insert into path_permissions values
('/', 1, 'no', 'yes', 'yes', 'yes', 'yes', 'yes');
insert into path_permissions values
mysql> select * from role;
+----+------+--------+
| id | name | active |
+----+------+--------+
| 1 | user | 1 |
+----+------+--------+
mysql&gt; select * from role_member;
+------+--------+-------+
| role | person | admin |