• 15 апреля стартует «Курс «SQL-injection Master» ©» от команды The Codeby

    За 3 месяца вы пройдете путь от начальных навыков работы с SQL-запросами к базам данных до продвинутых техник. Научитесь находить уязвимости связанные с базами данных, и внедрять произвольный SQL-код в уязвимые приложения.

    На последнюю неделю приходится экзамен, где нужно будет показать свои навыки, взломав ряд уязвимых учебных сайтов, и добыть флаги. Успешно сдавшие экзамен получат сертификат.

    Запись на курс до 25 апреля. Получить промодоступ ...

No Documents Found

  • Автор темы Gor
  • Дата начала
G

Gor

Всем доброго времени суток!

Вопрос относительно дизайна наверное. У меня есть html форма.
На форме есть Embeded view. (отображение как html)
КОгда в ней нет документов вместо вьюхи появляется очень некрасивая надпись No documents found =))

Как возможно изменить дизайн данной надписи и собственно текст??
 
A

Akupaka

link removed

как вариант формула скрытия внедренного вида на основе @Elements(@DbColumn), но есть риск получить превышение 32К

а еще есть гугл! в нете очень много инфы по этому поводу

а еще, по-идее, можно сделать агент WebQueryOpen на заглушке вида, который может сбегать к виду и проверить что там есть, и выдать наверх какой-нить флажек, а на форме уже этот флажек прочитать JSом
кроме того, внедренный вид поцепить в какой-нить div, потом, если флажек грит, что нету доков, нужно в этот div написать что-то свое...
 
A

Akupaka

а то шо это надо не забывать обрабатывать :)

попробовал агент на WQO на заглушку, срабатывает, вот только то ли на локальной машине не так как надо срабатывает, то ли я че-то забыл... но падла грит, что видит доки, хотя в виде не показывает доки... возможно на сервере будет нормально... хз, надо пробовать :)
 
E

EHT

1. Description: Web browser clients are often directed to a view that may not contain any documents. This might be because no documents meet the selection criteria or the database uses reader names fields to control which documents the user can see. When using the web browser client to open a Domino view which has no documents the web user sees a page which shows "No documents found" with no other information or other navigation tools.

To learn more about web development use the following links:

Beginner R5 Domino Web Application Development


Web browser clients are often directed to a view that may not contain any documents. This might be because no documents meet the selection criteria or the database uses reader names fields to control which documents the user can see. When using the web browser client to open a Domino view which has no documents the following message is displayed:

This message can be confusing to the user. To reduce confusion, replace the default "No documents found" message with a custom message like the following:
Follow these step to replace the "No documents found" message with a custom message:

Create a view template form to act as a container and provide formatting for the view. In this example the view name is "North" so the name of the view template form must be "$$ViewTemplate for North".

Add these fields to the view template form (put the ViewName and Count field at the top of the form and hide them at all times):

Код:
Field name	
Type	
Formula

ViewName	
Text. Computed for display	
@Subset(@ViewTitle;-1)

Count	
Text. Computed for display	
@Elements(@DbColumn("Notes":"NoCache";@DbName;ViewName;1))

$$ViewBody	
Editable	
None

NoDocsMessage	
Text. Computed for display	
@If(Count = 0; "No customers are located in the North region."; "")


In the ViewName field formula, @ViewName returns the list of view names and view alias names. The @Subset function is used to return the last name or alias in the list.
In the Count field formula, @DbColumn returns the list of values from the first column in the view. The @Elements function operates on this list to return the number of documents in the view to the Count field. So, if a view has no documents to display, the Count field will contain 0 (zero).
The $$ViewBody field is used to position the view for display in the view template form.
The @If formula in the NoDocsMessage field tests the Count field and displays the custom message when there are no documents to display.
Hide the $$ViewBody field when Count field is equal to zero using the hide paragraph formula shown in this image:

4. When you use a view template Domino does not provide the standard set of navigation links to page forward or backward, expand or collapse the view, or search the view. At a minimum, add view navigation links to page forward and backward using @DbCommand("Domino";"ViewNextPage") and @DbCommand("Domino";"ViewPreviousPage") commands.

This techique has one limitation. @DbColumn will return an error when it returns more than about 55KB of information. Try to make the column number you specify be a column in the view that has minimal information (preferably a text constant like "a".) Otherwise, the form will return an error when your user opens a really big view. One addition that could be done is to use @IsError to trap for errors if the @DbColumn returned one because the view was too big. If there was an error, then just set the Count field equal to a number greater than zero so the view contents will display.
------------------------------------------------------------------------------------------------------

2.
в форме обрамляешь вьюху тегом <div id="divEmbeddedView">view</div>

в форме, в JS Header пишешь:
Код

Код:
function CheckNoDocuments()
{ 
if (document.getElementById("divEmbeddedView").innerHTML.indexOf("No documents found") > 0) 
{
document.getElementById("divEmbeddedView").innerHTML = ""
};
}


в форме, в onLoad: CheckNoDocuments();

естественно, нужно, чтобы броузер пользователей позволял отрабатывать JS скриптам
-----------------------------------------------------------------------------------------------------------
3.
For a recent customer, we were using quite a few views on the web, and there was one view template for all the views. With a couple of the views there was a chance for the view to be empty, which leads to the standard No documents found Domino message. This customer wanted to customize this message. Luckily, the site was for an intranet and all their employees used IE, so the solution was quite a bit easier than what we've done in the past.

In the past, we had to hide the HTML that Domino generated, have a flag that says there are no documents, then have some JavaScript to generate our own message if the flag is set. That involves updating the view to stop hiding the HTML that Domino generates (when there are documents) and clear the flag so our own message won't be generated. With this solution, you just need to update the template. We enhanced the solution to default to the standard Domino way if the browser isn't IE.

First, don't make any changes to your view (or "views" in our case, which made this solution more attractive). Just go into the view template. Before the $$ViewBody field, add one line of pass-through HTML:
<div id="ViewBody" style="display:block; visibility:visibile;">

This will put the entire view HTML that Domino generates into its own division, which can be hidden later programmatically if there are no documents in the view. After the $$ViewBody field (which should not be in pass-through HTML), close out that division with a <div> tag.

Next, add a division that will appear if there are no documents. The division will be hidden initially and shown later if needed. To handle Netscape 4, put the division in a hidden layer. This will cause Netscape 4 to use the standard Domino message. Here's the pass-through HTML you will need:

Код:
<layer id="NoDocumentsFoundParent" style="display:none;">
<div id="NoDocumentsFound" style="display:block; visibility:hidden;">
<h1>Hey, there aren't any documents in this view!</h1>
</div>
</layer>

Obviously, you can put whatever message you want inside the division.

Next comes some JavaScript to programmatically hide the Domino-generated view and show the custom "No Documents Found" message if needed. The JavaScript can appear right on the page so it will run in-line while the page is being generated. It must appear after both the "ViewBody" and the "NoDocumentsFound" divisions, however. Here is the java script:

Код:
<script language="JavaScript" type="text/javascript"><!--
   if ( (document.getElementById) && (document.getElementsByTagName) ) {
      var tags = document.getElementById("ViewBody").document.getElementsByTagName("tr");
   } else if (document.all) {
      var tags = document.all["ViewBody"].document.all.tags("tr");
   } else {   // Unknown - don't use the "No Documents Found" division
      var tags = new Array("x");
   }
-----------------------------------------------------------------------------------------------------
 

lmike

нет, пердело совершенство
Lotus Team
27.08.2008
7 941
609
BIT
214
самое простое, ИМХО, решение - не мудрить, не использовать (а оно так и получится, в большинстве) H2 стиль, а встилях:
H2 {
display:none;
}
и на том все ;)
 
A

Akupaka

как по мне, так это самый неинтересный способ, т.к. не позволяет задать свою фразу и накладывает ограничение на использование стиля H2
 

lmike

нет, пердело совершенство
Lotus Team
27.08.2008
7 941
609
BIT
214
предлагаемые выше варианты, тоже неизящны и имеют еще больше ограничений ;)
ежели пользовать JS - то не изобретать велики, а воспользоваться "стандартами"...
типа JQuery либо JSON, xmlRequester...
тогда будет и изящество и ф-ционал
 
