Themeing, Designing, Writing

I’m working on the Darkscribes site, trying to build it up and improve what I have as I go. I’m also trying to get the sites old fiction archive up and online slowly by hand. It’s not easy at all, but I’m slowly getting there. One of the things I’m working on is themeing. I’m trying to get an Omega based theme for Darkscribes that resembles the old Coldstar themes look and feel. Hopefully as I do I can get a better feel for Drupal CSS coding. But it’s a long task. Part of it involved cleaning up the old css in order for it to be human readable. That took up almost five hours there.

Part of what I’m doing is trying to figure out how to get the sites capabilities online. Things like document upload, story construction, and chapter organization. It’s been difficult and I’m no where near done. I just wish I could find an easy way to fix the issues. But slow and stead won the race. I’ve got some code provided by popupman from FFN that works ok, but could use some work.

/**
* @file
* A module which integrates with the Book module allowing file uploads
*/

/**
* Implements hook_help.
*
* Displays help and module information.
*
* @param path
* Which path of the site we’re using to display help
* @param arg
* Array that holds the current path as returned from arg() function
*/
function book_uploader_help($path, $arg) {
switch($path) {
case “admin/help#book_uploader”:
return ‘

‘. t(“Allows users to upload files when creating a new Book Page”) .’

‘;
break;
}
}

/**
* Alter the node form to include a file upload field
*/
function node_uploader_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == ‘book_node_form’) {
$form['book-node-form']['page_content_file'] = array(
‘#type’ => ‘file’,
‘#title’ => t(‘Or upload Content (supports txt/html/docx/odt)’)
);
$form['#validate'][] = ‘book_uploader_custom_validate’;
}
}

/**
* In this function we attempt to load the uploaded file. If it exists,
* we then convert it to HTML if it is docx or odt, and then replace its
* contents into the body of the saved Book Page, before finally deleting
* the temporary file
*/
function book_uploader_custom_validate($form, &$form_state) {
$file = file_save_upload(‘page_content_file’, array(‘file_validate_extensions’ => array(‘txt html docx’)));
if ($file) {
$form_state['storage']['page_content_file'] = $file;
$is_docx = file_validate_extensions($file, ‘docx’);
if(empty($is_docx)) {
$wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
$content = book_uploader_docx2html($wrapper->realpath());
}
else {
$content = file_get_contents($file->uri);
}
$content = mb_convert_encoding($content, ‘UTF-8′);
$form_state['values']['body']['und'][0]['value'] = $content;
file_delete($file);
}
}

/**
* @param file
* Path to the docx file to convert to html
*/
function book_uploader_docx2html($file) {
$output = “”;
try {
$path = book_uploader_docx2text($file);
foreach(qp($path, ‘w|p’) as $qp) {
$qr = $qp->branch();
$output .= book_uploader_format($qr->find(‘w|r:first’), ‘w|r:first’);
$qp->find(‘w|r:first’);
while($qp->next(‘w|r’)->html() != null) {
$qr = $qp->branch();
$output .= book_uploader_format($qr->find(‘w|r’), ‘w|r’);
}
$output .= “r”;
}
return $output;
}
catch (Exception $e) {
return $output;
}
return $output;
}
function book_uploader_format($qp, $findSelector = null) {
// Create a new branch for printing later.
$qr = $qp->branch();
$text = “”;
$text = $qr->find($findSelector)->find(‘w|t’)->text();
$text = (book_uploader_checkUnderline($qp->branch())) ? ‘‘.$text.’‘ : $text;
$text = (book_uploader_checkBold($qp->branch())) ? ‘‘.$text.’‘ : $text;
$text = (book_uploader_checkItalics($qp->branch())) ? ‘‘.$text.’‘ : $text;

return $text;
}

/**
*
* @param QueryPath $qp
* @return String
*/
function book_uploader_checkBold($qp) {
$qp->children(“w|rPr”);
return ($qp->children(‘w|b’)->html()) ? true : false;
}

/**
*
* @param QueryPath $qp
* @return String
*/
function book_uploader_checkUnderline($qp) {
$qp->children(“w|rPr”);
return ($qp->children(‘w|u’)->html()) ? true : false;
}

function book_uploader_checkItalics($qp) {
$qp->children(“w|rPr”);
return ($qp->children(‘w|i’)->html()) ? true : false;
}

function book_uploader_docx2text($file) {
return book_uploader_readZippedXML($file, ‘word/document.xml’);
}

function book_uploader_readZippedXML($archiveFile, $dataFile) {
if (!class_exists(‘ZipArchive’, false)) {
return “ZipArchive Class Doesn’t Exist.”;
}
$zip = new ZipArchive;
if (true === $zip->open($archiveFile, ZipArchive::CREATE)) {
if (($index = $zip->locateName($dataFile)) !== false) {
$data = $zip->getFromIndex($index);
$zip->close();
return $data;
}
$zip->close();
}
return false;
}

I found a site post that had some useful code I think but I have no idea how to integrate it or anything of that  here.

All the While I’m trying to figure out ideas as well for my own stories and actually write them. It’s not easy to work all the time in to do all of this and it’s kicking my ass in a lot of ways. I just wish I knew if I was getting closer to done really.

Twitter Updates for 2012-03-13

  • @Kurinoone Am now following you while I work on the #Darkscribes website. #
  • Spending the week adding content into the #Darkscribes archive manually. Have to put eyes on content to clean it up. It's tedious. #
  • @Kurinoone It's my fiction archive website that has major issues since last year. rebuilding it now. http://t.co/Gcg1RVr2 and fixing manual #
  • @Kurinoone Is it okay if I add your content from FFN? #
  • Does anyone ever wonder how many of their followers are actual people? #
  • @Kurinoone I'll need your email because I'll need to create an account for you. I'll email you when it's in and your content is added. #
  • Going to have Neon Genesis: Goddess up on #Darkscribes today. Gonna try for at least 50 chapters by midnight. #
  • #Severe #Weather Occurring up in Michigan. If you follow me and you are up there, keep safe. #
  • @Kurinoone No sweat, I understand completely. Hence why I did my best to make the email not publicly available. Just contact through PMs #
  • Neon Genesis: Goddess is uploaded completely. #

Powered by Twitter Tools

Twitter Updates for 2012-03-03

  • Following the storm chasers on this Tornado outbreak today. All family in Nashville, let us know you are okay! #
  • Outbreak continues into Virginia. Three counties in VA under Warnings until 2000EST #
  • Retweeting as many tornado warnings as I can today into the night. Best to get them out to as many as possible. #
  • It is going to be a long night for you folks out there. we're praying for you. #
  • Severe weather is still on going tonight. It's been a pretty bad out through the Mid-West today. Death Toll is at 27. Praying for you. #

Powered by Twitter Tools

Projects progress report

I got some news on a few things. First off I seem at least to have solved the Darkscribes text encoding problem. The garbage characters seem to have been fixed and now we have good clean data on that front. I am still going to haveto figure out how to scrub the data as I import it. But the double encored utf8 problem seems to be fixed. Doesn’t mean we aren’t going to have to put eyes on everything, but that makes less to deal with.

Ryan is working Darkscribes look at the moment when he can. I like what he has done so far personally. I have had good success getting all the users and story pages in. We just need to adjust things I hope.

I am probably going to spend writting time on a couple of fan fictions the dedicate a bit to original content only for a while. If anything comes from it then that would rock.

Hopefully well have more concrete stuff to celebrate later.