drupal 7 response with two sets of html, a normal, followed by an in-maintenance with an error message - drupal-7

I have a weird problem on my localhost devop preventing me from updating drupal.
problem
Every page is served with two sets of html
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" ...>
<body class="html front ...">
...
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<body class="maintenance-page in-maintenance no-sidebars fluid-width">
...
</body>
</html>
where the second page is a rendering of the maintenance page
** what I am looking for**
as i spend like 8 hours debugging this, I am at my wits end, and looking for an other perspectives or suggestions
context
the problem is not theme related becaus it does this for every theme
the weird thing is that this local version is an exact copy (code, database, php version, .htacces) of the online production version that does not have this problem
the only difference is an error i get on my local devop
TypeError: Argument 1 passed to DateObject::limitGranularity() must be of the type array, null given, called in /Applications/MAMP/htdocs/sontheing/xdev_en_rli_nl/sites/all/modules/contrib/date/date.module on line 255 in DateObject->limitGranularity()
Trying to temporarily resolve this error, to see if this is the cause of my weird double html, sends me down a rabbithole patching various date modules.... And I don understand how a type error could have this weird double html rendering result...
the only other occurence of this problem with someone else i could find here
https://drupal.stackexchange.com/questions/269926/maintenance-page-being-rendered-as-an-entire-page-load-after-the-main-page-load
Question
Does this problem ring a bell for someone.
Has anybody seen this before?
how it looks in garland

problem 1 -
I havent a clue howcome drupal rendered two html pages in the same response, but found the culprit in my case
problem 2 -
I traced the problem back to the cron and apache solr, which ultimately crashed on a specific node.
Opening that node it also crashed. (Noone ever found that problem because these nodes are rarely viewed, cuase they are mainly historic)
so that was the reason the cron crashed
The error stemming from the date field
reason 2 -
The reason for the page crashing is that drupal tried to render a long text field via the date formatter. Which is weird because i use the same field in other content types and there it is rendered as a text field.
solution 2 -
So, i have not yet discovered why drupal thought that these instances of this text field where date fields, but the solution here was to save the contents of the text fields (I could open the nodes in the editor) then remove the text field from the contenttype, then add a new text field and restore the contents for each node....
followup 2 -
If i can find the reason why drupal thought a text field was a date field I will report that in this thread

Related

Sanity/next slug- 404 not found

When I try to access my slug page, the name of the slug shows in the browser search bar (so I know its accessing the backend data), but nothing shows up on the page. In the console, error 404 keeps coming every 3 seconds.
Due to lack of timing, experience, knowledge, etc., I've had to switch from react to next very last minute (learning both for the first time at the moment). In react, I remember you could establish a path/page that went '/pageName/:slug', but I haven't seen that for next. I think this might be what is causing the issue, that I don't have an equivalent of that, but I'm not sure how to go about doing that. How do I fix this issue?
I'm happy to post any code if needed.
Got it. I hadn't given much context in the post, but I had two .js page files, gallery.js (where I can select a set), and sets.js where I wanted the slug to route into. So my link in gallery.js looked like this: <a href="./sets/[slug]">.
The fix: I renamed sets.js to [slug].js, and removed /sets/ so that it was just <a href="./[slug]">.

Script Link in Header - EnableOptimizations Strips Attributes

