Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by Peter

  1. @LostKobrakai I thought .htaccess was needed for rewrites to work as well?

    I found your gist. Is this code compatible with PW 3.0? Maybe you could indicate  where to put the code? 

    I'm using UpCloud with RunCloud. Below contents of /etc/nginx-rc/:

    conf.d               extra.d               fastcgi_params          koi-win          mime.types.default  proxy.conf           uwsgi_params
    default_server.conf  fastcgi.conf          fastcgi_params.default  main-extra.conf  nginx.conf          scgi_params          uwsgi_params.default
    dhparam.pem          fastcgi.conf.default  koi-utf                 mime.types       nginx.conf.default  scgi_params.default  win-utf


  2. Thanks, but using JSON how can I pass the information that the inner ul should have a class "sub-menu"?

    $json =  $pages->get(1022)->menu_items;
    $items = json_decode($json, true);
    if( count($items) > 0 ){
      $out .= '<ul class="class="main-menu cf">';
      foreach($items as $item){
        $url = ($item['url']) ? $item['url'] : $pages->get($item['pages_id'])->url;
        $target = (1 == $item['newtab']) ? 'target="_blank"':'';
        $out .= '<li class="list-item"><a href="' . $url . '" class="list-item-link" ' . $target . '>' . $item['title'] . '</a></li>';
      $out .= '</ul>';
    <nav id="mainMenu">
        <label for='tm' id='toggle-menu' onclick>Navigation <span class='drop-icon'>▼</span></label> <input id='tm' type='checkbox'>
        <?php echo $out;?>
  3. Hi,

    I get the following errors when trying to configure Lister Pro:

    Uncaught TypeError: Cannot read property 'on' of nullProcessListerPro.init @ ProcessPageListerPro.js?v=101-1452724320:40(anonymous function) @ ProcessPageListerPro.js?v=101-1452724320:209l @ JqueryCore.js?v=1452713217:2c.fireWith @ JqueryCore.js?v=1452713217:2v.extend.ready @ JqueryCore.js?v=1452713217:2A @ JqueryCore.js?v=1452713217:2

    The browser (Chrome, Safari and Opera on the Mac) complains about this function in ProcessPageListerPro.js:

    ProcessLister.results.on('loaded', function() {
    	ProcessListerPro.pageClick(); // refresh counters

    This renders the Lister Pro configuration unusable. Doesn´t allow deleting or adding filters or change any other setting.

    I can comment out the function and it kind of works, but then it does not list all of templates/fields available to Lister Pro.

    I have the same experience locally (vagrant) and on the server (tested on PW 2.7.3 and 3.0.3)

    Anyone experiencing the same? Any ideas how to fix this?

    PS. I no longer have access to the Lister Pro VIP forum, thats why i'm posting here.

    - Peter

  4. I need project.project_progress to output as integer for the progress bar:

    app.controller('projects', function ($scope) {
      $scope.projects = [];
      $scope.projects = <?=$page->getChildren('template=project')?>;
      $scope.sortType     = 'title';
      $scope.sortReverse  = false;
      $scope.searchProject   = '';
    <tr ng-repeat="project in projects | orderBy:sortType:sortReverse | filter:searchProject">
    <div class='progress-bar-indication'>
    <span class='meter' style='width: {{project.project_progress}}%'>
    <td><a href="{{project.id}}"><i class="fa fa-eye"></i></a></td>
  5. Hi Manol,

    How can I access the page url using your module?

    I am bulding an Intranet solution and I want to use Angular on in the table views of projects, clients etc. and then link to a detail page for a specifc project, client etc.

    Also, JSON returns id as integer but every other field as string. How can I use/(convert?) a specific field as integer?

    Thanks for the module.


    PS. To get the module installed I had to add an is_array check in the getChildren function of your module.

    EDIT: I used this module for the urls: ProcessRedirectIds

  6. Thanks,

    I´m running PHP Version 5.4.40.

    It works now, but the module seems to output the parameters in text too:

    <section id='video'>yt_autoplayyt_hlyt_relyt_startyt_autoplayyt_hlyt_relyt_start<div class='TextformatterVideoEmbed'...

    I'm using your module in addition to TextformatterVideoEmbed and I have added it after that one.

    Another question: Do you know how to mute the sound or set a low volume level when using the autoplay parameter?

    I know this is not possible using parameters in the url, but there must be way :-)



  7. Sorry, but I still get errors with the latest version:

    Parse Error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' (line 49 of /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/site/modules/TextformatterVideoEmbedOptions/TextformatterVideoEmbedOptions.module) 
  8. Hi,

    I get a parse error when trying to install this module:

    Parse Error: syntax error, unexpected '.1' (T_DNUMBER), expecting ')' (line 27 of /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/site/modules/TextformatterVideoEmbedOptions/TextformatterVideoEmbedOptions.module) 
  9. Thanks Soma,

    That worked. And thanks for a great module!

    Now my code looks like this:

    $mainMenu = $modules->get("MarkupSimpleNavigation");
    $pages->get('/employees/')->nav_selector = 'employee=1';
    $options = array(
        'show_root' => true,
        'parent_class' => 'parent',
        'current_class' => 'on',
        'levels' => true,
        'firstlast' => true,
        'max_levels' => 3,
        'collapsed' => false,
        'outer_tpl' => '<ul>||</ul>',
        'inner_tpl' => '<ul>||</ul>',
        'list_tpl' => '<li%s>||</li>',
        'item_tpl' => '<a href="{url}">{title}</a>',
        'selector_level1' => 'start=0',
        'selector_level2' => 'template!=project, start=0',
        'selector_level3' => 'start=0',
        'selector_field' => 'nav_selector'
    echo $mainMenu->render($options);
  10. Any ideas why this works:

    'selector_level2' => 'start=0, employee=""',

    and this don't:

    'selector_level2' => 'start=0, employee!=""', 

    In the first example I am excluding people from an author list, showing only the authors that are NOT employees.

    The second example works for the authors, but then the other level2 items no longer show (only "Employees") .

    (My objective is to show only the authors that are also employees - in my backend I have a checkbox controlling this).

    I have also tried with:

    employee!=0 and employee=1

    Up to now I have worked around this,

    'selector_level2' => 'start=0, limit=20,

    but employees come and go so this is not the ideal solution.

    Any ideas?


  11. Thanks Craig,

    Works great:

    echo "<script type='text/javascript'>".
         "var user = {};".
         "user.lang = '{$user->language->title}';".
    $.get('/' + user.lang + '/marker/' + marker.rcdID + '/', {}, function(data) {
  12. Thanks Ryan

    Got it working (as seen here on this dev site:

    Thanks also to Adrian for the: $useWrappers = false;

    In the RCDMap.js I want to set the correct language

    $.get('/en/marker/' + marker.rcdID + '/', {}, function(data) {

    Any ideas how I can use a conditional like this inside the .js file?:

    if($user->language->title == 'no'){

    I know that I can load different .js files for each language like this:

    if($user->language->title == 'no'){
    echo "<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false&language=no'></script>";
    echo "<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>";	
  13. Thanks Adrian,

    I will start a crash course in URL segments :-)

    Maybe a silly question, but have can I set up a template file in PW (using the prepend/append approach from the Skyscraper Profile) that does not get "wrapped" by _init.php/_out.php ?


  14. I'm having trouble understanding if http://www.synbioproject.org/sbmap/marker/3210/ leads to an actual page in PW or if it's just a URL that generates the code on the fly... makes sense?

    In other words, in Ryan's code, is /marker/ part of the PW page hierarchy with children '3210' etc.?

    I know, newbie questions :-)

    Based on the Skyscrapers Profile (_init.php/_out.php), I have a the following in my /includes/functions.php:

    function findProjects($selector) {
    	$selector = "template=project, limit=20, sort=-date";
    	$projects = wire('pages')->find($selector); 
    	return $projects; 
    function renderProjectList(PageArray $projects) {
    	if (wire('user')->language->title == 'no'){
     	if(!count($projects)) return "<div style='clear:both; padding-top:.1em;'><p>Ingen prosjekter ble funnet</p><p>Her vil du snart finne en oversikt over pågående og kommende Vista-prosjekter.</p></div>";
    	if(!count($projects)) return "<div style='clear:both; padding-top:.1em;'><p>No projects found</p><p>Here you will soon find a list of ongoing and forthcoming Vista Projects.</p></div>";	
    	$pagerLinks = $showHeader ? $projects->renderPager(array(
    	'numPageLinks' => 2,
    	'separatorItemLabel' => "...",
        'nextItemLabel' => "»",
        'previousItemLabel' => "«",
        'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>",
        'itemMarkup' => "<li class='{class}'>{out}</li>",
        'linkMarkup' => "<a href='{url}'><span>{out}</span></a>"      
    )) : '';
    	$out = 	$pagerLinks . "\n<table class='list_publications'>";
    	$out .= "\n\t<tbody>";
    	foreach($projects as $project) {
    		$out .= renderProjectItem($project, $showCategory);
    	$out .= "\n\t</tbody>" . 
    		"\n</table>" . $pagerLinks;
    	return $out; 

    I also have a function: renderProjectItem(Page $project)

    The above functions are for my template: list-all-projects.php:

    $selector = '';
    $headline = $page->title;
    $content = $page->body;
    $content .= renderProjectList(findProjects($selector));

    In my template for a single project; project.php, I have the following:

    function renderProjectBody($page) {
    	$out = 	"\n<div id='bodycopy'>" . 
    		"\n\t<br />{$page->body}";
    		$out .= "\n<ul class='page_list'>"; 
    	$out .= "\n</ul>" . 
    	return $out;
    function renderProjectData($page) {
    	if (wire('user')->language->title == 'no'){
    	$searchUrl = wire('config')->urls->root . "no/search/";
    	$searchUrl = wire('config')->urls->root . "en/search/";	
    	if (wire('user')->language->title == 'no'){	
    	if (strtotime(date('Y-m-d')) >= strtotime($page->date) && $page->end_date == ''){
    		$status = "Pågående";
    	}else if (strtotime(date('Y-m-d')) < strtotime($page->date) && $page->end_date == ''){
        	$status = "Planlagt";
         }else if($page->end_date != ''){
    	    $status = "Ferdig";
    	 if (strtotime(date('Y-m-d')) >= strtotime($page->date) && $page->end_date == ''){
    		$status = "Ongoing";
    	}else if (strtotime(date('Y-m-d')) < strtotime($page->date) && $page->end_date == ''){
        	$status = "Planned";
        }else if($page->end_date != ''){
    	    $status = "Finished";
    	$running = '';
    	$leader = '';
    	$authors = '';
    	if (wire('user')->language->title == 'no'){
    		$download = 'Last ned';
    		$download = 'Download';
    	$lang = wire('user')->language;
    	$label = 'label';
    	if (wire('user')->language->title != 'no'){
    	$label = "label{$lang}";
    	foreach($page->authors as $a) {
    		$authors .= "\n\t<li><a href='{$a->url}'>{$a->title}</a></li>";
    	foreach($page->leader as $a) {
    		$leader .= "\n\t<li><a href='{$a->url}'>{$a->title}</a></li>";
    	$out =	"\n<table class='publication_data'>" . 
    		$out .= "\n\t<tr><th>Status</th><td><span>$status</span></td></tr>";
    		if (wire('user')->language->title == 'no'){
    		$out .= "\n\t<tr><th>Startdato</th><td>$page->date</td></tr>";
    		$out .= "\n\t<tr><th>Start Date</th><td>$page->date</td></tr>";
    		if ($page->end_date == 0){
    		if (wire('user')->language->title == 'no'){
    				$out .= "\n\t<tr><th>Estimert sluttdato</th><td>" . ($page->estimated_end ? "\n$page->estimated_end" : $running) . "</td></tr>";
    				$out .= "\n\t<tr><th>Estimated finish date</th><td>" . ($page->estimated_end ? "\n$page->estimated_end" : $running) . "</td></tr>";
    			if (wire('user')->language->title == 'no'){
    				$out .= "\n\t<tr><th>Sluttdato</th><td>" . ($page->end_date ? "\n$page->end_date" : $running) . "</td></tr>";
    				$out .= "\n\t<tr><th>Finished date</th><td>" . ($page->end_date ? "\n$page->end_date" : $running) . "</td></tr>";
    		$out .= "\n\t<tr><th>". ($page->fields->get('client')->$label) ."</th><td>" . ($page->client ? "\n$page->client" : $na) . "</td></tr>";
    		$out .= "\n\t<tr><th>". ($page->fields->get('leader')->$label) ."</th><td>" . ($leader ? "\n<ul>$leader</ul>" : $na) . "</td></tr>";
    		if (wire('user')->language->title == 'no'){
    			$out .= "\n\t<tr><th>Prosjektmedlemmer</th><td>" . ($authors ? "\n<ul>$authors</ul>" : $na) . "</td></tr>";
    			$out .= "\n\t<tr><th>Project Members</th><td>" . ($authors ? "\n<ul>$authors</ul>" : $na) . "</td></tr>";	
    		if (wire('user')->language->title == 'no'){
    		$out .= "\n\t<tr><th>Rapport</th><td><a href='{$page->files->first()->url}'>" . $download . "</a> ({$page->files->first()->ext} | {$page->files->first()->filesizeStr})</td></tr>";
    		$out .= "\n\t<tr><th>Report</th><td><a href='{$page->files->first()->url}'>" . $download . "</a> ({$page->files->first()->ext} | {$page->files->first()->filesizeStr})</td></tr>";
    		$out .="\n\t</tbody>".
    	return $out; 
    $browserTitle = $page->title . ", " . $page->parent->title . " Project";
    $content = renderProjectData($page) . renderProjectBody($page);

    So, I would appreciate some help to understand have I can pull som of that data to use in the 'google.maps.InfoWindow', by id or other means...



  15. Thanks Adrian,

    That part I have already managed. I have also got  the clustering working (thanks Mats and Ryan)

    Here's my working 'map.php':

    echo "\n\n<div id='map'></div>";
    $js = "<script type='text/javascript'>";
    $js .= "RCDMap.options.zoom = 4;";
    $js .= "RCDMap.options.mapTypeId = google.maps.MapTypeId.TERRAIN;";
    $js .= "RCDMap.init('map', 0, 0);";
    foreach($page->children as $items) {
      $js .= "\nRCDMap.addMarker('{$items->title}', '{$items->url}',{$items->map->lat}, {$items->map->lng});";
    $js .= "RCDMap.fitToMarkers();";
    $js .= "</script>";
    echo $js;

    My question is how can I pull data from my project-pages to populate the 'google.maps.InfoWindow'.

    Ryan's code from 'RCDMap.js':

    $.get('/sbmap/marker/' + marker.rcdID + '/', {}, function(data) {

    Ryan is using the 'rcdID' ('url'/'page_id'), in the example below '3210', to identify and pull data to show in the 'google.maps.InfoWindow'.

    RCDMap.addMarker('Adam Arkin Lab', '3210', 37.8735034, -122.2675594, 2718, 3337, 3210, icons[2718]);

    Ryan's code:

    $.get('/sbmap/marker/' + marker.rcdID + '/', {}, function(data) {

    get this:


    I am wondering how I can pull the right project info (based on id?) when clicking a marker.


  16. Hello

    I really like what Ryan did on this project: http://www.synbioproject.org/sbmap/

    I´m trying to make a map that shows projects around the world, but I cannot get my head around the way Ryan pulls data to populate the 'google.maps.InfoWindow'

    From Ryan's modified 'RCDMap.js':

    addMarker: function(title, url, lat, lng, cat, subcat, page_id, icon) {
    		var latLng = new google.maps.LatLng(lat, lng); 
    		var marker = new google.maps.Marker({ 
    			position: latLng, 
    			map: RCDMap.map,
    			rcdID: page_id,
    			rcdURL: url,
    			icon: icon,
    			shadow: '/sbmap/site/templates/styles/images/map_icon_shadow.png'
    google.maps.event.addListener(marker, 'click', function(e) {
    	if(RCDMap.infoWindow) RCDMap.infoWindow.close();
    	$.get('/sbmap/marker/' + marker.rcdID + '/', {}, function(data) {
    	RCDMap.infoWindow = new google.maps.InfoWindow({ content: data });
    	RCDMap.infoWindow.open(RCDMap.map, marker); 

    From the source: (He is using page_id, which is also 'url'(?)

    RCDMap.addMarker('Adam Arkin Lab', '3210', 37.8735034, -122.2675594, 2718, 3337, 3210, icons[2718]);

    When clicking on the markers, I want to show a short description of  every project, client, project leader, project members, start date, end date etc.

    I want to pull this info from the existing project pages.

    What is the best way to accomplish this?



  • Create New...