A

Akupaka

ага, значит заюзать xmlRequester это не велики изобретать? ;)
и отрисовывать вид ручками - это самая простая и легкая задача?!
 

lmike

нет, пердело совершенство
Lotus Team
27.08.2008
7 941
609
BIT
214
ага, значит заюзать xmlRequester это не велики изобретать? ;)
и отрисовывать вид ручками - это самая простая и легкая задача?!
эти решения уже есть...
вот один из великов:
вот еще интересней:
 
A

Akupaka

вопрос не в том есть ли это уже где-то ;) вышеуказанные примеры тоже есть в большом количестве...
тут мы уже просто начали спорить как лучше, каждый вариант имеет право быть ;)
а решать какой проще использовать уже тому кто задал вопрос :)
 
M

Mihal

предлагаемые выше варианты, тоже неизящны и имеют еще больше ограничений ;)
ежели пользовать JS - то не изобретать велики, а воспользоваться "стандартами"...
типа JQuery либо JSON, xmlRequester...
тогда будет и изящество и ф-ционал

Какое ограничение у @Text(@DBLookup(...))?
 

lmike

нет, пердело совершенство
Lotus Team
27.08.2008
7 941
609
BIT
214
Какое ограничение у @Text(@DBLookup(...))?
"обычное" ;), в хэлпе дизайнера... (полагаю, сами знаете) - по объему переваримых данных
в кириллической кодировке - делим где-то на два (в символах)
если вьюшкой пользуются много пользоватеплей и разными правами (нек. могут видеть всё, а нек. ничего) и вьюшка "большая", то и будем натыкаться на поглюкивание
 
G

Gor

Что то не совсем получается у меня это сделать...
Засовываю вьюху в теги

Потом смотрю сурс у страницы

<div id="divEmbeddedView"><br>
<h2>No documents found</h2></div>

вот такое вот получается... надпись всё арвно видна

У меня вьюха ещё на столе находится...может вэтом ещё дело

Дело в том что решение с @Elements мне не подходит, т.к. Embeded veiw у меня с первой сортированной колонкой по uid...
 

lmike

нет, пердело совершенство
Lotus Team
27.08.2008
7 941
609
BIT
214
JS что дает - отрассируйте alert -ами
мобуть он не работает или в нем ошибка
и не пойму - чем H2 стиль не устроил?
 
G

Gor

to: Imike
и не пойму - чем H2 стиль не устроил?
Хех) Я просто не знаю как применить отмену H2 стиля)

Хотяяя... вьюха у меня в ячейке таблицы висит, если только на ячейку таблицы повесить H2 {display:none}

Тогда же по идее это только применимо к данной ячейки будет?

Что то не то у меня опять получилось)

<td style="H2 {display:none;}" width="923" bgcolor="#F4FAFE" colspan="2"><h2>No documents found</h2></td></tr>
</table>

А как в ячейке таблицы этот стиль запретить?
 
A

Akupaka

Что то не совсем получается у меня это сделать...
Засовываю вьюху в теги

Потом смотрю сурс у страницы

<div id="divEmbeddedView"><br>
<h2>No documents found</h2></div>

вот такое вот получается... надпись всё арвно видна
ну, если кроме этого ничего не делать больше, то тогда чего надписи пропасть? :)
надо еще JS-ом обработать эту строчку, т.е. если она есть, то удалить ее...
 
G

Gor

ну, если кроме этого ничего не делать больше, то тогда чего надписи пропасть?
надо еще JS-ом обработать эту строчку, т.е. если она есть, то удалить ее...
=)) обрабатываю, как на примере в Header и на Onload повесил обработку... Может дело в том что у меня это на Сабформе висит всё... обработчики
 
A

Akupaka

ммм... не знаю, мож, код не правильный?.. или попробуй повесить обработчик просто в <script> который идет после div'а... он запустится сразу при формировании страницы...
покажи код, возможно в нем не так че-то...
 
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!