Not sure if this is a bug or if 2sxc is doing this on purpose, "for reasons."
First, here is the goal. I am in a 2sxc App, in a View using Razor/C#. I need to get the following JS module linked up in the <head> like this:
<script src="//unpkg.com/#dnncommunity/dnn-elements/dist/dnn/dnn.esm.js"
type="module" async="async" defer="defer" crossorigin="anonymous">
</script>
Obviously if I just put it in as-is, it gets on the page, but not in the <head>.
If I add the attribute, data-enableoptimizations="true" then its in the <head> but all 4 of my attributes get stripped:
<script src="https://unpkg.com/#dnncommunity/dnn-elements/dist/dnn/dnn.esm.js" type="text/javascript"></script>
Additionally, notice that the src had only the leading "//unpkg...", and for some reason, the optimizations have added back "https:" which I do not want.
And where did type="text/javascript" come from? That hasn't been required for years.
I can solve this in the theme/skin by using the DnnJsInclude control like this. It uses ClientResourceManagement and allows me to specify all the attributes in HtmlAttributesAsString like this:
<dnn:DnnJsInclude
FilePath="//unpkg.com/#dnncommunity/dnn-elements/dist/esm/dnn.js"
ForceProvider="DnnPageHeaderProvider"
HtmlAttributesAsString="type:module,async:async,defer:defer,crossorigin:anonymous"
Priority="1001"
runat="server"
/>
This gets me the correct result, but it means my standard content editors now need the ability to edit page settings to use my 2sxc App. Which I do not want (the permissions or the training complication).
I realize I can probably use that DnnJsInclude control from my Razor code, but it seems like this is a valid use case that data-enableoptimizations should handle. Yes? No? Maybe? Maybe it already does it but I don't know the right syntax?
Anyone know how to get 2sxc to do this? Or is this a bug worth reporting regarding data-enableoptimizations? I was especially surprised that it just stripped my valid attributes.
So for some background: once the attribute is set, it will be picked up and taken apart, because DNN will need the parts given one by one, not as a <script> tag.
I would assume that as of now, there is no mechanism which tries to preserve the remaining bits. We haven't looked at this in a long time, and maybe the DNN APIs are missing in v7.4.2 (our minimum compatibility).
But in general: this is currently by design, and could be improved. I suggest you open an issue on github and/or contribute a change ;)
Okay, so I worked it out in code using the DnnJsInclude control. Here is the solution in a nutshell:
#using DotNetNuke.Web.Client.ClientResourceManagement
#{
// Add a <script> tag in the head as a JS module
var include = new DnnJsInclude
{
FilePath = "https://unpkg.com/#dnncommunity/dnn-elements/dist/dnn/dnn.esm.js",
ForceProvider = "DnnPageHeaderProvider",
Priority = 1001, // stay out of the way?
HtmlAttributesAsString = "type:module,async:async,defer:defer,crossorigin:anonymous",
};
var loader = (Context.CurrentHandler as Page).FindControl("ClientResourceIncludes");
if (loader != null)
{
loader.Controls.Add(include);
}
}
Which gets the exact output needed thanks to the HtmlAttributesAsString parameter.
I even wrote it up as a blog post with a lot of details.
DNN Details 004: Using the New Dnn-Elements in a 2sxc View?
Since this is dependent on Dnn, it doesn't benefit the Oqtane/hybrid coders.

Umbraco cms AngularJS Regular Expression Keep appearing

Umbraco uses angularJS as based library and backoffice totally developed on it. The reason telling first is to tell that I have a field on which URL regular expression applied. If someone entered invalid url like below image
it shows error as need.
But if a user try to remove whole text by selecting it and removing at once. It still keep appearing the error like this
However, if a user erase text one by one like this
then the validation error removed and user need to click on button to see error again.
I would to know how screen 3 state can be achievable when user remove all text together? Its really annoying behavior for a user to remove text character one by one to refresh the state of the field. Screen 3 state should be applied on screen 2.
Can anybody tell me how it can fix or achievable? Right now, it seems like a default behavior.
Looking forward to hear from you guys. Suggestions will be much appreciatable.
Regards o
I've looked into this issue. This seems to be a product bug.
When you remove whole text at once, newValue is an empty string and the code responsible for resetting error messages doesn't run. If you have access to the umbraco code, you can easily fix it by removing highlighted check:

Interpolating custom data onto a PDF

