This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lmce_owncloud [2014/06/09 21:20] – [Useful commands for app development] admin | lmce_owncloud [2014/06/10 11:47] (current) – admin | ||
---|---|---|---|
Line 33: | Line 33: | ||
vlc -vvv file:/// | vlc -vvv file:/// | ||
| | ||
- | ===== Useful | + | ===== Useful |
+ | ==== PHP ==== | ||
+ | |||
+ | Add Settings in admin area (appinfo/ | ||
+ | |||
+ | <code php> | ||
+ | \OCP\App:: | ||
+ | </ | ||
+ | |||
+ | Get users ID: | ||
+ | |||
+ | <code php> | ||
+ | OCP\User:: | ||
+ | </ | ||
Translate in Template | Translate in Template | ||
Line 40: | Line 53: | ||
<?php echo $l-> | <?php echo $l-> | ||
</ | </ | ||
- | ==== PHP ==== | ||
+ | Check for logged in user: | ||
+ | |||
+ | <code php> | ||
+ | OCP\JSON:: | ||
+ | </ | ||
+ | |||
+ | Check for enabled app: | ||
+ | |||
+ | <code php> | ||
+ | OCP\JSON:: | ||
+ | </ | ||
==== Javascript ==== | ==== Javascript ==== | ||
+ | |||
+ | Include JS (appinfo/ | ||
+ | |||
+ | <code php> | ||
+ | OCP\Util:: | ||
+ | </ | ||
+ | |||
+ | Includes file app_folder/ | ||
Translate: | Translate: | ||
Line 54: | Line 85: | ||
<code javascript> | <code javascript> | ||
OC.dialogs.filepicker(' | OC.dialogs.filepicker(' | ||
+ | </ | ||
+ | |||
+ | AJAX URL: | ||
+ | |||
+ | <code javascript> | ||
+ | OC.filePath(' | ||
+ | </ | ||
+ | |||
+ | Example AJAX request: | ||
+ | |||
+ | <code javascript> | ||
+ | $.ajax({ | ||
+ | // REQUEST URL | ||
+ | url: OC.filePath(' | ||
+ | type: " | ||
+ | // URL PARAMS | ||
+ | data: { action: action}, | ||
+ | success: function(data){ | ||
+ | // DO SOMETHING WITH data | ||
+ | }, | ||
+ | error: function(data){ | ||
+ | alert(' | ||
+ | }, | ||
+ | }); | ||
</ | </ | ||
==== CSS ==== | ==== CSS ==== | ||
+ | |||
+ | |||
+ | Include CSS (appinfo/ | ||
+ | |||
+ | <code php> | ||
+ | OCP\Util:: | ||
+ | </ | ||
+ | |||
+ | Includes file app_folder/ | ||
+ | |||
Get file app folder using **%appswebroot%**: | Get file app folder using **%appswebroot%**: | ||
Line 64: | Line 129: | ||
background: | background: | ||
} | } | ||
+ | </ | ||
+ | |||
+ | Good to know vars in JS: | ||
+ | |||
+ | <code javascript> | ||
+ | oc_debug=false; | ||
+ | oc_webroot="/ | ||
+ | oc_appswebroots={" | ||
+ | dayNames=[" | ||
+ | var monthNames=[" | ||
+ | var firstDay=0; | ||
+ | var oc_config={" | ||
</ | </ |