Merge pull request #1 from redmatrix/master

2015-04-15_1
This commit is contained in:
mrjive 2015-04-15 11:19:25 +02:00
commit 7b467d6ca7
15 changed files with 71 additions and 61 deletions

View File

@ -17,6 +17,7 @@ We need much more than this, but here are areas where developers can help. Pleas
[li]Write more webpage widgets[/li]
[li]restricted access OAuth clients[/li]
[li](Advanced) create a UI for building Comanche pages[/li]
[li](less advanced) create a way to preview Comanche results on a preview page while editing on another page[/li]
[li]Extend WebDAV to provide desktop access to photo albums[/li]
[li]External post connectors - create standard interface[/li]
[li]External post connectors, add popular services[/li]

View File

@ -1171,7 +1171,7 @@ function status_editor($a, $x, $popup = false) {
'$action' => $a->get_baseurl(true) . '/item',
'$share' => (x($x,'button') ? $x['button'] : t('Share')),
'$webpage' => $webpage,
'$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link title')),
'$placeholdpagetitle' => ((x($x,'ptlabel')) ? $x['ptlabel'] : t('Page link name')),
'$pagetitle' => (x($x,'pagetitle') ? $x['pagetitle'] : ''),
'$id_select' => $id_select,
'$id_seltext' => t('Post as'),

View File

@ -436,7 +436,7 @@ function post_activity_item($arr) {
$arr['verb'] = ((x($arr,'verb')) ? $arr['verb'] : ACTIVITY_POST);
$arr['obj_type'] = ((x($arr,'obj_type')) ? $arr['obj_type'] : ACTIVITY_OBJ_NOTE);
if($is_comment)
if(($is_comment) && ($arr['obj_type'] === ACTIVITY_OBJ_NOTE))
$arr['obj_type'] = ACTIVITY_OBJ_COMMENT;
$arr['allow_cid'] = ((x($arr,'allow_cid')) ? $arr['allow_cid'] : $channel['channel_allow_cid']);

View File

@ -1595,18 +1595,20 @@ function layout_select($channel_id, $current = '') {
intval($channel_id),
intval(ITEM_PDL)
);
if($r) {
$o = t('Select a page layout: ');
$o .= '<select name="layout_mid" id="select-layout_mid" >';
$empty_selected = (($current === '') ? ' selected="selected" ' : '');
$o .= '<option value="" ' . $empty_selected . '>' . t('default') . '</option>';
$empty_selected = (($current === false) ? ' selected="selected" ' : '');
$options .= '<option value="" ' . $empty_selected . '>' . t('default') . '</option>';
foreach($r as $rr) {
$selected = (($rr['mid'] == $current) ? ' selected="selected" ' : '');
$o .= '<option value="' . $rr['mid'] . '"' . $selected . '>' . $rr['sid'] . '</option>';
$options .= '<option value="' . $rr['mid'] . '"' . $selected . '>' . $rr['sid'] . '</option>';
}
$o .= '</select>';
}
$o = replace_macros(get_markup_template('field_select_raw.tpl'), array(
'$field' => array('layout_mid', t('Page layout'), $selected, t('You can create your own with the layouts tool'), $options)
));
return $o;
}
@ -1639,13 +1641,14 @@ function mimetype_select($channel_id, $current = 'text/bbcode') {
}
}
$o = t('Page content type: ');
$o .= '<select name="mimetype" id="mimetype-select">';
foreach($x as $y) {
$select = (($y == $current) ? ' selected="selected" ' : '');
$o .= '<option name="' . $y . '"' . $select . '>' . $y . '</option>';
$selected = (($y == $current) ? ' selected="selected" ' : '');
$options .= '<option name="' . $y . '"' . $selected . '>' . $y . '</option>';
}
$o .= '</select>';
$o = replace_macros(get_markup_template('field_select_raw.tpl'), array(
'$field' => array('mimetype', t('Page content type'), $selected, '', $options)
));
return $o;
}
@ -2105,7 +2108,7 @@ function design_tools() {
$who = $channel['channel_address'];
return replace_macros(get_markup_template('design_tools.tpl'), array(
'$title' => t('Design'),
'$title' => t('Design Tools'),
'$who' => $who,
'$sys' => $sys,
'$blocks' => t('Blocks'),

View File

@ -36,7 +36,8 @@ function attach_init(&$a) {
header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
if($r['data']['flags'] & ATTACH_FLAG_OS ) {
$istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb');
$fname = dbunescbin($r['data']['data']);
$istream = fopen('store/' . $c[0]['channel_address'] . '/' . $fname,'rb');
$ostream = fopen('php://output','wb');
if($istream && $ostream) {
pipe_streams($istream,$ostream);
@ -45,7 +46,7 @@ function attach_init(&$a) {
}
}
else
echo $r['data']['data'];
echo dbunescbin($r['data']['data']);
killme();
}

View File

@ -78,16 +78,11 @@ function blocks_content(&$a) {
return;
}
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(feature_enabled($owner,'expert')) {
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(! $mimetype)
$mimetype = 'choose';
if(! $mimetype) {
$mimetype = 'choose';
}
else {
$mimetype = 'text/bbcode';
}
$x = array(
'webpage' => ITEM_BUILDBLOCK,

View File

@ -177,7 +177,17 @@ function connedit_post(&$a) {
if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
$new_friend = true;
if(! $abook_my_perms) {
$abook_my_perms = get_channel_default_perms(local_channel());
$role = get_pconfig(local_channel(),'system','permissions_role');
if($role) {
$x = get_role_perms($role);
if($x['perms_accept'])
$abook_my_perms = $x['perms_accept'];
}
}
}
$r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d

View File

@ -126,7 +126,7 @@ function editwebpage_content(&$a) {
$plaintext = true;
if(get_config('system','page_mimetype'))
$mimeselect = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
$mimeselect = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
else
$mimeselect = mimetype_select($itm[0]['uid'],$mimetype);

View File

@ -116,7 +116,7 @@ function item_post(&$a) {
* Check service class limits
*/
if ($uid && !(x($_REQUEST,'parent')) && !(x($_REQUEST,'post_id'))) {
$ret = item_check_service_class($uid,x($_REQUEST,'webpage'));
$ret = item_check_service_class($uid,(($_REQUEST['webpage'] == ITEM_WEBPAGE) ? true : false));
if (!$ret['success']) {
notice( t($ret['message']) . EOL) ;
if(x($_REQUEST,'return'))
@ -1084,6 +1084,7 @@ function item_check_service_class($channel_id,$iswebpage) {
$ret = array('success' => false, $message => '');
if ($iswebpage) {
// note: we aren't counting comanche templates and blocks, only webpages
$r = q("select count(id) as total from item where parent = id
and ( item_restrict & %d ) > 0 and ( item_restrict & %d ) = 0 and uid = %d ",
intval(ITEM_WEBPAGE),
@ -1092,7 +1093,8 @@ function item_check_service_class($channel_id,$iswebpage) {
);
}
else {
$r = q("select count(id) as total from item where parent = id and item_restrict = 0 and uid = %d ",
$r = q("select count(id) as total from item where parent = id and item_restrict = 0 and (item_flags & %d) > 0 and uid = %d ",
intval(ITEM_WALL),
intval($channel_id)
);
}
@ -1103,14 +1105,16 @@ function item_check_service_class($channel_id,$iswebpage) {
}
if (!$iswebpage) {
$max = service_class_fetch($channel_id,'total_items');
if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) {
$result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$r[0]['total']);
$result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$max);
return $result;
}
}
else {
$max = service_class_fetch($channel_id,'total_pages');
if(! service_class_allows($channel_id,'total_pages',$r[0]['total'])) {
$result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$r[0]['total']);
$result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$max);
return $result;
}
}

View File

@ -55,11 +55,12 @@ function page_init(&$a) {
$sql_options = item_permissions_sql($u[0]['channel_id']);
$r = q("select item.* from item left join item_id on item.id = item_id.iid
where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
item_restrict = %d $sql_options $revision limit 1",
where item.uid = %d and sid = '%s' and (( service = 'WEBPAGE' and
item_restrict = %d ) or ( service = 'PDL' and item_restrict = %d )) $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
intval(ITEM_WEBPAGE)
intval(ITEM_WEBPAGE),
intval(ITEM_PDL)
);
if(! $r) {
@ -83,7 +84,12 @@ function page_init(&$a) {
return;
}
if($r[0]['layout_mid']) {
if($r[0]['item_restrict'] == ITEM_PDL) {
require_once('include/comanche.php');
comanche_parser(get_app(),$r[0]['body']);
get_app()->pdl = $r[0]['body'];
}
elseif($r[0]['layout_mid']) {
$l = q("select body from item where mid = '%s' and uid = %d limit 1",
dbesc($r[0]['layout_mid']),
intval($u[0]['channel_id'])
@ -98,8 +104,6 @@ function page_init(&$a) {
$a->data['webpage'] = $r;
}
@ -111,17 +115,11 @@ function page_content(&$a) {
if(! $r)
return;
// logger('layout: ' . print_r($a->layout,true));
// Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so...
// I recommend we now get rid of this bit - it's quite a hack to work around... - mike
if ($perms['write_pages']) {
$chan = $a->channel['channel_id'];
$who = $channel_address;
$which = $r[0]['id'];
$o .= writepages_widget($who,$which);
if($r[0]['item_restrict'] == ITEM_PDL) {
$r[0]['body'] = t('Ipsum Lorem');
$r[0]['mimetype'] = 'text/plain';
$r[0]['title'] = '';
}
xchan_query($r);

View File

@ -70,13 +70,10 @@ function webpages_content(&$a) {
return;
}
if(feature_enabled($owner,'expert') || $a->is_sys) {
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(! $mimetype)
$mimetype = 'choose';
}
else {
$mimetype = 'text/bbcode';
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(! $mimetype) {
$mimetype = 'choose';
}
$layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout'));

View File

@ -1 +1 @@
2015-04-11.999
2015-04-14.1002

View File

@ -7,13 +7,14 @@
}
#webpage-list-table th:nth-child(1){
padding: 7px 3px 7px 10px;
white-space: nowrap;
}
#webpage-list-table td:nth-child(1){
padding: 7px 3px 7px 10px;
white-space: nowrap;
}
#webpage-list-table th:nth-child(5),
#webpage-list-table td:nth-child(5){
padding: 7px 3px;

View File

@ -19,6 +19,11 @@
<span class="channel-id-select-desc">{{$id_seltext}}</span> {{$id_select}}
</div>
{{/if}}
{{if $webpage}}
<div id="jot-pagetitle-wrap" class="jothidden" style="display:none">
<input name="pagetitle" id="jot-pagetitle" type="text" placeholder="{{$placeholdpagetitle}}" value="{{$pagetitle}}">
</div>
{{/if}}
<div id="jot-title-wrap" class="jothidden" style="display:none">
<input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" tabindex=1 value="{{$title}}">
</div>
@ -27,11 +32,6 @@
<input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" data-role="cat-tagsinput">
</div>
{{/if}}
{{if $webpage}}
<div id="jot-pagetitle-wrap" class="jothidden" style="display:none">
<input name="pagetitle" id="jot-pagetitle" type="text" placeholder="{{$placeholdpagetitle}}" value="{{$pagetitle}}">
</div>
{{/if}}
<div id="jot-text-wrap">
<textarea class="profile-jot-text" id="profile-jot-text" name="body" tabindex=2 placeholder="{{$share}}">{{$content}}</textarea>
</div>

View File

@ -13,7 +13,7 @@
</div>
{{/if}}
{{if $pages}}
<div id="pagelist-content-wrapper" class="generic-content-wrapper-styled">
<div id="pagelist-content-wrapper" class="section-content-wrapper-np">
<table id="webpage-list-table">
<tr>
<th width="1%">{{$pagelink_txt}}</th>