That is indeed a problem. Today I tweaked the clause slug a bit, but its still not something people would memorize I fear.
$invoker = $event->getInvoker();
$clauseOrdering = $invoker->_get('Document')->_get('clause_ordering');
$slug = $invoker->_get('Document')->_get('code');
$slug.= ' '.$invoker->_get('clause_body_id');
$slug.= ' '.(str_word_count($clauseOrdering, 0, '023456789')+1);
$slug.= ' '.$invoker->_get('clause_number_information');
$slug.= ' '.$invoker->_get('clause_number_subparagraph');
$slug = Doctrine_Inflector::urlize($slug);
$invoker->_set('slug', $slug);
So basically the slug is the document code + the id of the clause_body + the position of the clause + additional clause number information + clause subparagraph. I guess the clause body id is the only piece of information that is totally meaningless to admins, but still its tricky.
What we might need is something a bit more fancy. As in you get auto complete just like with documents and the options you get presented is a list of the clauses with " the position of the clause + additional clause number information + clause subparagraph" but also linked so that people can open up the clause to see the details.
@Hannah: If this all sounds like gibberish I can try and explain it a bit simpler, but if you understand what we are talking about please give your input.
regards,
Lukas Kahwe Smith
sm...@pooteeweet.org
> Hi,
>
> I was actually responding to Dennis' email right now, bc I thought I understood it - but then, I realized that in fact I didn't :) Are you talking about a name that you need for the clause (for the purpose of finding specific docs/clauses in the backend)? I guess this relates solely to the backend, not really to the front-end, or?
>
> So yes, an explanation in simpler terms would be much appreciated and I will definitely give my input once I understood the problem :)
This is a question for the admin tools. In a few places people will need to select a clause. For example when trying to do a follow up on a previous clause or when creating a relation from a document to a clause. Here we were planning to use livesearch. As in you start typing some piece of information about the clause and it automatically suggest you a list of possible matches, which you can then select.
For documents the most obvious choice here is the code with optionally maybe also supporting the name.
However for clauses there isnt really anything to use here besides the clause number+additional number info + subparagraph.
> Wow Lukas
>
> That sounds way more sophisticated than what I got out of the wiki :-) Especially as I refer myself to the backend. But as far as I understand your approach: you want to create a searchable string (a connection of information bits from document, clause, clause_body), to be able to search over it with a given search term, something alphanumeric the user has entered in the search box before? So we try to find something in it that matches the entered search term?
Well we could use the slug for that with a bit of tweaking, like moving the clause_body_id to the end ..
But like I said it would be nice to have some way to verify that the selected clause is actually the right one. So in the spirit of KISS (keeping it simple stupid) we could just use the slug for the autosuggest (we would have to apply the Doctrine_Inflector::urlize($slug) thing on the input string inside the action class before calling the autosuggest helper).
Then we could have a button next to the input form that when pressed takes the slug value and opens a new window with the clause.
ok, I think now I get it. So just to fully understand this: the piece
of information to be inserted would be the code? Or the name? Or both?
(sorry for being so slow on this...)
If that's the question, then I guess the only way to find specific
clauses would be to go via the document, so essentially document code
+ clause number (because there may be multiple clauses with the same
clause number/subparagraph; however, the combination of doc code +
clause number is unique, except for very few exceptions). Do you mean
something like that by "additional clause number info", or what
exactly are you referring to there?
Again, sorry for being a bit slow :)
Best,
Hannah
> ok, I think now I get it. So just to fully understand this: the piece of information to be inserted would be the code? Or the name? Or both? (sorry for being so slow on this...)
so you would enter the document code, the position and optionally the additional info and subparagraph
> If that's the question, then I guess the only way to find specific clauses would be to go via the document, so essentially document code + clause number (because there may be multiple clauses with the same clause number/subparagraph; however, the combination of doc code + clause number is unique, except for very few exceptions). Do you mean something like that by "additional clause number info", or what exactly are you referring to there?
exactly ..
@Dennis: going to bed soon .. but i guess for now we will just kick out the clause_body_id from the slug .. but i need to review once more why without the clause_body_id we could get duplicates. dont remember ..
> @Dennis: going to bed soon .. but i guess for now we will just kick out the clause_body_id from the slug .. but i need to review once more why without the clause_body_id we could get duplicates. dont remember ..
Actually its probably a bug in the computation of the position.
$slug.= ' '.(str_word_count($clauseOrdering, 0, '023456789')+1);
Which is weird because I make sure to update the document instance after every update:
$invoker->_get('Document')->refresh();
And the ordering the db is correct:
1,2,3,4,5
But in the DB it computes postion 1 for both clause 1 and 2 ..
>
> On 15.03.2010, at 23:50, Lukas Kahwe Smith wrote:
>
>> @Dennis: going to bed soon .. but i guess for now we will just kick out the clause_body_id from the slug .. but i need to review once more why without the clause_body_id we could get duplicates. dont remember ..
>
>
> Actually its probably a bug in the computation of the position.
> $slug.= ' '.(str_word_count($clauseOrdering, 0, '023456789')+1);
and the bug of course was in the code above .. was missing a "1" in the list of numbers :)
fixed in svn .. clause_body_id is also out .. so we can provide nice human readable links for clauses consisting of the associated document code and all the clause number information.