Merge commit 'refs/merge-requests/54' of git://gitorious.org/owncloud/owncloud into merge-requests/54

This commit is contained in:
Marvin Thomas Rabe 2011-10-06 22:35:36 +02:00
commit 878178145d
5 changed files with 61 additions and 12 deletions

View file

@ -53,16 +53,7 @@ $name = $_POST['name'];
$value = $_POST['value'];
$parameters = isset($_POST['parameteres'])?$_POST['parameters']:array();
if(is_array($value)){
$value = OC_Contacts_VCard::escapeSemicolons($value);
}
$property = new Sabre_VObject_Property( $name, $value );
$parameternames = array_keys($parameters);
foreach($parameternames as $i){
$property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]);
}
$vcard->add($property);
OC_Contacts_VCard::addVCardProperty($vcard, $name, $value, $parameters);
$line = count($vcard->children) - 1;
$checksum = md5($property->serialize());

View file

@ -104,6 +104,8 @@ $(document).ready(function(){
if(jsondata.status == 'success'){
$('#rightcontent').data('id',jsondata.data.id);
$('#rightcontent').html(jsondata.data.page);
$('#leftcontent .active').removeClass('active');
$('#leftcontent ul').append('<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'">'+jsondata.data.name+'</a></li>');
}
else{
alert(jsondata.data.message);

View file

@ -246,7 +246,7 @@ class OC_Contacts_VCard{
public static function escapeSemicolons($value){
foreach($value as &$i ){
$i = implode("\\\\;", explode(';', $i));
} unset($i);
}
return implode(';',$value);
}
@ -272,6 +272,26 @@ class OC_Contacts_VCard{
return $array;
}
/**
* @brief Add property to vcard object
* @param object $vcard
* @param object $name of property
* @param object $value of property
* @param object $paramerters of property
*/
public static function addVCardProperty($vcard, $name, $value, $parameters=array()){
if(is_array($value)){
$value = OC_Contacts_VCard::escapeSemicolons($value);
}
$property = new Sabre_VObject_Property( $name, $value );
$parameternames = array_keys($parameters);
foreach($parameternames as $i){
$property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]);
}
$vcard->add($property);
}
/**
* @brief Data structure of vCard
* @param object $property

View file

@ -11,5 +11,41 @@
<?php endif; ?>
<label for="fn"><?php echo $l->t('Name'); ?></label>
<input type="text" name="fn" value=""><br>
<label for="ADR"><?php echo $l->t('Address'); ?></label>
<div id="contacts_addresspart">
<select id="ADR" name="parameters[ADR][TYPE]" size="1">
<option value="adr_work"><?php echo $l->t('Work'); ?></option>
<option value="adr_home" selected="selected"><?php echo $l->t('Home'); ?></option>
</select>
<p><label><?php echo $l->t('PO Box'); ?></label> <input type="text" name="value[ADR][0]" value=""></p>
<p><label><?php echo $l->t('Extended'); ?></label> <input type="text" name="value[ADR][1]" value=""></p>
<p><label><?php echo $l->t('Street'); ?></label> <input type="text" name="value[ADR][2]" value=""></p>
<p><label><?php echo $l->t('City'); ?></label> <input type="text" name="value[ADR][3]" value=""></p>
<p><label><?php echo $l->t('Region'); ?></label> <input type="text" name="value[ADR][4]" value=""></p>
<p><label><?php echo $l->t('Zipcode'); ?></label> <input type="text" name="value[ADR][5]" value=""></p>
<p><label><?php echo $l->t('Country'); ?></label> <input type="text" name="value[ADR][6]" value=""></p>
</div>
<label for="TEL"><?php echo $l->t('Telephone'); ?></label>
<div id="contacts_phonepart">
<select id="TEL" name="parameters[TEL][TYPE]" size="1">
<option value="home"><?php echo $l->t('Home'); ?></option>
<option value="cell" selected="selected"><?php echo $l->t('Mobile'); ?></option>
<option value="work"><?php echo $l->t('Work'); ?></option>
<option value="text"><?php echo $l->t('Text'); ?></option>
<option value="voice"><?php echo $l->t('Voice'); ?></option>
<option value="fax"><?php echo $l->t('Fax'); ?></option>
<option value="video"><?php echo $l->t('Video'); ?></option>
<option value="pager"><?php echo $l->t('Pager'); ?></option>
</select>
<input type="text" name="value[TEL]" value="">
</div>
<label for="EMAIL"><?php echo $l->t('Email'); ?></label>
<div id="contacts_email">
<input id="EMAIL" type="text" name="value[EMAIL]" value="">
</div>
<label for="ORG"><?php echo $l->t('Organization'); ?></label>
<div id="contacts_organisation">
<input id="ORG" type="text" name="value[ORG]" value="">
</div>
<input type="submit" name="submit" value="<?php echo $l->t('Create Contact'); ?>">
</form>

View file

@ -70,7 +70,7 @@ if ($source !== false) {
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-Disposition: filename=".basename($source));
header('Content-Disposition: filename="'.basename($source).'"');
header("Content-Type: " . $mimetype);
header("Content-Length: " . OC_Filesystem::filesize($source));
//download the file