I am building an Angular test preparation app (with Laravel 5.1 API). One of the requirements is to allow the user to print a certificate of achievement.
The client wants the person's name and credentials interpolated into the document (e.g., highlighted below). Here is a snapshot of the PDF template they sent:
The way I'm handling PDF viewing is simply by storing the file on S3 and giving them a link to that file.
Interpolating information into a PDF doc doesn't seem trivial and I haven't found much information on programmatically allowing this, but there are tools like DocHub, that allow you do edit while viewing the PDF.
I'm interested in learning:
is doing this programmatically trivial?
are there 3rd party tools I'm unaware of?
would I even be able to send this information along to the S3 link to interpolate in the first place?
Using PDF as a format for editing is usually a bad choice. If you have a form with fixed fields, then it's easy. Create a PDF template with an interactive form. In this form, based on AcroForm technology, you'll define fields with fixed coordinates, and a fixed size. You can then add content to these fields.
One major disadvantage with this approach is the lack of flexibility. Did you notice that I used the word "fixed" three times in the previous paragraph? If text doesn't fit the predefined field, you're out of luck. If the field is overdimensioned, you'll end up with plenty of white space. This approach is great if you can predict what the data will be like. A typical use case is a ticket or a voucher. For instance: the empty form is a really nice page, with only a couple of fields where an automated system can put a name, a date, a time, and a seat number.
This isn't the best approach for the example you show in your screen shot. The position of every line of text, every word, every character is known in advance. If you want to replace a short word with a long word (or vice-versa), then all those positions (of each line, of the complete page, possibly of the complete document) need to be recalculated. That's madness. Only people with very poor design skills come up with such an idea.
A better idea, is to store the template as HTML. See for instance chapter 5 of iText's pdfHTML tutorial, where we have this snippet of HTML:
<html>
<head>
<title>Invitation to SXSW 2018</title>
</head>
<body>
<u><b>Re: Invitation</b></u>
<br>
<p>Dear <name>SXSW visitor</name>,
we hope you had a great SXSW film festival experience last year.
And we would like to invite you to the next edition of SXSW Film
that takes place from March 9 until March 17, 2018.</p>
<p>Sincerely,<br>
The SXSW crew<br>
<date>August 4, 2017</date></p>
</body>
</html>
Actually, it's not really HTML, because the <name> tag and the <date> tag don't exist in HTML. All HTML processors (browsers as well as pdfHTML) ignore those tags and treat their content as if the tag was a <span>:
It doesn't make much sense to have such tags in the context of pure HTML, but it does make a lot of sense in the case of pdfHTML. With pdfHTMLL, you can configure custom tags, and have a result that looks like the PDFs shown below:
Look at the document for "John Doe" and compare it with the document for "Bruno Lowagie". The name "John Doe" is much shorter than my name, hence more words fit on that first line. The text flows nicely (we could also have chosen to justify the text on both sides). This "flow" is impossible to achieve with your approach, because you will never get a PDF template to reflow nicely.
OK, I get it, you probably say, but what about the practical aspects? You talk about a Java / .Net library, but I am working with Laravel and Angular.js. First, let me tell you that I don't think you'll find any good PDF tools for Laravel or Angular.js, because of the nature of PDF and those development environments (in my opinion, those technologies don't play well together). Regardless of my opinion, this shouldn't be much of a problem for you because you work in an Amazon environment. AWS supports Java, and the Java code needed to get pdfHTML working is minimal. Most of the code samples I wrote for the pdfHTML tutorial are shorter than 15 lines. So why not try Java and pdfHTML?
If you're already using Amazon services, why not use an amazon lambda function, in combination with iText7 (java), to generate the pdf on demand?
That way, you are guaranteed that the pdf is correct, and has nice layout every time.
Generating the pdf can either be done by:
converting HTML,
programmatically creating your entire document,
filling and flattening an XFA form.
I think for your use-case, either option 1 or 2 are the most sustainable.

DNN: Registered Mark changing to Question Mark

I am having a problem with registered marks in the HTML module.  We need to use the Registered Trademark symbol (®) but some of them are being changed to question marks.  I can find no ryme or reason behind which change and which remain correct.  I have tried a number of things to fix this issue including the following:
Using ® and ®
using <sup>®</sup>
copy and paste of ® in both source and non source
and using the "insert special character" from the RTE menu
Some of the symbols remain but most revert back to question marks.  If i'm in edit mode, the questions marks change back to the registered mark.  Also sometimes the first time viewing the page not logged in or in view mode, they will look fine. But as soon as I got to edit mode or a new page then go back, they change back to question marks.  I am out of idea as to why this is happening.
You can see the page at: http://fasttracsc.twif.net/AboutFastTracSC.aspx  Anywhere you see Fasttrac? it should be Fasttrac®
Any help anyone can provide would be much appreciated.
Thanks in advance.
ok i have found the problem. The Rich Text Editor has a bug ("maybe by design?") that even the source button does not show you raw HTML. The RTE is still rendering the HTML prior to inserting into the database. If you change the RTE to Basic Text Box and edit the HTML there, you are once again able to get a consistent ® symbol using the ® code.

Resources