Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-03-11 06:06:23

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

feature-request: additional settings for Linker-Plugin

I submitted this as ticket #58 (http://xinha.gogo.co.nz/cgi-bin/trac.cgi/ticket/58)
the discussion about my ideas/requests could be done here.

Setting to define which type of link is allowed.
- popup-window (i won't allow the user to open popups as it would break the design)
- same window (not every page has frames)
- email-link (ok, this one doesn't hurt - but it is not needed everywhere)


Currently the tree with the links comes from a 'backend' php-file. This is very nice if you use it to scan directories.
Wouldn't it make sense to have the avaliable links as config-variables?
(in my case this would be only about 10 links to the latest news on the site and 15 links to some content-sites)
It would require a lot of extra work if i have to do it using the backend-php-file.


...and my third suggestion:
couldn't be the tree right of the inputs?
in some cases i would mainly use the tree to select the file
but other users might enter an external link and won't need the tree at all!


(of course i can do some of these features myselfe, but i want to know if they make sense...)

niko

Last edited by niko (2005-03-11 06:08:02)


Niko

Offline

#2 2005-03-11 16:32:32

dhscompguy
Xinha Community Member
Registered: 2005-03-10
Posts: 23

Re: feature-request: additional settings for Linker-Plugin

To left-align the link panel --

function: Linker.Dialog.prototype._prepareDialog

old line 340: ddTree.style.left = 1 + 'px';
new line 340: ddTree.style.left = 322 + 'px';

old line 349: options.style.right = 0 + 'px';
new line 349: options.style.left = 0 + 'px';

The scan.php file returns a plain old javascript array --

[
'/index.php',
 [
   '/testing',
   [
       '/testing/index.php'
   ]
 ]
]

You can put something like that in your scan.php file and be done with it.

To disable the email fieldset and hide the popup/frame choices --

function: Linker.Dialog.prototype.show

  AFTER THIS:
  if(!this.ready)
  {
    var lDialog = this;
    window.setTimeout(function() {lDialog.show(inputs,ok,cancel);},100);
    return;
  }

 ADD THIS:
 this.dialog.getElementById('mailtable').parentNode.style.display = 'none';
 var t = this.dialog.getElementsByName('target');
 for (var i = 0; i < t.length; i++)
 {
     if (t[i].value == 'popup' || t[i].value == '_top') t[i].parentNode.style.display = 'none';
 }

Last edited by dhscompguy (2005-03-11 17:26:44)


Learn how to astral project: [url]http://gnosticweb.org[/url]

Offline

#3 2005-03-11 17:54:48

dhscompguy
Xinha Community Member
Registered: 2005-03-10
Posts: 23

Re: feature-request: additional settings for Linker-Plugin

I think this is a good idea --

      OLD LINE 377:
      this.dTree.add(id, parent, files[i][0].replace(/^.*\//, ''), null, files[i][0]);

      NEW LINE 377:
      this.dTree.add(id, parent, files[i][0].replace(/^.*\//, ''),
                     'javascript:document.getElementsByName(\'' + this.dialog.id.href + '\')[0].value=unescape(\'' + escape(files[i][0]) + '/\');document.getElementsByName(\'' + this.dialog.id.type + '\')[0].click();document.getElementsByName(\'' + this.dialog.id.href + '\')[0].focus();void(0);',
                     files[i][0]);

It allows the folders to be selected as links too.


Learn how to astral project: [url]http://gnosticweb.org[/url]

Offline

#4 2005-03-14 05:29:01

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: feature-request: additional settings for Linker-Plugin

thanks for your replies,

dhscompguy wrote:

To left-align the link panel --

function: Linker.Dialog.prototype._prepareDialog

old line 340: ddTree.style.left = 1 + 'px';
new line 340: ddTree.style.left = 322 + 'px';

old line 349: options.style.right = 0 + 'px';
new line 349: options.style.left = 0 + 'px';

To left-align the link panel --

yes, but isn't this worth a config-variable?
config.Linker.treePosition = 'left'; //or right


dhscompguy wrote:

The scan.php file returns a plain old javascript array --

[
'/index.php',
 [
   '/testing',
   [
       '/testing/index.php'
   ]
 ]
]

You can put something like that in your scan.php file and be done with it.

yes, i know that.
BUT: im writing out the xinha-config in a cms-site of my cms. and currenly i have my own cms-api to define the xinha-settings.
Of couse i have serveral places where i use xinha - and everywhere i need different links in the linker-plugin.
So i would have to write an external file for every cms-site (instead of having defined the links within the cms-site itself!)

its not a big problem doing so... but it would much, much better fit into the concept of my cms big_smile
(one option is of course writing it into a php-session - but i would like to avoid this...)

dhscompguy wrote:

To disable the email fieldset and hide the popup/frame choices --

function: Linker.Dialog.prototype.show
  AFTER THIS:
  if(!this.ready)
  {
    var lDialog = this;
    window.setTimeout(function() {lDialog.show(inputs,ok,cancel);},100);
    return;
  }

 ADD THIS:
 this.dialog.getElementById('mailtable').parentNode.style.display = 'none';
 var t = this.dialog.getElementsByName('target');
 for (var i = 0; i < t.length; i++)
 {
     if (t[i].value == 'popup' || t[i].value == '_top') t[i].parentNode.style.display = 'none';
 }

yes... but one page needs this and one not... why not make it configurable?



dhscompguy wrote:

I think this is a good idea --

      OLD LINE 377:
      this.dTree.add(id, parent, files[i][0].replace(/^.*\//, ''), null, files[i][0]);

      NEW LINE 377:
      this.dTree.add(id, parent, files[i][0].replace(/^.*\//, ''),
                     'javascript:document.getElementsByName(\'' + this.dialog.id.href + '\')[0].value=unescape(\'' + escape(files[i][0]) + '/\');document.getElementsByName(\'' + this.dialog.id.type + '\')[0].click();document.getElementsByName(\'' + this.dialog.id.href + '\')[0].focus();void(0);',
                     files[i][0]);

It allows the folders to be selected as links too.

good idea too.... might be needed in some cases - but in others not big_smile
so another config-setting would be nice....


imho it would be the best to write a patch that adds these config-settings...
(would you do that? - i can do it too... but its your code big_smile)

niko


Niko

Offline

#5 2005-03-15 10:02:11

dhscompguy
Xinha Community Member
Registered: 2005-03-10
Posts: 23

Re: feature-request: additional settings for Linker-Plugin

BUT: im writing out the xinha-config in a cms-site of my cms. and currenly i have my own cms-api to define the xinha-settings.
Of couse i have serveral places where i use xinha - and everywhere i need different links in the linker-plugin.
So i would have to write an external file for every cms-site (instead of having defined the links within the cms-site itself!)

Couldn't you just modify scan.php to take some variable from the GET query string and return the appropriate set of links? Then you can simply set the linker.lConfig.backend to "/xinha/plugins/linker/scan.php?var=value".

imho it would be the best to write a patch that adds these config-settings...

I'll get this done over the weekend... if somebody else doesn't beat me to it. smile

Last edited by dhscompguy (2005-03-15 10:03:00)


Learn how to astral project: [url]http://gnosticweb.org[/url]

Offline

#6 2005-03-15 11:07:45

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: feature-request: additional settings for Linker-Plugin

Couldn't you just modify scan.php to take some variable from the GET query string and return the appropriate set of links? Then you can simply set the linker.lConfig.backend to "/xinha/plugins/linker/scan.php?var=value".

good idea... but not working in my case (the length of the get-parameter is limited and i do have quite a big number of links)


Niko

Offline

#7 2005-03-15 20:07:06

dhscompguy
Xinha Community Member
Registered: 2005-03-10
Posts: 23

Re: feature-request: additional settings for Linker-Plugin

If you have the links in the database and can figure out a way to pull them out based on an id of some sort, then you shouldn't have any problems fetching the links.

This is what I'm using at the moment --

require_once('lib/common.php');
$most_recent = db_one('SELECT creation_date FROM entries ORDER BY creation_date DESC LIMIT 1');
$file = CACHE_PATH . '/scan.js';
clearstatcache();
if (!file_exists($file) || (file_exists($file) && strtotime($most_recent) > filemtime($file)))
{
    $js = to_js(get_children(0));
    file_put_contents($file, $js);
    echo $js;
}
else
{
    echo file_get_contents($file);
}

function get_children($id)
{
    $results = db_query("SELECT id, label FROM entries WHERE parent_id = $id");
    if (db_num_rows($results))
    {
        while ($row = db_fetch_array($results))
        {
            $entry = $row['label'];
            $children = get_children($row['id']);
            $entries[$row['id']] = $children ? array($entry, $children) : $entry;
        }
    }
    return $entries;
}

Basically -- take the id, look up the links, stick them into a multi-dimensional (hierarchical) array, and then pass them into the wonderful to_js() function provided in the original scan.php.

Last edited by dhscompguy (2005-03-15 20:08:31)


Learn how to astral project: [url]http://gnosticweb.org[/url]

Offline

#8 2005-03-16 04:15:58

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: feature-request: additional settings for Linker-Plugin

dhscompguy wrote:

If you have the links in the database and can figure out a way to pull them out based on an id of some sort, then you shouldn't have any problems fetching the links.

sure, that would be no problem!

BUT: i have a separate file!
in my cms there are several places where xinha is used, every place could have different links!
so i would need a extra scan.php-like file for every place where xinha is used

...which could be done but is confusing imho...


Niko

Offline

#9 2005-03-16 05:01:07

adamp
Xinha Pro
Registered: 2005-03-14
Posts: 77

Re: feature-request: additional settings for Linker-Plugin

You could just add some more code in scan.php to check which page is currently using xinha and build the list based on that information (e.g. the referring file is /somedir/editor.php so you can build a list relative to that).

Offline

#10 2005-03-16 06:37:59

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: feature-request: additional settings for Linker-Plugin

yes... i probably could do that...
but i still don't like it big_smile


Niko

Offline

#11 2005-03-17 02:45:48

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: feature-request: additional settings for Linker-Plugin

i made a litte patch
hopefully gogo will apply it big_smile

if you don't need this feature just don't use it! (the default-settings didn't change)

http://xinha.gogo.co.nz/cgi-bin/trac.cgi/ticket/66


Niko

Offline

Board footer

Powered by FluxBB