diff options
author | mrjive <mrjive@mrjive.it> | 2015-04-15 11:19:25 +0200 |
---|---|---|
committer | mrjive <mrjive@mrjive.it> | 2015-04-15 11:19:25 +0200 |
commit | 7b467d6ca7a27bd83388627f16df96b47963c42f (patch) | |
tree | 76c7ba2286bb8cb3c031137f394cc3bd02b84c73 | |
parent | 865b602cf8b4eff5e7da00362df95e52e2fe4f77 (diff) | |
parent | 834044b15bf4cd3f436f065449cbc0ed76b4de93 (diff) | |
download | volse-hubzilla-7b467d6ca7a27bd83388627f16df96b47963c42f.tar.gz volse-hubzilla-7b467d6ca7a27bd83388627f16df96b47963c42f.tar.bz2 volse-hubzilla-7b467d6ca7a27bd83388627f16df96b47963c42f.zip |
Merge pull request #1 from redmatrix/master
2015-04-15_1
-rw-r--r-- | doc/to_do_code.bb | 1 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rwxr-xr-x | include/items.php | 2 | ||||
-rw-r--r-- | include/text.php | 27 | ||||
-rw-r--r-- | mod/attach.php | 5 | ||||
-rw-r--r-- | mod/blocks.php | 11 | ||||
-rw-r--r-- | mod/connedit.php | 10 | ||||
-rw-r--r-- | mod/editwebpage.php | 2 | ||||
-rw-r--r-- | mod/item.php | 12 | ||||
-rw-r--r-- | mod/page.php | 32 | ||||
-rw-r--r-- | mod/webpages.php | 11 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/css/mod_webpages.css | 3 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 10 | ||||
-rw-r--r-- | view/tpl/webpagelist.tpl | 2 |
15 files changed, 71 insertions, 61 deletions
diff --git a/doc/to_do_code.bb b/doc/to_do_code.bb index 713885f92..a0835d224 100644 --- a/doc/to_do_code.bb +++ b/doc/to_do_code.bb @@ -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]
diff --git a/include/conversation.php b/include/conversation.php index 67f3afde0..05898cfce 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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'), diff --git a/include/items.php b/include/items.php index e08aab85a..01f207878 100755 --- a/include/items.php +++ b/include/items.php @@ -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']); diff --git a/include/text.php b/include/text.php index 791254e52..f1f6d41f0 100644 --- a/include/text.php +++ b/include/text.php @@ -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'), diff --git a/mod/attach.php b/mod/attach.php index cf72d09c6..118c67dd5 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -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(); } diff --git a/mod/blocks.php b/mod/blocks.php index 1b7a3588f..e0f32f4f1 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -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, diff --git a/mod/connedit.php b/mod/connedit.php index 70839e373..8ae1707ae 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -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 diff --git a/mod/editwebpage.php b/mod/editwebpage.php index e81cde479..e30a33171 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -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); diff --git a/mod/item.php b/mod/item.php index 45ac4a6aa..53064132c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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; } } diff --git a/mod/page.php b/mod/page.php index 05d88aa52..ad1862a7a 100644 --- a/mod/page.php +++ b/mod/page.php @@ -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); diff --git a/mod/webpages.php b/mod/webpages.php index b4c4e6e4e..e2b5eb3a4 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -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')); diff --git a/version.inc b/version.inc index ffc321393..548eb28e1 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-04-11.999 +2015-04-14.1002 diff --git a/view/css/mod_webpages.css b/view/css/mod_webpages.css index af1ef5357..32291adc7 100644 --- a/view/css/mod_webpages.css +++ b/view/css/mod_webpages.css @@ -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; diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index ed1d1e35f..927b3a5b9 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -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> diff --git a/view/tpl/webpagelist.tpl b/view/tpl/webpagelist.tpl index 4e5b3e0e4..9d440eb64 100644 --- a/view/tpl/webpagelist.tpl +++ b/view/tpl/webpagelist.tpl @@ -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> |