On Wed, 14 Dec 2011 11:16:12 -0600
Jon Phillips <[email protected]> wrote:
> Did this get replaced in one of the new parsers?
there is no new parser only - (script( )script) AFAIK
>
> I don't like having all these different markup. Like oh, we have (())
> and then we have XML in the widgets.
>
You mean rss? I think that should be deleted you can create rss just
putting it into widgets why you need a parser for that (I did it on
sharims). Instead of edit in place we could put (edit({ JSON })edit) it
will be very easy to parse
json_decode($aiki->get_string_between($widget, '(edit(', ')edit)'));
(edit({
"table": "ocal_files",
"filed": "upload_published",
"select": {"Active": 1, "Hidden": 0},
"permissions": "librarian"
})edit)
see AIKI Markup proposal below
> We should stick with the (()) style at this point and replace silly
> things like the custom XML where possible with the (()) style and the
> (script()script) and using the aiki api, which should be more firm
> anyway.
>
> Agree?
>
> And, then what about below?
>
> On Sun, Sep 11, 2011 at 9:32 AM, Roger Martín <[email protected]>
> wrote:
>
> > Jakub proposal has great possibilities: we can suppress aiki parse
> > and use only jakub's markup:
> >
> > widget before:
> > (noloop_top( <table> )noloop_top)
> > ...tr td ((username))
> > (noloop_bottom(...)
> >
> > widget after:
> > table
> > (the-loop( // all wordpress developers knows the-loop
> > tr td [username]
> > )
> > /table
> >
> > In few words, we can replace (the-loop( by "(sql( ". NORMAL_SELECT,
> > and then call parser.
> > Some problems we must resolve:
> > - pagination. perhaps we can create (sql-paginated(...
> > - our code uses regular expression, but now with nested markers we
> > need rewrite all code.
> > Does have somebody a idea for how making this?
> >
> > If we could do that we can unify internal parser, sql parser and php
> > parser in new super-parser.
> >
> > Roger
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~aikiframework-devel
> > Post to : [email protected]
> > Unsubscribe : https://launchpad.net/~aikiframework-devel
> > More help : https://help.launchpad.net/ListHelp
> >
> >
>
>
------------------------------
:: AIKI Markup PROPOSALS
------------------------------
(if( $aiki->permission == 'SystemGOD' {
(edit({
"table": "ocal_files",
"filed": "upload_published",
"select": {"Active": 1, "Hidden": 0}
"pkey": ((id)) // right now id is taken from SQL of the widget
})edit) // every thing should be transparent
})if)
------------------------------
:: Example - SQL and if
------------------------------
<table>
<tr>
<th>id</th>
<th>username</th>
(if( $aiki->membership->permissions == 'SystemGOD' {
<th>delete</th>
})if)
</tr>
(sql( SELECT * FROM aiki_users {
<tr>
<td>[[id]]</td>
<td>[[username]]</td>
(if( $aiki->membership->permissions == 'SystemGOD' {
<td><button class="delete">X</button></td>
})if)
</tr>
})sql)
</table>
<script>
$(function() {
$('button.delete').live('click', function() {
var td = $(this).parent();
$.get('/delete/' td.prev().html(), function(data) {
if (data) {
td.parent().remove();
}
});
});
});
</script>
------------------------------
:: noloop noloop_bottom
------------------------------
SQL: SELECT * FROM aiki_widgets
<table>
<tr>
<th>id</th>
<th>widget_name</th>
</tr>
(loop(
<tr>
<td>((id))</td>
<td>((widget_name))</td>
</tr>
)loop)
</table>
And an idea: we could remove SQL from widget and only use inline SQL so
there will be no need to old [-[username]-] - and new which
look better [[username]]
<table>
<tr>
<th>id</th>
<th>widget_name</th>
</tr>
(sql( SELECT * FROM aiki_widgets {
<tr>
<td>((id))</td>
<td>((widget_name))</td>
</tr>
})sql)
</table>
------------------------------
:: Widgets need arguments
------------------------------
(sql( SELECT * FROM ocal_files WHERE user_name = '((url[1]))' LIMIT 10 {
(widget:image_thumbnail( ((url[1])), "((full_path))",
"((filename))" )widget)
})sql)
and in widget image-thumbnail:
<div>
<a href="((args[1]))/((args[2]))">
<img src="/image/20px/svg_to_png/(script( replace("svg", "png",
"((args[2]))"); )script)"/> </a>
(sql( SELECT num_downloads FROM ocal_files WHERE id = ((args[0])) {
<div>Downloaded ((num_downloads)) times</div> // this is just an
example, it can be pass as argument })sql)
</div>
Notes:
[1] we should alway use quotes
[2] ((url[1])) instead of (!(1)!) - it will be an array from url
[3] we can also have comments
------------------------------
:: Final Code
------------------------------
<table>
<tr>
<th>id</th>
<th>username</th>
(if( $aiki->membership->permissions == 'SystemGOD' {
<th>delete</th>
}else{
<th><th>
})if)
</tr>
(sql( SELECT * FROM aiki_users {
<tr>
<td>((id))</td>
<td>((username))</td>
(if( $aiki->membership->permissions == 'SystemGOD' ||
$aiki->membership->username ==
"((username))" { (widget:delete_user( ((id)) )widget)
})if)
</tr>
}else{ // no result for query
<tr>
<td colspan="2">Sory no users</td>
</tr>
})sql)
</table>
------------------------------
:: Syntax Summary
------------------------------
with parameters:
(name( parameters {
<html> + syntax
})name)
without parameters:
(name(
<html> + syntax
)name)
database values:
((field))
predefined arrays:
((url[1]))
((args[1]))
--
Jakub Jankiewicz
twitter: @jcubic
www: http://jcubic.pl
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp