osalabs / osafw-php Goto Github PK
View Code? Open in Web Editor NEWBusiness Applications Web Framework, PHP
License: MIT License
Business Applications Web Framework, PHP
License: MIT License
Should we show the writable status of /osafw-php/www/template/lang/
?
If 'IS_LANG_UPD' => true
fopen error immidiately terminates request.
The intrinsic nature of the getListRows()
function is actually to set
($this->list_rows
) or even more to init
(set multiple properties $this->list_rows
, $this->list_pager
).
Would it be more clear to have setListRows
or initListRows
name of this method?
"Moderator Menu" -> "Lookup Manager"
<li class="nav-item <~/common/active ifeq="GLOBAL[controller]" value="AdminLookupManager">" ><a class="nav-link" href="<~/admin/lookupmanager/url>">Lookup Manager</a></li>
<~/admin/lookupmanager/url> doesn't exist as well as the controller
I need a custom layout for printing.
Is this the proper approach to change the default layout for Controller?
public function __construct() {
parent::__construct();
$this->fw->page_layout = '/site/layout_print_custom.html';
}
How to use it properly?
"attrs_control": "data-live-search='true"
results to the following html:
data-live-search="true"
"attrs_control": "data-live-search=true"
results to the following html:
data-live-search=true
The last one works but I want it to be pretty in html:
data-live-search="true"
Should the attrs_control be default with noescape attibute?
<~attrs_control noescape>
At the moment it is hardcoded to 'en', i.e. does not depend on actual $_SESSION['lang']
value:
<html lang="en" ...
It would be nice to order by arbitrary number of columns in lists utilizing default $list_sortdef
public $list_sortdef = 'id asc, title desc, othercolumn';
Currently we need to override setListSorting()
:
public function setListSorting() {
if ( $this->list_filter['sortby'] == '') {
$this->list_orderby = $this->list_sortdef;
} else {
parent::setListSorting();
}
}
It would be nice to have the ability to set a text placeholder for search input box alongside with the "search_fields", i.e.
"search_fields": "id iname suppliers_iname",
"search_placeholder": "ID, Item, Supplier",
or even better, take those text values from "view_list_map"
And then display this placeholder in search input list filter
Why form_id
and not just id
?
public function SaveAction($id) {
$id += 0;
form_id
is associated with DOM ID like <form id="someDocumentID" ...
id
is associated with existing entity for the current controller/model, it's like this
keywordConsider the following request:
http://osafw.com/Manage/Bookings/555
It means that some Controller performs Mange action on Booking entity with number-like ID 555 . But the Booking page may have several forms with string-like DOM IDs ("bookingForm", "smsForm", "emalForm" etc) .
Suggest changing ifgt
to ifge
in sidebar.html:
<~admin80_menu ifgt="SESSION[access_level]" value="80" inline>
<~admin80_menu ifge="SESSION[access_level]" value="80" inline>
Because it's natural to count by tens. Consider the following:
Value | Category |
---|---|
100 | Admin |
90 | Supervisor |
80 | Manger |
To display manager menu, I have to
<~admin80_menu ifgt="SESSION[access_level]" value="79" inline>
that doesn't align with having access_level value of 80 in tag name <~admin80
and comparison value of 79.
If the default size is 16px (common setting in modern browsers), then the reduced size will be 14px:
@media (max-width: 767px) {
html {
font-size: 0.875rem;
}
.h1, h1 {
font-size: 2rem;
}
.h2, h2 {
font-size: 1.75rem;
}
.h3, h3 {
font-size: 1.5rem;
}
.h4, h4 {
font-size: 1.5rem;
}
}
Consider the following code in onload.js
:
var Config = {
maxSmsChars: <~js[maxSmsChars]>,
maxEmailChars: <~js[maxEmailChars]>,
commsSmsRefreshStatusUrl: '<~/comms/sms/url>' + '/(RefreshSmsStatus)/',
manageBookingsUrl: '<~/manage/bookings/url>'
}
$PS['js'] array only exists for edit
action (existing entity with id), i.e. if it's not new
.
So, if I request new
action the $PS['js'] is empty and the browser throw JS-syntax error.
What is the best way to deal with this?
var Config = {
maxSmsChars: <~js[maxSmsChars]><~un_js unless="js[maxSmsChars]" inline>1</~un_js>,
maxEmailChars: <~js[maxEmailChars]><~un_js2 unless="js[maxEmailChars]" inline>1</~un_js2>,
commsSmsRefreshStatusUrl: '<~/comms/sms/url>' + '/(RefreshSmsStatus)/',
manageBookingsUrl: '<~/manage/bookings/url>'
}
var Config = {
<if_id if="id" inline>
maxSmsChars: <~js[maxSmsChars]>,
maxEmailChars: <~js[maxEmailChars]>,
</if_id>
commsSmsRefreshStatusUrl: '<~/comms/sms/url>' + '/(RefreshSmsStatus)/',
manageBookingsUrl: '<~/manage/bookings/url>'
}
Changes in the controller are undesirable for various reasons.
We need a good standard regarding exchanging data between back-end Controller and front-end Client. Probably using some common object in PS with initialization to setup default values.
At the moment it feels strange to me of using ParsePage tags in JS-files ... These tags break syntax highlighting and create linter errors in IDE.
$ps['_layout']
to override the default layout?$ps['_layout']
undocumented feature or hack?$ps['_fw_layout']
.I have an AJAX-request to get a list of <option>
s for the <select>
ed value.
I don't want to use default layout_pjax.html
because of extra <script>
block and the content of `<~main> is escaped by default.
So, I've created /site/layout_pjax_nojs_noescape.html
with the following content:
<~main noescape>
And then in the Controller:
public function getSelectOptionsAction() {
$ps = array(
'_layout' => '/site/layout_pjax_nojs_noescape.html',
'main' => $this->model->getSelectOptions(reqs('parent_id'))
);
return $ps;
}
Or should I just simply do:
function getSelectOptionsAction() {
echo $this->model->getSelectOptions(reqs('parent_id'));
}
Is there any way to put &HTML; in a label without escaping the ampersand?
I need to add currency sign to label, i.e.
"label", "Price, €"
It'd be nice to have some usage example.
I've created site.js
to implement instant language switching through AJAX-request and location reload.
I need this JS-file on every page, so I added to the /layout/sys_footer.html
the following:
<script src="<~ROOT_URL>/js/site/site.js"></script>
Should we provide empty site.js
and recommend to use it like site.css
?
I definitely don't want to add site-specific code into fw.js
.
It would be nice to have a search highlighting from the box, probably with the option to turn it off.
Why do we need all these == ''
equations in conditionals, for example:
if ( $this->list_filter['sortby'] == '') {
why just not using:
if (!$this->list_filter['sortby']) {`
Should we have these settings in config.site.php
instead of class DateUtils
static properties definition? I was confused by the default USA format.
I need a comprehensive description about routing.
Probably a two-column table like 'HTTP_METHOD/URL_PATH ---> Corresponding handler in Controller (function name of the action)'.
I'm still confused about const route_default_action = ''
, and why the values are in lowercase ('index', 'show') when the function names are capitalized ('IndexAction', 'ShowAction') ...
Should we UPPERCASE all SQL key words in code? SELECT, WHERE, ORDER BY etc.
$row = $this->db->row("select * from ".$this->table_name." where id=".$this->db->quote($id));
$row = $this->db->row("SELECT * FROM ".$this->table_name." WHERE id=".$this->db->quote($id));
$sql = "select {$sql_select} where {$sql_where} group by {$sql_group} order by {$sql_order}";
$sql = "SELECT {$sql_select} WHERE {$sql_where} GROUP BY {$sql_group} ORDER BY {$sql_order}";
I find UPPERCASE formatting is more readable especially with huge queries.
It's also better when reading logs in terminal without any highlighting:
select lcc.*, c.iname as 'contacts.iname', c.status as 'contacts.status',
ca.iname as 'cars.iname', ca.iyear as 'cars.iyear', ca.licenseno as 'cars.licenseno', ca.status as 'cars.status'
from link_cars_contacts lcc
left join contacts c on c.id = lcc.contacts_id
left join cars ca on ca.id = lcc.cars_id
where lcc.cars_id='473'
order by lcc.itype
SELECT lcc.*, c.iname AS 'contacts.iname', c.status AS 'contacts.status',
ca.iname AS 'cars.iname', ca.iyear AS 'cars.iyear', ca.licenseno AS 'cars.licenseno', ca.status AS 'cars.status'
FROM link_cars_contacts lcc
LEFT JOIN contacts c ON c.id = lcc.contacts_id
LEFT JOIN cars ca ON ca.id = lcc.cars_id
WHERE lcc.cars_id='473'
ORDER BY lcc.itype
If I want to implement some API-service that talks only in JSON format.
What would be the best approach?
$this->fw->route->format = 'json';
into __construct
for every Controller?_json => true
for every $ps
returned? Create some private function postActionAlterPs(&$ps)
or global one in SiteUtils and pass $ps to it in every action?FwController
and then inherit from it?I think we need some basic guides describing how to do common things.
Currently, to switch to EU date format you need to modify the code in 3 places. Some better one-place setting would be nice.
/template/common/calendar.html
, line 5: $('.date').datepicker({format: 'dd/mm/yyyy'});
/php/fw/DateUtils.php
, lines 8-12 public static $DATE_FORMAT=0;
public static $DATE_FORMAT_STR='DD/MM/YYYY';
public static $TIME_FORMAT=0;
public static $TIME_FORMAT_STR='HH:MM';
/php/fw/parsepage.php
, line 924, function sec2date
. Change "d" and "m" order in the switch block: switch (strtolower($format)) {
case '':
$format = 'd/m/Y';
break;
case 'short':
$format = 'd/m/Y H:i';
break;
case 'long':
$format = 'd/m/Y H:i:s';
break;
case 'sql':
$format = 'Y-m-d H:i:s';
break;
}
If I have trailing spaces inside backticks of multi-language string, the lang file continues to be updated on every request:
`Space trailing `
` Space leading`
` Space both `
en.txt
keeps growing with:
Space trailing ===.
Space leading ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
Space trailing ===.
Space both ===.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.